CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1/*
2 * Copyright (c) 2013-2022 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
69public:
70 static ShotcutSettings &singleton();
71 explicit ShotcutSettings() : QObject() {}
72 explicit ShotcutSettings(const QString &appDataLocation);
73 void log();
74
75 // general
76 QString language() const;
77 void setLanguage(const QString &);
78 double imageDuration() const;
79 void setImageDuration(double);
80 QString openPath() const;
81 void setOpenPath(const QString &);
82 QString savePath() const;
83 void setSavePath(const QString &);
84 QStringList recent() const;
85 void setRecent(const QStringList &);
86 QString theme() const;
87 void setTheme(const QString &);
88 QThread::Priority jobPriority() const;
89 void setJobPriority(const QString &);
90 bool showTitleBars() const;
91 void setShowTitleBars(bool);
92 bool showToolBar() const;
93 void setShowToolBar(bool);
94 bool textUnderIcons() const;
95 void setTextUnderIcons(bool);
96 bool smallIcons() const;
97 void setSmallIcons(bool);
98 QByteArray windowGeometry() const;
99 void setWindowGeometry(const QByteArray &);
100 QByteArray windowGeometryDefault() const;
101 void setWindowGeometryDefault(const QByteArray &);
102 QByteArray windowState() const;
103 void setWindowState(const QByteArray &);
104 QByteArray windowStateDefault() const;
105 void setWindowStateDefault(const QByteArray &);
106 QString viewMode() const;
107 void setViewMode(const QString &viewMode);
108 QString exportFrameSuffix() const;
109 void setExportFrameSuffix(const QString &suffix);
110 bool convertAdvanced() const;
111 void setConvertAdvanced(bool);
112
113 // encode
114 QString encodePath() const;
115 void setEncodePath(const QString &);
116 bool encodeFreeSpaceCheck() const;
117 void setEncodeFreeSpaceCheck(bool);
118 bool encodeUseHardware() const;
119 void setEncodeUseHardware(bool);
120 QStringList encodeHardware() const;
121 void setEncodeHardware(const QStringList &);
122 bool encodeAdvanced() const;
123 void setEncodeAdvanced(bool);
124 bool showConvertClipDialog() const;
125 void setShowConvertClipDialog(bool);
126 bool encodeParallelProcessing() const;
127 void setEncodeParallelProcessing(bool);
128
129 // player
130 int playerAudioChannels() const;
131 void setPlayerAudioChannels(int);
132 QString playerDeinterlacer() const;
133 void setPlayerDeinterlacer(const QString &);
134 QString playerExternal() const;
135 void setPlayerExternal(const QString &);
136 QString playerGamma() const;
137 void setPlayerGamma(const QString &);
138 bool playerGPU() const;
139 void setPlayerGPU(bool);
140 bool playerWarnGPU() const;
141 QString playerInterpolation() const;
142 void setPlayerInterpolation(const QString &);
143 bool playerJACK() const;
144 void setPlayerJACK(bool);
145 int playerKeyerMode() const;
146 void setPlayerKeyerMode(int);
147 bool playerMuted() const;
148 void setPlayerMuted(bool);
149 QString playerProfile() const;
150 void setPlayerProfile(const QString &);
151 bool playerProgressive() const;
152 void setPlayerProgressive(bool);
153 bool playerRealtime() const;
154 void setPlayerRealtime(bool);
155 bool playerScrubAudio() const;
156 void setPlayerScrubAudio(bool);
157 int playerVolume() const;
158 void setPlayerVolume(int);
159 float playerZoom() const;
160 void setPlayerZoom(float);
161 int playerPreviewScale() const;
162 void setPlayerPreviewScale(int);
163 int playerVideoDelayMs() const;
164 void setPlayerVideoDelayMs(int);
165 double playerJumpSeconds() const;
166 void setPlayerJumpSeconds(double);
167
168 // playlist
169 QString playlistThumbnails() const;
170 void setPlaylistThumbnails(const QString &);
171 bool playlistAutoplay() const;
172 void setPlaylistAutoplay(bool);
173
174 // timeline
175 bool timelineDragScrub() const;
176 void setTimelineDragScrub(bool);
177 bool timelineShowWaveforms() const;
178 void setTimelineShowWaveforms(bool);
179 bool timelineShowThumbnails() const;
180 void setTimelineShowThumbnails(bool);
181 bool timelineRipple() const;
182 void setTimelineRipple(bool);
183 bool timelineRippleAllTracks() const;
184 void setTimelineRippleAllTracks(bool);
185 bool timelineRippleMarkers() const;
186 void setTimelineRippleMarkers(bool);
187 bool timelineSnap() const;
188 void setTimelineSnap(bool);
189 bool timelineCenterPlayhead() const;
190 void setTimelineCenterPlayhead(bool);
191 int timelineTrackHeight() const;
192 void setTimelineTrackHeight(int);
193 bool timelineScrollZoom() const;
194 void setTimelineScrollZoom(bool);
195 bool timelineFramebufferWaveform() const;
196 void setTimelineFramebufferWaveform(bool);
197 int audioReferenceTrack() const;
198 void setAudioReferenceTrack(int);
199 double audioReferenceSpeedRange() const;
200 void setAudioReferenceSpeedRange(double);
201 bool timelinePreviewTransition() const;
202 void setTimelinePreviewTransition(bool);
203
204 // filter
205 QString filterFavorite(const QString &filterName);
206 void setFilterFavorite(const QString &filterName, const QString &value);
207 double audioInDuration() const;
208 void setAudioInDuration(double);
209 double audioOutDuration() const;
210 void setAudioOutDuration(double);
211 double videoInDuration() const;
212 void setVideoInDuration(double);
213 double videoOutDuration() const;
214 void setVideoOutDuration(double);
215 bool askOutputFilter() const;
216 void setAskOutputFilter(bool);
217
218 // scope
219 bool loudnessScopeShowMeter(const QString &meter) const;
220 void setLoudnessScopeShowMeter(const QString &meter, bool b);
221
222 // Markers
223 void setMarkerColor(const QColor &color);
224 QColor markerColor() const;
225 void setMarkersShowColumn(const QString &column, bool b);
226 bool markersShowColumn(const QString &column) const;
227 void setMarkerSort(int column, Qt::SortOrder order);
228 int getMarkerSortColumn();
229 Qt::SortOrder getMarkerSortOrder();
230
231 // general continued
232 int drawMethod() const;
233 void setDrawMethod(int);
234 bool noUpgrade() const;
235 void setNoUpgrade(bool value);
236 bool checkUpgradeAutomatic();
237 void setCheckUpgradeAutomatic(bool b);
238 bool askUpgradeAutomatic();
239 void setAskUpgradeAutomatic(bool b);
240
241 void sync();
242 QString appDataLocation() const;
243 static void setAppDataForSession(const QString &location);
244 void setAppDataLocally(const QString &location);
245
246 // layout
247 QStringList layouts() const;
248 bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state);
249 QByteArray layoutGeometry(const QString &name);
250 QByteArray layoutState(const QString &name);
251 bool removeLayout(const QString &name);
252 int layoutMode() const;
253 void setLayoutMode(int mode = 0);
254
255 // general continued
256 bool clearRecent() const;
257 void setClearRecent(bool);
258 QString projectsFolder() const;
259 void setProjectsFolder(const QString &path);
260 QString audioInput() const;
261 void setAudioInput(const QString &name);
262 QString videoInput() const;
263 void setVideoInput(const QString &name);
264 QString glaxnimatePath() const;
265 void setGlaxnimatePath(const QString &path);
266 bool exportRangeMarkers() const;
267 void setExportRangeMarkers(bool);
268 int undoLimit() 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 QSettings settings;
314 QString m_appDataLocation;
315};
316
317#define Settings ShotcutSettings::singleton()
318
319#endif // SETTINGS_H