TTKMusicPlayer  4.1.3.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 - 2025 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  OtherLogTrackEnable = 0x600E,
84  //
85  RippleLowPowerMode = 0x7000,
86  RippleSpectrumEnable = 0x7001,
87  RippleSpectrumColor = 0x7002,
88  RippleSpectrumTransparent = 0x7003,
89  //
90  ShowInteriorLrc = 0x8000,
91  LrcColor = 0x8001,
92  LrcSize = 0x8002,
93  LrcType = 0x8003,
94  LrcFamily = 0x8004,
95  LrcFrontgroundColor = 0x8005,
96  LrcBackgroundColor = 0x8006,
97  LrcColorTransparent = 0x8007,
98  //
99  ShowDesktopLrc = 0x9000,
100  DLrcColor = 0x9001,
101  DLrcSize = 0x9002,
102  DLrcType = 0x9003,
103  DLrcFamily = 0x9004,
104  DLrcFrontgroundColor = 0x9005,
105  DLrcBackgroundColor = 0x9006,
106  DLrcColorTransparent = 0x9007,
107  DLrcWindowMode = 0x9008,
108  DLrcSingleLineMode = 0x9009,
109  DLrcLockedMode = 0x900A,
110  DLrcGeometry = 0x900B,
111  //
112  EqualizerEnable = 0xA000,
113  EqualizerValue = 0xA001,
114  EqualizerIndex = 0xA002,
115  EnhancedMusicIndex = 0xA003,
116  EnhancedFadeEnable = 0xA004,
117  EnhancedFadeInValue = 0xA005,
118  EnhancedFadeOutValue = 0xA006,
119  EnhancedEffectValue = 0xA007,
120  //
121  TimerAutoIndex = 0xB000,
122  TimerAutoPlayMode = 0xB001,
123  TimerAutoPlayHour = 0xB002,
124  TimerAutoPlaySecond = 0xB003,
125  TimerAutoPlayRepeat = 0xB004,
126  TimerAutoPlayItemIndex = 0xB005,
127  TimerAutoPlaySongIndex = 0xB006,
128  TimerAutoStopMode = 0xB007,
129  TimerAutoStopHour = 0xB008,
130  TimerAutoStopSecond = 0xB009,
131  TimerAutoStopRepeat = 0xB00A,
132  TimerAutoShutdownMode = 0xB00B,
133  TimerAutoShutdownHour = 0xB00C,
134  TimerAutoShutdownSecond = 0xB00D,
135  TimerAutoShutdownRepeat = 0xB00E,
136  //
137  DownloadMusicDirPath = 0xC000,
138  DownloadLrcDirPath = 0xC001,
139  DownloadServerIndex = 0xC002,
140  DownloadCacheEnable = 0xC003,
141  DownloadCacheSize = 0xC004,
142  DownloadLimitEnable = 0xC005,
143  DownloadDownloadLimitSize = 0xC006,
144  DownloadUploadLimitSize = 0xC007,
145  DownloadFileNameRule = 0xC008,
146  };
147 
151  inline void setValue(Config type, const QVariant &var)
152  {
153  m_parameter[type] = var;
154  }
155 
159  inline void setValue(const QString &stype, const QVariant &var)
160  {
161  m_parameter[stringToEnum(stype)] = var;
162  }
163 
167  inline QVariant value(Config type) const
168  {
169  return m_parameter[type];
170  }
171 
175  inline QVariant value(const QString &stype) const
176  {
177  return m_parameter[stringToEnum(stype)];
178  }
179 
183  inline int count() const
184  {
185  return m_parameter.count();
186  }
187 
191  inline bool isEmpty() const
192  {
193  return m_parameter.isEmpty();
194  }
195 
199  inline bool contains(Config type) const
200  {
201  return m_parameter.contains(type);
202  }
203 
204 private:
208  inline Config stringToEnum(const QString &stype) const
209  {
210  const int index = staticMetaObject.indexOfEnumerator("Config");
211  const QMetaEnum &metaEnum = staticMetaObject.enumerator(index);
212  const int key = metaEnum.keyToValue(stype.toStdString().c_str());
213  return TTKStaticCast(Config, key);
214  }
215 
216  QVariant m_variant;
217  QMap<Config, QVariant> m_parameter;
218 
220 
221 };
222 
223 #define G_SETTING_PTR makeMusicSettingManager()
225 
226 #endif // MUSICSETTINGMANAGER
227 
#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:173
bool contains(Config type) const
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:168
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.