diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-04-10 23:39:45 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-04-10 23:39:45 +0800 |
commit | 841eb920676d6c8ac6440c8929e7422e95a9c4c5 (patch) | |
tree | c28dd11fb908682e69d5eb6dc953d1e5bf66b5a7 /qmidiplayer-desktop | |
parent | e0e4f9f84bb8eed6cde71ff4d67286c2e26e4693 (diff) | |
download | QMidiPlayer-841eb920676d6c8ac6440c8929e7422e95a9c4c5.tar.xz |
The Last Judgement.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.cpp | 26 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 9 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.hpp | 6 |
3 files changed, 35 insertions, 6 deletions
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 17c0893..0c33043 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -20,6 +20,18 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : qmpMainWindow::getInstance()->getPlayer()->setNoteOnCallBack(cb,NULL); connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity())); int devc=mapper->enumDevices(); + //We setup default output here... + //Pretty strange... + for(int i=0;i<devc;++i) + { + qmpSettingsWindow::getDefaultOutWidget()->addItem(mapper->deviceName(i).c_str()); + if(!QString(mapper->deviceName(i).c_str()).compare(qmpSettingsWindow::getSettingsIntf()-> + value("Midi/DefaultOutput","Internal FluidSynth").toString())) + qmpSettingsWindow::getDefaultOutWidget()->setCurrentIndex(i+1); + } + qmpSettingsWindow::getSettingsIntf()->setValue("Midi/DefaultOutput", + qmpSettingsWindow::getDefaultOutWidget()->currentText()); + qmpSettingsWindow::getSettingsIntf(); for(int i=0;i<16;++i) { ui->twChannels->setItem(i,0,new QTableWidgetItem()); @@ -32,7 +44,19 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : ui->twChannels->setCellWidget(i,3,new QDCComboBox()); QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,3); cb->addItem("Internal FluidSynth");cb->setID(i); - for(int j=0;j<devc;++j)cb->addItem(mapper->deviceName(j).c_str()); + for(int j=0;j<devc;++j) + { + cb->addItem(mapper->deviceName(j).c_str()); + if(!qmpSettingsWindow::getSettingsIntf()-> + value("Midi/DefaultOutput","Internal FluidSynth").toString().compare( + QString(mapper->deviceName(j).c_str()))) + { + cb->setCurrentIndex(j+1); + changeMidiMapping(i,j+1); + } + } + if(qmpSettingsWindow::getSettingsIntf()->value("Midi/DisableMapping",0).toInt()) + cb->setEnabled(false); connect(cb,SIGNAL(onChange(int,int)),this,SLOT(changeMidiMapping(int,int))); ui->twChannels->setCellWidget(i,4,new QDCLabel("")); ((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i); diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index 2074972..2e6af6d 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -4,7 +4,8 @@ #include "ui_qmpsettingswindow.h" #include "qmpmainwindow.hpp" -QSettings *qmpSettingsWindow::settings=NULL; +QSettings* qmpSettingsWindow::settings=NULL; +QComboBox* qmpSettingsWindow::outwidget=NULL; void qmpFluidForEachOpt(void* data,char* /*name*/,char* option) { @@ -19,7 +20,7 @@ qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) : ui->setupUi(this); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); settings=new QSettings(QDir::homePath()+QString("/.config/qmprc"),QSettings::IniFormat); - settingsInit(); + settingsInit();outwidget=ui->cbOutputDevice; } qmpSettingsWindow::~qmpSettingsWindow() @@ -37,6 +38,7 @@ void qmpSettingsWindow::closeEvent(QCloseEvent *event) } QListWidget* qmpSettingsWindow::getSFWidget(){return ui->lwSoundfont;} +QComboBox* qmpSettingsWindow::getDefaultOutWidget(){return outwidget;} void qmpSettingsWindow::on_buttonBox_accepted() { @@ -173,8 +175,7 @@ void qmpSettingsWindow::settingsInit() void qmpSettingsWindow::settingsUpdate() { - settings->setValue("Midi/DefaultOutput",settings->value("Midi/DefaultOutput","Internal FluidSynth")); - //this item is still a stub... + settings->setValue("Midi/DefaultOutput",ui->cbOutputDevice->currentText()); settings->setValue("Midi/DisableMapping",ui->cbDisableMapping->isChecked()?1:0); diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp index c506de4..cac691e 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.hpp +++ b/qmidiplayer-desktop/qmpsettingswindow.hpp @@ -5,6 +5,7 @@ #include <QCloseEvent> #include <QSettings> #include <QListWidget> +#include <QComboBox> namespace Ui { class qmpSettingsWindow; @@ -41,7 +42,10 @@ class qmpSettingsWindow:public QDialog Ui::qmpSettingsWindow *ui; void settingsUpdate(); static QSettings *settings; - public: static QSettings* getSettingsIntf(){return settings;} + static QComboBox* outwidget; + public: + static QSettings* getSettingsIntf(){return settings;} + static QComboBox* getDefaultOutWidget(); }; #endif // QMPSETTINGSWINDOW_H |