File indexing completed on 2024-05-05 05:40:58
0001 /************************************************************************* 0002 * Copyright (C) 2011 by Renaud Guezennec * 0003 * * 0004 * https://rolisteam.org/ * 0005 * * 0006 * rolisteam is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published * 0008 * by the Free Software Foundation; either version 2 of the License, * 0009 * or (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the * 0018 * Free Software Foundation, Inc., * 0019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0020 *************************************************************************/ 0021 0022 #ifndef PREFERENCES_DIALOG_H 0023 #define PREFERENCES_DIALOG_H 0024 0025 #include <QCheckBox> 0026 #include <QComboBox> 0027 #include <QDialog> 0028 #include <QLineEdit> 0029 #include <QPointer> 0030 #include <QStringListModel> 0031 #include <QStyledItemDelegate> 0032 0033 #include "common_widgets/colorbutton.h" 0034 #include "data/rolisteamtheme.h" 0035 #include "model/dicealiasmodel.h" 0036 #include "model/palettemodel.h" 0037 #include "preferences/preferencesmanager.h" 0038 #include "rwidgets/customs/centeredcheckbox.h" 0039 //#include "widgets/filedirchooser.h" 0040 #include "rwidgets_global.h" 0041 class PreferencesController; 0042 0043 namespace Ui 0044 { 0045 class PreferencesDialogBox; 0046 } 0047 0048 /** 0049 * @brief Actually only to change directories. 0050 */ 0051 class RWIDGET_EXPORT PreferencesDialog : public QDialog 0052 { 0053 Q_OBJECT 0054 0055 public: 0056 enum class PreferenceTab 0057 { 0058 General, 0059 Player, 0060 Themes, 0061 Diagnostic 0062 }; 0063 Q_ENUM(PreferenceTab) 0064 enum AudioPlayerDataIndex 0065 { 0066 First, 0067 Second, 0068 Third 0069 }; 0070 Q_ENUM(AudioPlayerDataIndex) 0071 0072 PreferencesDialog(PreferencesController* controller, QWidget* parent= nullptr, Qt::WindowFlags f= Qt::Dialog); 0073 virtual ~PreferencesDialog(); 0074 0075 public slots: 0076 void show(PreferenceTab tab= PreferenceTab::General); 0077 void backgroundChanged(); 0078 void manageHeartBeat(); 0079 void manageMessagingPref(); 0080 void updateTranslationPref(); 0081 0082 private slots: 0083 void load(); 0084 void save() const; 0085 void performDiag(); 0086 void testAliasCommand(); 0087 void updateTheme(); 0088 void dupplicateTheme(bool selectNew= true); 0089 void setTitleAtCurrentTheme(); 0090 void setStyle(); 0091 void editColor(QModelIndex); 0092 void editCss(); 0093 void exportTheme(); 0094 bool importTheme(); 0095 void deleteTheme(); 0096 0097 void addDirectory(); 0098 void removeDirectory(); 0099 void upDirectory(); 0100 void downDirectory(); 0101 0102 QModelIndex currentIndexFromCurrentList(int i); 0103 0104 private: 0105 PreferencesManager* m_preferences= nullptr; 0106 Ui::PreferencesDialogBox* ui; 0107 0108 QPushButton* m_applyBtn; 0109 QPointer<PreferencesController> m_ctrl; 0110 QList<QStringListModel*> m_musicDirectories; 0111 0112 bool m_currentThemeIsEditable; 0113 }; 0114 0115 #endif