aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpsettingswindow.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop/qmpsettingswindow.hpp')
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp162
1 files changed, 86 insertions, 76 deletions
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<unsigned&>(i);}
- inline int i(unsigned int u)const
- {return reinterpret_cast<int&>(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<unsigned &>(i);
+ }
+ inline int i(unsigned int u)const
+ {
+ return reinterpret_cast<int &>(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<std::string,qmpOption> customOptions;
- std::map<std::string,QGridLayout*> 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<std::string, qmpOption> customOptions;
+ std::map<std::string, QGridLayout *> 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