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