aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpmainwindow.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-09-16 00:53:06 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-09-16 00:53:06 +0800
commitc944d7279bd3745f3391c56dc1dbc5e02f26c425 (patch)
treed96db563d7afb263faad5579286b025a5b4f0318 /qmidiplayer-desktop/qmpmainwindow.hpp
parent9fecb429a37bcaa577aaa972139f6db3ce17ac50 (diff)
downloadQMidiPlayer-c944d7279bd3745f3391c56dc1dbc5e02f26c425.tar.xz
Use QCommandLineParser to parse arguments.
New argument for loading plugins from given files. Use functor whenever possible in QObject::connect. A little bit of code cleanups.
Diffstat (limited to 'qmidiplayer-desktop/qmpmainwindow.hpp')
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.hpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp
index 262bc2e..a95d1fe 100644
--- a/qmidiplayer-desktop/qmpmainwindow.hpp
+++ b/qmidiplayer-desktop/qmpmainwindow.hpp
@@ -14,6 +14,7 @@
#include <QSlider>
#include <QPointer>
#include <QApplication>
+#include <QCommandLineParser>
#include <thread>
#include <chrono>
#include <future>
@@ -60,14 +61,10 @@ class QReflectiveAction:public QAction
std::string reflt;
signals:
void onClick(std::string s);
- private slots:
- void triggerslot(){
- emit(onClick(reflt));
- }
public:
explicit QReflectiveAction(const QIcon& icon,const QString& text,const std::string& ref):
QAction(icon,text,nullptr),reflt(ref){
- connect(this,SIGNAL(triggered(bool)),this,SLOT(triggerslot()));
+ connect(this,&QAction::triggered,std::bind(&QReflectiveAction::onClick,this,reflt));
}
};
@@ -78,14 +75,10 @@ class QReflectivePushButton:public QPushButton
std::string reflt;
signals:
void onClick(std::string s);
- private slots:
- void clickslot(){
- emit(onClick(reflt));
- }
public:
explicit QReflectivePushButton(const QIcon& icon,const QString& text,const std::string& ref):
QPushButton(icon,""),reflt(ref){
- connect(this,SIGNAL(clicked(bool)),this,SLOT(clickslot()));
+ connect(this,&QPushButton::clicked,std::bind(&QReflectivePushButton::onClick,this,reflt));
setToolTip(text);
}
};
@@ -141,7 +134,7 @@ class qmpMainWindow:public QMainWindow
Q_OBJECT
public:
- explicit qmpMainWindow(QWidget *parent = 0);
+ explicit qmpMainWindow(QCommandLineParser *clp,QWidget *parent=nullptr);
void init();
void closeEvent(QCloseEvent *event);
void dropEvent(QDropEvent *event);
@@ -195,7 +188,7 @@ class qmpMainWindow:public QMainWindow
private:
Ui::qmpMainWindow *ui;
QTimer *timer;
- bool playing,stopped,dragging,fin,havemidi;
+ bool playing,stopped,dragging,fin;
std::thread *playerTh=nullptr;
std::thread *renderTh=nullptr;
std::chrono::steady_clock::time_point st;
@@ -217,6 +210,7 @@ class qmpMainWindow:public QMainWindow
qmpReloadSynthFunc* reloadsynf;
std::vector<std::string> enabled_buttons,enabled_actions;
std::vector<QString> argfiles;
+ QCommandLineParser *clp;
void onfnChanged();
void playerSetup(IFluidSettings *fs);