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