CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1/*
2 * Copyright (c) 2013-2023 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 <QKeySequence>
22#include <QObject>
23#include <QSettings>
24#include <QStringList>
25#include <QByteArray>
26#include <QThread>
27
28class ShotcutSettings : public QObject
29{
30 Q_OBJECT
31 Q_PROPERTY(bool timelineDragScrub READ timelineDragScrub WRITE setTimelineDragScrub NOTIFY
32 timelineDragScrubChanged)
33 Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms
34 NOTIFY timelineShowWaveformsChanged)
35 Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails
36 NOTIFY timelineShowThumbnailsChanged)
37 Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY
38 timelineRippleChanged)
39 Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE
40 setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
41 Q_PROPERTY(bool timelineRippleMarkers READ timelineRippleMarkers WRITE setTimelineRippleMarkers
42 NOTIFY timelineRippleMarkersChanged)
43 Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
44 Q_PROPERTY(bool timelineScrollZoom READ timelineScrollZoom WRITE setTimelineScrollZoom NOTIFY
45 timelineScrollZoomChanged)
46 Q_PROPERTY(bool timelineFramebufferWaveform READ timelineFramebufferWaveform WRITE
47 setTimelineFramebufferWaveform NOTIFY timelineFramebufferWaveformChanged)
48 Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
49 Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
50 Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY
51 playlistThumbnailsChanged)
52 Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
53 Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
54 Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
55 Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY
56 audioInDurationChanged)
57 Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY
58 audioOutDurationChanged)
59 Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY
60 videoInDurationChanged)
61 Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY
62 videoOutDurationChanged)
63 Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
64 Q_PROPERTY(bool askOutputFilter READ askOutputFilter WRITE setAskOutputFilter NOTIFY
65 askOutputFilterChanged)
66 Q_PROPERTY(QString appDataLocation READ appDataLocation CONSTANT)
67 Q_PROPERTY(TimelineScrolling timelineScrolling READ timelineScrolling WRITE setTimelineScrolling
68 NOTIFY timelineScrollingChanged)
69 Q_ENUMS(TimelineScrolling)
70
71public:
72 static const qsizetype MaxPath {32767};
73 enum TimelineScrolling {
74 NoScrolling,
75 CenterPlayhead,
76 PageScrolling,
77 SmoothScrolling
78 };
79
80 static ShotcutSettings &singleton();
81 void log();
82
83 // general
84 QString language() const;
85 void setLanguage(const QString &);
86 double imageDuration() const;
87 void setImageDuration(double);
88 QString openPath() const;
89 void setOpenPath(const QString &);
90 QString savePath() const;
91 void setSavePath(const QString &);
92 QStringList recent() const;
93 void setRecent(const QStringList &);
94 QString theme() const;
95 void setTheme(const QString &);
96 QThread::Priority jobPriority() const;
97 void setJobPriority(const QString &);
98 bool showTitleBars() const;
99 void setShowTitleBars(bool);
100 bool showToolBar() const;
101 void setShowToolBar(bool);
102 bool textUnderIcons() const;
103 void setTextUnderIcons(bool);
104 bool smallIcons() const;
105 void setSmallIcons(bool);
106 QByteArray windowGeometry() const;
107 void setWindowGeometry(const QByteArray &);
108 QByteArray windowGeometryDefault() const;
109 void setWindowGeometryDefault(const QByteArray &);
110 QByteArray windowState() const;
111 void setWindowState(const QByteArray &);
112 QByteArray windowStateDefault() const;
113 void setWindowStateDefault(const QByteArray &);
114 QString viewMode() const;
115 void setViewMode(const QString &viewMode);
116 QString exportFrameSuffix() const;
117 void setExportFrameSuffix(const QString &suffix);
118 bool convertAdvanced() const;
119 void setConvertAdvanced(bool);
120
121 // encode
122 QString encodePath() const;
123 void setEncodePath(const QString &);
124 bool encodeFreeSpaceCheck() const;
125 void setEncodeFreeSpaceCheck(bool);
126 bool encodeUseHardware() const;
127 void setEncodeUseHardware(bool);
128 QStringList encodeHardware() const;
129 void setEncodeHardware(const QStringList &);
130 bool encodeAdvanced() const;
131 void setEncodeAdvanced(bool);
132 bool showConvertClipDialog() const;
133 void setShowConvertClipDialog(bool);
134 bool encodeParallelProcessing() const;
135 void setEncodeParallelProcessing(bool);
136
137 // player
138 int playerAudioChannels() const;
139 void setPlayerAudioChannels(int);
140 QString playerDeinterlacer() const;
141 void setPlayerDeinterlacer(const QString &);
142 QString playerExternal() const;
143 void setPlayerExternal(const QString &);
144 bool playerGPU() const;
145 void setPlayerGPU(bool);
146 bool playerWarnGPU() const;
147 QString playerInterpolation() const;
148 void setPlayerInterpolation(const QString &);
149 bool playerJACK() const;
150 void setPlayerJACK(bool);
151 int playerKeyerMode() const;
152 void setPlayerKeyerMode(int);
153 bool playerMuted() const;
154 void setPlayerMuted(bool);
155 QString playerProfile() const;
156 void setPlayerProfile(const QString &);
157 bool playerProgressive() const;
158 void setPlayerProgressive(bool);
159 bool playerRealtime() const;
160 void setPlayerRealtime(bool);
161 bool playerScrubAudio() const;
162 void setPlayerScrubAudio(bool);
163 int playerVolume() const;
164 void setPlayerVolume(int);
165 float playerZoom() const;
166 void setPlayerZoom(float);
167 int playerPreviewScale() const;
168 void setPlayerPreviewScale(int);
169 int playerVideoDelayMs() const;
170 void setPlayerVideoDelayMs(int);
171 double playerJumpSeconds() const;
172 void setPlayerJumpSeconds(double);
173
174 // playlist
175 QString playlistThumbnails() const;
176 void setPlaylistThumbnails(const QString &);
177 bool playlistAutoplay() const;
178 void setPlaylistAutoplay(bool);
179
180 // timeline
181 bool timelineDragScrub() const;
182 void setTimelineDragScrub(bool);
183 bool timelineShowWaveforms() const;
184 void setTimelineShowWaveforms(bool);
185 bool timelineShowThumbnails() const;
186 void setTimelineShowThumbnails(bool);
187 bool timelineRipple() const;
188 void setTimelineRipple(bool);
189 bool timelineRippleAllTracks() const;
190 void setTimelineRippleAllTracks(bool);
191 bool timelineRippleMarkers() const;
192 void setTimelineRippleMarkers(bool);
193 bool timelineSnap() const;
194 void setTimelineSnap(bool);
195 int timelineTrackHeight() const;
196 void setTimelineTrackHeight(int);
197 bool timelineScrollZoom() const;
198 void setTimelineScrollZoom(bool);
199 bool timelineFramebufferWaveform() const;
200 void setTimelineFramebufferWaveform(bool);
201 int audioReferenceTrack() const;
202 void setAudioReferenceTrack(int);
203 double audioReferenceSpeedRange() const;
204 void setAudioReferenceSpeedRange(double);
205 bool timelinePreviewTransition() const;
206 void setTimelinePreviewTransition(bool);
207 void setTimelineScrolling(TimelineScrolling value);
208 TimelineScrolling timelineScrolling() const;
209
210 // filter
211 QString filterFavorite(const QString &filterName);
212 void setFilterFavorite(const QString &filterName, const QString &value);
213 double audioInDuration() const;
214 void setAudioInDuration(double);
215 double audioOutDuration() const;
216 void setAudioOutDuration(double);
217 double videoInDuration() const;
218 void setVideoInDuration(double);
219 double videoOutDuration() const;
220 void setVideoOutDuration(double);
221 bool askOutputFilter() const;
222 void setAskOutputFilter(bool);
223
224 // scope
225 bool loudnessScopeShowMeter(const QString &meter) const;
226 void setLoudnessScopeShowMeter(const QString &meter, bool b);
227
228 // Markers
229 void setMarkerColor(const QColor &color);
230 QColor markerColor() const;
231 void setMarkersShowColumn(const QString &column, bool b);
232 bool markersShowColumn(const QString &column) const;
233 void setMarkerSort(int column, Qt::SortOrder order);
234 int getMarkerSortColumn();
235 Qt::SortOrder getMarkerSortOrder();
236
237 // general continued
238 int drawMethod() const;
239 void setDrawMethod(int);
240 bool noUpgrade() const;
241 void setNoUpgrade(bool value);
242 bool checkUpgradeAutomatic();
243 void setCheckUpgradeAutomatic(bool b);
244 bool askUpgradeAutomatic();
245 void setAskUpgradeAutomatic(bool b);
246
247 void sync();
248 QString appDataLocation() const;
249 static void setAppDataForSession(const QString &location);
250 void setAppDataLocally(const QString &location);
251
252 // layout
253 QStringList layouts() const;
254 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
255 QByteArray layoutGeometry(const QString &name);
256 QByteArray layoutState(const QString &name);
257 bool removeLayout(const QString &name);
258 int layoutMode() const;
259 void setLayoutMode(int mode = 0);
260
261 // general continued
262 bool clearRecent() const;
263 void setClearRecent(bool);
264 QString projectsFolder() const;
265 void setProjectsFolder(const QString &path);
266 QString audioInput() const;
267 void setAudioInput(const QString &name);
268 QString videoInput() const;
269 void setVideoInput(const QString &name);
270 QString glaxnimatePath() const;
271 void setGlaxnimatePath(const QString &path);
272 bool exportRangeMarkers() const;
273 void setExportRangeMarkers(bool);
274 int undoLimit() const;
275 bool warnLowMemory() const;
276
277 // proxy
278 bool proxyEnabled() const;
279 void setProxyEnabled(bool);
280 QString proxyFolder() const;
281 void setProxyFolder(const QString &path);
282 bool proxyUseProjectFolder() const;
283 void setProxyUseProjectFolder(bool);
284 bool proxyUseHardware() const;
285 void setProxyUseHardware(bool);
286
287 // Shortcuts
288 void clearShortcuts(const QString &name);
289 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
290 QList<QKeySequence> shortcuts(const QString &name);
291
292public slots:
293 void reset();
294
295signals:
296 void openPathChanged();
297 void savePathChanged();
298 void timelineDragScrubChanged();
299 void timelineShowWaveformsChanged();
300 void timelineShowThumbnailsChanged();
301 void timelineRippleChanged();
302 void timelineRippleAllTracksChanged();
303 void timelineRippleMarkersChanged();
304 void timelineSnapChanged();
305 void timelineScrollZoomChanged();
306 void timelineFramebufferWaveformChanged();
307 void playerAudioChannelsChanged(int);
308 void playerGpuChanged();
309 void audioInDurationChanged();
310 void audioOutDurationChanged();
311 void videoInDurationChanged();
312 void videoOutDurationChanged();
313 void playlistThumbnailsChanged();
314 void viewModeChanged();
315 void smallIconsChanged();
316 void askOutputFilterChanged();
317 void timelineScrollingChanged();
318
319private:
320 explicit ShotcutSettings();
321 explicit ShotcutSettings(const QString &appDataLocation);
322 void migrateRecent();
323 void migrateLayout();
324
325 QSettings settings;
326 QString m_appDataLocation;
327 QSettings m_recent;
328};
329
330#define Settings ShotcutSettings::singleton()
331
332#endif // SETTINGS_H