CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1/*
2 * Copyright (c) 2013-2024 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 <framework/mlt_types.h>
22#include <QByteArray>
23#include <QKeySequence>
24#include <QObject>
25#include <QSettings>
26#include <QStringList>
27#include <QThread>
28
29class ShotcutSettings : public QObject
30{
31 Q_OBJECT
32 Q_PROPERTY(bool timelineDragScrub READ timelineDragScrub WRITE setTimelineDragScrub NOTIFY
33 timelineDragScrubChanged)
34 Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms
35 NOTIFY timelineShowWaveformsChanged)
36 Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE
37 setTimelineShowThumbnails NOTIFY timelineShowThumbnailsChanged)
38 Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY
39 timelineRippleChanged)
40 Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE
41 setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
42 Q_PROPERTY(bool timelineRippleMarkers READ timelineRippleMarkers WRITE setTimelineRippleMarkers
43 NOTIFY timelineRippleMarkersChanged)
44 Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
45 Q_PROPERTY(bool timelineScrollZoom READ timelineScrollZoom WRITE setTimelineScrollZoom NOTIFY
46 timelineScrollZoomChanged)
47 Q_PROPERTY(bool timelineFramebufferWaveform READ timelineFramebufferWaveform WRITE
48 setTimelineFramebufferWaveform NOTIFY timelineFramebufferWaveformChanged)
49 Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
50 Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
51 Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY
52 playlistThumbnailsChanged)
53 Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
54 Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
55 Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
56 Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY
57 audioInDurationChanged)
58 Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY
59 audioOutDurationChanged)
60 Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY
61 videoInDurationChanged)
62 Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY
63 videoOutDurationChanged)
64 Q_PROPERTY(double audioInCurve READ audioInCurve WRITE setAudioInCurve NOTIFY audioInCurveChanged)
65 Q_PROPERTY(
66 double audioOutCurve READ audioOutCurve WRITE setAudioOutCurve NOTIFY audioOutCurveChanged)
67 Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
68 Q_PROPERTY(bool askOutputFilter READ askOutputFilter WRITE setAskOutputFilter NOTIFY
69 askOutputFilterChanged)
70 Q_PROPERTY(QString appDataLocation READ appDataLocation CONSTANT)
71 Q_PROPERTY(TimelineScrolling timelineScrolling READ timelineScrolling WRITE setTimelineScrolling
72 NOTIFY timelineScrollingChanged)
73 Q_ENUMS(TimelineScrolling)
74 Q_PROPERTY(bool timelineRectangleSelect READ timelineRectangleSelect WRITE
75 setTimelineRectangleSelect NOTIFY timelineRectangleSelectChanged)
76 Q_PROPERTY(bool keyframesDragScrub READ keyframesDragScrub WRITE setKeyframesDragScrub NOTIFY
77 keyframesDragScrubChanged)
78 Q_PROPERTY(bool timelineAdjustGain READ timelineAdjustGain WRITE setTimelineAdjustGain NOTIFY
79 timelineAdjustGainChanged)
80
81public:
82 static const qsizetype MaxPath{32767};
83 enum TimelineScrolling { NoScrolling, CenterPlayhead, PageScrolling, SmoothScrolling };
84
85 static ShotcutSettings &singleton();
86 void log();
87
88 // general
89 QString language() const;
90 void setLanguage(const QString &);
91 double imageDuration() const;
92 void setImageDuration(double);
93 QString openPath() const;
94 void setOpenPath(const QString &);
95 QString savePath() const;
96 void setSavePath(const QString &);
97 QStringList recent() const;
98 void setRecent(const QStringList &);
99 QStringList projects();
100 void setProjects(const QStringList &);
101 QString theme() const;
102 void setTheme(const QString &);
103 QThread::Priority jobPriority() const;
104 void setJobPriority(const QString &);
105 bool showTitleBars() const;
106 void setShowTitleBars(bool);
107 bool showToolBar() const;
108 void setShowToolBar(bool);
109 bool textUnderIcons() const;
110 void setTextUnderIcons(bool);
111 bool smallIcons() const;
112 void setSmallIcons(bool);
113 QByteArray windowGeometry() const;
114 void setWindowGeometry(const QByteArray &);
115 QByteArray windowGeometryDefault() const;
116 void setWindowGeometryDefault(const QByteArray &);
117 QByteArray windowState() const;
118 void setWindowState(const QByteArray &);
119 QByteArray windowStateDefault() const;
120 void setWindowStateDefault(const QByteArray &);
121 QString viewMode() const;
122 void setViewMode(const QString &viewMode);
123 QString exportFrameSuffix() const;
124 void setExportFrameSuffix(const QString &suffix);
125 bool convertAdvanced() const;
126 void setConvertAdvanced(bool);
127
128 // encode
129 QString encodePath() const;
130 void setEncodePath(const QString &);
131 bool encodeFreeSpaceCheck() const;
132 void setEncodeFreeSpaceCheck(bool);
133 bool encodeUseHardware() const;
134 void setEncodeUseHardware(bool);
135 QStringList encodeHardware() const;
136 void setEncodeHardware(const QStringList &);
137 bool encodeAdvanced() const;
138 void setEncodeAdvanced(bool);
139 bool showConvertClipDialog() const;
140 void setShowConvertClipDialog(bool);
141 bool encodeParallelProcessing() const;
142 void setEncodeParallelProcessing(bool);
143
144 // player
145 int playerAudioChannels() const;
146 void setPlayerAudioChannels(int);
147 QString playerDeinterlacer() const;
148 void setPlayerDeinterlacer(const QString &);
149 QString playerExternal() const;
150 void setPlayerExternal(const QString &);
151 bool playerGPU() const;
152 void setPlayerGPU(bool);
153 bool playerWarnGPU() const;
154 QString playerInterpolation() const;
155 void setPlayerInterpolation(const QString &);
156 bool playerJACK() const;
157 void setPlayerJACK(bool);
158 int playerDecklinkGamma() const;
159 void setPlayerDecklinkGamma(int);
160 int playerKeyerMode() const;
161 void setPlayerKeyerMode(int);
162 bool playerMuted() const;
163 void setPlayerMuted(bool);
164 QString playerProfile() const;
165 void setPlayerProfile(const QString &);
166 bool playerProgressive() const;
167 void setPlayerProgressive(bool);
168 bool playerRealtime() const;
169 void setPlayerRealtime(bool);
170 bool playerScrubAudio() const;
171 void setPlayerScrubAudio(bool);
172 int playerVolume() const;
173 void setPlayerVolume(int);
174 float playerZoom() const;
175 void setPlayerZoom(float);
176 int playerPreviewScale() const;
177 void setPlayerPreviewScale(int);
178 int playerVideoDelayMs() const;
179 void setPlayerVideoDelayMs(int);
180 double playerJumpSeconds() const;
181 void setPlayerJumpSeconds(double);
182 QString playerAudioDriver() const;
183 void setPlayerAudioDriver(const QString &s);
184 bool playerPauseAfterSeek() const;
185 void setPlayerPauseAfterSeek(bool);
186
187 // playlist
188 QString playlistThumbnails() const;
189 void setPlaylistThumbnails(const QString &);
190 bool playlistAutoplay() const;
191 void setPlaylistAutoplay(bool);
192 bool playlistShowColumn(const QString &);
193 void setPlaylistShowColumn(const QString &, bool);
194
195 // timeline
196 bool timelineDragScrub() const;
197 void setTimelineDragScrub(bool);
198 bool timelineShowWaveforms() const;
199 void setTimelineShowWaveforms(bool);
200 bool timelineShowThumbnails() const;
201 void setTimelineShowThumbnails(bool);
202 bool timelineRipple() const;
203 void setTimelineRipple(bool);
204 bool timelineRippleAllTracks() const;
205 void setTimelineRippleAllTracks(bool);
206 bool timelineRippleMarkers() const;
207 void setTimelineRippleMarkers(bool);
208 bool timelineSnap() const;
209 void setTimelineSnap(bool);
210 int timelineTrackHeight() const;
211 void setTimelineTrackHeight(int);
212 bool timelineScrollZoom() const;
213 void setTimelineScrollZoom(bool);
214 bool timelineFramebufferWaveform() const;
215 void setTimelineFramebufferWaveform(bool);
216 int audioReferenceTrack() const;
217 void setAudioReferenceTrack(int);
218 double audioReferenceSpeedRange() const;
219 void setAudioReferenceSpeedRange(double);
220 bool timelinePreviewTransition() const;
221 void setTimelinePreviewTransition(bool);
222 void setTimelineScrolling(TimelineScrolling value);
223 TimelineScrolling timelineScrolling() const;
224 bool timelineAutoAddTracks() const;
225 void setTimelineAutoAddTracks(bool);
226 bool timelineRectangleSelect() const;
227 void setTimelineRectangleSelect(bool);
228 bool timelineAdjustGain() const;
229 void setTimelineAdjustGain(bool);
230
231 // filter
232 QString filterFavorite(const QString &filterName);
233 void setFilterFavorite(const QString &filterName, const QString &value);
234 double audioInDuration() const;
235 void setAudioInDuration(double);
236 double audioOutDuration() const;
237 void setAudioOutDuration(double);
238 double videoInDuration() const;
239 void setVideoInDuration(double);
240 double videoOutDuration() const;
241 void setVideoOutDuration(double);
242 int audioInCurve() const;
243 void setAudioInCurve(int);
244 int audioOutCurve() const;
245 void setAudioOutCurve(int);
246 bool askOutputFilter() const;
247 void setAskOutputFilter(bool);
248
249 // scope
250 bool loudnessScopeShowMeter(const QString &meter) const;
251 void setLoudnessScopeShowMeter(const QString &meter, bool b);
252
253 // Markers
254 void setMarkerColor(const QColor &color);
255 QColor markerColor() const;
256 void setMarkersShowColumn(const QString &column, bool b);
257 bool markersShowColumn(const QString &column) const;
258 void setMarkerSort(int column, Qt::SortOrder order);
259 int getMarkerSortColumn();
260 Qt::SortOrder getMarkerSortOrder();
261
262 // general continued
263 int drawMethod() const;
264 void setDrawMethod(int);
265 bool noUpgrade() const;
266 void setNoUpgrade(bool value);
267 bool checkUpgradeAutomatic();
268 void setCheckUpgradeAutomatic(bool b);
269 bool askUpgradeAutomatic();
270 void setAskUpgradeAutomatic(bool b);
271 bool askChangeVideoMode();
272 void setAskChangeVideoMode(bool b);
273
274 void sync();
275 QString appDataLocation() const;
276 static void setAppDataForSession(const QString &location);
277 void setAppDataLocally(const QString &location);
278
279 // layout
280 QStringList layouts() const;
281 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
282 QByteArray layoutGeometry(const QString &name);
283 QByteArray layoutState(const QString &name);
284 bool removeLayout(const QString &name);
285 int layoutMode() const;
286 void setLayoutMode(int mode = 0);
287
288 // general continued
289 bool clearRecent() const;
290 void setClearRecent(bool);
291 QString projectsFolder() const;
292 void setProjectsFolder(const QString &path);
293 QString audioInput() const;
294 void setAudioInput(const QString &name);
295 QString videoInput() const;
296 void setVideoInput(const QString &name);
297 QString glaxnimatePath() const;
298 void setGlaxnimatePath(const QString &path);
299 bool exportRangeMarkers() const;
300 void setExportRangeMarkers(bool);
301 int undoLimit() const;
302 bool warnLowMemory() const;
303 int backupPeriod() const;
304 void setBackupPeriod(int i);
305 mlt_time_format timeFormat() const;
306 void setTimeFormat(int format);
307 bool askFlatpakWrappers();
308 void setAskFlatpakWrappers(bool b);
309 QString dockerPath() const;
310 void setDockerPath(const QString &path);
311 QString chromiumPath() const;
312 void setChromiumPath(const QString &path);
313 QString screenRecorderPath() const;
314 void setScreenRecorderPath(const QString &path);
315
316 // proxy
317 bool proxyEnabled() const;
318 void setProxyEnabled(bool);
319 QString proxyFolder() const;
320 void setProxyFolder(const QString &path);
321 bool proxyUseProjectFolder() const;
322 void setProxyUseProjectFolder(bool);
323 bool proxyUseHardware() const;
324 void setProxyUseHardware(bool);
325
326 // Shortcuts
327 void clearShortcuts(const QString &name);
328 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
329 QList<QKeySequence> shortcuts(const QString &name);
330
331 // Slideshow
332 double slideshowImageDuration(double defaultSeconds) const;
333 void setSlideshowImageDuration(double seconds);
334 double slideshowAudioVideoDuration(double defaultSeconds) const;
335 void setSlideshowAudioVideoDuration(double seconds);
336 int slideshowAspectConversion(int defaultAspectConversion) const;
337 void setSlideshowAspectConversion(int aspectConversion);
338 int slideshowZoomPercent(int defaultZoomPercent) const;
339 void setSlideshowZoomPercent(int zoomPercent);
340 double slideshowTransitionDuration(double defaultTransitionDuration) const;
341 void setSlideshowTransitionDuration(double transitionDuration);
342 int slideshowTransitionStyle(int defaultTransitionStyle) const;
343 void setSlideshowTransitionStyle(int transitionStyle);
344 int slideshowTransitionSoftness(int defaultTransitionSoftness) const;
345 void setSlideshowTransitionSoftness(int transitionSoftness);
346
347 // Keyframes
348 bool keyframesDragScrub() const;
349 void setKeyframesDragScrub(bool);
350
351 // Subtitles
352 void setSubtitlesShowColumn(const QString &column, bool b);
353 bool subtitlesShowColumn(const QString &column) const;
354 void setSubtitlesTrackTimeline(bool b);
355 bool subtitlesTrackTimeline() const;
356 void setSubtitlesShowPrevNext(bool b);
357 bool subtitlesShowPrevNext() const;
358 void setWhisperExe(const QString &path);
359 QString whisperExe();
360 void setWhisperModel(const QString &path);
361 QString whisperModel();
362
363 // Notes
364 void setNotesZoom(int zoom);
365 int notesZoom() const;
366
367 // Files
368 QString filesViewMode() const;
369 void setFilesViewMode(const QString &viewMode);
370 QStringList filesLocations() const;
371 QString filesLocationPath(const QString &name) const;
372 bool setFilesLocation(const QString &name, const QString &path);
373 bool removeFilesLocation(const QString &name);
374 QStringList filesOpenOther(const QString &type) const;
375 void setFilesOpenOther(const QString &type, const QString &filePath);
376 bool removeFilesOpenOther(const QString &type, const QString &filePath);
377 QString filesCurrentDir() const;
378 void setFilesCurrentDir(const QString &s);
379 bool filesFoldersOpen() const;
380 void setFilesFoldersOpen(bool b);
381
382 // Speech (Text-to-Speech dialog)
383 QString speechLanguage() const;
384 void setSpeechLanguage(const QString &code);
385 QString speechVoice() const;
386 void setSpeechVoice(const QString &voiceId);
387 double speechSpeed() const;
388 void setSpeechSpeed(double speed);
389
390public slots:
391 void reset();
392
393signals:
394 void openPathChanged();
395 void savePathChanged();
396 void timelineDragScrubChanged();
397 void timelineShowWaveformsChanged();
398 void timelineShowThumbnailsChanged();
399 void timelineRippleChanged();
400 void timelineRippleAllTracksChanged();
401 void timelineRippleMarkersChanged();
402 void timelineSnapChanged();
403 void timelineScrollZoomChanged();
404 void timelineFramebufferWaveformChanged();
405 void playerAudioChannelsChanged(int);
406 void playerGpuChanged();
407 void audioInDurationChanged();
408 void audioOutDurationChanged();
409 void videoInDurationChanged();
410 void videoOutDurationChanged();
411 void audioInCurveChanged();
412 void audioOutCurveChanged();
413 void playlistThumbnailsChanged();
414 void viewModeChanged();
415 void filesViewModeChanged();
416 void smallIconsChanged();
417 void askOutputFilterChanged();
418 void timelineScrollingChanged();
419 void timelineAutoAddTracksChanged();
420 void timelineRectangleSelectChanged();
421 void timeFormatChanged();
422 void keyframesDragScrubChanged();
423 void timelineAdjustGainChanged();
424
425private:
426 explicit ShotcutSettings();
427 explicit ShotcutSettings(const QString &appDataLocation);
428 void migrateRecent();
429 void migrateLayout();
430
431 QSettings settings;
432 QString m_appDataLocation;
433 QSettings m_recent;
434};
435
436#define Settings ShotcutSettings::singleton()
437
438#endif // SETTINGS_H