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