diff options
author | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2020-05-12 00:58:40 +0800 |
commit | a7407edaf81c685d4a389785a405a53a5de4b148 (patch) | |
tree | e6e4f2d85f2172c94ac83a6e8f01e1e90a78ede9 /qmidiplayer-desktop/qmpsettings.hpp | |
parent | 437b7b16c322a8e53ac55a5f831098494d9a7073 (diff) | |
download | QMidiPlayer-a7407edaf81c685d4a389785a405a53a5de4b148.tar.xz |
Format EVERYTHING.
Hopefully this will make the source code less horrendous and actually
readable.
The command used was:
```
astyle --suffix=none --style=allman --attach-extern-c --attach-closing-while --indent-switches --indent-after-parens --pad-oper --pad-header --unpad-paren --align-pointer=name --recursive './*.cpp,*.hpp'
```
Diffstat (limited to 'qmidiplayer-desktop/qmpsettings.hpp')
-rw-r--r-- | qmidiplayer-desktop/qmpsettings.hpp | 131 |
1 files changed, 66 insertions, 65 deletions
diff --git a/qmidiplayer-desktop/qmpsettings.hpp b/qmidiplayer-desktop/qmpsettings.hpp index ff46970..2fb894f 100644 --- a/qmidiplayer-desktop/qmpsettings.hpp +++ b/qmidiplayer-desktop/qmpsettings.hpp @@ -10,79 +10,80 @@ struct qmpOption { - enum ParameterType{ - parameter_int=0, - parameter_uint, - parameter_bool, - parameter_double, - parameter_str, - parameter_enum, - parameter_url, - parameter_custom=0x100 - }; + enum ParameterType + { + parameter_int = 0, + parameter_uint, + parameter_bool, + parameter_double, + parameter_str, + parameter_enum, + parameter_url, + parameter_custom = 0x100 + }; - std::string tab; - std::string desc; - ParameterType type; - QWidget* widget; - QVariant defaultval,minv,maxv; - std::function<void*()> save_func; - std::function<void(void*)> load_func; - std::vector<std::string> enumlist; + std::string tab; + std::string desc; + ParameterType type; + QWidget *widget; + QVariant defaultval, minv, maxv; + std::function<void *()> save_func; + std::function<void(void *)> load_func; + std::vector<std::string> enumlist; - qmpOption():widget(nullptr){} - qmpOption(std::string _tab,std::string _desc, - ParameterType _t,QWidget* _w=nullptr, - QVariant _def=QVariant(),QVariant _min=QVariant(),QVariant _max=QVariant(), - std::function<void*()> _save=nullptr,std::function<void(void*)> _load=nullptr): - tab(_tab), - desc(_desc), - type(_t), - widget(_w), - defaultval(_def), - minv(_min), - maxv(_max), - save_func(_save), - load_func(_load){} + qmpOption(): widget(nullptr) {} + qmpOption(std::string _tab, std::string _desc, + ParameterType _t, QWidget *_w = nullptr, + QVariant _def = QVariant(), QVariant _min = QVariant(), QVariant _max = QVariant(), + std::function<void *()> _save = nullptr, std::function<void(void *)> _load = nullptr): + tab(_tab), + desc(_desc), + type(_t), + widget(_w), + defaultval(_def), + minv(_min), + maxv(_max), + save_func(_save), + load_func(_load) {} }; class qmpSettings { - public: - qmpSettings(); - ~qmpSettings(); - void registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval); - int getOptionInt(std::string key); - void setOptionInt(std::string key,int val); - void registerOptionUint(std::string tab,std::string desc,std::string key,unsigned min,unsigned max,unsigned defaultval); - unsigned getOptionUint(std::string key); - void setOptionUint(std::string key,unsigned val); - void registerOptionBool(std::string tab,std::string desc,std::string key,bool defaultval); - bool getOptionBool(std::string key); - void setOptionBool(std::string key,bool val); - void registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval); - double getOptionDouble(std::string key); - void setOptionDouble(std::string key,double val); - void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval,bool is_url); - std::string getOptionString(std::string key); - void setOptionString(std::string key,std::string val); - void registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> enumlist,int defaultval); - int getOptionEnumInt(std::string key); - std::string getOptionEnumIntOptName(std::string key); - void setOptionEnumInt(std::string key,int val); - void setOptionEnumIntOptName(std::string key,std::string valname); - void registerOptionCustom(std::string tab,std::string desc,std::string key,void* widget,void* defaultval,std::function<void*()> save_func,std::function<void(void*)> load_func); - void* getOptionCustom(std::string key); - void setOptionCustom(std::string key,void* val); +public: + qmpSettings(); + ~qmpSettings(); + void registerOptionInt(std::string tab, std::string desc, std::string key, int min, int max, int defaultval); + int getOptionInt(std::string key); + void setOptionInt(std::string key, int val); + void registerOptionUint(std::string tab, std::string desc, std::string key, unsigned min, unsigned max, unsigned defaultval); + unsigned getOptionUint(std::string key); + void setOptionUint(std::string key, unsigned val); + void registerOptionBool(std::string tab, std::string desc, std::string key, bool defaultval); + bool getOptionBool(std::string key); + void setOptionBool(std::string key, bool val); + void registerOptionDouble(std::string tab, std::string desc, std::string key, double min, double max, double defaultval); + double getOptionDouble(std::string key); + void setOptionDouble(std::string key, double val); + void registerOptionString(std::string tab, std::string desc, std::string key, std::string defaultval, bool is_url); + std::string getOptionString(std::string key); + void setOptionString(std::string key, std::string val); + void registerOptionEnumInt(std::string tab, std::string desc, std::string key, std::vector<std::string> enumlist, int defaultval); + int getOptionEnumInt(std::string key); + std::string getOptionEnumIntOptName(std::string key); + void setOptionEnumInt(std::string key, int val); + void setOptionEnumIntOptName(std::string key, std::string valname); + void registerOptionCustom(std::string tab, std::string desc, std::string key, void *widget, void *defaultval, std::function<void *()> save_func, std::function<void(void *)> load_func); + void *getOptionCustom(std::string key); + void setOptionCustom(std::string key, void *val); - void setOptionRaw(QString key,QVariant val); - QVariant getOptionRaw(QString key,QVariant defval=QVariant()); + void setOptionRaw(QString key, QVariant val); + QVariant getOptionRaw(QString key, QVariant defval = QVariant()); - private: - static QSettings *settings; - std::map<std::string,qmpOption> options; - std::vector<std::string> optionlist; +private: + static QSettings *settings; + std::map<std::string, qmpOption> options; + std::vector<std::string> optionlist; - friend class qmpSettingsWindow; + friend class qmpSettingsWindow; }; #endif |