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(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
37  Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
38  Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY playlistThumbnailsChanged)
39  Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
40  Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
41  Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
42  Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY audioInDurationChanged)
43  Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY audioOutDurationChanged)
44  Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY videoInDurationChanged)
45  Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY videoOutDurationChanged)
46  Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
47 
48 public:
49  static ShotcutSettings& singleton();
50  explicit ShotcutSettings() : QObject() {}
51  explicit ShotcutSettings(const QString& appDataLocation);
52  void log();
53 
54  QString language() const;
55  void setLanguage(const QString&);
56  double imageDuration() const;
57  void setImageDuration(double);
58  QString openPath() const;
59  void setOpenPath(const QString&);
60  QString savePath() const;
61  void setSavePath(const QString&);
62  QStringList recent() const;
63  void setRecent(const QStringList&);
64  QString theme() const;
65  void setTheme(const QString&);
66  bool showTitleBars() const;
67  void setShowTitleBars(bool);
68  bool showToolBar() const;
69  void setShowToolBar(bool);
70  bool textUnderIcons() const;
71  void setTextUnderIcons(bool);
72  bool smallIcons() const;
73  void setSmallIcons(bool);
74  QByteArray windowGeometry() const;
75  void setWindowGeometry(const QByteArray&);
76  QByteArray windowGeometryDefault() const;
77  void setWindowGeometryDefault(const QByteArray&);
78  QByteArray windowState() const;
79  void setWindowState(const QByteArray&);
80  QByteArray windowStateDefault() const;
81  void setWindowStateDefault(const QByteArray&);
82  QString viewMode() const;
83  void setViewMode(const QString& viewMode);
84 
85  QString encodePath() const;
86  void setEncodePath(const QString&);
87  bool encodeFreeSpaceCheck() const;
88  void setEncodeFreeSpaceCheck(bool);
89  bool encodeUseHardware() const;
90  void setEncodeUseHardware(bool);
91  QStringList encodeHardware() const;
92  void setEncodeHardware(const QStringList&);
93  bool encodeAdvanced() const;
94  void setEncodeAdvanced(bool);
95  bool showConvertClipDialog() const;
96  void setShowConvertClipDialog(bool);
97  bool encodeParallelProcessing() const;
98  void setEncodeParallelProcessing(bool);
99 
100  int playerAudioChannels() const;
101  void setPlayerAudioChannels(int);
102  QString playerDeinterlacer() const;
103  void setPlayerDeinterlacer(const QString&);
104  QString playerExternal() const;
105  void setPlayerExternal(const QString&);
106  QString playerGamma() const;
107  void setPlayerGamma(const QString&);
108  bool playerGPU() const;
109  void setPlayerGPU(bool);
110  bool playerWarnGPU() const;
111  QString playerInterpolation() const;
112  void setPlayerInterpolation(const QString&);
113  bool playerJACK() const;
114  void setPlayerJACK(bool);
115  int playerKeyerMode() const;
116  void setPlayerKeyerMode(int);
117  bool playerMuted() const;
118  void setPlayerMuted(bool);
119  QString playerProfile() const;
120  void setPlayerProfile(const QString&);
121  bool playerProgressive() const;
122  void setPlayerProgressive(bool);
123  bool playerRealtime() const;
124  void setPlayerRealtime(bool);
125  bool playerScrubAudio() const;
126  void setPlayerScrubAudio(bool);
127  int playerVolume() const;
128  void setPlayerVolume(int);
129  float playerZoom() const;
130  void setPlayerZoom(float);
131  int playerPreviewScale() const;
132  void setPlayerPreviewScale(int);
133  int playerVideoDelayMs() const;
134  void setPlayerVideoDelayMs(int);
135 
136  QString playlistThumbnails() const;
137  void setPlaylistThumbnails(const QString&);
138  bool playlistAutoplay() const;
139  void setPlaylistAutoplay(bool);
140 
141  bool timelineDragScrub() const;
142  void setTimelineDragScrub(bool);
143  bool timelineShowWaveforms() const;
144  void setTimelineShowWaveforms(bool);
145  bool timelineShowThumbnails() const;
146  void setTimelineShowThumbnails(bool);
147 
148  bool timelineRipple() const;
149  void setTimelineRipple(bool);
150  bool timelineRippleAllTracks() const;
151  void setTimelineRippleAllTracks(bool);
152  bool timelineSnap() const;
153  void setTimelineSnap(bool);
154  bool timelineCenterPlayhead() const;
155  void setTimelineCenterPlayhead(bool);
156  int timelineTrackHeight() const;
157  void setTimelineTrackHeight(int);
158 
159  QString filterFavorite(const QString& filterName);
160  void setFilterFavorite(const QString& filterName, const QString& value);
161 
162  double audioInDuration() const;
163  void setAudioInDuration(double);
164 
165  double audioOutDuration() const;
166  void setAudioOutDuration(double);
167 
168  double videoInDuration() const;
169  void setVideoInDuration(double);
170 
171  double videoOutDuration() const;
172  void setVideoOutDuration(double);
173 
174  bool loudnessScopeShowMeter(const QString& meter) const;
175  void setLoudnessScopeShowMeter(const QString& meter, bool b);
176 
177  int drawMethod() const;
178  void setDrawMethod(int);
179 
180  bool noUpgrade() const;
181  void setNoUpgrade(bool value);
182  bool checkUpgradeAutomatic();
183  void setCheckUpgradeAutomatic(bool b);
184  bool askUpgradeAutmatic();
185  void setAskUpgradeAutomatic(bool b);
186 
187  void sync();
188  QString appDataLocation() const;
189  static void setAppDataForSession(const QString& location);
190  void setAppDataLocally(const QString& location);
191 
192  QStringList layouts() const;
193  bool setLayout(const QString& name, const QByteArray& geometry, const QByteArray& state);
194  QByteArray layoutGeometry(const QString& name);
195  QByteArray layoutState(const QString& name);
196  bool removeLayout(const QString& name);
197  int layoutMode() const;
198  void setLayoutMode(int mode = 0);
199 
200  bool clearRecent() const;
201  void setClearRecent(bool);
202 
203  QString projectsFolder() const;
204  void setProjectsFolder(const QString& path);
205 
206  bool proxyEnabled() const;
207  void setProxyEnabled(bool);
208  QString proxyFolder() const;
209  void setProxyFolder(const QString& path);
210  bool proxyUseProjectFolder() const;
211  void setProxyUseProjectFolder(bool);
212  bool proxyUseHardware() const;
213  void setProxyUseHardware(bool);
214 
215  int undoLimit() const;
216 
217 signals:
218  void openPathChanged();
219  void savePathChanged();
220  void timelineDragScrubChanged();
221  void timelineShowWaveformsChanged();
222  void timelineShowThumbnailsChanged();
223  void timelineRippleChanged();
224  void timelineRippleAllTracksChanged();
225  void timelineSnapChanged();
226  void timelineCenterPlayheadChanged();
227  void playerAudioChannelsChanged(int);
228  void playerGpuChanged();
229  void audioInDurationChanged();
230  void audioOutDurationChanged();
231  void videoInDurationChanged();
232  void videoOutDurationChanged();
233  void playlistThumbnailsChanged();
234  void viewModeChanged();
235  void smallIconsChanged();
236 
237 private:
238  QSettings settings;
239  QString m_appDataLocation;
240 };
241 
242 #define Settings ShotcutSettings::singleton()
243 
244 #endif // SETTINGS_H