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 bool playlistShowColumn(const QString &);
186 void setPlaylistShowColumn(const QString &, bool);
187
188 // timeline
189 bool timelineDragScrub() const;
190 void setTimelineDragScrub(bool);
191 bool timelineShowWaveforms() const;
192 void setTimelineShowWaveforms(bool);
193 bool timelineShowThumbnails() const;
194 void setTimelineShowThumbnails(bool);
195 bool timelineRipple() const;
196 void setTimelineRipple(bool);
197 bool timelineRippleAllTracks() const;
198 void setTimelineRippleAllTracks(bool);
199 bool timelineRippleMarkers() const;
200 void setTimelineRippleMarkers(bool);
201 bool timelineSnap() const;
202 void setTimelineSnap(bool);
203 int timelineTrackHeight() const;
204 void setTimelineTrackHeight(int);
205 bool timelineScrollZoom() const;
206 void setTimelineScrollZoom(bool);
207 bool timelineFramebufferWaveform() const;
208 void setTimelineFramebufferWaveform(bool);
209 int audioReferenceTrack() const;
210 void setAudioReferenceTrack(int);
211 double audioReferenceSpeedRange() const;
212 void setAudioReferenceSpeedRange(double);
213 bool timelinePreviewTransition() const;
214 void setTimelinePreviewTransition(bool);
215 void setTimelineScrolling(TimelineScrolling value);
216 TimelineScrolling timelineScrolling() const;
217 bool timelineAutoAddTracks() const;
218 void setTimelineAutoAddTracks(bool);
219 bool timelineRectangleSelect() const;
220 void setTimelineRectangleSelect(bool);
221
222 // filter
223 QString filterFavorite(const QString &filterName);
224 void setFilterFavorite(const QString &filterName, const QString &value);
225 double audioInDuration() const;
226 void setAudioInDuration(double);
227 double audioOutDuration() const;
228 void setAudioOutDuration(double);
229 double videoInDuration() const;
230 void setVideoInDuration(double);
231 double videoOutDuration() const;
232 void setVideoOutDuration(double);
233 bool askOutputFilter() const;
234 void setAskOutputFilter(bool);
235
236 // scope
237 bool loudnessScopeShowMeter(const QString &meter) const;
238 void setLoudnessScopeShowMeter(const QString &meter, bool b);
239
240 // Markers
241 void setMarkerColor(const QColor &color);
242 QColor markerColor() const;
243 void setMarkersShowColumn(const QString &column, bool b);
244 bool markersShowColumn(const QString &column) const;
245 void setMarkerSort(int column, Qt::SortOrder order);
246 int getMarkerSortColumn();
247 Qt::SortOrder getMarkerSortOrder();
248
249 // general continued
250 int drawMethod() const;
251 void setDrawMethod(int);
252 bool noUpgrade() const;
253 void setNoUpgrade(bool value);
254 bool checkUpgradeAutomatic();
255 void setCheckUpgradeAutomatic(bool b);
256 bool askUpgradeAutomatic();
257 void setAskUpgradeAutomatic(bool b);
258
259 void sync();
260 QString appDataLocation() const;
261 static void setAppDataForSession(const QString &location);
262 void setAppDataLocally(const QString &location);
263
264 // layout
265 QStringList layouts() const;
266 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
267 QByteArray layoutGeometry(const QString &name);
268 QByteArray layoutState(const QString &name);
269 bool removeLayout(const QString &name);
270 int layoutMode() const;
271 void setLayoutMode(int mode = 0);
272
273 // general continued
274 bool clearRecent() const;
275 void setClearRecent(bool);
276 QString projectsFolder() const;
277 void setProjectsFolder(const QString &path);
278 QString audioInput() const;
279 void setAudioInput(const QString &name);
280 QString videoInput() const;
281 void setVideoInput(const QString &name);
282 QString glaxnimatePath() const;
283 void setGlaxnimatePath(const QString &path);
284 bool exportRangeMarkers() const;
285 void setExportRangeMarkers(bool);
286 int undoLimit() const;
287 bool warnLowMemory() const;
288 int backupPeriod() const;
289 void setBackupPeriod(int i);
290 mlt_time_format timeFormat() const;
291 void setTimeFormat(int format);
292
293 // proxy
294 bool proxyEnabled() const;
295 void setProxyEnabled(bool);
296 QString proxyFolder() const;
297 void setProxyFolder(const QString &path);
298 bool proxyUseProjectFolder() const;
299 void setProxyUseProjectFolder(bool);
300 bool proxyUseHardware() const;
301 void setProxyUseHardware(bool);
302
303 // Shortcuts
304 void clearShortcuts(const QString &name);
305 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
306 QList<QKeySequence> shortcuts(const QString &name);
307
308 // Slideshow
309 double slideshowClipDuration(double defaultClipDuration) const;
310 void setSlideshowClipDuration(double clipDuration);
311 int slideshowAspectConversion(int defaultAspectConversion) const;
312 void setSlideshowAspectConversion(int aspectConversion);
313 int slideshowZoomPercent(int defaultZoomPercent) const;
314 void setSlideshowZoomPercent(int zoomPercent);
315 double slideshowTransitionDuration(double defaultTransitionDuration) const;
316 void setSlideshowTransitionDuration(double transitionDuration);
317 int slideshowTransitionStyle(int defaultTransitionStyle) const;
318 void setSlideshowTransitionStyle(int transitionStyle);
319 int slideshowTransitionSoftness(int defaultTransitionSoftness) const;
320 void setSlideshowTransitionSoftness(int transitionSoftness);
321
322public slots:
323 void reset();
324
325signals:
326 void openPathChanged();
327 void savePathChanged();
328 void timelineDragScrubChanged();
329 void timelineShowWaveformsChanged();
330 void timelineShowThumbnailsChanged();
331 void timelineRippleChanged();
332 void timelineRippleAllTracksChanged();
333 void timelineRippleMarkersChanged();
334 void timelineSnapChanged();
335 void timelineScrollZoomChanged();
336 void timelineFramebufferWaveformChanged();
337 void playerAudioChannelsChanged(int);
338 void playerGpuChanged();
339 void audioInDurationChanged();
340 void audioOutDurationChanged();
341 void videoInDurationChanged();
342 void videoOutDurationChanged();
343 void playlistThumbnailsChanged();
344 void viewModeChanged();
345 void smallIconsChanged();
346 void askOutputFilterChanged();
347 void timelineScrollingChanged();
348 void timelineAutoAddTracksChanged();
349 void timelineRectangleSelectChanged();
350 void timeFormatChanged();
351
352private:
353 explicit ShotcutSettings();
354 explicit ShotcutSettings(const QString &appDataLocation);
355 void migrateRecent();
356 void migrateLayout();
357
358 QSettings settings;
359 QString m_appDataLocation;
360 QSettings m_recent;
361};
362
363#define Settings ShotcutSettings::singleton()
364
365#endif // SETTINGS_H