aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-05-25 22:40:15 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-05-25 22:40:15 +0800
commit3f72121ac41741d53e4916f1275cbd4f93259c4d (patch)
tree15bba079c86de0e241812cd657ad190eb0c2c41a /qmidiplayer-desktop
parenteba45fdf11a98113b439db0510b55f14845db8fb (diff)
downloadQMidiPlayer-3f72121ac41741d53e4916f1275cbd4f93259c4d.tar.xz
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.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qdialskulpturestyle.cpp4
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp2
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.hpp4
-rw-r--r--qmidiplayer-desktop/qmpefxwindow.hpp2
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp56
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.hpp14
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp19
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp32
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp2
9 files changed, 74 insertions, 61 deletions
diff --git a/qmidiplayer-desktop/qdialskulpturestyle.cpp b/qmidiplayer-desktop/qdialskulpturestyle.cpp
index ba9e03f..33c80de 100644
--- a/qmidiplayer-desktop/qdialskulpturestyle.cpp
+++ b/qmidiplayer-desktop/qdialskulpturestyle.cpp
@@ -386,12 +386,12 @@ QDialSkulptureStyle::drawComplexControl( ComplexControl cc,
}
const QStyleOptionSlider *option = qstyleoption_cast<const QStyleOptionSlider *>(optc);
- if (option == NULL)
+ if (option == nullptr)
return;
int d = qMin(option->rect.width() & ~1, option->rect.height() & ~1);
QStyleOptionSlider opt = *option;
- const QAbstractSlider *slider = NULL;
+ const QAbstractSlider *slider = nullptr;
// always highlight knob if pressed (even if mouse is not over knob)
if ((option->state & QStyle::State_HasFocus) && (slider = qobject_cast<const QAbstractSlider *>(widget))) {
if (slider->isSliderDown()) {
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 3b54069..1800aa5 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -15,7 +15,7 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
ceditw=new qmpChannelEditor(this);
cha=new QIcon(":/img/ledon.svg");chi=new QIcon(":/img/ledoff.svg");
cb=new qmpCWNoteOnCB();fused=callbacksc=cbcnt=0;
- qmpMainWindow::getInstance()->getPlayer()->setEventHandlerCB(cb,NULL);
+ qmpMainWindow::getInstance()->getPlayer()->setEventHandlerCB(cb,nullptr);
connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
std::vector<std::string> devs=qmpMainWindow::getInstance()->getPlayer()->getMidiOutDevices();
size_t devc=devs.size();
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp
index cb7b791..36cba3c 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.hpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.hpp
@@ -52,8 +52,8 @@ class qmpCWNoteOnCB:public QObject,public ICallBack
{
Q_OBJECT
public:
- void callBack(void* callerdata,void*)
- {if(((((SEventCallBackData*)callerdata)->type)&0xF0)==0x90)emit onNoteOn();}
+ void callBack(const void* callerdata,void*)
+ {if(((((const SEvent*)callerdata)->type)&0xF0)==0x90)emit onNoteOn();}
signals:
void onNoteOn();
};
diff --git a/qmidiplayer-desktop/qmpefxwindow.hpp b/qmidiplayer-desktop/qmpefxwindow.hpp
index 8b5319d..bacda1d 100644
--- a/qmidiplayer-desktop/qmpefxwindow.hpp
+++ b/qmidiplayer-desktop/qmpefxwindow.hpp
@@ -34,7 +34,7 @@ class qmpEfxWindow:public QWidget
~qmpEfxWindow();
void closeEvent(QCloseEvent *event);
void showEvent(QShowEvent *event);
- void sendEfxChange(void *_fs=NULL);
+ void sendEfxChange(void *_fs=nullptr);
private slots:
void on_dRoom_valueChanged();
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index baebe4f..5f9dfba 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -26,7 +26,7 @@ char* wcsto8bit(const wchar_t* s)
#endif
#define UPDATE_INTERVAL 66
-qmpMainWindow* qmpMainWindow::ref=NULL;
+qmpMainWindow* qmpMainWindow::ref=nullptr;
qmpMainWindow::qmpMainWindow(QWidget *parent) :
QMainWindow(parent),
@@ -39,7 +39,7 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
setButtonHeight(ui->pbPrev,36);setButtonHeight(ui->pbSettings,36);setButtonHeight(ui->pbStop,36);
playing=false;stopped=true;dragging=false;fin=false;
settingsw=new qmpSettingsWindow(this);pmgr=new qmpPluginManager();
- player=NULL;timer=NULL;fluidrenderer=NULL;
+ player=nullptr;timer=nullptr;fluidrenderer=nullptr;
}
qmpMainWindow::~qmpMainWindow()
@@ -56,15 +56,15 @@ qmpMainWindow::~qmpMainWindow()
rtmididev->deleteDevices();
delete pmgr;if(player)delete player;
if(timer)delete timer;
- delete helpw;helpw=NULL;
- delete efxw;efxw=NULL;
- delete chnlw;chnlw=NULL;
- delete plistw;plistw=NULL;
- delete infow;infow=NULL;
- delete settingsw;settingsw=NULL;
- delete panicf;panicf=NULL;
- delete renderf;renderf=NULL;
- delete reloadsynf;reloadsynf=NULL;
+ delete helpw;helpw=nullptr;
+ delete efxw;efxw=nullptr;
+ delete chnlw;chnlw=nullptr;
+ delete plistw;plistw=nullptr;
+ delete infow;infow=nullptr;
+ delete settingsw;settingsw=nullptr;
+ delete panicf;panicf=nullptr;
+ delete renderf;renderf=nullptr;
+ delete reloadsynf;reloadsynf=nullptr;
delete ui;
}
@@ -179,8 +179,8 @@ void qmpMainWindow::closeEvent(QCloseEvent *event)
for(auto i=mfunc.begin();i!=mfunc.end();++i)
{
i->second.i()->close();
- i->second.setAssignedControl((QReflectiveAction*)NULL),
- i->second.setAssignedControl((QReflectivePushButton*)NULL);
+ i->second.setAssignedControl((QReflectiveAction*)nullptr),
+ i->second.setAssignedControl((QReflectivePushButton*)nullptr);
}
efxw->close();chnlw->close();
plistw->close();infow->close();
@@ -211,11 +211,11 @@ void qmpMainWindow::updateWidgets()
if(!plistw->getRepeat())
{
timer->stop();stopped=true;playing=false;
- invokeCallback("main.stop",NULL);
+ invokeCallback("main.stop",nullptr);
setFuncEnabled("Render",stopped);setFuncEnabled("ReloadSynth",stopped);
chnlw->resetAcitivity();
player->playerDeinit();playerTh->join();
- delete playerTh;playerTh=NULL;
+ delete playerTh;playerTh=nullptr;
player->playerPanic(true);
chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.svg")));
@@ -232,9 +232,9 @@ void qmpMainWindow::updateWidgets()
{
renderTh->join();timer->stop();
ui->centralWidget->setEnabled(true);
- delete renderTh;renderTh=NULL;
+ delete renderTh;renderTh=nullptr;
fluidrenderer->renderDeinit();
- delete fluidrenderer;fluidrenderer=NULL;
+ delete fluidrenderer;fluidrenderer=nullptr;
}
}
while(!player->isFinished()&&player->getTCeptr()>player->getStamp(ui->hsTimer->value())
@@ -259,8 +259,8 @@ void qmpMainWindow::switchTrack(QString s)
setFuncEnabled("Render",stopped);setFuncEnabled("ReloadSynth",stopped);
ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/pause.svg")));
timer->stop();player->playerDeinit();
- invokeCallback("main.stop",NULL);
- if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;}
+ invokeCallback("main.stop",nullptr);
+ if(playerTh){playerTh->join();delete playerTh;playerTh=nullptr;}
player->playerPanic(true);
ui->hsTimer->setValue(0);
chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
@@ -272,7 +272,7 @@ void qmpMainWindow::switchTrack(QString s)
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);
player->playerInit();
- invokeCallback("main.start",NULL);
+ invokeCallback("main.start",nullptr);
player->fluid()->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
playerTh=new std::thread(&CMidiPlayer::playerThread,player);
@@ -359,7 +359,7 @@ int qmpMainWindow::loadFile(QString fns)
const char* c=s.c_str();
#endif
int ret=1;
- invokeCallback("main.reset",NULL);
+ invokeCallback("main.reset",nullptr);
if(!player->playerLoadFile(c))
{QMessageBox::critical(this,tr("Error"),tr("%1 is not a valid midi file.").arg(fns));ret=0;}
#ifdef _WIN32
@@ -387,7 +387,7 @@ void qmpMainWindow::on_pbPlayPause_clicked()
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);
player->playerInit();
- invokeCallback("main.start",NULL);
+ invokeCallback("main.start",nullptr);
player->fluid()->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
playerTh=new std::thread(&CMidiPlayer::playerThread,player);
@@ -411,7 +411,7 @@ void qmpMainWindow::on_pbPlayPause_clicked()
player->setResumed();
}
player->setTCpaused(!playing);
- invokeCallback("main.pause",NULL);
+ invokeCallback("main.pause",nullptr);
}
ui->pbPlayPause->setIcon(QIcon(getThemedIcon(playing?":/img/pause.svg":":/img/play.svg")));
}
@@ -478,11 +478,11 @@ void qmpMainWindow::on_pbStop_clicked()
if(!stopped)
{
timer->stop();stopped=true;playing=false;
- invokeCallback("main.stop",NULL);
+ invokeCallback("main.stop",nullptr);
player->playerDeinit();
setFuncEnabled("Render",stopped);setFuncEnabled("ReloadSynth",stopped);
player->playerPanic(true);chnlw->resetAcitivity();
- if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;}
+ if(playerTh){playerTh->join();delete playerTh;playerTh=nullptr;}
chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.svg")));
ui->hsTimer->setValue(0);
@@ -631,8 +631,8 @@ std::map<std::string,qmpFuncPrivate>& qmpMainWindow::getFunc()
void qmpMainWindow::setupWidget()
{
for(auto i=mfunc.begin();i!=mfunc.end();++i)
- i->second.setAssignedControl((QReflectiveAction*)NULL),
- i->second.setAssignedControl((QReflectivePushButton*)NULL);
+ i->second.setAssignedControl((QReflectiveAction*)nullptr),
+ i->second.setAssignedControl((QReflectivePushButton*)nullptr);
QList<QWidget*>w=ui->buttonwidget->findChildren<QWidget*>("",Qt::FindDirectChildrenOnly);
for(unsigned i=0;i<w.size();++i)
delete w[i];
@@ -723,7 +723,7 @@ qmpFuncPrivate::qmpFuncPrivate(qmpFuncBaseIntf *i,std::string _desc,const char *
_icon=QIcon(pixm);
}else _icon=QIcon();
checked=false;
- asgna=NULL;asgnb=NULL;
+ asgna=nullptr;asgnb=nullptr;
}
void qmpMainWindow::on_pbAdd_clicked()
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;
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 13d5730..8655dff 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -101,7 +101,7 @@ qmpPluginManager::~qmpPluginManager()
if(plugins[i].initialized)plugins[i].pinterface->deinit();
delete plugins[i].pinterface;
}
- qmw=NULL;qsw=NULL;delete pluginAPI;
+ qmw=nullptr;qsw=nullptr;delete pluginAPI;
}
std::vector<qmpPlugin> *qmpPluginManager::getPlugins()
{
@@ -182,10 +182,11 @@ std::string qmpPluginAPI::getChannelPresetString(int ch)
return std::string(ret);
}
bool qmpPluginAPI::isDarkTheme(){return qmw?qmw->isDarkTheme():false;}
+void* qmpPluginAPI::getMainWindow(){return (void*)qmw;}
void qmpPluginAPI::discardCurrentEvent(){if(qmw&&qmw->getPlayer())qmw->getPlayer()->discardCurrentEvent();}
-void qmpPluginAPI::commitEventChange(SEventCallBackData d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->commitEventChange(d);}
-void qmpPluginAPI::callEventReaderCB(SEventCallBackData d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->callEventReaderCB(d);}
+void qmpPluginAPI::commitEventChange(SEvent d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->commitEventChange(d);}
+void qmpPluginAPI::callEventReaderCB(SEvent d){if(qmw&&qmw->getPlayer())qmw->getPlayer()->callEventReaderCB(d);}
void qmpPluginAPI::setFuncState(std::string name,bool state){if(qmw)qmw->setFuncState(name,state);}
void qmpPluginAPI::setFuncEnabled(std::string name,bool enable){if(qmw)qmw->setFuncEnabled(name,enable);}
@@ -219,6 +220,18 @@ void qmpPluginAPI::registerFileReader(qmpFileReader* reader,std::string name)
{qmw->getPlayer()->registerReader(reader,name);}
void qmpPluginAPI::unregisterFileReader(std::string name)
{qmw->getPlayer()->unregisterReader(name);}
+int qmpPluginAPI::registerEventHandler(callback_t cb,void *userdata)
+{return qmw->getPlayer()->registerEventHandler(cb,userdata);}
+void qmpPluginAPI::unregisterEventHandler(int id)
+{qmw->getPlayer()->unregisterEventHandler(id);}
+int qmpPluginAPI::registerEventReadHandler(callback_t cb,void *userdata)
+{return qmw->getPlayer()->registerEventReadHandler(cb,userdata);}
+void qmpPluginAPI::unregisterEventReadHandler(int id)
+{qmw->getPlayer()->unregisterEventReadHandler(id);}
+int qmpPluginAPI::registerFileReadFinishHook(callback_t cb,void *userdata)
+{return qmw->getPlayer()->registerFileReadFinishHook(cb,userdata);}
+void qmpPluginAPI::unregisterFileReadFinishHook(int id)
+{qmw->getPlayer()->unregisterFileReadFinishHook(id);}
void qmpPluginAPI::registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval)
{qsw->registerOptionInt(tab,desc,key,min,max,defaultval);}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index 9d8b4cf..b14ff4d 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -8,8 +8,8 @@
#include "ui_qmpsettingswindow.h"
#include "qmpmainwindow.hpp"
-QSettings* qmpSettingsWindow::settings=NULL;
-QComboBox* qmpSettingsWindow::outwidget=NULL;
+QSettings* qmpSettingsWindow::settings=nullptr;
+QComboBox* qmpSettingsWindow::outwidget=nullptr;
void qmpFluidForEachOpt(void* data,const char*,const char* option)
{
@@ -35,7 +35,7 @@ qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) :
qmpSettingsWindow::~qmpSettingsWindow()
{
delete cw;
- delete settings;settings=NULL;
+ delete settings;settings=nullptr;
delete ui;
}
@@ -447,7 +447,7 @@ void qmpSettingsWindow::updateCustomOptions()
void qmpSettingsWindow::registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval)
{
- customOptions[key].widget=NULL;
+ customOptions[key].widget=nullptr;
customOptions[key].desc=desc;
customOptions[key].defaultval=defaultval;
customOptions[key].minv=min;
@@ -455,7 +455,7 @@ void qmpSettingsWindow::registerOptionInt(std::string tab,std::string desc,std::
customOptions[key].type=0;
if(desc.length())
{
- QGridLayout* page=NULL;
+ QGridLayout* page=nullptr;
if(customOptPages[tab])page=customOptPages[tab];
else
{
@@ -491,7 +491,7 @@ void qmpSettingsWindow::setOptionInt(std::string key,int val)
void qmpSettingsWindow::registerOptionUint(std::string tab,std::string desc,std::string key,unsigned min,unsigned max,unsigned defaultval)
{
- customOptions[key].widget=NULL;
+ customOptions[key].widget=nullptr;
customOptions[key].desc=desc;
customOptions[key].defaultval=defaultval;
customOptions[key].minv=min;
@@ -499,7 +499,7 @@ void qmpSettingsWindow::registerOptionUint(std::string tab,std::string desc,std:
customOptions[key].type=1;
if(desc.length())
{
- QGridLayout* page=NULL;
+ QGridLayout* page=nullptr;
if(customOptPages[tab])page=customOptPages[tab];
else
{
@@ -534,13 +534,13 @@ void qmpSettingsWindow::setOptionUint(std::string key,unsigned val)
void qmpSettingsWindow::registerOptionBool(std::string tab,std::string desc,std::string key,bool defaultval)
{
- customOptions[key].widget=NULL;
+ customOptions[key].widget=nullptr;
customOptions[key].desc=desc;
customOptions[key].defaultval=defaultval;
customOptions[key].type=2;
if(desc.length())
{
- QGridLayout* page=NULL;
+ QGridLayout* page=nullptr;
if(customOptPages[tab])page=customOptPages[tab];
else
{
@@ -571,7 +571,7 @@ void qmpSettingsWindow::setOptionBool(std::string key,bool val)
void qmpSettingsWindow::registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval)
{
- customOptions[key].widget=NULL;
+ customOptions[key].widget=nullptr;
customOptions[key].desc=desc;
customOptions[key].defaultval=defaultval;
customOptions[key].minv=min;
@@ -579,7 +579,7 @@ void qmpSettingsWindow::registerOptionDouble(std::string tab,std::string desc,st
customOptions[key].type=3;
if(desc.length())
{
- QGridLayout* page=NULL;
+ QGridLayout* page=nullptr;
if(customOptPages[tab])page=customOptPages[tab];
else
{
@@ -615,14 +615,14 @@ void qmpSettingsWindow::setOptionDouble(std::string key,double val)
void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval,bool ispath)
{
- customOptions[key].widget=NULL;
+ customOptions[key].widget=nullptr;
customOptions[key].desc=desc;
customOptions[key].defaultval=QString(defaultval.c_str());
customOptions[key].type=4;
if(ispath)customOptions[key].type=6;
if(desc.length())
{
- QGridLayout* page=NULL;
+ QGridLayout* page=nullptr;
if(customOptPages[tab])page=customOptPages[tab];
else
{
@@ -672,13 +672,13 @@ void qmpSettingsWindow::setOptionString(std::string key,std::string val)
void qmpSettingsWindow::registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval)
{
- customOptions[key].widget=NULL;
+ customOptions[key].widget=nullptr;
customOptions[key].desc=desc;
customOptions[key].defaultval=defaultval;
customOptions[key].type=5;
if(desc.length())
{
- QGridLayout* page=NULL;
+ QGridLayout* page=nullptr;
if(customOptPages[tab])page=customOptPages[tab];
else
{
@@ -737,6 +737,6 @@ QString QFileEdit::text(){return le->text();}
void QFileEdit::setText(const QString& s){le->setText(s);}
void QFileEdit::chooseFile()
{
- QString s=QFileDialog::getOpenFileName(NULL,tr("Select a file"),QFileInfo(text()).dir().absolutePath());
+ QString s=QFileDialog::getOpenFileName(nullptr,tr("Select a file"),QFileInfo(text()).dir().absolutePath());
if(s.length())setText(s);
}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp
index 5636f54..f186969 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.hpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.hpp
@@ -37,7 +37,7 @@ class QFileEdit:public QWidget
private slots:
void chooseFile();
public:
- QFileEdit(QWidget* par=NULL);
+ QFileEdit(QWidget* par=nullptr);
QString text();
void setText(const QString& s);
};