From 841eb920676d6c8ac6440c8929e7422e95a9c4c5 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 10 Apr 2016 23:39:45 +0800 Subject: The Last Judgement. --- qmidiplayer-desktop/qmpchannelswindow.cpp | 26 +++++++++++++++++++++++++- qmidiplayer-desktop/qmpsettingswindow.cpp | 9 +++++---- qmidiplayer-desktop/qmpsettingswindow.hpp | 6 +++++- 3 files changed, 35 insertions(+), 6 deletions(-) (limited to 'qmidiplayer-desktop') 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;iaddItem(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;jaddItem(mapper->deviceName(j).c_str()); + for(int j=0;jaddItem(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 #include #include +#include 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 -- cgit v1.2.3