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
23#include <QKeySequence>
24#include <QObject>
25#include <QSettings>
26#include <QStringList>
27#include <QByteArray>
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 setTimelineShowThumbnails
38 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(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged)
66 Q_PROPERTY(bool askOutputFilter READ askOutputFilter WRITE setAskOutputFilter NOTIFY
67 askOutputFilterChanged)
68 Q_PROPERTY(QString appDataLocation READ appDataLocation CONSTANT)
69 Q_PROPERTY(TimelineScrolling timelineScrolling READ timelineScrolling WRITE setTimelineScrolling
70 NOTIFY timelineScrollingChanged)
71 Q_ENUMS(TimelineScrolling)
72 Q_PROPERTY(bool timelineRectangleSelect READ timelineRectangleSelect WRITE
73 setTimelineRectangleSelect NOTIFY timelineRectangleSelectChanged)
74 Q_PROPERTY(bool keyframesDragScrub READ keyframesDragScrub WRITE setKeyframesDragScrub
75 NOTIFY keyframesDragScrubChanged)
76
77public:
78 static const qsizetype MaxPath {32767};
79 enum TimelineScrolling {
80 NoScrolling,
81 CenterPlayhead,
82 PageScrolling,
83 SmoothScrolling
84 };
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
129 // encode
130 QString encodePath() const;
131 void setEncodePath(const QString &);
132 bool encodeFreeSpaceCheck() const;
133 void setEncodeFreeSpaceCheck(bool);
134 bool encodeUseHardware() const;
135 void setEncodeUseHardware(bool);
136 QStringList encodeHardware() const;
137 void setEncodeHardware(const QStringList &);
138 bool encodeAdvanced() const;
139 void setEncodeAdvanced(bool);
140 bool showConvertClipDialog() const;
141 void setShowConvertClipDialog(bool);
142 bool encodeParallelProcessing() const;
143 void setEncodeParallelProcessing(bool);
144
145 // player
146 int playerAudioChannels() const;
147 void setPlayerAudioChannels(int);
148 QString playerDeinterlacer() const;
149 void setPlayerDeinterlacer(const QString &);
150 QString playerExternal() const;
151 void setPlayerExternal(const QString &);
152 bool playerGPU() const;
153 void setPlayerGPU(bool);
154 bool playerWarnGPU() const;
155 QString playerInterpolation() const;
156 void setPlayerInterpolation(const QString &);
157 bool playerJACK() const;
158 void setPlayerJACK(bool);
159 int playerKeyerMode() const;
160 void setPlayerKeyerMode(int);
161 bool playerMuted() const;
162 void setPlayerMuted(bool);
163 QString playerProfile() const;
164 void setPlayerProfile(const QString &);
165 bool playerProgressive() const;
166 void setPlayerProgressive(bool);
167 bool playerRealtime() const;
168 void setPlayerRealtime(bool);
169 bool playerScrubAudio() const;
170 void setPlayerScrubAudio(bool);
171 int playerVolume() const;
172 void setPlayerVolume(int);
173 float playerZoom() const;
174 void setPlayerZoom(float);
175 int playerPreviewScale() const;
176 void setPlayerPreviewScale(int);
177 int playerVideoDelayMs() const;
178 void setPlayerVideoDelayMs(int);
179 double playerJumpSeconds() const;
180 void setPlayerJumpSeconds(double);
181 QString playerAudioDriver() const;
182 void setPlayerAudioDriver(const QString &s);
183
184 // playlist
185 QString playlistThumbnails() const;
186 void setPlaylistThumbnails(const QString &);
187 bool playlistAutoplay() const;
188 void setPlaylistAutoplay(bool);
189 bool playlistShowColumn(const QString &);
190 void setPlaylistShowColumn(const QString &, bool);
191
192 // timeline
193 bool timelineDragScrub() const;
194 void setTimelineDragScrub(bool);
195 bool timelineShowWaveforms() const;
196 void setTimelineShowWaveforms(bool);
197 bool timelineShowThumbnails() const;
198 void setTimelineShowThumbnails(bool);
199 bool timelineRipple() const;
200 void setTimelineRipple(bool);
201 bool timelineRippleAllTracks() const;
202 void setTimelineRippleAllTracks(bool);
203 bool timelineRippleMarkers() const;
204 void setTimelineRippleMarkers(bool);
205 bool timelineSnap() const;
206 void setTimelineSnap(bool);
207 int timelineTrackHeight() const;
208 void setTimelineTrackHeight(int);
209 bool timelineScrollZoom() const;
210 void setTimelineScrollZoom(bool);
211 bool timelineFramebufferWaveform() const;
212 void setTimelineFramebufferWaveform(bool);
213 int audioReferenceTrack() const;
214 void setAudioReferenceTrack(int);
215 double audioReferenceSpeedRange() const;
216 void setAudioReferenceSpeedRange(double);
217 bool timelinePreviewTransition() const;
218 void setTimelinePreviewTransition(bool);
219 void setTimelineScrolling(TimelineScrolling value);
220 TimelineScrolling timelineScrolling() const;
221 bool timelineAutoAddTracks() const;
222 void setTimelineAutoAddTracks(bool);
223 bool timelineRectangleSelect() const;
224 void setTimelineRectangleSelect(bool);
225
226 // filter
227 QString filterFavorite(const QString &filterName);
228 void setFilterFavorite(const QString &filterName, const QString &value);
229 double audioInDuration() const;
230 void setAudioInDuration(double);
231 double audioOutDuration() const;
232 void setAudioOutDuration(double);
233 double videoInDuration() const;
234 void setVideoInDuration(double);
235 double videoOutDuration() const;
236 void setVideoOutDuration(double);
237 bool askOutputFilter() const;
238 void setAskOutputFilter(bool);
239
240 // scope
241 bool loudnessScopeShowMeter(const QString &meter) const;
242 void setLoudnessScopeShowMeter(const QString &meter, bool b);
243
244 // Markers
245 void setMarkerColor(const QColor &color);
246 QColor markerColor() const;
247 void setMarkersShowColumn(const QString &column, bool b);
248 bool markersShowColumn(const QString &column) const;
249 void setMarkerSort(int column, Qt::SortOrder order);
250 int getMarkerSortColumn();
251 Qt::SortOrder getMarkerSortOrder();
252
253 // general continued
254 int drawMethod() const;
255 void setDrawMethod(int);
256 bool noUpgrade() const;
257 void setNoUpgrade(bool value);
258 bool checkUpgradeAutomatic();
259 void setCheckUpgradeAutomatic(bool b);
260 bool askUpgradeAutomatic();
261 void setAskUpgradeAutomatic(bool b);
262 bool askChangeVideoMode();
263 void setAskChangeVideoMode(bool b);
264
265 void sync();
266 QString appDataLocation() const;
267 static void setAppDataForSession(const QString &location);
268 void setAppDataLocally(const QString &location);
269
270 // layout
271 QStringList layouts() const;
272 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
273 QByteArray layoutGeometry(const QString &name);
274 QByteArray layoutState(const QString &name);
275 bool removeLayout(const QString &name);
276 int layoutMode() const;
277 void setLayoutMode(int mode = 0);
278
279 // general continued
280 bool clearRecent() const;
281 void setClearRecent(bool);
282 QString projectsFolder() const;
283 void setProjectsFolder(const QString &path);
284 QString audioInput() const;
285 void setAudioInput(const QString &name);
286 QString videoInput() const;
287 void setVideoInput(const QString &name);
288 QString glaxnimatePath() const;
289 void setGlaxnimatePath(const QString &path);
290 bool exportRangeMarkers() const;
291 void setExportRangeMarkers(bool);
292 int undoLimit() const;
293 bool warnLowMemory() const;
294 int backupPeriod() const;
295 void setBackupPeriod(int i);
296 mlt_time_format timeFormat() const;
297 void setTimeFormat(int format);
298
299 // proxy
300 bool proxyEnabled() const;
301 void setProxyEnabled(bool);
302 QString proxyFolder() const;
303 void setProxyFolder(const QString &path);
304 bool proxyUseProjectFolder() const;
305 void setProxyUseProjectFolder(bool);
306 bool proxyUseHardware() const;
307 void setProxyUseHardware(bool);
308
309 // Shortcuts
310 void clearShortcuts(const QString &name);
311 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
312 QList<QKeySequence> shortcuts(const QString &name);
313
314 // Slideshow
315 double slideshowClipDuration(double defaultClipDuration) const;
316 void setSlideshowClipDuration(double clipDuration);
317 int slideshowAspectConversion(int defaultAspectConversion) const;
318 void setSlideshowAspectConversion(int aspectConversion);
319 int slideshowZoomPercent(int defaultZoomPercent) const;
320 void setSlideshowZoomPercent(int zoomPercent);
321 double slideshowTransitionDuration(double defaultTransitionDuration) const;
322 void setSlideshowTransitionDuration(double transitionDuration);
323 int slideshowTransitionStyle(int defaultTransitionStyle) const;
324 void setSlideshowTransitionStyle(int transitionStyle);
325 int slideshowTransitionSoftness(int defaultTransitionSoftness) const;
326 void setSlideshowTransitionSoftness(int transitionSoftness);
327
328 // Keyframes
329 bool keyframesDragScrub() const;
330 void setKeyframesDragScrub(bool);
331
332 // Subtitles
333 void setSubtitlesShowColumn(const QString &column, bool b);
334 bool subtitlesShowColumn(const QString &column) const;
335 void setSubtitlesTrackTimeline(bool b);
336 bool subtitlesTrackTimeline() const;
337 void setSubtitlesShowPrevNext(bool b);
338 bool subtitlesShowPrevNext() const;
339 void setWhisperExe(const QString &path);
340 QString whisperExe();
341 void setWhisperModel(const QString &path);
342 QString whisperModel();
343
344 // Notes
345 void setNotesZoom(int zoom);
346 int notesZoom() const;
347
348public slots:
349 void reset();
350
351signals:
352 void openPathChanged();
353 void savePathChanged();
354 void timelineDragScrubChanged();
355 void timelineShowWaveformsChanged();
356 void timelineShowThumbnailsChanged();
357 void timelineRippleChanged();
358 void timelineRippleAllTracksChanged();
359 void timelineRippleMarkersChanged();
360 void timelineSnapChanged();
361 void timelineScrollZoomChanged();
362 void timelineFramebufferWaveformChanged();
363 void playerAudioChannelsChanged(int);
364 void playerGpuChanged();
365 void audioInDurationChanged();
366 void audioOutDurationChanged();
367 void videoInDurationChanged();
368 void videoOutDurationChanged();
369 void playlistThumbnailsChanged();
370 void viewModeChanged();
371 void smallIconsChanged();
372 void askOutputFilterChanged();
373 void timelineScrollingChanged();
374 void timelineAutoAddTracksChanged();
375 void timelineRectangleSelectChanged();
376 void timeFormatChanged();
377 void keyframesDragScrubChanged();
378
379private:
380 explicit ShotcutSettings();
381 explicit ShotcutSettings(const QString &appDataLocation);
382 void migrateRecent();
383 void migrateLayout();
384
385 QSettings settings;
386 QString m_appDataLocation;
387 QSettings m_recent;
388};
389
390#define Settings ShotcutSettings::singleton()
391
392#endif // SETTINGS_H