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 | // |
30 | // W A R N I N G |
31 | // ------------- |
32 | // |
33 | // This file is not part of the Qt API. It exists for the convenience |
34 | // of Qt Designer. This header |
35 | // file may change from version to version without notice, or even be removed. |
36 | // |
37 | // We mean it. |
38 | // |
39 | |
40 | #ifndef SHARED_SETTINGS_H |
41 | #define SHARED_SETTINGS_H |
42 | |
43 | #include "shared_global_p.h" |
44 | #include "shared_enums_p.h" |
45 | #include "deviceprofile_p.h" |
46 | |
47 | #include <QtCore/qglobal.h> |
48 | #include <QtCore/qvector.h> |
49 | |
50 | QT_BEGIN_NAMESPACE |
51 | |
52 | class QDesignerFormEditorInterface; |
53 | class QDesignerSettingsInterface; |
54 | |
55 | class QStringList; |
56 | class QSize; |
57 | |
58 | namespace qdesigner_internal { |
59 | class Grid; |
60 | class PreviewConfiguration; |
61 | } |
62 | |
63 | /*! |
64 | Auxiliary methods to store/retrieve settings |
65 | */ |
66 | namespace qdesigner_internal { |
67 | |
68 | class QDESIGNER_SHARED_EXPORT QDesignerSharedSettings { |
69 | public: |
70 | using DeviceProfileList = QVector<DeviceProfile>; |
71 | |
72 | explicit QDesignerSharedSettings(QDesignerFormEditorInterface *core); |
73 | |
74 | Grid defaultGrid() const; |
75 | void setDefaultGrid(const Grid &grid); |
76 | |
77 | QStringList formTemplatePaths() const; |
78 | void setFormTemplatePaths(const QStringList &paths); |
79 | |
80 | void setAdditionalFormTemplatePaths(const QStringList &additionalPaths); |
81 | QStringList additionalFormTemplatePaths() const; |
82 | |
83 | QString formTemplate() const; |
84 | void setFormTemplate(const QString &t); |
85 | |
86 | QSize newFormSize() const; |
87 | void setNewFormSize(const QSize &s); |
88 | |
89 | // Check with isCustomPreviewConfigurationEnabled if custom or default |
90 | // configuration should be used. |
91 | PreviewConfiguration customPreviewConfiguration() const; |
92 | void setCustomPreviewConfiguration(const PreviewConfiguration &configuration); |
93 | |
94 | bool isCustomPreviewConfigurationEnabled() const; |
95 | void setCustomPreviewConfigurationEnabled(bool enabled); |
96 | |
97 | QStringList userDeviceSkins() const; |
98 | void setUserDeviceSkins(const QStringList &userDeviceSkins); |
99 | |
100 | bool zoomEnabled() const; |
101 | void setZoomEnabled(bool v); |
102 | |
103 | // Zoom in percent |
104 | int zoom() const; |
105 | void setZoom(int z); |
106 | |
107 | // Object naming convention (ActionEditor) |
108 | ObjectNamingMode objectNamingMode() const; |
109 | void setObjectNamingMode(ObjectNamingMode n); |
110 | |
111 | // Embedded Design |
112 | DeviceProfile currentDeviceProfile() const; |
113 | void setCurrentDeviceProfileIndex(int i); |
114 | int currentDeviceProfileIndex() const; |
115 | |
116 | DeviceProfile deviceProfileAt(int idx) const; |
117 | DeviceProfileList deviceProfiles() const; |
118 | void setDeviceProfiles(const DeviceProfileList &dp); |
119 | |
120 | static const QStringList &defaultFormTemplatePaths(); |
121 | |
122 | protected: |
123 | QDesignerSettingsInterface *settings() const { return m_settings; } |
124 | |
125 | private: |
126 | QStringList deviceProfileXml() const; |
127 | QDesignerSettingsInterface *m_settings; |
128 | }; |
129 | |
130 | } // namespace qdesigner_internal |
131 | |
132 | QT_END_NAMESPACE |
133 | |
134 | #endif // SHARED_SETTINGS_H |
135 | |