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