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