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  Lib_SearchMode,
75  Lib_AutoUpdate,
76 
77  Player_Version,
78  Player_Language,
79  Player_FontName,
80  Player_FontSize,
81  Player_Style,
82  Player_Size,
83  Player_Pos,
84  Player_Fullscreen,
85  Player_Maximized,
86  Player_ShownPlugin,
87  Player_OneInstance,
88  Player_Min2Tray,
89  Player_StartInTray,
90  Player_ShowTrayIcon,
91  Player_NotifyNewVersion,
92  Player_SplitterState,
93  Player_Shortcuts,
94 
95  PL_Playlist,
96  PL_LoadSavedPlaylists,
97  PL_LoadTemporaryPlaylists,
98  PL_LoadLastTrack,
99  PL_RememberTime,
100  PL_StartPlaying,
101  PL_LastTrack,
102  PL_LastPlaylist,
103  PL_Mode,
104  PL_ShowNumbers,
105  PL_EntryLook,
106  PL_FontSize,
107 
108  Notification_Show,
109  Notification_Timeout,
110  Notification_Name,
111 
112  Engine_Name,
113  Engine_Vol,
114  Engine_Mute,
115  Engine_ConvertQuality,
116  Engine_CovertTargetPath,
117  Engine_ShowSpectrum,
118  Engine_ShowLevel,
119  Engine_CurTrackPos_s,
120  Engine_CrossFaderActive,
121  Engine_CrossFaderTime,
122  Engine_Pitch,
123  Engine_PreservePitch,
124  Engine_Speed,
125  Engine_SpeedActive,
126 
127  Engine_SR_Active,
128  Engine_SR_Warning,
129  Engine_SR_Path,
130  Engine_SR_SessionPath,
131 
132  Spectrum_Style,
133  Level_Style,
134 
135  Broadcast_Active,
136  Broadcast_Prompt,
137  Broadcast_Port,
138 
139  MP3enc_found,
140  Pitch_found,
141  Player_Quit,
142 
143  Remote_Active,
144  Remote_Port,
145 
146  Num_Setting_Keys
147 };
148 }
149 
150 template<typename T, SK::SettingKey S>
152 {
153 public:
154  T* p=nullptr;
155  SettingKey(){}
156  ~SettingKey(){}
157 };
158 
159 
160 /*
161  * typedef SettingKey<QString, SK::Lib_Path> LibPath_t; LibPath_t LibPath;
162  *
163  */
164 
171 #define INST(type, settingkey) typedef SettingKey<type, SK:: settingkey> settingkey##_t; const settingkey##_t settingkey
172 
177 namespace Set {
178 
179 //typedef SettingKey<bool, SK::LFM_Active> LFM_Active_t; const LFM_Active_t LFM_Active
180 INST(bool, LFM_Active); /* is lastFM active? */
181 INST(int, LFM_ScrobbleTimeSec); /* time in sec when to scrobble */
182 INST(StringPair, LFM_Login); /* 2-Tupel, username, password */
183 
184 INST(bool, LFM_Corrections); /* propose lfm corrections */
185 INST(bool, LFM_ShowErrors); /* get error message, if there are lfm problems */
186 INST(QString, LFM_SessionKey); /* lfm session key */
187 
188 INST(int, Eq_Last); /* last equalizer index */
189 INST(QList<EQ_Setting>, Eq_List); /* All equalizers */
190 INST(bool, Eq_Gauss); /* do curve, when changing eq setting */
191 
192 INST(bool, Lib_Show); /* show library */
193 INST(QString, Lib_Path); /* library path */
194 INST(BoolList, Lib_ColsTitle); /* shown columns tracks */
195 INST(BoolList, Lib_ColsArtist); /* shown columns artist */
196 INST(BoolList, Lib_ColsAlbum); /* shown columns albums */
197 INST(bool, Lib_LiveSearch); /* library live search */
198 INST(LibSortOrder, Lib_Sorting); /* how to sort in lib */
199 INST(QString, Lib_CurPlugin); /* Current shown library plugin */
200 INST(QByteArray, Lib_SplitterStateArtist); /* Splitter state between artists and albums */
201 INST(QByteArray, Lib_SplitterStateTrack); /* Splitter state between artists and tracks */
202 INST(QByteArray, Lib_SplitterStateGenre); /* Splitter state between tracks and genres */
203 INST(int, Lib_OldWidth); /* Old library width when hiding library */
204 INST(bool, Lib_DC_DoNothing); /* when double clicked, create playlist and do nothing*/
205 INST(bool, Lib_DC_PlayIfStopped); /* when double clicked, play if stopped */
206 INST(bool, Lib_DC_PlayImmediately); /* when double clicked, play immediately */
207 INST(bool, Lib_DD_DoNothing); /* when drag dropped, insert tracks and do nothing */
208 INST(bool, Lib_DD_PlayIfStoppedAndEmpty); /* when drag dropped, play if playlist is empty and stopped */
209 INST(int, Lib_FontSize); /* current library font size */
210 INST(bool, Lib_FontBold); /* current library font weight */
211 INST(int, Lib_SearchMode); /* Search mode in library. See */
212 INST(bool, Lib_AutoUpdate); /* Automatic update of library */
213 
214 INST(QString, Player_Version); /* Version string of player */
215 INST(QString, Player_Language); /* language of player */
216 INST(int, Player_Style); /* dark or native: native = 0, dark = 1 */
217 INST(QString, Player_FontName); /* current font name */
218 INST(int, Player_FontSize); /* current font size */
219 INST(QSize, Player_Size); /* player size */
220 INST(QPoint, Player_Pos); /* player position */
221 INST(bool, Player_Fullscreen); /* player fullscreen */
222 INST(bool, Player_Maximized); /* player maximized */
223 INST(QString, Player_ShownPlugin); /* current shown plugin in player, empty if none */
224 INST(bool, Player_OneInstance); /* only one Sayonara instance is allowed */
225 INST(bool, Player_Min2Tray); /* minimize Sayonara to tray */
226 INST(bool, Player_ShowTrayIcon); /* Show/hide the tray icon */
227 INST(bool, Player_StartInTray); /* start in tray */
228 INST(bool, Player_NotifyNewVersion); /* check for new version on startup */
229 INST(QByteArray, Player_SplitterState); /* spliter state between playlist and library */
230 INST(RawShortcutMap, Player_Shortcuts); /* player shortcuts */
231 
232 INST(QStringList, PL_Playlist); /* old playlist: list of integers in case of library tracks, if no library track, filepath */
233 INST(bool, PL_LoadSavedPlaylists); /* load saved playlists on startup */
234 INST(bool, PL_LoadTemporaryPlaylists); /* load temporary playlists on startup */
235 INST(bool, PL_LoadLastTrack); /* load last track on startup */
236 INST(bool, PL_RememberTime); /* remember time of last track */
237 INST(bool, PL_StartPlaying); /* start playing immediately when opening Sayonara */
238 INST(int, PL_LastTrack); /* last track idx in playlist */
239 INST(int, PL_LastPlaylist); /* last Playlist id, where LastTrack has been played */
240 INST(QString, PL_EntryLook); /* formatting of playlist entry */
241 INST(int, PL_FontSize); /* current playlist font size */
242 
243 INST(PlaylistMode, PL_Mode); /* playlist mode: rep1, repAll, shuffle... */
244 INST(bool, PL_ShowNumbers); /* show numbers in playlist */
245 INST(bool, Notification_Show); /* show notifications */
246 INST(int, Notification_Timeout); /* notification timeout */
247 INST(QString, Notification_Name); /* type of notifications: libnotify or empty for native baloons :( */
248 
249 INST(QString, Engine_Name); /* Deprecated: Engine name */
250 INST(int, Engine_Vol); /* Volume */
251 INST(bool, Engine_Mute); /* Muted/unmuted */
252 INST(int, Engine_CurTrackPos_s); /* position of track (used to load old position) */
253 INST(int, Engine_ConvertQuality); /* Convert quality, 1-10 for variable, > 64 for fixed bitrate */
254 INST(QString, Engine_CovertTargetPath); /* last convert path */
255 INST(bool, Engine_ShowSpectrum); /* show spectrum */
256 INST(bool, Engine_ShowLevel); /* show level */
257 INST(bool, Engine_CrossFaderActive); /* crossfader active */
258 INST(int, Engine_CrossFaderTime); /* crossfader overlap time */
259 INST(int, Engine_Pitch); /* hertz of a */
260 INST(bool, Engine_SpeedActive); /* is speed control active? */
261 INST(float, Engine_Speed); /* if yes, set speed */
262 INST(bool, Engine_PreservePitch); /* if yes, should pitch be preserved? */
263 
264 INST(bool, Engine_SR_Active); /* Streamripper active */
265 INST(bool, Engine_SR_Warning); /* streamripper warnings */
266 INST(QString, Engine_SR_Path); /* streamripper paths */
267 INST(bool, Engine_SR_SessionPath); /* streamripper session path */
268 
269 INST(int, Spectrum_Style); /* index of spectrum style */
270 INST(int, Level_Style); /* index of level style */
271 INST(bool, Broadcast_Active); /* is broadcast active? */
272 INST(bool, Broadcast_Prompt); /* prompt when new connection arrives? */
273 INST(int, Broadcast_Port); /* broadcast port */
274 
275 INST(bool, Remote_Active); /* Remote control activated */
276 INST(int, Remote_Port); /* Remote control port */
277 
278 
279 
280 }
281 
282 namespace SetNoDB{
283 
284 INST(bool, MP3enc_found);
285 INST(bool, Pitch_found);
286 INST(bool, Player_Quit);
287 
288 }
289 
290 
291 
292 #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:171
Definition: SettingKey.h:151
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:177
The SK namespace is used to access setting keys.
Definition: SettingKey.h:41
Definition: SettingKey.h:282
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