1 /** -*- mode: c++ ; c-basic-offset: 2 -*-
2  *
3  *  @file DialogSettings.h
4  *
5  *  Copyright 2017 Sebastien Fourey
6  *
7  *  This file is part of G'MIC-Qt, a generic plug-in for raster graphics
8  *  editors, offering hundreds of filters thanks to the underlying G'MIC
9  *  image processing framework.
10  *
11  *  gmic_qt is free software: you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation, either version 3 of the License, or
14  *  (at your option) any later version.
15  *
16  *  gmic_qt is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with gmic_qt.  If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25 #ifndef GMIC_QT_DIALOGSETTINGS_H
26 #define GMIC_QT_DIALOGSETTINGS_H
27 
28 #include <QColor>
29 #include <QDialog>
30 #include <QIcon>
31 #include "GmicQt.h"
32 #include "MainWindow.h"
33 class QCloseEvent;
34 class QSettings;
35 
36 namespace Ui
37 {
38 class DialogSettings;
39 }
40 
41 namespace GmicQt
42 {
43 
44 class DialogSettings : public QDialog {
45   Q_OBJECT
46 
47 public:
48   explicit DialogSettings(QWidget * parent);
49   ~DialogSettings() override;
50   static MainWindow::PreviewPosition previewPosition();
51   static bool logosAreVisible();
52   static bool darkThemeEnabled();
53   static QString languageCode();
54   static bool filterTranslationEnabled();
55   static bool nativeColorDialogs();
56   static void saveSettings(QSettings &);
57   static void loadSettings(UserInterfaceMode userInterfaceMode);
58   static bool previewZoomAlwaysEnabled();
59   static bool notifyFailedStartupUpdate();
60   static const QColor CheckBoxTextColor;
61   static const QColor CheckBoxBaseColor;
62   static QColor UnselectedFilterTextColor;
63   static QString FolderParameterDefaultValue;
64   static QString FileParameterDefaultPath;
65   static int previewTimeout();
66   static OutputMessageMode outputMessageMode();
67   static QIcon AddIcon;
68   static QIcon RemoveIcon;
69   static QString GroupSeparator;
70   static QString DecimalPoint;
71   static QString NegativeSign;
72 
73 public slots:
74   void onRadioLeftPreviewToggled(bool);
75   void onUpdateClicked();
76   void onOk();
77   void enableUpdateButton();
78   void onDarkThemeToggled(bool);
79   void onUpdatePeriodicityChanged(int i);
80   void onColorDialogsToggled(bool);
81   void done(int r) override;
82   void onLogosVisibleToggled(bool);
83   void onPreviewTimeoutChange(int);
84   void onOutputMessageModeChanged(int);
85   void onPreviewZoomToggled(bool);
86   void onNotifyStartupUpdateFailedToggle(bool);
87 
88 private:
89   static void removeObsoleteKeys(QSettings &);
90   Ui::DialogSettings * ui;
91   static bool _darkThemeEnabled;
92   static QString _languageCode;
93   static bool _nativeColorDialogs;
94   static MainWindow::PreviewPosition _previewPosition;
95   static int _updatePeriodicity;
96   static bool _logosAreVisible;
97   static int _previewTimeout;
98   static OutputMessageMode _outputMessageMode;
99   static bool _previewZoomAlwaysEnabled;
100   static bool _notifyFailedStartupUpdate;
101   static bool _filterTranslationEnabled;
102 };
103 
104 } // namespace GmicQt
105 
106 #endif // GMIC_QT_DIALOGSETTINGS_H
107