TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicsettingmanager.h
Go to the documentation of this file.
1 #ifndef MUSICSETTINGMANAGER
2 #define MUSICSETTINGMANAGER
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2024 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QMetaEnum>
23 #include "musicobject.h"
24 #include "ttksingleton.h"
25 
29 class TTK_MODULE_EXPORT MusicSettingManager : public QObject
30 {
31  Q_OBJECT
32  Q_ENUMS(Config)
34 public:
35  enum Config
36  {
37  Null = -1,
38  ScreenSize = 0x1000,
39  WidgetPosition = 0x1001,
40  WidgetSize = 0x1002,
41  //
42  ConfigVersion = 0x2000,
43  PlayMode = 0x2001,
44  Volume = 0x2002,
45  LastPlayIndex = 0x2003,
46  //
47  LanguageIndex = 0x3000,
48  StartUpMode = 0x3001,
49  StartUpPlayMode = 0x3002,
50  CloseEventMode = 0x3003,
51  CloseNetWorkMode = 0x3004,
52  FileAssociationMode = 0x3005,
53  FileAssociationValue = 0x3006,
54  WindowConciseMode = 0x3007,
55  RemoteWidgetMode = 0x3008,
56  WindowQuitMode = 0x3009,
57  ExtraDevicePath = 0x300A,
58  LastFileDialogPath = 0x300B,
59  MediaLibraryPath = 0x300C,
60  //
61  BackgroundThemeValue = 0x4000,
62  BackgroundTransparent = 0x4001,
63  BackgroundListTransparent = 0x4002,
64  BackgroundTransparentEnable = 0x4003,
65  //
66  HotkeyEnable = 0x5000,
67  HotkeyValue = 0x5001,
68  //
69  OtherCheckUpdateEnable = 0x6000,
70  OtherReadAlbumCover = 0x6001,
71  OtherReadFileInfo = 0x6002,
72  OtherWriteAlbumCover = 0x6003,
73  OtherWriteFileInfo = 0x6004,
74  OtherSideByMode = 0x6005,
75  OtherSideByInMode = 0x6006,
76  OtherLrcKTVMode = 0x6007,
77  OtherScreenSaverEnable = 0x6008,
78  OtherScreenSaverTime = 0x6009,
79  OtherScreenSaverIndex = 0x600A,
80  OtherPlaylistAutoSaveEnable = 0x600B,
81  OtherRandomShuffleMode = 0x600C,
82  OtherHighDpiScalingEnable = 0x600D,
83  //
84  RippleLowPowerMode = 0x7000,
85  RippleSpectrumEnable = 0x7001,
86  RippleSpectrumColor = 0x7002,
87  //
88  ShowInteriorLrc = 0x8000,
89  LrcColor = 0x8001,
90  LrcSize = 0x8002,
91  LrcType = 0x8003,
92  LrcFamily = 0x8004,
93  LrcFrontgroundColor = 0x8005,
94  LrcBackgroundColor = 0x8006,
95  LrcColorTransparent = 0x8007,
96  //
97  ShowDesktopLrc = 0x9000,
98  DLrcColor = 0x9001,
99  DLrcSize = 0x9002,
100  DLrcType = 0x9003,
101  DLrcFamily = 0x9004,
102  DLrcFrontgroundColor = 0x9005,
103  DLrcBackgroundColor = 0x9006,
104  DLrcColorTransparent = 0x9007,
105  DLrcWindowMode = 0x9008,
106  DLrcSingleLineMode = 0x9009,
107  DLrcLockedMode = 0x900A,
108  DLrcGeometry = 0x900B,
109  //
110  EqualizerEnable = 0xA000,
111  EqualizerValue = 0xA001,
112  EqualizerIndex = 0xA002,
113  EnhancedMusicIndex = 0xA003,
114  EnhancedFadeEnable = 0xA004,
115  EnhancedFadeInValue = 0xA005,
116  EnhancedFadeOutValue = 0xA006,
117  EnhancedEffectValue = 0xA007,
118  //
119  TimerAutoIndex = 0xB000,
120  TimerAutoPlayMode = 0xB001,
121  TimerAutoPlayHour = 0xB002,
122  TimerAutoPlaySecond = 0xB003,
123  TimerAutoPlayRepeat = 0xB004,
124  TimerAutoPlayItemIndex = 0xB005,
125  TimerAutoPlaySongIndex = 0xB006,
126  TimerAutoStopMode = 0xB007,
127  TimerAutoStopHour = 0xB008,
128  TimerAutoStopSecond = 0xB009,
129  TimerAutoStopRepeat = 0xB00A,
130  TimerAutoShutdownMode = 0xB00B,
131  TimerAutoShutdownHour = 0xB00C,
132  TimerAutoShutdownSecond = 0xB00D,
133  TimerAutoShutdownRepeat = 0xB00E,
134  //
135  DownloadMusicDirPath = 0xC000,
136  DownloadLrcDirPath = 0xC001,
137  DownloadServerIndex = 0xC002,
138  DownloadCacheEnable = 0xC003,
139  DownloadCacheSize = 0xC004,
140  DownloadLimitEnable = 0xC005,
141  DownloadDownloadLimitSize = 0xC006,
142  DownloadUploadLimitSize = 0xC007,
143  DownloadFileNameRule = 0xC008,
144  };
145 
149  inline void setValue(Config type, const QVariant &var)
150  {
151  m_parameter[type] = var;
152  }
153 
157  inline void setValue(const QString &stype, const QVariant &var)
158  {
159  m_parameter[stringToEnum(stype)] = var;
160  }
161 
165  inline QVariant value(Config type) const
166  {
167  return m_parameter[type];
168  }
169 
173  inline QVariant value(const QString &stype) const
174  {
175  return m_parameter[stringToEnum(stype)];
176  }
177 
181  inline int count() const
182  {
183  return m_parameter.count();
184  }
185 
189  inline bool isEmpty() const
190  {
191  return m_parameter.isEmpty();
192  }
193 
197  inline bool contains(Config type) const
198  {
199  return m_parameter.contains(type);
200  }
201 
202 private:
206  inline Config stringToEnum(const QString &stype) const
207  {
208  const int index = staticMetaObject.indexOfEnumerator("Config");
209  const QMetaEnum &metaEnum = staticMetaObject.enumerator(index);
210  const int key = metaEnum.keyToValue(stype.toStdString().c_str());
211  return TTKStaticCast(Config, key);
212  }
213 
214  QVariant m_variant;
215  QMap<Config, QVariant> m_parameter;
216 
218 
219 };
220 
221 #define G_SETTING_PTR makeMusicSettingManager()
223 
224 #endif // MUSICSETTINGMANAGER
225 
#define TTKStaticCast(x, y)
Definition: ttkglobal.h:159
#define TTK_MODULE_EXPORT
QMap< Config, QVariant > m_parameter
QVariant value(const QString &stype) const
The Volume class provides asbtract volume interface.
Definition: volume.h:51
void setValue(Config type, const QVariant &var)
static constexpr wchar_t key[]
QVariant value(Config type) const
#define TTK_DECLARE_SINGLETON_CLASS(Class)
// Singleton Macro // //
Definition: ttksingleton.h:86
PlayMode
Definition: musicobject.h:171
bool contains(Config type) const
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
Config stringToEnum(const QString &stype) const
TTK_MODULE_EXPORT MusicSettingManager * makeMusicSettingManager()
void setValue(const QString &stype, const QVariant &var)
The class of the paramater setting manager.