CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1/*
2 * Copyright (c) 2013-2023 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 <QKeySequence>
22#include <QObject>
23#include <QSettings>
24#include <QStringList>
25#include <QByteArray>
26#include <QThread>
27
28class ShotcutSettings : public QObject
29{
30 Q_OBJECT
31 Q_PROPERTY(bool timelineDragScrub READ timelineDragScrub WRITE setTimelineDragScrub NOTIFY
32 timelineDragScrubChanged)
33 Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms
34 NOTIFY timelineShowWaveformsChanged)
35 Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails
36 NOTIFY timelineShowThumbnailsChanged)
37 Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY
38 timelineRippleChanged)
39 Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE
40 setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
41 Q_PROPERTY(bool timelineRippleMarkers READ timelineRippleMarkers WRITE setTimelineRippleMarkers
42 NOTIFY timelineRippleMarkersChanged)
43 Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
44 Q_PROPERTY(bool timelineCenterPlayhead READ timelineCenterPlayhead WRITE setTimelineCenterPlayhead
45 NOTIFY timelineCenterPlayheadChanged)
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
70public:
71 static const qsizetype MaxPath {32767};
72
73 static ShotcutSettings &singleton();
74 void log();
75
76 // general
77 QString language() const;
78 void setLanguage(const QString &);
79 double imageDuration() const;
80 void setImageDuration(double);
81 QString openPath() const;
82 void setOpenPath(const QString &);
83 QString savePath() const;
84 void setSavePath(const QString &);
85 QStringList recent() const;
86 void setRecent(const QStringList &);
87 QString theme() const;
88 void setTheme(const QString &);
89 QThread::Priority jobPriority() const;
90 void setJobPriority(const QString &);
91 bool showTitleBars() const;
92 void setShowTitleBars(bool);
93 bool showToolBar() const;
94 void setShowToolBar(bool);
95 bool textUnderIcons() const;
96 void setTextUnderIcons(bool);
97 bool smallIcons() const;
98 void setSmallIcons(bool);
99 QByteArray windowGeometry() const;
100 void setWindowGeometry(const QByteArray &);
101 QByteArray windowGeometryDefault() const;
102 void setWindowGeometryDefault(const QByteArray &);
103 QByteArray windowState() const;
104 void setWindowState(const QByteArray &);
105 QByteArray windowStateDefault() const;
106 void setWindowStateDefault(const QByteArray &);
107 QString viewMode() const;
108 void setViewMode(const QString &viewMode);
109 QString exportFrameSuffix() const;
110 void setExportFrameSuffix(const QString &suffix);
111 bool convertAdvanced() const;
112 void setConvertAdvanced(bool);
113
114 // encode
115 QString encodePath() const;
116 void setEncodePath(const QString &);
117 bool encodeFreeSpaceCheck() const;
118 void setEncodeFreeSpaceCheck(bool);
119 bool encodeUseHardware() const;
120 void setEncodeUseHardware(bool);
121 QStringList encodeHardware() const;
122 void setEncodeHardware(const QStringList &);
123 bool encodeAdvanced() const;
124 void setEncodeAdvanced(bool);
125 bool showConvertClipDialog() const;
126 void setShowConvertClipDialog(bool);
127 bool encodeParallelProcessing() const;
128 void setEncodeParallelProcessing(bool);
129
130 // player
131 int playerAudioChannels() const;
132 void setPlayerAudioChannels(int);
133 QString playerDeinterlacer() const;
134 void setPlayerDeinterlacer(const QString &);
135 QString playerExternal() const;
136 void setPlayerExternal(const QString &);
137 bool playerGPU() const;
138 void setPlayerGPU(bool);
139 bool playerWarnGPU() const;
140 QString playerInterpolation() const;
141 void setPlayerInterpolation(const QString &);
142 bool playerJACK() const;
143 void setPlayerJACK(bool);
144 int playerKeyerMode() const;
145 void setPlayerKeyerMode(int);
146 bool playerMuted() const;
147 void setPlayerMuted(bool);
148 QString playerProfile() const;
149 void setPlayerProfile(const QString &);
150 bool playerProgressive() const;
151 void setPlayerProgressive(bool);
152 bool playerRealtime() const;
153 void setPlayerRealtime(bool);
154 bool playerScrubAudio() const;
155 void setPlayerScrubAudio(bool);
156 int playerVolume() const;
157 void setPlayerVolume(int);
158 float playerZoom() const;
159 void setPlayerZoom(float);
160 int playerPreviewScale() const;
161 void setPlayerPreviewScale(int);
162 int playerVideoDelayMs() const;
163 void setPlayerVideoDelayMs(int);
164 double playerJumpSeconds() const;
165 void setPlayerJumpSeconds(double);
166
167 // playlist
168 QString playlistThumbnails() const;
169 void setPlaylistThumbnails(const QString &);
170 bool playlistAutoplay() const;
171 void setPlaylistAutoplay(bool);
172
173 // timeline
174 bool timelineDragScrub() const;
175 void setTimelineDragScrub(bool);
176 bool timelineShowWaveforms() const;
177 void setTimelineShowWaveforms(bool);
178 bool timelineShowThumbnails() const;
179 void setTimelineShowThumbnails(bool);
180 bool timelineRipple() const;
181 void setTimelineRipple(bool);
182 bool timelineRippleAllTracks() const;
183 void setTimelineRippleAllTracks(bool);
184 bool timelineRippleMarkers() const;
185 void setTimelineRippleMarkers(bool);
186 bool timelineSnap() const;
187 void setTimelineSnap(bool);
188 bool timelineCenterPlayhead() const;
189 void setTimelineCenterPlayhead(bool);
190 int timelineTrackHeight() const;
191 void setTimelineTrackHeight(int);
192 bool timelineScrollZoom() const;
193 void setTimelineScrollZoom(bool);
194 bool timelineFramebufferWaveform() const;
195 void setTimelineFramebufferWaveform(bool);
196 int audioReferenceTrack() const;
197 void setAudioReferenceTrack(int);
198 double audioReferenceSpeedRange() const;
199 void setAudioReferenceSpeedRange(double);
200 bool timelinePreviewTransition() const;
201 void setTimelinePreviewTransition(bool);
202
203 // filter
204 QString filterFavorite(const QString &filterName);
205 void setFilterFavorite(const QString &filterName, const QString &value);
206 double audioInDuration() const;
207 void setAudioInDuration(double);
208 double audioOutDuration() const;
209 void setAudioOutDuration(double);
210 double videoInDuration() const;
211 void setVideoInDuration(double);
212 double videoOutDuration() const;
213 void setVideoOutDuration(double);
214 bool askOutputFilter() const;
215 void setAskOutputFilter(bool);
216
217 // scope
218 bool loudnessScopeShowMeter(const QString &meter) const;
219 void setLoudnessScopeShowMeter(const QString &meter, bool b);
220
221 // Markers
222 void setMarkerColor(const QColor &color);
223 QColor markerColor() const;
224 void setMarkersShowColumn(const QString &column, bool b);
225 bool markersShowColumn(const QString &column) const;
226 void setMarkerSort(int column, Qt::SortOrder order);
227 int getMarkerSortColumn();
228 Qt::SortOrder getMarkerSortOrder();
229
230 // general continued
231 int drawMethod() const;
232 void setDrawMethod(int);
233 bool noUpgrade() const;
234 void setNoUpgrade(bool value);
235 bool checkUpgradeAutomatic();
236 void setCheckUpgradeAutomatic(bool b);
237 bool askUpgradeAutomatic();
238 void setAskUpgradeAutomatic(bool b);
239
240 void sync();
241 QString appDataLocation() const;
242 static void setAppDataForSession(const QString &location);
243 void setAppDataLocally(const QString &location);
244
245 // layout
246 QStringList layouts() const;
247 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
248 QByteArray layoutGeometry(const QString &name);
249 QByteArray layoutState(const QString &name);
250 bool removeLayout(const QString &name);
251 int layoutMode() const;
252 void setLayoutMode(int mode = 0);
253
254 // general continued
255 bool clearRecent() const;
256 void setClearRecent(bool);
257 QString projectsFolder() const;
258 void setProjectsFolder(const QString &path);
259 QString audioInput() const;
260 void setAudioInput(const QString &name);
261 QString videoInput() const;
262 void setVideoInput(const QString &name);
263 QString glaxnimatePath() const;
264 void setGlaxnimatePath(const QString &path);
265 bool exportRangeMarkers() const;
266 void setExportRangeMarkers(bool);
267 int undoLimit() const;
268 bool warnLowMemory() const;
269
270 // proxy
271 bool proxyEnabled() const;
272 void setProxyEnabled(bool);
273 QString proxyFolder() const;
274 void setProxyFolder(const QString &path);
275 bool proxyUseProjectFolder() const;
276 void setProxyUseProjectFolder(bool);
277 bool proxyUseHardware() const;
278 void setProxyUseHardware(bool);
279
280 // Shortcuts
281 void clearShortcuts(const QString &name);
282 void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts);
283 QList<QKeySequence> shortcuts(const QString &name);
284
285public slots:
286 void reset();
287
288signals:
289 void openPathChanged();
290 void savePathChanged();
291 void timelineDragScrubChanged();
292 void timelineShowWaveformsChanged();
293 void timelineShowThumbnailsChanged();
294 void timelineRippleChanged();
295 void timelineRippleAllTracksChanged();
296 void timelineRippleMarkersChanged();
297 void timelineSnapChanged();
298 void timelineCenterPlayheadChanged();
299 void timelineScrollZoomChanged();
300 void timelineFramebufferWaveformChanged();
301 void playerAudioChannelsChanged(int);
302 void playerGpuChanged();
303 void audioInDurationChanged();
304 void audioOutDurationChanged();
305 void videoInDurationChanged();
306 void videoOutDurationChanged();
307 void playlistThumbnailsChanged();
308 void viewModeChanged();
309 void smallIconsChanged();
310 void askOutputFilterChanged();
311
312private:
313 explicit ShotcutSettings();
314 explicit ShotcutSettings(const QString &appDataLocation);
315 void migrateRecent();
316 void migrateLayout();
317
318 QSettings settings;
319 QString m_appDataLocation;
320 QSettings m_recent;
321};
322
323#define Settings ShotcutSettings::singleton()
324
325#endif // SETTINGS_H