Sayonara Player
SettingKey.h
1 /* SettingKey.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21  // clazy:excludeall=non-pod-global-static
22 
23 #ifndef SETTINGKEY_H
24 #define SETTINGKEY_H
25 
26 #include "Utils/typedefs.h"
27 
28 enum class SettingKey : unsigned short
29 {
30  LFM_Active=0,
31  LFM_ScrobbleTimeSec,
32  LFM_Login,
33  LFM_Username,
34  LFM_Password,
35  LFM_Corrections,
36  LFM_ShowErrors,
37  LFM_SessionKey,
38 
39  Eq_Last,
40  Eq_List,
41  Eq_Gauss,
42 
43  Lib_Show,
44  Lib_Path,
45  Lib_ColsTitle,
46  Lib_ColsArtist,
47  Lib_ColsAlbum,
48  Lib_LiveSearch,
49  Lib_Sorting,
50  Lib_CurPlugin,
51  Lib_SplitterStateArtist,
52  Lib_SplitterStateTrack,
53  Lib_SplitterStateGenre,
54  Lib_SplitterStateDate,
55  Lib_OldWidth,
56  Lib_DC_DoNothing,
57  Lib_DC_PlayIfStopped,
58  Lib_DC_PlayImmediately,
59  Lib_DD_DoNothing,
60  Lib_DD_PlayIfStoppedAndEmpty,
61  Lib_FontSize,
62  Lib_FontBold,
63  Lib_SearchMode,
64  Lib_AutoUpdate,
65  Lib_ShowAlbumArtists,
66  Lib_ShowAlbumCovers,
67  Lib_CoverZoom,
68  Lib_CoverShowUtils,
69  Lib_CoverShowArtist,
70  Lib_CoverOrigPMCache,
71  Lib_CoverScaledPMCache,
72  Lib_GenreTree,
73  Lib_LastIndex,
74  Lib_AllLibraries, // deprecated
75  Lib_UseViewClearButton,
76  Lib_ShowFilterExtBar,
77 
78  Dir_ShowTracks,
79  Dir_SplitterDirFile,
80  Dir_SplitterTracks,
81 
82  Player_Version,
83  Player_Language,
84  Player_FontName,
85  Player_FontSize,
86  Player_Style,
87  Player_ControlStyle,
88  Player_Size,
89  Player_Pos,
90  Player_Fullscreen,
91  Player_Maximized,
92  Player_ShownPlugin,
93  Player_OneInstance,
94  Player_Min2Tray,
95  Player_StartInTray,
96  Player_ShowTrayIcon,
97  Player_NotifyNewVersion,
98  Player_SplitterState,
99  Player_Shortcuts,
100  Player_SplitterControls,
101  Player_PrivId,
102  Player_PublicId,
103 
104  PL_Playlist,
105  PL_LoadSavedPlaylists,
106  PL_LoadTemporaryPlaylists,
107  PL_LoadLastTrack,
108  PL_RememberTime,
109  PL_StartPlaying,
110  PL_LastTrack,
111  PL_LastTrackBeforeStop,
112  PL_LastPlaylist,
113  PL_Mode,
114  PL_ShowNumbers,
115  PL_EntryLook,
116  PL_FontSize,
117  PL_ShowClearButton,
118  PL_RememberTrackAfterStop,
119  PL_ShowCovers,
120  PL_ShowRating,
121 
122  Notification_Show,
123  Notification_Timeout,
124  Notification_Name,
125 
126  Engine_Name,
127  Engine_Vol,
128  Engine_Mute,
129  AudioConvert_NumberThreads,
130  AudioConvert_PreferredConverter,
131  AudioConvert_QualityLameVBR,
132  AudioConvert_QualityLameCBR,
133  AudioConvert_QualityOgg,
134  Engine_CovertTargetPath,
135  Engine_SpectrumBins,
136  Engine_ShowSpectrum,
137  Engine_ShowLevel,
138  Engine_CurTrackPos_s,
139  Engine_CrossFaderActive,
140  Engine_CrossFaderTime,
141  Engine_Pitch,
142  Engine_PreservePitch,
143  Engine_Speed,
144  Engine_SpeedActive,
145  Engine_Sink,
146 
147  Engine_SR_Active,
148  Engine_SR_Warning,
149  Engine_SR_Path,
150  Engine_SR_SessionPath,
151  Engine_SR_SessionPathTemplate,
152  Engine_SR_AutoRecord,
153 
154  Spectrum_Style,
155  Level_Style,
156 
157  Broadcast_Active,
158  Broadcast_Prompt,
159  Broadcast_Port,
160 
161  MP3enc_found,
162  Pitch_found,
163  Player_Quit,
164 
165  Remote_Active,
166  Remote_Port,
167 
168  Stream_NewTab,
169  Stream_ShowHistory,
170 
171  Lyrics_Zoom,
172  Lyrics_Server,
173 
174  Cover_Server,
175  Cover_FetchFromWWW,
176  Cover_StartSearch,
177  Icon_Theme,
178  Icon_ForceInDarkTheme,
179 
180  Proxy_Active,
181  Proxy_Username,
182  Proxy_Password,
183  Proxy_Hostname,
184  Proxy_Port,
185  Proxy_SavePw,
186 
187  Logger_Level,
188  Settings_Revision,
189 
190  Num_Setting_Keys
191 };
192 
193 
194 
195 class QString;
196 class QStringList;
197 class QPoint;
198 class QSize;
199 class QByteArray;
200 
201 class EQ_Setting;
202 struct RawShortcutMap;
203 
204 namespace Playlist
205 {
206  class Mode;
207 }
208 
209 namespace Library
210 {
211  class Sortings;
212  class Info;
213 }
214 
215 template<typename DataType, SettingKey keyIndex>
217 {
218  public:
219  using Data=DataType;
220  const static SettingKey key=keyIndex;
221 
222  private:
223  SettingIdentifier()=delete;
225 };
226 
227 
228 #define INST_ABSTR(ns, type, settingkey) \
229  namespace ns { using settingkey = SettingIdentifier<type, SettingKey:: settingkey>; }
230 
231 #define INST(type, settingkey) INST_ABSTR(Set, type, settingkey)
232 #define INST_NO_DB(type, settingkey) INST_ABSTR(SetNoDB, type, settingkey)
233 
234 
239  //typedef SettingKey<bool, SK::LFM_Active> LFM_Active_t; const LFM_Active_t LFM_Active
240  INST(bool, LFM_Active) /* is lastFM active? */
241  INST(int, LFM_ScrobbleTimeSec) /* time in sec when to scrobble */
242  INST(StringPair, LFM_Login) /* deprecated: 2-Tupel, username, password */
243  INST(QString, LFM_Username) /* username*/
244  INST(QString, LFM_Password) /* encrypted password */
245 
246  INST(bool, LFM_Corrections) /* propose lfm corrections */
247  INST(bool, LFM_ShowErrors) /* get error message, if there are lfm problems */
248  INST(QString, LFM_SessionKey) /* lfm session key */
249 
250  INST(int, Eq_Last) /* last equalizer index */
251  INST(QList<EQ_Setting>, Eq_List) /* All equalizers */
252  INST(bool, Eq_Gauss) /* do curve, when changing eq setting */
253 
254  INST(bool, Lib_Show) /* show library */
255  INST(QString, Lib_Path) // deprecated
256  INST(BoolList, Lib_ColsTitle) /* shown columns tracks */
257  INST(BoolList, Lib_ColsArtist) /* shown columns artist */
258  INST(BoolList, Lib_ColsAlbum) /* shown columns albums */
259  INST(bool, Lib_LiveSearch) /* library live search */
260  INST(::Library::Sortings, Lib_Sorting) /* how to sort in lib */
261  INST(QString, Lib_CurPlugin) /* Current shown library plugin */
262  INST(QByteArray, Lib_SplitterStateArtist) /* Splitter state between artists and albums */
263  INST(QByteArray, Lib_SplitterStateTrack) /* Splitter state between artists and tracks */
264  INST(QByteArray, Lib_SplitterStateGenre) /* Splitter state between tracks and genres */
265  INST(QByteArray, Lib_SplitterStateDate) /* Splitter state between tracks and genres */
266  INST(int, Lib_OldWidth) /* Old library width when hiding library */
267  INST(bool, Lib_DC_DoNothing) /* when double clicked, create playlist and do nothing*/
268  INST(bool, Lib_DC_PlayIfStopped) /* when double clicked, play if stopped */
269  INST(bool, Lib_DC_PlayImmediately) /* when double clicked, play immediately */
270  INST(bool, Lib_DD_DoNothing) /* when drag dropped, insert tracks and do nothing */
271  INST(bool, Lib_DD_PlayIfStoppedAndEmpty) /* when drag dropped, play if playlist is empty and stopped */
272  INST(int, Lib_FontSize) /* current library font size */
273  INST(bool, Lib_FontBold) /* current library font weight */
274  INST(int, Lib_SearchMode) /* Search mode in library. See */
275  INST(bool, Lib_AutoUpdate) /* Automatic update of library */
276  INST(bool, Lib_ShowAlbumArtists) /* Show album artists instead of artists */
277  INST(bool, Lib_ShowAlbumCovers) /* Show album cover view */
278  INST(int, Lib_CoverZoom) /* Zoom of album cover view */
279  INST(int, Lib_CoverOrigPMCache) /* Original sized pixmap cache */
280  INST(int, Lib_CoverScaledPMCache) /* Scaled sized pixmap cache */
281  INST(bool, Lib_CoverShowUtils) /* Show utils bar in cover view */
282  INST(bool, Lib_CoverShowArtist) /* Show artist name in cover view */
283  INST(bool, Lib_GenreTree) /* Show tree view of genres */
284  INST(QList<::Library::Info>, Lib_AllLibraries) // deprecated
285  INST(int, Lib_LastIndex) /* Last selected library */
286  INST(bool, Lib_UseViewClearButton) /* Show clear button in single view */
287  INST(bool, Lib_ShowFilterExtBar) /* Show the file extension filter bar in track view */
288 
289  INST(bool, Dir_ShowTracks) /* show tracks panel in directory view */
290  INST(QByteArray, Dir_SplitterDirFile) /* Splitter state between dirs and files */
291  INST(QByteArray, Dir_SplitterTracks) /* Splitter between upper and track view */
292 
293 
294  INST(QString, Player_Version) /* Version string of player */
295  INST(QString, Player_Language) /* language of player */
296  INST(int, Player_Style) /* dark or native: native = 0, dark = 1 */
297  INST(int, Player_ControlStyle) /* Big cover or not */
298  INST(QString, Player_FontName) /* current font name */
299  INST(int, Player_FontSize) /* current font size */
300  INST(QSize, Player_Size) /* player size */
301  INST(QPoint, Player_Pos) /* player position */
302  INST(bool, Player_Fullscreen) /* player fullscreen */
303  INST(bool, Player_Maximized) /* player maximized */
304  INST(QString, Player_ShownPlugin) /* current shown plugin in player, empty if none */
305  INST(bool, Player_OneInstance) /* only one Sayonara instance is allowed */
306  INST(bool, Player_Min2Tray) /* minimize Sayonara to tray */
307  INST(bool, Player_ShowTrayIcon) /* Show/hide the tray icon */
308  INST(bool, Player_StartInTray) /* start in tray */
309  INST(bool, Player_NotifyNewVersion) /* check for new version on startup */
310  INST(QByteArray, Player_SplitterState) /* spliter state between playlist and library */
311  INST(RawShortcutMap, Player_Shortcuts) /* player shortcuts */
312  INST(QByteArray, Player_SplitterControls) /* Splitter state between controls and playlist */
313  INST(QByteArray, Player_PrivId) /* Unique identifier */
314  INST(QByteArray, Player_PublicId) /* Unique identifier */
315 
316  INST(QStringList, PL_Playlist) /* old playlist: list of integers in case of library tracks, if no library track, filepath */
317  INST(bool, PL_LoadSavedPlaylists) /* load saved playlists on startup */
318  INST(bool, PL_LoadTemporaryPlaylists) /* load temporary playlists on startup */
319  INST(bool, PL_LoadLastTrack) /* load last track on startup */
320  INST(bool, PL_RememberTime) /* remember time of last track */
321  INST(bool, PL_StartPlaying) /* start playing immediately when opening Sayonara */
322  INST(int, PL_LastTrack) /* last track idx in playlist */
323  INST(int, PL_LastTrackBeforeStop) /* last track before stop */
324  INST(int, PL_LastPlaylist) /* last Playlist id, where LastTrack has been played */
325  INST(QString, PL_EntryLook) /* formatting of playlist entry */
326  INST(int, PL_FontSize) /* current playlist font size */
327  INST(bool, PL_ShowClearButton) /* show clear button in playlist */
328  INST(Playlist::Mode, PL_Mode) /* playlist mode: rep1, repAll, shuffle... */
329  INST(bool, PL_ShowNumbers) /* show numbers in playlist */
330  INST(bool, PL_RememberTrackAfterStop) /* when stop button is pressed, remember last track index */
331  INST(bool, PL_ShowCovers) /* Show covers in Playlist */
332  INST(bool, PL_ShowRating) /* Show rating in playlist */
333 
334  INST(bool, Notification_Show) /* show notifications */
335  INST(int, Notification_Timeout) /* notification timeout */
336  INST(QString, Notification_Name) /* type of notifications: libnotify or empty for native baloons :( */
337 
338  INST(int, AudioConvert_NumberThreads) /* Number of threads */
339  INST(QString, AudioConvert_PreferredConverter) /* Preferred Converter: ogg, lame cbr, lame vbr */
340  INST(int, AudioConvert_QualityLameVBR) /* Lame Quality for variable bitrate 1-10 */
341  INST(int, AudioConvert_QualityLameCBR) /* 64 - 320 */
342  INST(int, AudioConvert_QualityOgg) /* 1 - 10 */
343 
344  INST(QString, Engine_Name) /* Deprecated: Engine name */
345  INST(int, Engine_Vol) /* Volume */
346  INST(bool, Engine_Mute) /* Muted/unmuted */
347  INST(int, Engine_CurTrackPos_s) /* position of track (used to load old position) */
348  INST(QString, Engine_CovertTargetPath) /* last convert path */
349  INST(int, Engine_SpectrumBins) /* number of spectrum bins */
350  INST(bool, Engine_ShowSpectrum) /* show spectrum */
351  INST(bool, Engine_ShowLevel) /* show level */
352  INST(bool, Engine_CrossFaderActive) /* crossfader, but not gapless active */
353  INST(int, Engine_CrossFaderTime) /* crossfader overlap time */
354  INST(int, Engine_Pitch) /* hertz of a */
355  INST(bool, Engine_SpeedActive) /* is speed control active? */
356  INST(float, Engine_Speed) /* if yes, set speed */
357  INST(bool, Engine_PreservePitch) /* if yes, should pitch be preserved? */
358  INST(QString, Engine_Sink) /* Alsa, pulseaudio */
359 
360  INST(bool, Engine_SR_Active) /* Streamripper active */
361  INST(bool, Engine_SR_Warning) /* streamripper warnings */
362  INST(QString, Engine_SR_Path) /* streamripper paths */
363  INST(bool, Engine_SR_SessionPath) /* create streamripper session path? */
364  INST(QString, Engine_SR_SessionPathTemplate) /* streamripper session path template*/
365  INST(bool, Engine_SR_AutoRecord) /* streamripper automatic recording */
366 
367  INST(int, Spectrum_Style) /* index of spectrum style */
368  INST(int, Level_Style) /* index of level style */
369  INST(bool, Broadcast_Active) /* is broadcast active? */
370  INST(bool, Broadcast_Prompt) /* prompt when new connection arrives? */
371  INST(int, Broadcast_Port) /* broadcast port */
372 
373  INST(bool, Remote_Active) /* Remote control activated */
374  INST(int, Remote_Port) /* Remote control port */
375 
376  INST(bool, Stream_NewTab) /* Open Streams in new tab */
377  INST(bool, Stream_ShowHistory) /* Show history when playing streams */
378 
379  INST(int, Lyrics_Zoom) /* Zoom factor in lyrics window */
380  INST(QString, Lyrics_Server) /* Lyrics server */
381 
382  INST(QStringList, Cover_Server) /* Cover server */
383  INST(bool, Cover_FetchFromWWW) /* Fetch covers from www */
384  INST(bool, Cover_StartSearch) /* start alternative cover search automatically */
385  INST(QString, Icon_Theme) /* Current icon theme */
386  INST(bool, Icon_ForceInDarkTheme) /* Current icon theme */
387 
388  INST(bool, Proxy_Active) /* Is proxy server active */
389  INST(QString, Proxy_Username) /* Proxy Username */
390  INST(QString, Proxy_Password) /* Proxy Password */
391  INST(QString, Proxy_Hostname) /* Proxy Hostname/IP Address */
392  INST(int, Proxy_Port) /* Proxy Port 3128 */
393  INST(bool, Proxy_SavePw) /* Should password be saved */
394 
395  INST(int, Settings_Revision) /* Version number of settings */
396 
397  INST(int, Logger_Level) /* Also log development: */
398 
399  INST_NO_DB(bool, MP3enc_found)
400  INST_NO_DB(bool, Pitch_found)
401  INST_NO_DB(bool, Player_Quit)
402 
403 #endif // SETTINGKEY_H
The Mode class.
Definition: PlaylistMode.h:32
INST(bool, LFM_Active) INST(int
Set namespace defines the setting: Which key and which type.
The Sortings class.
Definition: Sorting.h:33
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerPresets.h:32
Definition: typedefs.h:31
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:29
The RawShortcutMap struct consisting of a specifier writable into database and a shortcut. This class is used for converting a shortcut map into its database representation.
Definition: RawShortcutMap.h:35
Definition: AbstractPlaylist.h:33
Definition: SettingKey.h:216
Definition: org_mpris_media_player2_adaptor.h:20