1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef QDESIGNER_APPEARANCEOPTIONS_H |
30 | #define QDESIGNER_APPEARANCEOPTIONS_H |
31 | |
32 | #include "designer_enums.h" |
33 | #include "qdesigner_toolwindow.h" |
34 | |
35 | #include <QtDesigner/abstractoptionspage.h> |
36 | |
37 | #include <QtCore/qobject.h> |
38 | #include <QtCore/qpointer.h> |
39 | #include <QtWidgets/qwidget.h> |
40 | |
41 | QT_BEGIN_NAMESPACE |
42 | |
43 | class QDesignerFormEditorInterface; |
44 | class QDesignerSettings; |
45 | |
46 | namespace Ui { |
47 | class AppearanceOptionsWidget; |
48 | } |
49 | |
50 | /* AppearanceOptions data */ |
51 | struct AppearanceOptions { |
52 | bool equals(const AppearanceOptions&) const; |
53 | void toSettings(QDesignerSettings &) const; |
54 | void fromSettings(const QDesignerSettings &); |
55 | |
56 | UIMode uiMode{DockedMode}; |
57 | ToolWindowFontSettings toolWindowFontSettings; |
58 | }; |
59 | |
60 | inline bool operator==(const AppearanceOptions &ao1, const AppearanceOptions &ao2) |
61 | { |
62 | return ao1.equals(ao2); |
63 | } |
64 | |
65 | inline bool operator!=(const AppearanceOptions &ao1, const AppearanceOptions &ao2) |
66 | { |
67 | return !ao1.equals(ao2); |
68 | } |
69 | |
70 | /* QDesignerAppearanceOptionsWidget: Let the user edit AppearanceOptions */ |
71 | class QDesignerAppearanceOptionsWidget : public QWidget |
72 | { |
73 | Q_OBJECT |
74 | public: |
75 | explicit QDesignerAppearanceOptionsWidget(QWidget *parent = nullptr); |
76 | ~QDesignerAppearanceOptionsWidget(); |
77 | |
78 | AppearanceOptions appearanceOptions() const; |
79 | void setAppearanceOptions(const AppearanceOptions &ao); |
80 | |
81 | signals: |
82 | void uiModeChanged(bool modified); |
83 | |
84 | private slots: |
85 | void slotUiModeComboChanged(); |
86 | |
87 | private: |
88 | UIMode uiMode() const; |
89 | |
90 | Ui::AppearanceOptionsWidget *m_ui; |
91 | UIMode m_initialUIMode = NeutralMode; |
92 | }; |
93 | |
94 | /* The options page for appearance options. */ |
95 | |
96 | class QDesignerAppearanceOptionsPage : public QObject, public QDesignerOptionsPageInterface |
97 | { |
98 | Q_OBJECT |
99 | |
100 | public: |
101 | QDesignerAppearanceOptionsPage(QDesignerFormEditorInterface *core); |
102 | |
103 | QString name() const override; |
104 | QWidget *createPage(QWidget *parent) override; |
105 | void apply() override; |
106 | void finish() override; |
107 | |
108 | signals: |
109 | void settingsChanged(); |
110 | |
111 | private: |
112 | QDesignerFormEditorInterface *m_core; |
113 | QPointer<QDesignerAppearanceOptionsWidget> m_widget; |
114 | AppearanceOptions m_initialOptions; |
115 | }; |
116 | |
117 | QT_END_NAMESPACE |
118 | |
119 | #endif // QDESIGNER_APPEARANCEOPTIONS_H |
120 |