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