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 #ifndef SETTINGKEY_H
22 #define SETTINGKEY_H
23 
24 #include "Utils/typedefs.h"
25 
26 class QString;
27 class QStringList;
28 class QPoint;
29 class QSize;
30 class QByteArray;
31 
32 class EQ_Setting;
33 struct RawShortcutMap;
34 
35 namespace Playlist
36 {
37  class Mode;
38 }
39 
40 namespace Library
41 {
42  class Sortings;
43  class Info;
44 }
45 
46 
51 enum class SettingKey : unsigned short
52 {
53  LFM_Active=0,
54  LFM_ScrobbleTimeSec,
55  LFM_Login,
56  LFM_Corrections,
57  LFM_ShowErrors,
58  LFM_SessionKey,
59 
60  Eq_Last,
61  Eq_List,
62  Eq_Gauss,
63 
64  Lib_Show,
65  Lib_Path,
66  Lib_ColsTitle,
67  Lib_ColsArtist,
68  Lib_ColsAlbum,
69  Lib_LiveSearch,
70  Lib_Sorting,
71  Lib_CurPlugin,
72  Lib_SplitterStateArtist,
73  Lib_SplitterStateTrack,
74  Lib_SplitterStateGenre,
75  Lib_SplitterStateDate,
76  Lib_OldWidth,
77  Lib_DC_DoNothing,
78  Lib_DC_PlayIfStopped,
79  Lib_DC_PlayImmediately,
80  Lib_DD_DoNothing,
81  Lib_DD_PlayIfStoppedAndEmpty,
82  Lib_FontSize,
83  Lib_FontBold,
84  Lib_SearchMode,
85  Lib_AutoUpdate,
86  Lib_ShowAlbumArtists,
87  Lib_ShowAlbumCovers,
88  Lib_CoverZoom,
89  Lib_CoverShowUtils,
90  Lib_GenreTree,
91  Lib_LastIndex,
92  Lib_AllLibraries, // deprecated
93  Lib_UseViewClearButton,
94 
95  Dir_ShowTracks,
96  Dir_SplitterDirFile,
97  Dir_SplitterTracks,
98 
99  Player_Version,
100  Player_Language,
101  Player_FontName,
102  Player_FontSize,
103  Player_Style,
104  Player_Size,
105  Player_Pos,
106  Player_Fullscreen,
107  Player_Maximized,
108  Player_ShownPlugin,
109  Player_OneInstance,
110  Player_Min2Tray,
111  Player_StartInTray,
112  Player_ShowTrayIcon,
113  Player_NotifyNewVersion,
114  Player_SplitterState,
115  Player_Shortcuts,
116 
117  PL_Playlist,
118  PL_LoadSavedPlaylists,
119  PL_LoadTemporaryPlaylists,
120  PL_LoadLastTrack,
121  PL_RememberTime,
122  PL_StartPlaying,
123  PL_LastTrack,
124  PL_LastPlaylist,
125  PL_Mode,
126  PL_ShowNumbers,
127  PL_EntryLook,
128  PL_FontSize,
129  PL_ShowClearButton,
130  PL_RememberTrackAfterStop,
131 
132  Notification_Show,
133  Notification_Timeout,
134  Notification_Name,
135 
136  Engine_Name,
137  Engine_Vol,
138  Engine_Mute,
139  Engine_ConvertQuality,
140  Engine_CovertTargetPath,
141  Engine_SpectrumBins,
142  Engine_ShowSpectrum,
143  Engine_ShowLevel,
144  Engine_CurTrackPos_s,
145  Engine_CrossFaderActive,
146  Engine_CrossFaderTime,
147  Engine_Pitch,
148  Engine_PreservePitch,
149  Engine_Speed,
150  Engine_SpeedActive,
151  Engine_Sink,
152 
153  Engine_SR_Active,
154  Engine_SR_Warning,
155  Engine_SR_Path,
156  Engine_SR_SessionPath,
157  Engine_SR_SessionPathTemplate,
158  Engine_SR_AutoRecord,
159 
160  Spectrum_Style,
161  Level_Style,
162 
163  Broadcast_Active,
164  Broadcast_Prompt,
165  Broadcast_Port,
166 
167  MP3enc_found,
168  Pitch_found,
169  Player_Quit,
170 
171  Remote_Active,
172  Remote_Port,
173 
174  Stream_NewTab,
175  Stream_ShowHistory,
176 
177  Lyrics_Zoom,
178  Lyrics_Server,
179 
180  Cover_Server,
181  Cover_LoadFromFile,
182  Icon_Theme,
183  Icon_ForceInDarkTheme,
184 
185  Proxy_Active,
186  Proxy_Username,
187  Proxy_Password,
188  Proxy_Hostname,
189  Proxy_Port,
190  Proxy_SavePw,
191 
192  Num_Setting_Keys
193 };
194 
195 
196 template<typename DataType, SettingKey keyIndex>
198 {
199  public:
200  SettingIdentifier() {}
201  ~SettingIdentifier() {}
202 };
203 
210 #define INST(type, settingkey) static const SettingIdentifier<type, SettingKey:: settingkey> settingkey
211 
216 namespace Set
217 {
218  //typedef SettingKey<bool, SK::LFM_Active> LFM_Active_t; const LFM_Active_t LFM_Active
219  INST(bool, LFM_Active); /* is lastFM active? */
220  INST(int, LFM_ScrobbleTimeSec); /* time in sec when to scrobble */
221  INST(StringPair, LFM_Login); /* 2-Tupel, username, password */
222 
223  INST(bool, LFM_Corrections); /* propose lfm corrections */
224  INST(bool, LFM_ShowErrors); /* get error message, if there are lfm problems */
225  INST(QString, LFM_SessionKey); /* lfm session key */
226 
227  INST(int, Eq_Last); /* last equalizer index */
228  INST(QList<EQ_Setting>, Eq_List); /* All equalizers */
229  INST(bool, Eq_Gauss); /* do curve, when changing eq setting */
230 
231  INST(bool, Lib_Show); /* show library */
232  INST(QString, Lib_Path); // deprecated
233  INST(BoolList, Lib_ColsTitle); /* shown columns tracks */
234  INST(BoolList, Lib_ColsArtist); /* shown columns artist */
235  INST(BoolList, Lib_ColsAlbum); /* shown columns albums */
236  INST(bool, Lib_LiveSearch); /* library live search */
237  INST(::Library::Sortings, Lib_Sorting); /* how to sort in lib */
238  INST(QString, Lib_CurPlugin); /* Current shown library plugin */
239  INST(QByteArray, Lib_SplitterStateArtist); /* Splitter state between artists and albums */
240  INST(QByteArray, Lib_SplitterStateTrack); /* Splitter state between artists and tracks */
241  INST(QByteArray, Lib_SplitterStateGenre); /* Splitter state between tracks and genres */
242  INST(QByteArray, Lib_SplitterStateDate); /* Splitter state between tracks and genres */
243  INST(int, Lib_OldWidth); /* Old library width when hiding library */
244  INST(bool, Lib_DC_DoNothing); /* when double clicked, create playlist and do nothing*/
245  INST(bool, Lib_DC_PlayIfStopped); /* when double clicked, play if stopped */
246  INST(bool, Lib_DC_PlayImmediately); /* when double clicked, play immediately */
247  INST(bool, Lib_DD_DoNothing); /* when drag dropped, insert tracks and do nothing */
248  INST(bool, Lib_DD_PlayIfStoppedAndEmpty); /* when drag dropped, play if playlist is empty and stopped */
249  INST(int, Lib_FontSize); /* current library font size */
250  INST(bool, Lib_FontBold); /* current library font weight */
251  INST(int, Lib_SearchMode); /* Search mode in library. See */
252  INST(bool, Lib_AutoUpdate); /* Automatic update of library */
253  INST(bool, Lib_ShowAlbumArtists); /* Show album artists instead of artists */
254  INST(bool, Lib_ShowAlbumCovers); /* Show album cover view */
255  INST(int, Lib_CoverZoom); /* Zoom of album cover view */
256  INST(bool, Lib_CoverShowUtils); /* Show utils bar in cover view */
257  INST(bool, Lib_GenreTree); /* Show tree view of genres */
258  INST(QList<::Library::Info>, Lib_AllLibraries); // deprecated
259  INST(int, Lib_LastIndex); /* Last selected library */
260  INST(bool, Lib_UseViewClearButton); /* Show clear button in single view */
261 
262  INST(bool, Dir_ShowTracks); /* show tracks panel in directory view */
263  INST(QByteArray, Dir_SplitterDirFile); /* Splitter state between dirs and files */
264  INST(QByteArray, Dir_SplitterTracks); /* Splitter between upper and track view */
265 
266 
267  INST(QString, Player_Version); /* Version string of player */
268  INST(QString, Player_Language); /* language of player */
269  INST(int, Player_Style); /* dark or native: native = 0, dark = 1 */
270  INST(QString, Player_FontName); /* current font name */
271  INST(int, Player_FontSize); /* current font size */
272  INST(QSize, Player_Size); /* player size */
273  INST(QPoint, Player_Pos); /* player position */
274  INST(bool, Player_Fullscreen); /* player fullscreen */
275  INST(bool, Player_Maximized); /* player maximized */
276  INST(QString, Player_ShownPlugin); /* current shown plugin in player, empty if none */
277  INST(bool, Player_OneInstance); /* only one Sayonara instance is allowed */
278  INST(bool, Player_Min2Tray); /* minimize Sayonara to tray */
279  INST(bool, Player_ShowTrayIcon); /* Show/hide the tray icon */
280  INST(bool, Player_StartInTray); /* start in tray */
281  INST(bool, Player_NotifyNewVersion); /* check for new version on startup */
282  INST(QByteArray, Player_SplitterState); /* spliter state between playlist and library */
283  INST(RawShortcutMap, Player_Shortcuts); /* player shortcuts */
284 
285  INST(QStringList, PL_Playlist); /* old playlist: list of integers in case of library tracks, if no library track, filepath */
286  INST(bool, PL_LoadSavedPlaylists); /* load saved playlists on startup */
287  INST(bool, PL_LoadTemporaryPlaylists); /* load temporary playlists on startup */
288  INST(bool, PL_LoadLastTrack); /* load last track on startup */
289  INST(bool, PL_RememberTime); /* remember time of last track */
290  INST(bool, PL_StartPlaying); /* start playing immediately when opening Sayonara */
291  INST(int, PL_LastTrack); /* last track idx in playlist */
292  INST(int, PL_LastPlaylist); /* last Playlist id, where LastTrack has been played */
293  INST(QString, PL_EntryLook); /* formatting of playlist entry */
294  INST(int, PL_FontSize); /* current playlist font size */
295  INST(bool, PL_ShowClearButton); /* show clear button in playlist */
296  INST(Playlist::Mode, PL_Mode); /* playlist mode: rep1, repAll, shuffle... */
297  INST(bool, PL_ShowNumbers); /* show numbers in playlist */
298  INST(bool, PL_RememberTrackAfterStop); /* when stop button is pressed, remember last track index */
299 
300  INST(bool, Notification_Show); /* show notifications */
301  INST(int, Notification_Timeout); /* notification timeout */
302  INST(QString, Notification_Name); /* type of notifications: libnotify or empty for native baloons :( */
303 
304  INST(QString, Engine_Name); /* Deprecated: Engine name */
305  INST(int, Engine_Vol); /* Volume */
306  INST(bool, Engine_Mute); /* Muted/unmuted */
307  INST(int, Engine_CurTrackPos_s); /* position of track (used to load old position) */
308  INST(int, Engine_ConvertQuality); /* Convert quality, 1-10 for variable, > 64 for fixed bitrate */
309  INST(QString, Engine_CovertTargetPath); /* last convert path */
310  INST(int, Engine_SpectrumBins); /* number of spectrum bins */
311  INST(bool, Engine_ShowSpectrum); /* show spectrum */
312  INST(bool, Engine_ShowLevel); /* show level */
313  INST(bool, Engine_CrossFaderActive); /* crossfader active */
314  INST(int, Engine_CrossFaderTime); /* crossfader overlap time */
315  INST(int, Engine_Pitch); /* hertz of a */
316  INST(bool, Engine_SpeedActive); /* is speed control active? */
317  INST(float, Engine_Speed); /* if yes, set speed */
318  INST(bool, Engine_PreservePitch); /* if yes, should pitch be preserved? */
319  INST(QString, Engine_Sink); /* Alsa, pulseaudio */
320 
321  INST(bool, Engine_SR_Active); /* Streamripper active */
322  INST(bool, Engine_SR_Warning); /* streamripper warnings */
323  INST(QString, Engine_SR_Path); /* streamripper paths */
324  INST(bool, Engine_SR_SessionPath); /* create streamripper session path? */
325  INST(QString, Engine_SR_SessionPathTemplate); /* streamripper session path template*/
326  INST(bool, Engine_SR_AutoRecord); /* streamripper automatic recording */
327 
328  INST(int, Spectrum_Style); /* index of spectrum style */
329  INST(int, Level_Style); /* index of level style */
330  INST(bool, Broadcast_Active); /* is broadcast active? */
331  INST(bool, Broadcast_Prompt); /* prompt when new connection arrives? */
332  INST(int, Broadcast_Port); /* broadcast port */
333 
334  INST(bool, Remote_Active); /* Remote control activated */
335  INST(int, Remote_Port); /* Remote control port */
336 
337  INST(bool, Stream_NewTab); /* Open Streams in new tab */
338  INST(bool, Stream_ShowHistory); /* Show history when playing streams */
339 
340  INST(int, Lyrics_Zoom); /* Zoom factor in lyrics window */
341  INST(QString, Lyrics_Server); /* Lyrics server */
342 
343  INST(QStringList, Cover_Server); /* Cover server */
344  INST(bool, Cover_LoadFromFile); /* load covers from audio file, if available */
345  INST(QString, Icon_Theme); /* Current icon theme */
346  INST(bool, Icon_ForceInDarkTheme); /* Current icon theme */
347 
348  INST(bool, Proxy_Active); /* Is proxy server active */
349  INST(QString, Proxy_Username); /* Proxy Username */
350  INST(QString, Proxy_Password); /* Proxy Password */
351  INST(QString, Proxy_Hostname); /* Proxy Hostname/IP Address */
352  INST(int, Proxy_Port); /* Proxy Port 3128 */
353  INST(bool, Proxy_SavePw); /* Should password be saved */
354 }
355 
356 namespace SetNoDB
357 {
358  INST(bool, MP3enc_found);
359  INST(bool, Pitch_found);
360  INST(bool, Player_Quit);
361 }
362 
363 #endif // SETTINGKEY_H
The Mode class.
Definition: PlaylistMode.h:32
#define INST(type, settingkey)
MACRO INST use this macro to declare a setting: INST(boo, LFM_Active) is expanded to typedef Setting...
Definition: SettingKey.h:210
SettingKey
The SK namespace is used to access setting keys.
Definition: SettingKey.h:51
The Sortings class.
Definition: Sorting.h:33
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerPresets.h:32
Set namespace defines the setting: Which key and which type.
Definition: SettingKey.h:216
Definition: typedefs.h:28
Definition: SettingKey.h:356
An interface class needed when implementing a library plugin.
Definition: LibraryManager.h:36
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:42
Definition: SettingKey.h:197
Definition: org_mpris_media_player2_adaptor.h:20