Sayonara Player
SettingKey.h
1 /* SettingKey.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef SETTINGKEY_H
24 #define SETTINGKEY_H
25 
26 #include "Helper/globals.h"
27 
28 class QString;
29 class QPoint;
30 class QSize;
31 class LibSortOrder;
32 struct EQ_Setting;
33 struct RawShortcutMap;
34 
35 class PlaylistMode;
36 
41 namespace SK {
42  enum SettingKey {
43 
44  LFM_Active=0,
45  LFM_ScrobbleTimeSec,
46  LFM_Login,
47  LFM_Corrections,
48  LFM_ShowErrors,
49  LFM_SessionKey,
50 
51  Eq_Last,
52  Eq_List,
53  Eq_Gauss,
54 
55  Lib_Show,
56  Lib_Path,
57  Lib_ColsTitle,
58  Lib_ColsArtist,
59  Lib_ColsAlbum,
60  Lib_LiveSearch,
61  Lib_Sorting,
62  Lib_CurPlugin,
63  Lib_SplitterStateArtist,
64  Lib_SplitterStateTrack,
65  Lib_SplitterStateGenre,
66  Lib_OldWidth,
67  Lib_DC_DoNothing,
68  Lib_DC_PlayIfStopped,
69  Lib_DC_PlayImmediately,
70  Lib_DD_DoNothing,
71  Lib_DD_PlayIfStoppedAndEmpty,
72  Lib_FontSize,
73  Lib_FontBold,
74 
75  Player_Version,
76  Player_Language,
77  Player_FontName,
78  Player_FontSize,
79  Player_Style,
80  Player_Size,
81  Player_Pos,
82  Player_Fullscreen,
83  Player_Maximized,
84  Player_ShownPlugin,
85  Player_OneInstance,
86  Player_Min2Tray,
87  Player_StartInTray,
88  Player_NotifyNewVersion,
89  Player_SplitterState,
90  Player_Shortcuts,
91 
92  PL_Playlist,
93  PL_LoadSavedPlaylists,
94  PL_LoadTemporaryPlaylists,
95  PL_LoadLastTrack,
96  PL_RememberTime,
97  PL_StartPlaying,
98  PL_LastTrack,
99  PL_LastPlaylist,
100  PL_Mode,
101  PL_ShowNumbers,
102  PL_EntryLook,
103  PL_FontSize,
104 
105  Notification_Show,
106  Notification_Timeout,
107  Notification_Name,
108 
109  Engine_Name,
110  Engine_Vol,
111  Engine_Mute,
112  Engine_ConvertQuality,
113  Engine_CovertTargetPath,
114  Engine_ShowSpectrum,
115  Engine_ShowLevel,
116  Engine_CurTrackPos_s,
117  Engine_CrossFaderActive,
118  Engine_CrossFaderTime,
119 
120  Engine_SR_Active,
121  Engine_SR_Warning,
122  Engine_SR_Path,
123  Engine_SR_SessionPath,
124 
125  Spectrum_Style,
126  Level_Style,
127 
128  Broadcast_Active,
129  Broadcast_Prompt,
130  Broadcast_Port,
131 
132  MP3enc_found,
133  Player_Quit,
134 
135  Remote_Active,
136  Remote_Port,
137 
138  Num_Setting_Keys
139  };
140 }
141 
142 template<typename T, SK::SettingKey S>
144 {
145 public:
146  T* p=nullptr;
147  SettingKey(){}
148  ~SettingKey(){}
149 };
150 
151 
152 /*
153  * typedef SettingKey<QString, SK::Lib_Path> LibPath_t; LibPath_t LibPath;
154  *
155  */
156 
163 #define INST(type, settingkey) typedef SettingKey<type, SK:: settingkey> settingkey##_t; const settingkey##_t settingkey
164 
169 namespace Set {
170 
171  //typedef SettingKey<bool, SK::LFM_Active> LFM_Active_t; const LFM_Active_t LFM_Active
172  INST(bool, LFM_Active); /* is lastFM active? */
173  INST(int, LFM_ScrobbleTimeSec); /* time in sec when to scrobble */
174  INST(StringPair, LFM_Login); /* 2-Tupel, username, password */
175 
176  INST(bool, LFM_Corrections); /* propose lfm corrections */
177  INST(bool, LFM_ShowErrors); /* get error message, if there are lfm problems */
178  INST(QString, LFM_SessionKey); /* lfm session key */
179 
180  INST(int, Eq_Last); /* last equalizer index */
181  INST(QList<EQ_Setting>, Eq_List); /* All equalizers */
182  INST(bool, Eq_Gauss); /* do curve, when changing eq setting */
183 
184  INST(bool, Lib_Show); /* show library */
185  INST(QString, Lib_Path); /* library path */
186  INST(BoolList, Lib_ColsTitle); /* shown columns tracks */
187  INST(BoolList, Lib_ColsArtist); /* shown columns artist */
188  INST(BoolList, Lib_ColsAlbum); /* shown columns albums */
189  INST(bool, Lib_LiveSearch); /* library live search */
190  INST(LibSortOrder, Lib_Sorting); /* how to sort in lib */
191  INST(QString, Lib_CurPlugin); /* Current shown library plugin */
192  INST(QByteArray, Lib_SplitterStateArtist); /* Splitter state between artists and albums */
193  INST(QByteArray, Lib_SplitterStateTrack); /* Splitter state between artists and tracks */
194  INST(QByteArray, Lib_SplitterStateGenre); /* Splitter state between tracks and genres */
195  INST(int, Lib_OldWidth); /* Old library width when hiding library */
196  INST(bool, Lib_DC_DoNothing); /* when double clicked, create playlist and do nothing*/
197  INST(bool, Lib_DC_PlayIfStopped); /* when double clicked, play if stopped */
198  INST(bool, Lib_DC_PlayImmediately); /* when double clicked, play immediately */
199  INST(bool, Lib_DD_DoNothing); /* when drag dropped, insert tracks and do nothing */
200  INST(bool, Lib_DD_PlayIfStoppedAndEmpty); /* when drag dropped, play if playlist is empty and stopped */
201  INST(int, Lib_FontSize); /* current library font size */
202  INST(bool, Lib_FontBold); /* current library font weight */
203 
204  INST(QString, Player_Version); /* Version string of player */
205  INST(QString, Player_Language); /* language of player */
206  INST(int, Player_Style); /* dark or native: native = 0, dark = 1 */
207  INST(QString, Player_FontName); /* current font name */
208  INST(int, Player_FontSize); /* current font size */
209  INST(QSize, Player_Size); /* player size */
210  INST(QPoint, Player_Pos); /* player position */
211  INST(bool, Player_Fullscreen); /* player fullscreen */
212  INST(bool, Player_Maximized); /* player maximized */
213  INST(QString, Player_ShownPlugin); /* current shown plugin in player, empty if none */
214  INST(bool, Player_OneInstance); /* only one Sayonara instance is allowed */
215  INST(bool, Player_Min2Tray); /* minimize Sayonara to tray */
216  INST(bool, Player_StartInTray); /* start in tray */
217  INST(bool, Player_NotifyNewVersion); /* check for new version on startup */
218  INST(QByteArray, Player_SplitterState); /* spliter state between playlist and library */
219  INST(RawShortcutMap, Player_Shortcuts); /* player shortcuts */
220 
221  INST(QStringList, PL_Playlist); /* old playlist: list of integers in case of library tracks, if no library track, filepath */
222  INST(bool, PL_LoadSavedPlaylists); /* load saved playlists on startup */
223  INST(bool, PL_LoadTemporaryPlaylists); /* load temporary playlists on startup */
224  INST(bool, PL_LoadLastTrack); /* load last track on startup */
225  INST(bool, PL_RememberTime); /* remember time of last track */
226  INST(bool, PL_StartPlaying); /* start playing immediately when opening Sayonara */
227  INST(int, PL_LastTrack); /* last track idx in playlist */
228  INST(int, PL_LastPlaylist); /* last Playlist id, where LastTrack has been played */
229  INST(QString, PL_EntryLook); /* formatting of playlist entry */
230  INST(int, PL_FontSize); /* current playlist font size */
231 
232  INST(PlaylistMode, PL_Mode); /* playlist mode: rep1, repAll, shuffle... */
233  INST(bool, PL_ShowNumbers); /* show numbers in playlist */
234  INST(bool, Notification_Show); /* show notifications */
235  INST(int, Notification_Timeout); /* notification timeout */
236  INST(QString, Notification_Name); /* type of notifications: libnotify or empty for native baloons :( */
237 
238  INST(QString, Engine_Name); /* Deprecated: Engine name */
239  INST(int, Engine_Vol); /* Volume */
240  INST(bool, Engine_Mute); /* Muted/unmuted */
241  INST(int, Engine_CurTrackPos_s); /* position of track (used to load old position) */
242  INST(int, Engine_ConvertQuality); /* Convert quality, 1-10 for variable, > 64 for fixed bitrate */
243  INST(QString, Engine_CovertTargetPath); /* last convert path */
244  INST(bool, Engine_ShowSpectrum); /* show spectrum */
245  INST(bool, Engine_ShowLevel); /* show level */
246  INST(bool, Engine_CrossFaderActive);
247  INST(int, Engine_CrossFaderTime);
248 
249  INST(bool, Engine_SR_Active); /* Streamripper active */
250  INST(bool, Engine_SR_Warning); /* streamripper warnings */
251  INST(QString, Engine_SR_Path); /* streamripper paths */
252  INST(bool, Engine_SR_SessionPath); /* streamripper session path */
253 
254  INST(int, Spectrum_Style); /* index of spectrum style */
255  INST(int, Level_Style); /* index of level style */
256  INST(bool, Broadcast_Active); /* is broadcast active? */
257  INST(bool, Broadcast_Prompt); /* prompt when new connection arrives? */
258  INST(int, Broadcast_Port); /* broadcast port */
259 
260  INST(bool, Remote_Active); /* Remote control activated */
261  INST(int, Remote_Port); /* Remote control port */
262 
263 
264 
265 }
266 
267 namespace SetNoDB{
268 
269  INST(bool, MP3enc_found);
270  INST(bool, Player_Quit);
271 
272 }
273 
274 
275 
276 #endif // SETTINGKEY_H
Definition: Sorting.h:75
#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:163
Definition: SettingKey.h:143
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerPresets.h:34
Definition: PlaylistMode.h:32
Set namespace defines the setting: Which key and which type.
Definition: SettingKey.h:169
The SK namespace is used to access setting keys.
Definition: SettingKey.h:41
Definition: SettingKey.h:267
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:37