CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1 /*
2  * Copyright (c) 2013-2020 Meltytech, LLC
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SETTINGS_H
19 #define SETTINGS_H
20 
21 #include <QObject>
22 #include <QSettings>
23 #include <QStringList>
24 #include <QByteArray>
25 
26 class ShotcutSettings : public QObject
27 {
28  Q_OBJECT
29  Q_PROPERTY(bool timelineDragScrub READ timelineDragScrub WRITE setTimelineDragScrub NOTIFY timelineDragScrubChanged)
30  Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms NOTIFY timelineShowWaveformsChanged)
31  Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails NOTIFY timelineShowThumbnailsChanged)
32  Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY timelineRippleChanged)
33  Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
34  Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
35  Q_PROPERTY(bool timelineCenterPlayhead READ timelineCenterPlayhead WRITE setTimelineCenterPlayhead NOTIFY timelineCenterPlayheadChanged)
36  Q_PROPERTY(bool timelineScrollZoom READ timelineScrollZoom WRITE setTimelineScrollZoom NOTIFY timelineScrollZoomChanged)
37  Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
38  Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
39  Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY playlistThumbnailsChanged)
40  Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
41  Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
42  Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
43  Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY audioInDurationChanged)
44  Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY audioOutDurationChanged)
45  Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY videoInDurationChanged)
46  Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY videoOutDurationChanged)
47  Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
48 
49 public:
50  static ShotcutSettings& singleton();
51  explicit ShotcutSettings() : QObject() {}
52  explicit ShotcutSettings(const QString& appDataLocation);
53  void log();
54 
55  QString language() const;
56  void setLanguage(const QString&);
57  double imageDuration() const;
58  void setImageDuration(double);
59  QString openPath() const;
60  void setOpenPath(const QString&);
61  QString savePath() const;
62  void setSavePath(const QString&);
63  QStringList recent() const;
64  void setRecent(const QStringList&);
65  QString theme() const;
66  void setTheme(const QString&);
67  bool showTitleBars() const;
68  void setShowTitleBars(bool);
69  bool showToolBar() const;
70  void setShowToolBar(bool);
71  bool textUnderIcons() const;
72  void setTextUnderIcons(bool);
73  bool smallIcons() const;
74  void setSmallIcons(bool);
75  QByteArray windowGeometry() const;
76  void setWindowGeometry(const QByteArray&);
77  QByteArray windowGeometryDefault() const;
78  void setWindowGeometryDefault(const QByteArray&);
79  QByteArray windowState() const;
80  void setWindowState(const QByteArray&);
81  QByteArray windowStateDefault() const;
82  void setWindowStateDefault(const QByteArray&);
83  QString viewMode() const;
84  void setViewMode(const QString& viewMode);
85 
86  QString encodePath() const;
87  void setEncodePath(const QString&);
88  bool encodeFreeSpaceCheck() const;
89  void setEncodeFreeSpaceCheck(bool);
90  bool encodeUseHardware() const;
91  void setEncodeUseHardware(bool);
92  QStringList encodeHardware() const;
93  void setEncodeHardware(const QStringList&);
94  bool encodeAdvanced() const;
95  void setEncodeAdvanced(bool);
96  bool showConvertClipDialog() const;
97  void setShowConvertClipDialog(bool);
98  bool encodeParallelProcessing() const;
99  void setEncodeParallelProcessing(bool);
100 
101  int playerAudioChannels() const;
102  void setPlayerAudioChannels(int);
103  QString playerDeinterlacer() const;
104  void setPlayerDeinterlacer(const QString&);
105  QString playerExternal() const;
106  void setPlayerExternal(const QString&);
107  QString playerGamma() const;
108  void setPlayerGamma(const QString&);
109  bool playerGPU() const;
110  void setPlayerGPU(bool);
111  bool playerWarnGPU() const;
112  QString playerInterpolation() const;
113  void setPlayerInterpolation(const QString&);
114  bool playerJACK() const;
115  void setPlayerJACK(bool);
116  int playerKeyerMode() const;
117  void setPlayerKeyerMode(int);
118  bool playerMuted() const;
119  void setPlayerMuted(bool);
120  QString playerProfile() const;
121  void setPlayerProfile(const QString&);
122  bool playerProgressive() const;
123  void setPlayerProgressive(bool);
124  bool playerRealtime() const;
125  void setPlayerRealtime(bool);
126  bool playerScrubAudio() const;
127  void setPlayerScrubAudio(bool);
128  int playerVolume() const;
129  void setPlayerVolume(int);
130  float playerZoom() const;
131  void setPlayerZoom(float);
132  int playerPreviewScale() const;
133  void setPlayerPreviewScale(int);
134  int playerVideoDelayMs() const;
135  void setPlayerVideoDelayMs(int);
136 
137  QString playlistThumbnails() const;
138  void setPlaylistThumbnails(const QString&);
139  bool playlistAutoplay() const;
140  void setPlaylistAutoplay(bool);
141 
142  bool timelineDragScrub() const;
143  void setTimelineDragScrub(bool);
144  bool timelineShowWaveforms() const;
145  void setTimelineShowWaveforms(bool);
146  bool timelineShowThumbnails() const;
147  void setTimelineShowThumbnails(bool);
148 
149  bool timelineRipple() const;
150  void setTimelineRipple(bool);
151  bool timelineRippleAllTracks() const;
152  void setTimelineRippleAllTracks(bool);
153  bool timelineSnap() const;
154  void setTimelineSnap(bool);
155  bool timelineCenterPlayhead() const;
156  void setTimelineCenterPlayhead(bool);
157  int timelineTrackHeight() const;
158  void setTimelineTrackHeight(int);
159  bool timelineScrollZoom() const;
160  void setTimelineScrollZoom(bool);
161 
162  QString filterFavorite(const QString& filterName);
163  void setFilterFavorite(const QString& filterName, const QString& value);
164 
165  double audioInDuration() const;
166  void setAudioInDuration(double);
167 
168  double audioOutDuration() const;
169  void setAudioOutDuration(double);
170 
171  double videoInDuration() const;
172  void setVideoInDuration(double);
173 
174  double videoOutDuration() const;
175  void setVideoOutDuration(double);
176 
177  bool loudnessScopeShowMeter(const QString& meter) const;
178  void setLoudnessScopeShowMeter(const QString& meter, bool b);
179 
180  int drawMethod() const;
181  void setDrawMethod(int);
182 
183  bool noUpgrade() const;
184  void setNoUpgrade(bool value);
185  bool checkUpgradeAutomatic();
186  void setCheckUpgradeAutomatic(bool b);
187  bool askUpgradeAutmatic();
188  void setAskUpgradeAutomatic(bool b);
189 
190  void sync();
191  QString appDataLocation() const;
192  static void setAppDataForSession(const QString& location);
193  void setAppDataLocally(const QString& location);
194 
195  QStringList layouts() const;
196  bool setLayout(const QString& name, const QByteArray& geometry, const QByteArray& state);
197  QByteArray layoutGeometry(const QString& name);
198  QByteArray layoutState(const QString& name);
199  bool removeLayout(const QString& name);
200  int layoutMode() const;
201  void setLayoutMode(int mode = 0);
202 
203  bool clearRecent() const;
204  void setClearRecent(bool);
205 
206  QString projectsFolder() const;
207  void setProjectsFolder(const QString& path);
208 
209  bool proxyEnabled() const;
210  void setProxyEnabled(bool);
211  QString proxyFolder() const;
212  void setProxyFolder(const QString& path);
213  bool proxyUseProjectFolder() const;
214  void setProxyUseProjectFolder(bool);
215  bool proxyUseHardware() const;
216  void setProxyUseHardware(bool);
217 
218  int undoLimit() const;
219 
220 signals:
221  void openPathChanged();
222  void savePathChanged();
223  void timelineDragScrubChanged();
224  void timelineShowWaveformsChanged();
225  void timelineShowThumbnailsChanged();
226  void timelineRippleChanged();
227  void timelineRippleAllTracksChanged();
228  void timelineSnapChanged();
229  void timelineCenterPlayheadChanged();
230  void timelineScrollZoomChanged();
231  void playerAudioChannelsChanged(int);
232  void playerGpuChanged();
233  void audioInDurationChanged();
234  void audioOutDurationChanged();
235  void videoInDurationChanged();
236  void videoOutDurationChanged();
237  void playlistThumbnailsChanged();
238  void viewModeChanged();
239  void smallIconsChanged();
240 
241 private:
242  QSettings settings;
243  QString m_appDataLocation;
244 };
245 
246 #define Settings ShotcutSettings::singleton()
247 
248 #endif // SETTINGS_H