CuteLogger
Fast and simple logging solution for Qt based applications
settings.h
1 /*
2  * Copyright (c) 2013-2019 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 <QObject>
22 #include <QSettings>
23 #include <QStringList>
24 #include <QByteArray>
25 
26 class ShotcutSettings : public QObject
27 {
28  Q_OBJECT
29  Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms NOTIFY timelineShowWaveformsChanged)
30  Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails NOTIFY timelineShowThumbnailsChanged)
31  Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY timelineRippleChanged)
32  Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged)
33  Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged)
34  Q_PROPERTY(bool timelineCenterPlayhead READ timelineCenterPlayhead WRITE setTimelineCenterPlayhead NOTIFY timelineCenterPlayheadChanged)
35  Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged)
36  Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged)
37  Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY playlistThumbnailsChanged)
38  Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged)
39  Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged)
40  Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged)
41  Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY audioInDurationChanged)
42  Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY audioOutDurationChanged)
43  Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY videoInDurationChanged)
44  Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY videoOutDurationChanged)
45 
46 
47 public:
48  static ShotcutSettings& singleton();
49  explicit ShotcutSettings() : QObject() {}
50  explicit ShotcutSettings(const QString& appDataLocation);
51  void log();
52 
53  QString language() const;
54  void setLanguage(const QString&);
55  double imageDuration() const;
56  void setImageDuration(double);
57  QString openPath() const;
58  void setOpenPath(const QString&);
59  QString savePath() const;
60  void setSavePath(const QString&);
61  QStringList recent() const;
62  void setRecent(const QStringList&);
63  QString theme() const;
64  void setTheme(const QString&);
65  bool showTitleBars() const;
66  void setShowTitleBars(bool);
67  bool showToolBar() const;
68  void setShowToolBar(bool);
69  QByteArray windowGeometry() const;
70  void setWindowGeometry(const QByteArray&);
71  QByteArray windowGeometryDefault() const;
72  void setWindowGeometryDefault(const QByteArray&);
73  QByteArray windowState() const;
74  void setWindowState(const QByteArray&);
75  QByteArray windowStateDefault() const;
76  void setWindowStateDefault(const QByteArray&);
77  QString viewMode() const;
78  void setViewMode(const QString& viewMode);
79 
80  QString encodePath() const;
81  void setEncodePath(const QString&);
82  bool encodeFreeSpaceCheck() const;
83  void setEncodeFreeSpaceCheck(bool);
84  bool encodeUseHardware() const;
85  void setEncodeUseHardware(bool);
86  QStringList encodeHardware() const;
87  void setEncodeHardware(const QStringList&);
88  bool encodeAdvanced() const;
89  void setEncodeAdvanced(bool);
90  bool showConvertClipDialog() const;
91  void setShowConvertClipDialog(bool);
92 
93  int playerAudioChannels() const;
94  void setPlayerAudioChannels(int);
95  QString playerDeinterlacer() const;
96  void setPlayerDeinterlacer(const QString&);
97  QString playerExternal() const;
98  void setPlayerExternal(const QString&);
99  QString playerGamma() const;
100  void setPlayerGamma(const QString&);
101  bool playerGPU() const;
102  void setPlayerGPU(bool);
103  bool playerWarnGPU() const;
104  QString playerInterpolation() const;
105  void setPlayerInterpolation(const QString&);
106  bool playerJACK() const;
107  void setPlayerJACK(bool);
108  int playerKeyerMode() const;
109  void setPlayerKeyerMode(int);
110  bool playerMuted() const;
111  void setPlayerMuted(bool);
112  QString playerProfile() const;
113  void setPlayerProfile(const QString&);
114  bool playerProgressive() const;
115  void setPlayerProgressive(bool);
116  bool playerRealtime() const;
117  void setPlayerRealtime(bool);
118  bool playerScrubAudio() const;
119  void setPlayerScrubAudio(bool);
120  int playerVolume() const;
121  void setPlayerVolume(int);
122  float playerZoom() const;
123  void setPlayerZoom(float);
124 
125  QString playlistThumbnails() const;
126  void setPlaylistThumbnails(const QString&);
127 
128  bool timelineShowWaveforms() const;
129  void setTimelineShowWaveforms(bool);
130  bool timelineShowThumbnails() const;
131  void setTimelineShowThumbnails(bool);
132 
133  bool timelineRipple() const;
134  void setTimelineRipple(bool);
135  bool timelineRippleAllTracks() const;
136  void setTimelineRippleAllTracks(bool);
137  bool timelineSnap() const;
138  void setTimelineSnap(bool);
139  bool timelineCenterPlayhead() const;
140  void setTimelineCenterPlayhead(bool);
141 
142  QString filterFavorite(const QString& filterName);
143  void setFilterFavorite(const QString& filterName, const QString& value);
144 
145  double audioInDuration() const;
146  void setAudioInDuration(double);
147 
148  double audioOutDuration() const;
149  void setAudioOutDuration(double);
150 
151  double videoInDuration() const;
152  void setVideoInDuration(double);
153 
154  double videoOutDuration() const;
155  void setVideoOutDuration(double);
156 
157  bool loudnessScopeShowMeter(const QString& meter) const;
158  void setLoudnessScopeShowMeter(const QString& meter, bool b);
159 
160  int drawMethod() const;
161  void setDrawMethod(int);
162 
163  bool noUpgrade() const;
164  void setNoUpgrade(bool value);
165  bool checkUpgradeAutomatic();
166  void setCheckUpgradeAutomatic(bool b);
167  bool askUpgradeAutmatic();
168  void setAskUpgradeAutomatic(bool b);
169 
170  void sync();
171  QString appDataLocation() const;
172  static void setAppDataForSession(const QString& location);
173  void setAppDataLocally(const QString& location);
174 
175  QStringList layouts() const;
176  bool setLayout(const QString& name, const QByteArray& geometry, const QByteArray& state);
177  QByteArray layoutGeometry(const QString& name);
178  QByteArray layoutState(const QString& name);
179  bool removeLayout(const QString& name);
180 
181  bool clearRecent() const;
182  void setClearRecent(bool);
183 
184  QString projectsFolder() const;
185  void setProjectsFolder(const QString& path);
186 
187 signals:
188  void openPathChanged();
189  void savePathChanged();
190  void timelineShowWaveformsChanged();
191  void timelineShowThumbnailsChanged();
192  void timelineRippleChanged();
193  void timelineRippleAllTracksChanged();
194  void timelineSnapChanged();
195  void timelineCenterPlayheadChanged();
196  void playerAudioChannelsChanged(int);
197  void playerGpuChanged();
198  void audioInDurationChanged();
199  void audioOutDurationChanged();
200  void videoInDurationChanged();
201  void videoOutDurationChanged();
202  void playlistThumbnailsChanged();
203  void viewModeChanged();
204 
205 private:
206  QSettings settings;
207  QString m_appDataLocation;
208 };
209 
210 #define Settings ShotcutSettings::singleton()
211 
212 #endif // SETTINGS_H