From a7407edaf81c685d4a389785a405a53a5de4b148 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 12 May 2020 00:58:40 +0800 Subject: 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' ``` --- qmidiplayer-desktop/qmpsettingswindow.hpp | 162 ++++++++++++++++-------------- 1 file changed, 86 insertions(+), 76 deletions(-) (limited to 'qmidiplayer-desktop/qmpsettingswindow.hpp') diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp index 5243ca9..c564c01 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.hpp +++ b/qmidiplayer-desktop/qmpsettingswindow.hpp @@ -17,98 +17,108 @@ #include "qmpcustomizewindow.hpp" #include "qmpdevpropdialog.hpp" -namespace Ui { - class qmpSettingsWindow; +namespace Ui +{ +class qmpSettingsWindow; } class QLineEdit; class QToolButton; -class QFileEdit:public QWidget +class QFileEdit : public QWidget { - Q_OBJECT - private: - QLineEdit *le; - QToolButton *tb; - private slots: - void chooseFile(); - public: - QFileEdit(QWidget* par=nullptr); - QString text(); - void setText(const QString& s); + Q_OBJECT +private: + QLineEdit *le; + QToolButton *tb; +private slots: + void chooseFile(); +public: + QFileEdit(QWidget *par = nullptr); + QString text(); + void setText(const QString &s); }; -class QHexSpinBox:public QSpinBox +class QHexSpinBox: public QSpinBox { - Q_OBJECT - public: - QHexSpinBox(QWidget *parent=0):QSpinBox(parent) - { - setPrefix("0x"); - setDisplayIntegerBase(16); - setRange(-0x80000000,0x7FFFFFFF); - } - protected: - QString textFromValue(int value)const - { - return QString::number(u(value),16).toUpper(); - } - int valueFromText(const QString &text)const - { - return i(text.toUInt(nullptr,16)); - } - QValidator::State validate(QString &input,int &pos)const - { - QString t=input; - if(t.startsWith("0x"))t.remove(0,2); - pos-=t.size()-t.trimmed().size();t=t.trimmed(); - if(t.isEmpty())return QValidator::Intermediate; - input=QString("0x")+t.toUpper(); - bool okay;t.toUInt(&okay,16); - if(!okay)return QValidator::Invalid; - return QValidator::Acceptable; - } - inline unsigned int u(int i)const - {return reinterpret_cast(i);} - inline int i(unsigned int u)const - {return reinterpret_cast(u);} + Q_OBJECT +public: + QHexSpinBox(QWidget *parent = nullptr) : QSpinBox(parent) + { + setPrefix("0x"); + setDisplayIntegerBase(16); + setRange(-0x80000000, 0x7FFFFFFF); + } +protected: + QString textFromValue(int value)const + { + return QString::number(u(value), 16).toUpper(); + } + int valueFromText(const QString &text)const + { + return i(text.toUInt(nullptr, 16)); + } + QValidator::State validate(QString &input, int &pos)const + { + QString t = input; + if (t.startsWith("0x")) + t.remove(0, 2); + pos -= t.size() - t.trimmed().size(); + t = t.trimmed(); + if (t.isEmpty()) + return QValidator::Intermediate; + input = QString("0x") + t.toUpper(); + bool okay; + t.toUInt(&okay, 16); + if (!okay) + return QValidator::Invalid; + return QValidator::Acceptable; + } + inline unsigned int u(int i)const + { + return reinterpret_cast(i); + } + inline int i(unsigned int u)const + { + return reinterpret_cast(u); + } }; class qmpDevicePriorityDialog; -class qmpSettingsWindow:public QDialog +class qmpSettingsWindow : public QDialog { - Q_OBJECT + Q_OBJECT - public: - explicit qmpSettingsWindow(qmpSettings *qmpsettings,QWidget *parent=nullptr); - ~qmpSettingsWindow(); - void closeEvent(QCloseEvent *event); - void hideEvent(QHideEvent *event); - void updatePluginList(qmpPluginManager *pmgr); - void postInit(); - void registerCustomizeWidgetOptions(); - void registerSoundFontOption(); - void registerPluginOption(qmpPluginManager *pmgr); - void registerExtraMidiOptions(); - signals: - void dialogClosing(); +public: + explicit qmpSettingsWindow(qmpSettings *qmpsettings, QWidget *parent = nullptr); + ~qmpSettingsWindow(); + void closeEvent(QCloseEvent *event); + void hideEvent(QHideEvent *event); + void updatePluginList(qmpPluginManager *pmgr); + void postInit(); + void registerCustomizeWidgetOptions(); + void registerSoundFontOption(); + void registerPluginOption(qmpPluginManager *pmgr); + void registerExtraMidiOptions(); +signals: + void dialogClosing(); - private slots: - void on_buttonBox_accepted(); - void on_buttonBox_rejected(); +private slots: + void on_buttonBox_accepted(); + void on_buttonBox_rejected(); - private: - Ui::qmpSettingsWindow *ui; - std::map customOptions; - std::map customOptPages; - void saveOption(std::string key=std::string()); - void loadOption(std::string key=std::string()); - void setupWidgets(); - QGridLayout* pageForTab(std::string tab); - qmpCustomizeWindow *cwt,*cwa; - qmpDevPropDialog *dps; - qmpDevicePriorityDialog *devpriod; - qmpSettings *settings; +private: + Ui::qmpSettingsWindow *ui; + std::map customOptions; + std::map customOptPages; + void saveOption(std::string key = std::string()); + void loadOption(std::string key = std::string()); + void setupWidgets(); + QGridLayout *pageForTab(std::string tab); + qmpCustomizeWindow *cwt, *cwa; + qmpDevPropDialog *dps; + qmpDevicePriorityDialog *devpriod; + qmpSettings *settings; }; #endif // QMPSETTINGSWINDOW_H -- cgit v1.2.3