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 bool exportRangeMarkers() const;
309 void setExportRangeMarkers(bool);
310 int undoLimit() const;
311 bool warnLowMemory() const;
312 int backupPeriod() const;
313 void setBackupPeriod(int i);
314 mlt_time_format timeFormat() const;
315 void setTimeFormat(int format);
316 bool askFlatpakWrappers();
317 void setAskFlatpakWrappers(bool b);
318 QString dockerPath() const;
319 void setDockerPath(const QString &path);
320 QString chromiumPath() const;
321 void setChromiumPath(const QString &path);
322 QString screenRecorderPath() const;
323 void setScreenRecorderPath(const QString &path);
324
325 // proxy
326 bool proxyEnabled() const;
327 void setProxyEnabled(bool);
328 QString proxyFolder() const;
329 void setProxyFolder(const QString &path);
330 bool proxyUseProjectFolder() const;
331 void setProxyUseProjectFolder(bool);
332 bool proxyUseHardware() const;
333 void setProxyUseHardware(bool);
334
335 // Shortcuts
336 void clearShortcuts(const QString &name);
337 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
338 QList<QKeySequence> shortcuts(const QString &name);
339
340 // Slideshow
341 double slideshowImageDuration(double defaultSeconds) const;
342 void setSlideshowImageDuration(double seconds);
343 double slideshowAudioVideoDuration(double defaultSeconds) const;
344 void setSlideshowAudioVideoDuration(double seconds);
345 int slideshowAspectConversion(int defaultAspectConversion) const;
346 void setSlideshowAspectConversion(int aspectConversion);
347 int slideshowZoomPercent(int defaultZoomPercent) const;
348 void setSlideshowZoomPercent(int zoomPercent);
349 double slideshowTransitionDuration(double defaultTransitionDuration) const;
350 void setSlideshowTransitionDuration(double transitionDuration);
351 int slideshowTransitionStyle(int defaultTransitionStyle) const;
352 void setSlideshowTransitionStyle(int transitionStyle);
353 int slideshowTransitionSoftness(int defaultTransitionSoftness) const;
354 void setSlideshowTransitionSoftness(int transitionSoftness);
355
356 // Keyframes
357 bool keyframesDragScrub() const;
358 void setKeyframesDragScrub(bool);
359
360 // Subtitles
361 void setSubtitlesShowColumn(const QString &column, bool b);
362 bool subtitlesShowColumn(const QString &column) const;
363 void setSubtitlesTrackTimeline(bool b);
364 bool subtitlesTrackTimeline() const;
365 void setSubtitlesShowPrevNext(bool b);
366 bool subtitlesShowPrevNext() const;
367 void setWhisperExe(const QString &path);
368 QString whisperExe();
369 void setWhisperModel(const QString &path);
370 QString whisperModel();
371
372 // Notes
373 void setNotesZoom(int zoom);
374 int notesZoom() const;
375
376 // Files
377 QString filesViewMode() const;
378 void setFilesViewMode(const QString &viewMode);
379 QStringList filesLocations() const;
380 QString filesLocationPath(const QString &name) const;
381 bool setFilesLocation(const QString &name, const QString &path);
382 bool removeFilesLocation(const QString &name);
383 QStringList filesOpenOther(const QString &type) const;
384 void setFilesOpenOther(const QString &type, const QString &filePath);
385 bool removeFilesOpenOther(const QString &type, const QString &filePath);
386 QString filesCurrentDir() const;
387 void setFilesCurrentDir(const QString &s);
388 bool filesFoldersOpen() const;
389 void setFilesFoldersOpen(bool b);
390
391 // Speech (Text-to-Speech dialog)
392 QString speechLanguage() const;
393 void setSpeechLanguage(const QString &code);
394 QString speechVoice() const;
395 void setSpeechVoice(const QString &voiceId);
396 double speechSpeed() const;
397 void setSpeechSpeed(double speed);
398
399 // Color Dialog
400 void saveCustomColors();
401 void restoreCustomColors();
402
403public slots:
404 void reset();
405
406signals:
407 void openPathChanged();
408 void savePathChanged();
409 void timelineDragScrubChanged();
410 void timelineShowWaveformsChanged();
411 void timelineShowThumbnailsChanged();
412 void timelineRippleChanged();
413 void timelineRippleAllTracksChanged();
414 void timelineRippleMarkersChanged();
415 void timelineSnapChanged();
416 void timelineScrollZoomChanged();
417 void timelineFramebufferWaveformChanged();
418 void playerAudioChannelsChanged(int);
419 void playerGpuChanged();
420 void audioInDurationChanged();
421 void audioOutDurationChanged();
422 void videoInDurationChanged();
423 void videoOutDurationChanged();
424 void audioInCurveChanged();
425 void audioOutCurveChanged();
426 void playlistThumbnailsChanged();
427 void viewModeChanged();
428 void filesViewModeChanged();
429 void smallIconsChanged();
430 void askOutputFilterChanged();
431 void timelineScrollingChanged();
432 void timelineAutoAddTracksChanged();
433 void timelineRectangleSelectChanged();
434 void timeFormatChanged();
435 void keyframesDragScrubChanged();
436 void timelineAdjustGainChanged();
437
438private:
439 explicit ShotcutSettings();
440 explicit ShotcutSettings(const QString &appDataLocation);
441 void migrateRecent();
442 void migrateLayout();
443
444 QSettings settings;
445 QString m_appDataLocation;
446 QSettings m_recent;
447};
448
449#define Settings ShotcutSettings::singleton()
450
451#endif // SETTINGS_H