1 /* ColorCode, a free MasterMind clone with built in solver 2 * Copyright (C) 2009 Dirk Laebisch 3 * http://www.laebisch.com/ 4 * 5 * ColorCode is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * ColorCode is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with ColorCode. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef PREFDIALOG_H 20 #define PREFDIALOG_H 21 22 #include "ui_prefdialog.h" 23 #include "settings.h" 24 #include "colorcode.h" 25 #include "ccsolver.h" 26 #include <iostream> 27 #include <QDialog> 28 29 class PrefDialog : public QDialog, public Ui::PrefDialog 30 { 31 Q_OBJECT 32 33 public: 34 PrefDialog(QWidget* parent = 0, Qt::WindowFlags f = Qt::Dialog); 35 ~PrefDialog(); 36 37 void InitSettings(); 38 void SetSettings(); 39 virtual QSize sizeHint () const; 40 41 signals: 42 void ResetColorOrderSignal(); 43 44 private slots: 45 void ApplySlot(); 46 void RestoreDefSlot(); 47 void CancelSlot(); 48 void OkSlot(); 49 50 void LevelPresetChangedSlot(); 51 void ColorCntChangedSlot(); 52 void PegCntChangedSlot(); 53 void DoublesChangedSlot(); 54 void ShowIndicatorsChangedSlot(int state); 55 void ResetColorOrderSlot(); 56 void UseHighscoresChangedSlot(int state); 57 void ShowTimerChangedSlot(int state); 58 void CustomRowHColorChangedSlot(int state); 59 void SetBtnColorSlot(); 60 61 private: 62 bool SetSuppressSlots(bool b, bool force = false); 63 void InitControls(); 64 void CheckLevelPresets(); 65 void CheckDoubles(); 66 void SetSwatchStyleSheet(QPushButton* btn, const QString colorstr); 67 void SetBtnColor(QPushButton* btn); 68 QColor GetCurBtnColor(const QPushButton* btn); 69 QColor Desaturate(QColor c); 70 void ApplySettings(); 71 72 QPushButton* mRestoreBtn; 73 QPushButton* mOkBtn; 74 QPushButton* mApplyBtn; 75 QPushButton* mCancelBtn; 76 77 Settings* mSettings; 78 79 bool mSuppressSlots; 80 81 }; 82 83 #endif // PREFDIALOG_H 84