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