1 /** 2 * \file settings.h 3 * 4 * \section LICENSE 5 * 6 * Copyright (C) 2012-2021 Thorsten Roth 7 * 8 * This file is part of iQPuzzle. 9 * 10 * iQPuzzle is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation, either version 3 of the License, or 13 * (at your option) any later version. 14 * 15 * iQPuzzle is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with iQPuzzle. If not, see <http://www.gnu.org/licenses/>. 22 * 23 * \section DESCRIPTION 24 * Class definition for settings. 25 */ 26 27 #ifndef SETTINGS_H_ 28 #define SETTINGS_H_ 29 30 #include <QDialog> 31 32 class QSettings; 33 34 namespace Ui { 35 class SettingsDialog; 36 } 37 38 /** 39 * \class Settings 40 * \brief Settings dialog. 41 */ 42 class Settings : public QDialog { 43 Q_OBJECT 44 45 public: 46 explicit Settings(QString sSharePath, QWidget *pParent = nullptr); 47 virtual ~Settings(); 48 49 static const quint8 nSHIFT = 0xF0; 50 auto getMouseControls() const -> QList<uint>; 51 auto getLanguage() -> QString; 52 auto getUseSystemBackground() -> bool; 53 54 auto getEasy() const -> uint; 55 auto getHard() const -> uint; 56 57 signals: 58 void changeLang(const QString &sLang); 59 void useSystemBackgroundColor(const bool bUseSysColor); 60 61 public slots: 62 void accept() override; 63 void updateUiLang(); 64 65 protected: 66 void showEvent(QShowEvent *pEvent) override; 67 68 private: 69 void readSettings(); 70 QStringList searchTranslations(); 71 72 QWidget *m_pParent{}; 73 Ui::SettingsDialog *m_pUi; 74 QSettings *m_pSettings; 75 76 QString m_sGuiLanguage; 77 const QString m_sSharePath; 78 QStringList m_sListMouseButtons; 79 QList<uint> m_listMouseButtons; 80 QList<uint> m_listMouseControls; 81 bool m_bUseSystemBackground{}; 82 uint m_nEasy{}; 83 uint m_nHard{}; 84 }; 85 86 #endif // SETTINGS_H_ 87