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