From 3f72121ac41741d53e4916f1275cbd4f93259c4d Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 25 May 2019 22:40:15 +0800 Subject: Massive code refactor en cours! Less complain from compilers: - use nullptr instead of NULL - use types for event fields - explicit type casting added Stop saving parameters of meta events in p1/p2 fields of SEvent. callback_t now uses std::function, deprecating ICallback. Not recommended for daily usage, or even testing: the code refactor is still a work in progress. --- qmidiplayer-desktop/qmpmainwindow.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'qmidiplayer-desktop/qmpmainwindow.hpp') diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp index a456dec..262bc2e 100644 --- a/qmidiplayer-desktop/qmpmainwindow.hpp +++ b/qmidiplayer-desktop/qmpmainwindow.hpp @@ -66,7 +66,7 @@ class QReflectiveAction:public QAction } public: explicit QReflectiveAction(const QIcon& icon,const QString& text,const std::string& ref): - QAction(icon,text,NULL),reflt(ref){ + QAction(icon,text,nullptr),reflt(ref){ connect(this,SIGNAL(triggered(bool)),this,SLOT(triggerslot())); } }; @@ -102,7 +102,7 @@ class qmpFuncPrivate public: qmpFuncPrivate(){} qmpFuncPrivate(qmpFuncBaseIntf* i,std::string _desc,const char* icon,int iconlen,bool checkable); - ~qmpFuncPrivate(){asgna=NULL;asgnb=NULL;} + ~qmpFuncPrivate(){asgna=nullptr;asgnb=nullptr;} qmpFuncBaseIntf* i(){return _i;} void setAssignedControl(QReflectiveAction* a){asgna=a;if(!a)return;asgna->setCheckable(_checkable);asgna->setChecked(checked);} void setAssignedControl(QReflectivePushButton* a){asgnb=a;if(!a)return;asgnb->setCheckable(_checkable);asgnb->setChecked(checked);} @@ -125,9 +125,9 @@ class qmpCallBack ICallBack* cbc; callback_t cbf; public: - qmpCallBack(){t=-1;cbc=NULL;cbf=NULL;} - qmpCallBack(ICallBack* _cb){t=0;cbc=_cb;cbf=NULL;} - qmpCallBack(callback_t _cb){t=1;cbf=_cb;cbc=NULL;} + qmpCallBack(){t=-1;cbc=nullptr;cbf=nullptr;} + qmpCallBack(ICallBack* _cb){t=0;cbc=_cb;cbf=nullptr;} + qmpCallBack(callback_t _cb){t=1;cbf=_cb;cbc=nullptr;} void operator ()(void* cbd,void* usrd) { if(t<0)return; @@ -196,8 +196,8 @@ class qmpMainWindow:public QMainWindow Ui::qmpMainWindow *ui; QTimer *timer; bool playing,stopped,dragging,fin,havemidi; - std::thread *playerTh=NULL; - std::thread *renderTh=NULL; + std::thread *playerTh=nullptr; + std::thread *renderTh=nullptr; std::chrono::steady_clock::time_point st; double offset; CMidiPlayer *player; -- cgit v1.2.3