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