From 3312e495cf54a8bd6451552216f5aeea1a06d486 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 12 Feb 2017 23:33:41 +0800 Subject: UI revolution cont'd. Powered by @BLumia. Expose new APIs to plugin developer. Use svg icons. --- qmidiplayer-desktop/qmpchannelswindow.cpp | 4 +- qmidiplayer-desktop/qmpchannelswindow.hpp | 2 +- qmidiplayer-desktop/qmpefxwindow.cpp | 2 +- qmidiplayer-desktop/qmpefxwindow.ui | 2 +- qmidiplayer-desktop/qmpinfowindow.cpp | 2 +- qmidiplayer-desktop/qmpmainwindow.cpp | 96 ++--- qmidiplayer-desktop/qmpmainwindow.hpp | 1 + qmidiplayer-desktop/qmpmainwindow.ui | 646 ++++++++++++++++++------------ qmidiplayer-desktop/qmpplistwindow.cpp | 53 +-- qmidiplayer-desktop/qmpplistwindow.hpp | 2 +- qmidiplayer-desktop/qmpplistwindow.ui | 16 +- qmidiplayer-desktop/qmpplugin.cpp | 6 + qmidiplayer-desktop/qmpsettingswindow.cpp | 17 +- qmidiplayer-desktop/qmpsettingswindow.ui | 33 +- qmidiplayer-desktop/resources.qrc | 108 ++--- 15 files changed, 562 insertions(+), 428 deletions(-) (limited to 'qmidiplayer-desktop') diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index fc7c686..bd021f1 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -16,7 +16,7 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : pselectw=new qmpPresetSelector(this); ceditw=new qmpChannelEditor(this); mapper=qmpMainWindow::getInstance()->getPlayer()->getMidiMapper(); - cha=new QPixmap(":/img/ledon.png");chi=new QPixmap(":/img/ledoff.png"); + 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); connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity())); @@ -76,7 +76,7 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : chnlf=new qmpChannelFunc(this), std::string("Channel"), tr("Channel").toStdString(), - getThemedIconc(":/img/channel.png"), + getThemedIconc(":/img/channel.svg"), 0, true ); diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp index 4502b21..57be0ca 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.hpp +++ b/qmidiplayer-desktop/qmpchannelswindow.hpp @@ -107,7 +107,7 @@ class qmpChannelsWindow:public QDialog qmpPresetSelector *pselectw; qmpChannelEditor *ceditw; qmpMidiMapperRtMidi *mapper; - QPixmap *cha,*chi; + QIcon *cha,*chi; qmpCWNoteOnCB *cb; qmpChannelFunc *chnlf; //callback fuse... (avoid black midi blocking the main thread) diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp index 04a7e8d..507880e 100644 --- a/qmidiplayer-desktop/qmpefxwindow.cpp +++ b/qmidiplayer-desktop/qmpefxwindow.cpp @@ -32,7 +32,7 @@ qmpEfxWindow::qmpEfxWindow(QWidget *parent) : efxf=new qmpEfxFunc(this), std::string("Effects"), tr("Effects").toStdString(), - getThemedIconc(":/img/effects.png"), + getThemedIconc(":/img/effects.svg"), 0, true ); diff --git a/qmidiplayer-desktop/qmpefxwindow.ui b/qmidiplayer-desktop/qmpefxwindow.ui index d7e2245..97a0d58 100644 --- a/qmidiplayer-desktop/qmpefxwindow.ui +++ b/qmidiplayer-desktop/qmpefxwindow.ui @@ -50,7 +50,7 @@ - + 0 0 diff --git a/qmidiplayer-desktop/qmpinfowindow.cpp b/qmidiplayer-desktop/qmpinfowindow.cpp index 03084c1..de853aa 100644 --- a/qmidiplayer-desktop/qmpinfowindow.cpp +++ b/qmidiplayer-desktop/qmpinfowindow.cpp @@ -19,7 +19,7 @@ qmpInfoWindow::qmpInfoWindow(QWidget *parent) : infof=new qmpInfoFunc(this), std::string("FileInfo"), tr("File Information").toStdString(), - NULL, + getThemedIconc(":/img/info.svg"), 0, true ); diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index cbec3f5..fc7f850 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -54,11 +54,11 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : ui(new Ui::qmpMainWindow) { ui->setupUi(this); - ui->lnPolyphone->display("00000-00000"); + ui->lbCurPoly->setText("00000");ui->lbMaxPoly->setText("00000"); ui->lbFileName->setText("");ref=this;ui->verticalLayout->setAlignment(ui->pushButton,Qt::AlignRight); int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.); setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); - setButtonHeight(ui->pbNext,36);setButtonHeight(ui->pbPlayPause,36); + setButtonHeight(ui->pbNext,36);setButtonHeight(ui->pbPlayPause,36);setButtonHeight(ui->pbAdd,36); setButtonHeight(ui->pbPrev,36);setButtonHeight(ui->pbSettings,36);setButtonHeight(ui->pbStop,36); //setButtonHeight(ui->pbChannels,36);setButtonHeight(ui->pbPList,36); //setButtonHeight(ui->pbEfx,36);setButtonHeight(ui->pbVisualization,36); @@ -93,9 +93,9 @@ void qmpMainWindow::init() renderf=new qmpRenderFunc(this); panicf=new qmpPanicFunc(this); reloadsynf=new qmpReloadSynthFunc(this); - registerFunctionality(renderf,"Render",tr("Render to wave").toStdString(),NULL,0,false); - registerFunctionality(panicf,"Panic",tr("Panic").toStdString(),NULL,0,false); - registerFunctionality(reloadsynf,"ReloadSynth",tr("Restart fluidsynth").toStdString(),NULL,0,false); + registerFunctionality(renderf,"Render",tr("Render to wave").toStdString(),getThemedIconc(":/img/render.svg"),0,false); + registerFunctionality(panicf,"Panic",tr("Panic").toStdString(),getThemedIconc(":/img/panic.svg"),0,false); + registerFunctionality(reloadsynf,"ReloadSynth",tr("Restart fluidsynth").toStdString(),getThemedIconc(":/img/repeat-base.svg"),0,false); pmgr->scanPlugins();settingsw->updatePluginList(pmgr);pmgr->initPlugins(); if(singleFS){player->fluidPreInitialize();playerSetup();player->fluidInitialize(); for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue; @@ -114,15 +114,12 @@ void qmpMainWindow::init() connect(timer,SIGNAL(timeout()),this,SLOT(updateWidgets())); connect(timer,SIGNAL(timeout()),chnlw,SLOT(channelWindowsUpdate())); connect(timer,SIGNAL(timeout()),infow,SLOT(updateInfo())); - ui->pbNext->setIcon(QIcon(getThemedIcon(":/img/next.png"))); - ui->pbPrev->setIcon(QIcon(getThemedIcon(":/img/prev.png"))); - ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.png"))); - ui->pbStop->setIcon(QIcon(getThemedIcon(":/img/stop.png"))); - //ui->pbChannels->setIcon(QIcon(getThemedIcon(":/img/channel.png"))); - //ui->pbEfx->setIcon(QIcon(getThemedIcon(":/img/effects.png"))); - //ui->pbPList->setIcon(QIcon(getThemedIcon(":/img/list.png"))); - //ui->pbVisualization->setIcon(QIcon(getThemedIcon(":/img/visualization.png"))); - ui->pbSettings->setIcon(QIcon(getThemedIcon(":/img/settings.png"))); + ui->pbNext->setIcon(QIcon(getThemedIcon(":/img/next.svg"))); + ui->pbPrev->setIcon(QIcon(getThemedIcon(":/img/prev.svg"))); + ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.svg"))); + ui->pbStop->setIcon(QIcon(getThemedIcon(":/img/stop.svg"))); + ui->pbSettings->setIcon(QIcon(getThemedIcon(":/img/settings.svg"))); + ui->pbAdd->setIcon(QIcon(getThemedIcon(":/img/open.svg"))); if(havemidi)on_pbPlayPause_clicked(); setupWidget(); } @@ -246,9 +243,9 @@ void qmpMainWindow::updateWidgets() delete playerTh;playerTh=NULL; if(singleFS)player->playerPanic(true); chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); - ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.png"))); + ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.svg"))); ui->hsTimer->setValue(0); - ui->lnPolyphone->display("00000-00000"); + ui->lbCurPoly->setText("00000");ui->lbMaxPoly->setText("00000"); ui->lbCurTime->setText("00:00"); } else @@ -283,20 +280,22 @@ void qmpMainWindow::updateWidgets() char ts[100]; sprintf(ts,"%02d:%02d",(int)(elapsed.count()+offset)/60,(int)(elapsed.count()+offset)%60); ui->lbCurTime->setText(ts); - //sprintf(ts,"Poly: %d/%d",player->getPolyphone(),player->getMaxPolyphone()); - ui->lnPolyphone->display(QString("%1-%2").arg(player->getPolyphone(),5,10,QChar('0')) - .arg(player->getMaxPolyphone(),5,10,QChar('0'))); + ui->lbCurPoly->setText(QString("%1").arg(player->getPolyphone(),5,10,QChar('0'))); + ui->lbMaxPoly->setText(QString("%1").arg(player->getMaxPolyphone(),5,10,QChar('0'))); } } QString qmpMainWindow::getFileName(){return ui->lbFileName->text();} void qmpMainWindow::switchTrack(QString s) { - timer->stop();player->playerDeinit();playerTh->join(); - delete playerTh;playerTh=NULL; - ui->hsTimer->setValue(0); + stopped=false;playing=true; + setFuncEnabled("Render",stopped);setFuncEnabled("ReloadSynth",stopped); + ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/pause.svg"))); + timer->stop();player->playerDeinit(); for(auto i=mfunc.begin();i!=mfunc.end();++i)if(i->second.isVisualization())((qmpVisualizationIntf*)(i->second.i()))->stop(); + if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} if(singleFS)player->playerPanic(true); + ui->hsTimer->setValue(0); chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); QString fns=s;setWindowTitle(QUrl::fromLocalFile(fns).fileName().left(QUrl::fromLocalFile(fns).fileName().lastIndexOf('.'))+" - QMidiPlayer"); ui->lbFileName->setText(QUrl::fromLocalFile(fns).fileName().left(QUrl::fromLocalFile(fns).fileName().lastIndexOf('.'))); @@ -383,7 +382,7 @@ void qmpMainWindow::on_pbPlayPause_clicked() QString fns=plistw->getFirstItem(); if(!fns.length()) { - plistw->on_pbAdd_clicked(); + if(!plistw->on_pbAdd_clicked()){playing=false;return;} fns=plistw->getFirstItem(); if(!fns.length())return(void)(playing=false); }setWindowTitle(QUrl::fromLocalFile(fns).fileName().left(QUrl::fromLocalFile(fns).fileName().lastIndexOf('.'))+" - QMidiPlayer"); @@ -424,7 +423,7 @@ void qmpMainWindow::on_pbPlayPause_clicked() player->setTCpaused(!playing); for(auto i=mfunc.begin();i!=mfunc.end();++i)if(i->second.isVisualization())((qmpVisualizationIntf*)(i->second.i()))->pause(); } - ui->pbPlayPause->setIcon(QIcon(getThemedIcon(playing?":/img/pause.png":":/img/play.png"))); + ui->pbPlayPause->setIcon(QIcon(getThemedIcon(playing?":/img/pause.svg":":/img/play.svg"))); } void qmpMainWindow::on_hsTimer_sliderPressed() @@ -495,9 +494,9 @@ void qmpMainWindow::on_pbStop_clicked() if(singleFS)player->playerPanic(true);chnlw->resetAcitivity(); if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); - ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.png"))); + ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/play.svg"))); ui->hsTimer->setValue(0); - ui->lnPolyphone->display("00000-00000"); + ui->lbCurPoly->setText("00000");ui->lbMaxPoly->setText("00000"); ui->lbCurTime->setText("00:00"); } } @@ -519,35 +518,7 @@ void qmpMainWindow::on_pbNext_clicked() void qmpMainWindow::selectionChanged() { - stopped=false;playing=true; - ui->pbPlayPause->setIcon(QIcon(getThemedIcon(":/img/pause.png"))); - timer->stop();player->playerDeinit(); - for(auto i=mfunc.begin();i!=mfunc.end();++i)if(i->second.isVisualization())((qmpVisualizationIntf*)(i->second.i()))->stop(); - if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} - if(singleFS)player->playerPanic(true); - ui->hsTimer->setValue(0); - chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); - QString fns=plistw->getSelectedItem(); - ui->lbFileName->setText(QUrl::fromLocalFile(fns).fileName().left(QUrl::fromLocalFile(fns).fileName().lastIndexOf('.'))); - setWindowTitle(QUrl::fromLocalFile(fns).fileName().left(QUrl::fromLocalFile(fns).fileName().lastIndexOf('.'))+" - QMidiPlayer"); - onfnChanged(); - LOAD_FILE; - char ts[100]; - sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60); - ui->lbFinTime->setText(ts); - player->playerInit();if(!singleFS){playerSetup();player->fluidInitialize(); - for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue; - LOAD_SOUNDFONT; - }} - for(auto i=mfunc.begin();i!=mfunc.end();++i)if(i->second.isVisualization())((qmpVisualizationIntf*)(i->second.i()))->start(); - player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange(); - player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt()); - playerTh=new std::thread(&CMidiPlayer::playerThread,player); -#ifdef _WIN32 - SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); -#endif - st=std::chrono::steady_clock::now();offset=0; - timer->start(UPDATE_INTERVAL); + switchTrack(plistw->getSelectedItem()); } void qmpMainWindow::on_lbFileName_customContextMenuRequested(const QPoint &pos) @@ -645,6 +616,9 @@ std::map& qmpMainWindow::getFunc() void qmpMainWindow::setupWidget() { + for(auto i=mfunc.begin();i!=mfunc.end();++i) + i->second.setAssignedControl((QReflectiveAction*)NULL), + i->second.setAssignedControl((QReflectivePushButton*)NULL); QListw=ui->buttonwidget->findChildren("",Qt::FindDirectChildrenOnly); for(unsigned i=0;igetSettingsIntf()->value("Behavior/ShowButtonLabel",0).toInt()) + { + pb->setText(tr(mfunc[enabled_buttons[i]].desc().c_str())); + pb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + } + else setButtonWidth(pb,32); ui->buttonwidget->layout()->addWidget(pb); mfunc[enabled_buttons[i]].setAssignedControl(pb); @@ -720,3 +700,9 @@ qmpFuncPrivate::qmpFuncPrivate(qmpFuncBaseIntf *i,std::string _desc,const char * checked=false; asgna=NULL;asgnb=NULL; } + +void qmpMainWindow::on_pbAdd_clicked() +{ + if(plistw->on_pbAdd_clicked()) + switchTrack(plistw->getLastItem()); +} diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp index 395b833..9a80dec 100644 --- a/qmidiplayer-desktop/qmpmainwindow.hpp +++ b/qmidiplayer-desktop/qmpmainwindow.hpp @@ -166,6 +166,7 @@ class qmpMainWindow:public QMainWindow void on_pbSettings_clicked(); void funcReflector(std::string reflt); void on_pushButton_clicked(); + void on_pbAdd_clicked(); public slots: void dialogClosed(); diff --git a/qmidiplayer-desktop/qmpmainwindow.ui b/qmidiplayer-desktop/qmpmainwindow.ui index 8f41b4b..9ed0849 100644 --- a/qmidiplayer-desktop/qmpmainwindow.ui +++ b/qmidiplayer-desktop/qmpmainwindow.ui @@ -6,20 +6,20 @@ 0 0 - 450 - 245 + 495 + 200 - 450 - 245 + 495 + 200 - 450 - 245 + 495 + 200 @@ -33,24 +33,30 @@ :/img/qmidiplyr.png:/img/qmidiplyr.png - + + + 1 + - 2 + 4 - 2 + 0 - 2 + 4 - 2 + 0 - + 0 + + 0 + @@ -71,401 +77,499 @@ somefile.mid - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 - + 0 + + 3 + - + - + 0 0 - 00:00 + <html><head/><body><p>Poly</p></body></html> - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + Qt::AlignCenter - - - 0 - - - - - - 0 - 0 - - - - <html><head/><body><p>Poly</p></body></html> - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - - 84 - 16777215 - - - - QFrame::NoFrame - - - 11 - - - QLCDNumber::Flat - - - - - - - + - - 0 - 0 - - - - 00:00 - - - Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing - - - - - - - - - - 0 - 0 - - - - 100 - - - 0 - - - Qt::Horizontal - - - - - - - 0 - - - - - + 0 0 - 0 - 36 - - - - - 16777215 - 36 + 64 + 0 - + 00000 - - - :/img/play.png:/img/play.png - - - - 32 - 32 - + + Qt::AlignCenter - - - - 0 - 0 - - + 0 - 36 + 3 16777215 - 36 + 3 - - + + QFrame::HLine - - - :/img/stop.png:/img/stop.png - - - - 32 - 32 - + + QFrame::Sunken - + - + 0 0 - 0 - 36 - - - - - 16777215 - 36 + 64 + 0 - + 00000 - - - :/img/prev.png:/img/prev.png - - - - 32 - 32 - + + Qt::AlignCenter + + + + + + 0 + - + - + 0 0 - - - 0 - 36 - - - 16777215 - 36 + 21 + 21 - - - - - :/img/next.png:/img/next.png - - - - 32 - 32 - + ? - + - Qt::Horizontal + Qt::Vertical - QSizePolicy::Fixed + QSizePolicy::Expanding - 32 - 32 + 20 + 40 - - - - - 0 - 0 - - - - - 0 - 36 - - - - - 16777215 - 36 - - - - - - - - :/img/settings.png:/img/settings.png - - - - 32 - 32 - - - - true - - - + + + + + + 0 + + + + + + 0 + 0 + + + + 00:00 + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + - - - - 0 - 32 - + + + + 0 + 0 + + + + 00:00 + + + Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing - - - 0 - - - 6 - - - 0 - - - 6 - - - - + + + + 0 + 0 + + + + QSlider::handle{border:none;background:none;color:none;} + + + 100 + + 0 - + + Qt::Horizontal + + + + + + 0 - + - + 0 0 + + + 0 + 24 + + - 21 - 21 + 16777215 + 36 - ? + + + + + :/img/play.svg:/img/play.svg + + + + 32 + 32 + - + - + 0 0 - - 100 + + + 0 + 24 + - - 50 + + + 16777215 + 36 + + + + + + + + :/img/stop.svg:/img/stop.svg + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 36 + + + + + + + + :/img/prev.svg:/img/prev.svg + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 36 + + + + + + + + :/img/next.svg:/img/next.svg + + + + 32 + 32 + + + + + - Qt::Vertical + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 32 + 32 + + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 36 + + + + + + + + :/img/open.svg:/img/open.svg - + - + 0 0 + + + 0 + 24 + + + + + 16777215 + 36 + + - Master + - - Qt::AlignCenter + + + :/img/settings.svg:/img/settings.svg + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + Vol. + + + + + + + + 0 + 0 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + + + 0 + 24 + + + + + 0 + + + 6 + + + 0 + + + 6 + + + + @@ -477,6 +581,16 @@
qmpmainwindow.hpp
+ + pbPlayPause + pbStop + pbNext + pbPrev + pbSettings + hsTimer + vsMasterVol + pushButton + diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp index b6b133e..d010198 100644 --- a/qmidiplayer-desktop/qmpplistwindow.cpp +++ b/qmidiplayer-desktop/qmpplistwindow.cpp @@ -36,43 +36,43 @@ qmpPlistWindow::qmpPlistWindow(QWidget *parent) : switch(shuffle) { case 1: - ui->pbShuffle->setIcon(QIcon(getThemedIcon(":/img/shuffle.png"))); + ui->pbShuffle->setIcon(QIcon(getThemedIcon(":/img/shuffle.svg"))); ui->pbShuffle->setText("Shuffle On"); break; case 0: default: - ui->pbShuffle->setIcon(QIcon(getThemedIcon(":/img/shuffle-off.png"))); + ui->pbShuffle->setIcon(QIcon(getThemedIcon(":/img/shuffle-off.svg"))); ui->pbShuffle->setText("Shuffle Off"); break; } switch(repeat) { case 0: - ui->pbRepeat->setIcon(QIcon(getThemedIcon(":/img/repeat-non.png"))); + ui->pbRepeat->setIcon(QIcon(getThemedIcon(":/img/repeat-non.svg"))); ui->pbRepeat->setText("Repeat Off"); break; case 1: - ui->pbRepeat->setIcon(QIcon(getThemedIcon(":/img/repeat-one.png"))); + ui->pbRepeat->setIcon(QIcon(getThemedIcon(":/img/repeat-one.svg"))); ui->pbRepeat->setText("Repeat One"); break; case 2: - ui->pbRepeat->setIcon(QIcon(getThemedIcon(":/img/repeat-all.png"))); + ui->pbRepeat->setIcon(QIcon(getThemedIcon(":/img/repeat-all.svg"))); ui->pbRepeat->setText("Repeat All"); break; } delete plist; } - ui->pbAdd->setIcon(QIcon(getThemedIcon(":/img/add.png"))); - ui->pbRemove->setIcon(QIcon(getThemedIcon(":/img/remove.png"))); - ui->pbClear->setIcon(QIcon(getThemedIcon(":/img/clear.png"))); - ui->pbAddFolder->setIcon(QIcon(getThemedIcon(":/img/addfolder.png"))); - ui->pbSave->setIcon(QIcon(getThemedIcon(":/img/save.png"))); - ui->pbLoad->setIcon(QIcon(getThemedIcon(":/img/load.png"))); + ui->pbAdd->setIcon(QIcon(getThemedIcon(":/img/add.svg"))); + ui->pbRemove->setIcon(QIcon(getThemedIcon(":/img/remove.svg"))); + ui->pbClear->setIcon(QIcon(getThemedIcon(":/img/clear.svg"))); + ui->pbAddFolder->setIcon(QIcon(getThemedIcon(":/img/addfolder.svg"))); + ui->pbSave->setIcon(QIcon(getThemedIcon(":/img/save.svg"))); + ui->pbLoad->setIcon(QIcon(getThemedIcon(":/img/load.svg"))); qmpMainWindow::getInstance()->registerFunctionality( plistf=new qmpPlistFunc(this), std::string("Playlist"), tr("Playlist").toStdString(), - getThemedIconc(":/img/list.png"), + getThemedIconc(":/img/list.svg"), 0, true ); @@ -103,6 +103,7 @@ void qmpPlistWindow::showEvent(QShowEvent *event) void qmpPlistWindow::closeEvent(QCloseEvent *event) { setVisible(false); + while(ui->lwFiles->count()>1)delete ui->lwFiles->item(0); if(!qmpMainWindow::getInstance()->isFinalizing()&&qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt()) { qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/PListWShown",0); @@ -159,21 +160,21 @@ void qmpPlistWindow::insertItems(QStringList il) ui->lwFiles->addItems(il); } -void qmpPlistWindow::on_pbAdd_clicked() +int qmpPlistWindow::on_pbAdd_clicked() { QStringList sl; if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt()) sl=QFileDialog::getOpenFileNames(this,"Add File",qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/FileDialogPath","").toString(),"Midi files (*.mid *.midi)"); else sl=QFileDialog::getOpenFileNames(this,"Add File","","Midi files (*.mid *.midi *.rmi)"); - if(sl.empty())return; + if(sl.empty())return 0; for(int i=0;ilwFiles->addItem(new QListWidgetItem(sl.at(i))); - } + if(!isVisible())while(ui->lwFiles->count()>1)delete ui->lwFiles->item(0); if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt()) qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/FileDialogPath", QUrl(sl.at(0)).toString(QUrl::RemoveFilename)); + return 1; } void qmpPlistWindow::on_pbAddFolder_clicked() @@ -213,15 +214,15 @@ void qmpPlistWindow::on_pbRepeat_clicked() switch(repeat) { case 0: - ui->pbRepeat->setIcon(QIcon(":/img/repeat-non.png")); + ui->pbRepeat->setIcon(QIcon(":/img/repeat-non.svg")); ui->pbRepeat->setText(tr("Repeat Off")); break; case 1: - ui->pbRepeat->setIcon(QIcon(":/img/repeat-one.png")); + ui->pbRepeat->setIcon(QIcon(":/img/repeat-one.svg")); ui->pbRepeat->setText(tr("Repeat One")); break; case 2: - ui->pbRepeat->setIcon(QIcon(":/img/repeat-all.png")); + ui->pbRepeat->setIcon(QIcon(":/img/repeat-all.svg")); ui->pbRepeat->setText(tr("Repeat All")); break; } @@ -233,12 +234,12 @@ void qmpPlistWindow::on_pbShuffle_clicked() switch(shuffle) { case 1: - ui->pbShuffle->setIcon(QIcon(":/img/shuffle.png")); + ui->pbShuffle->setIcon(QIcon(":/img/shuffle.svg")); ui->pbShuffle->setText(tr("Shuffle On")); break; case 0: default: - ui->pbShuffle->setIcon(QIcon(":/img/shuffle-off.png")); + ui->pbShuffle->setIcon(QIcon(":/img/shuffle-off.svg")); ui->pbShuffle->setText(tr("Shuffle Off")); break; } @@ -317,27 +318,27 @@ void qmpPlistWindow::on_pbLoad_clicked() switch(shuffle) { case 1: - ui->pbShuffle->setIcon(QIcon(":/img/shuffle.png")); + ui->pbShuffle->setIcon(QIcon(":/img/shuffle.svg")); ui->pbShuffle->setText(tr("Shuffle On")); break; case 0: default: - ui->pbShuffle->setIcon(QIcon(":/img/shuffle-off.png")); + ui->pbShuffle->setIcon(QIcon(":/img/shuffle-off.svg")); ui->pbShuffle->setText(tr("Shuffle Off")); break; } switch(repeat) { case 0: - ui->pbRepeat->setIcon(QIcon(":/img/repeat-non.png")); + ui->pbRepeat->setIcon(QIcon(":/img/repeat-non.svg")); ui->pbRepeat->setText(tr("Repeat Off")); break; case 1: - ui->pbRepeat->setIcon(QIcon(":/img/repeat-one.png")); + ui->pbRepeat->setIcon(QIcon(":/img/repeat-one.svg")); ui->pbRepeat->setText(tr("Repeat One")); break; case 2: - ui->pbRepeat->setIcon(QIcon(":/img/repeat-all.png")); + ui->pbRepeat->setIcon(QIcon(":/img/repeat-all.svg")); ui->pbRepeat->setText(tr("Repeat All")); break; } diff --git a/qmidiplayer-desktop/qmpplistwindow.hpp b/qmidiplayer-desktop/qmpplistwindow.hpp index 9e78a8a..9e1b501 100644 --- a/qmidiplayer-desktop/qmpplistwindow.hpp +++ b/qmidiplayer-desktop/qmpplistwindow.hpp @@ -51,7 +51,7 @@ class qmpPlistWindow : public QDialog void selectionChanging(); public slots: - void on_pbAdd_clicked(); + int on_pbAdd_clicked(); private slots: void on_pbAddFolder_clicked(); void on_pbRemove_clicked(); diff --git a/qmidiplayer-desktop/qmpplistwindow.ui b/qmidiplayer-desktop/qmpplistwindow.ui index 7b4eaa5..4c4c786 100644 --- a/qmidiplayer-desktop/qmpplistwindow.ui +++ b/qmidiplayer-desktop/qmpplistwindow.ui @@ -66,7 +66,7 @@ - :/img/save.png:/img/save.png + :/img/save.svg:/img/save.svg @@ -98,7 +98,7 @@ - :/img/add.png:/img/add.png + :/img/add.svg:/img/add.svg @@ -130,7 +130,7 @@ - :/img/load.png:/img/load.png + :/img/load.svg:/img/load.svg @@ -162,7 +162,7 @@ - :/img/repeat-non.png:/img/repeat-non.png + :/img/repeat-non.svg:/img/repeat-non.svg @@ -194,7 +194,7 @@ - :/img/remove.png:/img/remove.png + :/img/remove.svg:/img/remove.svg @@ -226,7 +226,7 @@ - :/img/addfolder.png:/img/addfolder.png + :/img/addfolder.svg:/img/addfolder.svg @@ -258,7 +258,7 @@ - :/img/shuffle-off.png:/img/shuffle-off.png + :/img/shuffle-off.svg:/img/shuffle-off.svg @@ -290,7 +290,7 @@ - :/img/clear.png:/img/clear.png + :/img/clear.svg:/img/clear.svg diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index 7ff305c..f93cddf 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -179,6 +179,8 @@ bool qmpPluginAPI::isDarkTheme(){return qmw?qmw->isDarkTheme():false;} 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::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);} int qmpPluginAPI::registerEventHandlerIntf(IMidiCallBack *cb,void *userdata) {return qmw->getPlayer()->setEventHandlerCB(cb,userdata);} @@ -192,6 +194,10 @@ void qmpPluginAPI::registerVisualizationIntf(qmpVisualizationIntf* intf,std::str {qmw->registerVisualizationIntf(intf,name,desc,icon,iconlen);} void qmpPluginAPI::unregisterVisualizationIntf(std::string name) {qmw->unregisterVisualizationIntf(name);} +void qmpPluginAPI::registerFunctionality(qmpFuncBaseIntf *i,std::string name,std::string desc,const char *icon,int iconlen,bool checkable) +{qmw->registerFunctionality(i,name,desc,icon,iconlen,checkable);} +void qmpPluginAPI::unregisterFunctionality(std::string name) +{qmw->unregisterFunctionality(name);} int qmpPluginAPI::registerFileReadFinishedHandlerIntf(IMidiCallBack* cb,void* userdata) {return qmw->getPlayer()->setFileReadFinishedCB(cb,userdata);} void qmpPluginAPI::unregisterFileReadFinishedHandlerIntf(int intfhandle) diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index abd8213..3be0a3e 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -8,7 +8,7 @@ QSettings* qmpSettingsWindow::settings=NULL; QComboBox* qmpSettingsWindow::outwidget=NULL; -void qmpFluidForEachOpt(void* data,char* /*name*/,char* option) +void qmpFluidForEachOpt(void* data,char*,char* option) { QComboBox *pcb=(QComboBox*)data; pcb->addItem(option); @@ -24,10 +24,10 @@ qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) : connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); settings=new QSettings(QDir::homePath()+QString("/.config/qmprc"),QSettings::IniFormat); settingsInit();outwidget=ui->cbOutputDevice; - ui->pbAdd->setIcon(QIcon(getThemedIcon(":/img/add.png"))); - ui->pbRemove->setIcon(QIcon(getThemedIcon(":/img/remove.png"))); - ui->pbDown->setIcon(QIcon(getThemedIcon(":/img/down.png"))); - ui->pbUp->setIcon(QIcon(getThemedIcon(":/img/up.png"))); + ui->pbAdd->setIcon(QIcon(getThemedIcon(":/img/add.svg"))); + ui->pbRemove->setIcon(QIcon(getThemedIcon(":/img/remove.svg"))); + ui->pbDown->setIcon(QIcon(getThemedIcon(":/img/down.svg"))); + ui->pbUp->setIcon(QIcon(getThemedIcon(":/img/up.svg"))); cw=new qmpCustomizeWindow(this); } @@ -52,6 +52,7 @@ QComboBox* qmpSettingsWindow::getDefaultOutWidget(){return outwidget;} void qmpSettingsWindow::on_buttonBox_accepted() { settingsUpdate(); + qmpMainWindow::getInstance()->setupWidget(); emit dialogClosing(); } @@ -66,7 +67,6 @@ void qmpSettingsWindow::settingsInit() fluid_settings_t *fsettings=new_fluid_settings(); settings->setValue("Midi/DefaultOutput",settings->value("Midi/DefaultOutput","Internal FluidSynth")); - //this item is still a stub... settings->setValue("Midi/DisableMapping",settings->value("Midi/DisableMapping",0)); ui->cbDisableMapping->setChecked(settings->value("Midi/DisableMapping",0).toInt()); @@ -187,6 +187,9 @@ void qmpSettingsWindow::settingsInit() settings->setValue("Behavior/SingleInstance",settings->value("Behavior/SingleInstance",0)); ui->cbPersistentfs->setChecked(settings->value("Behavior/SingleInstance",0).toInt()); + settings->setValue("Behavior/ShowButtonLabel",settings->value("Behavior/ShowButtonLabel",0)); + ui->cbShowLabel->setChecked(settings->value("Behavior/ShowButtonLabel",0).toInt()); + settings->setValue("Behavior/IconTheme",settings->value("Behavior/IconTheme",0)); ui->cbIconTheme->setCurrentIndex(settings->value("Behavior/IconTheme",0).toInt()); @@ -240,6 +243,8 @@ void qmpSettingsWindow::settingsUpdate() settings->setValue("Behavior/SingleInstance",ui->cbPersistentfs->isChecked()?1:0); + settings->setValue("Behavior/ShowButtonLabel",ui->cbShowLabel->isChecked()?1:0); + settings->setValue("Behavior/IconTheme",ui->cbIconTheme->currentIndex()); if(!ui->cbDialogStatus->isChecked()) diff --git a/qmidiplayer-desktop/qmpsettingswindow.ui b/qmidiplayer-desktop/qmpsettingswindow.ui index 6497d1c..ad359f7 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.ui +++ b/qmidiplayer-desktop/qmpsettingswindow.ui @@ -23,7 +23,7 @@ - 3 + 0 @@ -467,7 +467,7 @@ - :/img/add.png:/img/add.png + :/img/add.svg:/img/add.svg @@ -484,7 +484,7 @@ - :/img/remove.png:/img/remove.png + :/img/remove.svg:/img/remove.svg @@ -501,7 +501,7 @@ - :/img/up.png:/img/up.png + :/img/up.svg:/img/up.svg @@ -518,7 +518,7 @@ - :/img/down.png:/img/down.png + :/img/down.svg:/img/down.svg @@ -540,7 +540,7 @@ - + 0 0 @@ -553,7 +553,7 @@ - + 0 0 @@ -566,7 +566,7 @@ - + 0 0 @@ -579,7 +579,7 @@ - + 0 0 @@ -592,7 +592,7 @@ - + 0 0 @@ -602,6 +602,19 @@ + + + + + 0 + 0 + + + + Show label beside icon in toolbar buttons + + + diff --git a/qmidiplayer-desktop/resources.qrc b/qmidiplayer-desktop/resources.qrc index 044acd8..1249307 100644 --- a/qmidiplayer-desktop/resources.qrc +++ b/qmidiplayer-desktop/resources.qrc @@ -1,56 +1,64 @@ - ../img/add.png - ../img/list.png - ../img/addfolder.png - ../img/channel.png - ../img/prev.png + ../img/add.svg + ../img/list.svg + ../img/addfolder.svg + ../img/channel.svg + ../img/prev.svg ../img/qmidiplyr.png - ../img/remove.png - ../img/clear.png - ../img/down.png - ../img/effects.png - ../img/repeat-all.png - ../img/repeat-base.png - ../img/repeat-non.png - ../img/load.png - ../img/next.png - ../img/repeat-one.png - ../img/save.png - ../img/settings.png - ../img/pause.png - ../img/play.png - ../img/shuffle-off.png - ../img/shuffle.png - ../img/stop.png - ../img/up.png - ../img/visualization.png - ../img/add_i.png - ../img/list_i.png - ../img/addfolder_i.png - ../img/channel_i.png - ../img/prev_i.png - ../img/remove_i.png - ../img/clear_i.png - ../img/down_i.png - ../img/effects_i.png - ../img/repeat-all_i.png - ../img/repeat-base_i.png - ../img/repeat-non_i.png - ../img/load_i.png - ../img/next_i.png - ../img/repeat-one_i.png - ../img/save_i.png - ../img/settings_i.png - ../img/pause_i.png - ../img/play_i.png - ../img/shuffle-off_i.png - ../img/shuffle_i.png - ../img/stop_i.png - ../img/up_i.png - ../img/visualization_i.png - ../img/ledon.png - ../img/ledoff.png + ../img/remove.svg + ../img/clear.svg + ../img/down.svg + ../img/effects.svg + ../img/repeat-all.svg + ../img/repeat-non.svg + ../img/load.svg + ../img/next.svg + ../img/repeat-one.svg + ../img/repeat-base.svg + ../img/save.svg + ../img/settings.svg + ../img/pause.svg + ../img/play.svg + ../img/shuffle-off.svg + ../img/shuffle.svg + ../img/stop.svg + ../img/up.svg + ../img/visualization.svg + ../img/add_i.svg + ../img/list_i.svg + ../img/addfolder_i.svg + ../img/channel_i.svg + ../img/prev_i.svg + ../img/remove_i.svg + ../img/clear_i.svg + ../img/down_i.svg + ../img/effects_i.svg + ../img/repeat-all_i.svg + ../img/repeat-non_i.svg + ../img/load_i.svg + ../img/next_i.svg + ../img/repeat-one_i.svg + ../img/repeat-base_i.svg + ../img/save_i.svg + ../img/settings_i.svg + ../img/pause_i.svg + ../img/play_i.svg + ../img/shuffle-off_i.svg + ../img/shuffle_i.svg + ../img/stop_i.svg + ../img/up_i.svg + ../img/visualization_i.svg + ../img/open.svg + ../img/info.svg + ../img/render.svg + ../img/panic.svg + ../img/open_i.svg + ../img/info_i.svg + ../img/render_i.svg + ../img/panic_i.svg + ../img/ledon.svg + ../img/ledoff.svg ../doc/index_internal.html ../doc/version_internal.html ../doc/license_internal.html -- cgit v1.2.3