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