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