diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-06-18 00:51:29 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-06-18 00:51:29 +0800 |
commit | 19c89fc7baa299e523e152a14066ebc8ce23af21 (patch) | |
tree | 893d2643b57cb03092ab520b64dabff753437bbc | |
parent | 795043d6851a355d70aa2341e2edfd526c24d041 (diff) | |
download | QMidiPlayer-19c89fc7baa299e523e152a14066ebc8ce23af21.tar.xz |
Device initialization file implementation (part 1).
Added UI for external device configuration.
Instrument mapping portion of the device intialization file is now working.
Fixed a few spots where return value of getChannelPreset() is ignored.
Fixed layout of the preset selection dialog.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | core/qmpmidioutfluid.cpp | 3 | ||||
-rw-r--r-- | core/qmpmidioutfluid.hpp | 2 | ||||
-rw-r--r-- | core/qmpmidioutrtmidi.cpp | 52 | ||||
-rw-r--r-- | core/qmpmidioutrtmidi.hpp | 5 | ||||
-rw-r--r-- | include/qmpcorepublic.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmidiplayer-desktop.pro | 9 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.cpp | 8 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpdevpropdialog.cpp | 96 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpdevpropdialog.hpp | 31 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpdevpropdialog.ui | 101 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpmainwindow.cpp | 7 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmppresetselect.cpp | 8 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmppresetselect.ui | 18 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 8 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.hpp | 4 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.ui | 36 |
17 files changed, 371 insertions, 27 deletions
@@ -1,3 +1,11 @@ +2019-06-17 0.8.7 indev +Device initialization file implementation (part 1). + +Added UI for external device configuration. +Instrument mapping portion of the device intialization file is now working. +Fixed a few spots where return value of getChannelPreset() is ignored. +Fixed layout of the preset selection dialog. + 2019-06-16 0.8.7 indev Inital implementation of the device properties API. diff --git a/core/qmpmidioutfluid.cpp b/core/qmpmidioutfluid.cpp index 414cb3a..ac6523f 100644 --- a/core/qmpmidioutfluid.cpp +++ b/core/qmpmidioutfluid.cpp @@ -123,7 +123,7 @@ std::vector<std::pair<uint16_t,std::string>> qmpMidiOutFluid::getBankList() { return bnk; } -std::vector<std::pair<uint8_t,std::string>> qmpMidiOutFluid::getPresets(int bank) +std::vector<std::pair<uint8_t,std::string>> qmpMidiOutFluid::getPresets(uint16_t bank) { std::vector<std::pair<uint8_t,std::string>> ret; if(pst.find(bank)==pst.end())return ret; @@ -137,6 +137,7 @@ std::vector<std::pair<uint8_t,std::string>> qmpMidiOutFluid::getPresets(int bank std::string qmpMidiOutFluid::getPresetName(uint16_t bank,uint8_t preset) { if(pst.find(bank)==pst.end())return ""; + //should consult fluidsynth instead? (4 bank mapping methods) return pst[bank][preset]; } bool qmpMidiOutFluid::getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname) diff --git a/core/qmpmidioutfluid.hpp b/core/qmpmidioutfluid.hpp index 72197e7..d6a62c9 100644 --- a/core/qmpmidioutfluid.hpp +++ b/core/qmpmidioutfluid.hpp @@ -41,7 +41,7 @@ class qmpMidiOutFluid:public qmpMidiOutDevice,public IFluidSettings void onMapped(uint8_t ch,int refcnt); void onUnmapped(uint8_t ch,int refcnt); std::vector<std::pair<uint16_t,std::string>> getBankList(); - std::vector<std::pair<uint8_t,std::string>> getPresets(int bank); + std::vector<std::pair<uint8_t,std::string>> getPresets(uint16_t bank); std::string getPresetName(uint16_t bank,uint8_t preset); bool getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname); uint8_t getInitialCCValue(uint8_t cc); diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp index 0ff2c86..2cc9d5b 100644 --- a/core/qmpmidioutrtmidi.cpp +++ b/core/qmpmidioutrtmidi.cpp @@ -1,6 +1,7 @@ #include <cctype> #include <cstdio> #include <cstring> +#include <algorithm> #include <deque> #include <vector> #include RT_MIDI_H @@ -132,6 +133,27 @@ qmpDeviceInitializer* qmpDeviceInitializer::parse(const char* path) } } } + else if(st_inmapping) + { + if(b.front()=='['&&b.back()==']') + { + b=b.substr(1,b.length()-2); + split(b,':',tok); + if(tok.size()<3)err("invalid bank") + cmsb=strtol(tok[0].c_str(),nullptr,10); + clsb=strtol(tok[1].c_str(),nullptr,10); + ret->banks[cmsb<<7|clsb]=BankStore{{},tok[2]}; + } + else if(b.find('=')!=std::string::npos) + { + if(!~cmsb||!~clsb)err("inst outside a bank") + split(b,'=',tok); + if(tok.size()<2)err("invalid inst") + int p=strtol(tok[0].c_str(),nullptr,10); + ret->banks[cmsb<<7|clsb].presets[p]=tok[1]; + } + else err("invalid mapping line") + } } #undef err @@ -143,10 +165,12 @@ qmpMidiOutRtMidi::qmpMidiOutRtMidi(unsigned _portid) { portid=_portid; outport=nullptr; + devinit=nullptr; } qmpMidiOutRtMidi::~qmpMidiOutRtMidi() { if(!outport)return; + if(devinit){delete devinit;devinit=nullptr;} if(outport->isPortOpen())outport->closePort(); delete outport;outport=nullptr; } @@ -229,18 +253,44 @@ void qmpMidiOutRtMidi::onUnmapped(uint8_t ch,int refcnt) } std::vector<std::pair<uint16_t,std::string>> qmpMidiOutRtMidi::getBankList() { + if(!devinit)return{}; + std::vector<std::pair<uint16_t,std::string>> ret; + for(auto&i:devinit->banks) + ret.push_back({i.first,i.second.bankname}); + std::sort(ret.begin(),ret.end(),[](std::pair<uint16_t,std::string>&a,std::pair<uint16_t,std::string>&b){return a.first<b.first;}); + return ret; } -std::vector<std::pair<uint8_t,std::string>> qmpMidiOutRtMidi::getPresets(int bank) +std::vector<std::pair<uint8_t,std::string>> qmpMidiOutRtMidi::getPresets(uint16_t bank) { + if(!devinit)return{}; + if(devinit->banks.find(bank)==devinit->banks.end())return{}; + std::vector<std::pair<uint8_t,std::string>> ret; + for(auto&i:devinit->banks[bank].presets) + ret.push_back({i.first,i.second}); + std::sort(ret.begin(),ret.end(),[](std::pair<uint8_t,std::string>&a,std::pair<uint8_t,std::string>&b){return a.first<b.first;}); + return ret; } std::string qmpMidiOutRtMidi::getPresetName(uint16_t bank,uint8_t preset) { + if(!devinit)return""; + if(devinit->banks.find(bank)!=devinit->banks.end()) + if(devinit->banks[bank].presets.find(preset)!=devinit->banks[bank].presets.end()) + return devinit->banks[bank].presets[preset]; + return""; } bool qmpMidiOutRtMidi::getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname) { + //This ain't a state-tracking device + return false; } uint8_t qmpMidiOutRtMidi::getInitialCCValue(uint8_t cc) { + if(!devinit)return 0;//Nope! +} +void qmpMidiOutRtMidi::setInitializerFile(const char* path) +{ + if(devinit)delete devinit; + devinit=qmpDeviceInitializer::parse(path); } RtMidiOut* qmpRtMidiManager::dummy=nullptr; diff --git a/core/qmpmidioutrtmidi.hpp b/core/qmpmidioutrtmidi.hpp index 23adec6..0c1843c 100644 --- a/core/qmpmidioutrtmidi.hpp +++ b/core/qmpmidioutrtmidi.hpp @@ -23,6 +23,7 @@ class qmpMidiOutRtMidi:public qmpMidiOutDevice private: unsigned portid; RtMidiOut* outport; + qmpDeviceInitializer* devinit; public: qmpMidiOutRtMidi(unsigned _portid); ~qmpMidiOutRtMidi(); @@ -37,10 +38,12 @@ public: void onMapped(uint8_t ch,int refcnt); void onUnmapped(uint8_t ch,int refcnt); std::vector<std::pair<uint16_t,std::string>> getBankList(); - std::vector<std::pair<uint8_t,std::string>> getPresets(int bank); + std::vector<std::pair<uint8_t,std::string>> getPresets(uint16_t bank); std::string getPresetName(uint16_t bank,uint8_t preset); bool getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname); uint8_t getInitialCCValue(uint8_t cc); + + void setInitializerFile(const char* path); }; class qmpRtMidiManager { diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp index 34e4ea6..178fa19 100644 --- a/include/qmpcorepublic.hpp +++ b/include/qmpcorepublic.hpp @@ -95,7 +95,7 @@ class qmpMidiOutDevice virtual void onMapped(uint8_t ch,int refcnt)=0; virtual void onUnmapped(uint8_t ch,int refcnt)=0; virtual std::vector<std::pair<uint16_t,std::string>> getBankList()=0; - virtual std::vector<std::pair<uint8_t,std::string>> getPresets(int bank)=0; + virtual std::vector<std::pair<uint8_t,std::string>> getPresets(uint16_t bank)=0; virtual std::string getPresetName(uint16_t bank,uint8_t preset)=0; virtual bool getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname)=0; virtual uint8_t getInitialCCValue(uint8_t cc)=0; diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro index d942f23..3d127bb 100644 --- a/qmidiplayer-desktop/qmidiplayer-desktop.pro +++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro @@ -29,7 +29,8 @@ SOURCES += main.cpp\ qmpplugin.cpp \ qmpcustomizewindow.cpp \ ../core/qmpmidioutrtmidi.cpp \ - ../core/qmpmidioutfluid.cpp + ../core/qmpmidioutfluid.cpp \ + qmpdevpropdialog.cpp HEADERS += qmpmainwindow.hpp \ ../core/qmpmidiplay.hpp \ @@ -46,7 +47,8 @@ HEADERS += qmpmainwindow.hpp \ qmpplugin.hpp \ qmpcustomizewindow.hpp \ ../core/qmpmidioutrtmidi.hpp \ - ../core/qmpmidioutfluid.hpp + ../core/qmpmidioutfluid.hpp \ + qmpdevpropdialog.hpp FORMS += qmpmainwindow.ui \ qmpplistwindow.ui \ @@ -57,7 +59,8 @@ FORMS += qmpmainwindow.ui \ qmpinfowindow.ui \ qmpsettingswindow.ui \ qmphelpwindow.ui \ - qmpcustomizewindow.ui + qmpcustomizewindow.ui \ + qmpdevpropdialog.ui TRANSLATIONS += translations/qmp_zh_CN.ts DEFINES += BUILD_MACHINE=$${QMAKE_HOST.name} diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 5a6a2de..b029e3e 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -156,8 +156,14 @@ void qmpChannelsWindow::channelWindowsUpdate() char data[128]; std::string nm; uint16_t b;uint8_t p; - qmpMainWindow::getInstance()->getPlayer()->getChannelOutputDevice(i)->getChannelPreset(i,&b,&p,nm); + CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer(); + bool r=plyr->getChannelOutputDevice(i)->getChannelPreset(i,&b,&p,nm); sprintf(data,"%03d:%03d %s",b,p,nm.c_str()); + if(!r) + { + nm=plyr->getChannelOutputDevice(i)->getPresetName(plyr->getCC(i,0)<<7|plyr->getCC(i,32),plyr->getCC(i,128)); + sprintf(data,"%03d:%03d:%03d %s",plyr->getCC(i,0),plyr->getCC(i,32),plyr->getCC(i,128),nm.c_str()); + } if(fused) { if(strcmp((ui->twChannels->item(i,4))-> diff --git a/qmidiplayer-desktop/qmpdevpropdialog.cpp b/qmidiplayer-desktop/qmpdevpropdialog.cpp new file mode 100644 index 0000000..0159a63 --- /dev/null +++ b/qmidiplayer-desktop/qmpdevpropdialog.cpp @@ -0,0 +1,96 @@ +#include <QComboBox> +#include <QHBoxLayout> +#include <QLabel> +#include <QFileDialog> +#include <QTableWidgetItem> +#include <QCheckBox> +#include "qmpdevpropdialog.hpp" +#include "qmpmainwindow.hpp" +#include "qmpsettingswindow.hpp" +#include "ui_qmpdevpropdialog.h" + +qmpDevPropDialog::qmpDevPropDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::qmpDevPropDialog) +{ + ui->setupUi(this); +} + +qmpDevPropDialog::~qmpDevPropDialog() +{ + delete ui; +} + +void qmpDevPropDialog::launch() +{ + QSettings *s=qmpSettingsWindow::getSettingsIntf(); + ui->twProps->clearContents(); + ui->twProps->setRowCount(0); + s->beginGroup("DevInit"); + for(auto&k:s->allKeys()) + setupRow(k,s->value(k).toString()); + s->endGroup(); + show(); +} + +void qmpDevPropDialog::on_pbAdd_clicked() +{ + setupRow(); +} + +void qmpDevPropDialog::on_pbRemove_clicked() +{ + ui->twProps->removeRow(ui->twProps->currentRow()); +} + +void qmpDevPropDialog::setupRow(const QString&dn,const QString&din) +{ + int r; + ui->twProps->insertRow(r=ui->twProps->rowCount()); + ui->twProps->setRowHeight(r,32); + QComboBox *cb; + ui->twProps->setCellWidget(r,0,cb=new QComboBox); + for(auto&s:qmpMainWindow::getInstance()->getPlayer()->getMidiOutDevices()) + if(s!="Internal FluidSynth")cb->addItem(QString::fromStdString(s)); + QWidget *fw=new QWidget; + QLabel *lb;QPushButton *pb; + fw->setLayout(new QHBoxLayout); + fw->layout()->addWidget(lb=new QLabel); + lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); + if(din.length()){lb->setText(din);fw->setProperty("fn",din);} + fw->layout()->addWidget(pb=new QPushButton); + pb->setText("..."); + pb->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); + QCheckBox *cbx; + ui->twProps->setCellWidget(r,1,cbx=new QCheckBox); + cbx->setEnabled(false); + cbx->setChecked(false); + ui->twProps->setCellWidget(r,2,fw); + ui->twProps->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents); + connect(cb,&QComboBox::currentTextChanged,this,[this,r](const QString&s){ + bool conn=false; + for(auto&ds:qmpMainWindow::getInstance()->getPlayer()->getMidiOutDevices()) + if(s==QString::fromStdString(ds)){conn=true;break;} + ((QCheckBox*)ui->twProps->cellWidget(r,1))->setChecked(conn); + }); + if(dn.length())cb->setCurrentText(dn); + emit cb->currentTextChanged(cb->currentText()); + connect(pb,&QPushButton::clicked,this,[this,lb,fw]{ + lb->setText(QFileDialog::getOpenFileUrl(this,"Select Device Initialization File",QUrl()).path()); + fw->setProperty("fn",lb->text()); + }); +} + +void qmpDevPropDialog::on_buttonBox_accepted() +{ + QSettings *s=qmpSettingsWindow::getSettingsIntf(); + s->beginGroup("DevInit"); + s->remove(""); + for(int i=0;i<ui->twProps->rowCount();++i) + { + s->setValue(((QComboBox*)ui->twProps->cellWidget(i,0))->currentText(), + ui->twProps->cellWidget(i,2)->property("fn").toString()); + } + s->endGroup(); + s->sync(); +} diff --git a/qmidiplayer-desktop/qmpdevpropdialog.hpp b/qmidiplayer-desktop/qmpdevpropdialog.hpp new file mode 100644 index 0000000..cd0d150 --- /dev/null +++ b/qmidiplayer-desktop/qmpdevpropdialog.hpp @@ -0,0 +1,31 @@ +#ifndef QMPDEVPROPDIALOG_HPP +#define QMPDEVPROPDIALOG_HPP + +#include <QDialog> + +namespace Ui { +class qmpDevPropDialog; +} + +class qmpDevPropDialog : public QDialog +{ + Q_OBJECT + + public: + explicit qmpDevPropDialog(QWidget *parent = nullptr); + void launch(); + ~qmpDevPropDialog(); + + private slots: + void on_pbAdd_clicked(); + + void on_pbRemove_clicked(); + + void on_buttonBox_accepted(); + + private: + Ui::qmpDevPropDialog *ui; + void setupRow(const QString &dn="",const QString &din=""); +}; + +#endif // QMPDEVPROPDIALOG_HPP diff --git a/qmidiplayer-desktop/qmpdevpropdialog.ui b/qmidiplayer-desktop/qmpdevpropdialog.ui new file mode 100644 index 0000000..6cea5c0 --- /dev/null +++ b/qmidiplayer-desktop/qmpdevpropdialog.ui @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>qmpDevPropDialog</class> + <widget class="QDialog" name="qmpDevPropDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>566</width> + <height>388</height> + </rect> + </property> + <property name="windowTitle"> + <string>External Output Device Setup</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTableWidget" name="twProps"> + <column> + <property name="text"> + <string>Device</string> + </property> + </column> + <column> + <property name="text"> + <string>Connected?</string> + </property> + </column> + <column> + <property name="text"> + <string>Device Initialization File</string> + </property> + </column> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="pbAdd"> + <property name="text"> + <string>+</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbRemove"> + <property name="text"> + <string>-</string> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>qmpDevPropDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>qmpDevPropDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index cd00b2e..cc8b80d 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -85,7 +85,12 @@ void qmpMainWindow::init() rtmididev=new qmpRtMidiManager(); rtmididev->createDevices(); std::vector<std::pair<qmpMidiOutRtMidi*,std::string>> rtdev=rtmididev->getDevices(); - for(auto &i:rtdev)player->registerMidiOutDevice(i.first,i.second); + for(auto &i:rtdev) + { + player->registerMidiOutDevice(i.first,i.second); + QString di=qmpSettingsWindow::getSettingsIntf()->value(QString("DevInit/%1").arg(QString::fromStdString(i.second)),"").toString(); + if(di.length())i.first->setInitializerFile(di.toUtf8().data()); + } reloadsynf=new qmpReloadSynthFunc(this); playerSetup(player->fluid());player->fluid()->deviceInit(); loadSoundFont(player->fluid()); diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp index a32aa99..6683e49 100644 --- a/qmidiplayer-desktop/qmppresetselect.cpp +++ b/qmidiplayer-desktop/qmppresetselect.cpp @@ -34,6 +34,7 @@ void qmpPresetSelector::setupWindow(int chid) sprintf(name,"Preset Selection - Channel #%d",ch+1); setWindowTitle(name); r=plyr->getChannelOutputDevice(ch)->getChannelPreset(ch,&b,&p,pstname); + if(!r){b=plyr->getCC(ch,0)<<7|plyr->getCC(ch,32);p=plyr->getCC(ch,128);} ui->lwBankSelect->blockSignals(true); ui->lwBankSelect->clear(); ui->lwPresetSelect->clear(); @@ -80,7 +81,14 @@ void qmpPresetSelector::on_pbOk_clicked() { CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer(); if(plyr->getChannelOutput(ch)){ + if(ui->spCustomMSB->isEnabled()) plyr->setChannelPreset(ch,(ui->spCustomMSB->value()<<7)|ui->spCustomLSB->value(),ui->spCustomPC->value()); + else + { + int b=ui->lwBankSelect->currentItem()->text().split(' ').first().toInt(); + int p=ui->lwPresetSelect->currentItem()->text().split(' ').first().toInt(); + plyr->setChannelPreset(ch,b,p); + } } else{ if(!ui->lwBankSelect->currentItem()||!ui->lwPresetSelect->currentItem())return (void)close(); diff --git a/qmidiplayer-desktop/qmppresetselect.ui b/qmidiplayer-desktop/qmppresetselect.ui index a52b97b..0168d19 100644 --- a/qmidiplayer-desktop/qmppresetselect.ui +++ b/qmidiplayer-desktop/qmppresetselect.ui @@ -1,25 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>qmpPresetSelector</class> - <widget class="QDialog" name="qmpPresetSelector"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>404</width> - <height>300</height> - </rect> - </property> + <widget class="QDialog" name="qmpPresetSelector">\ <property name="minimumSize"> <size> - <width>404</width> + <width>480</width> <height>300</height> </size> </property> <property name="maximumSize"> <size> - <width>404</width> - <height>300</height> + <width>16777215</width> + <height>16777215</height> </size> </property> <property name="windowTitle"> @@ -47,7 +39,7 @@ </property> <property name="maximumSize"> <size> - <width>64</width> + <width>16777215</width> <height>16777215</height> </size> </property> diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index b14ff4d..08a76fd 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -30,11 +30,12 @@ qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) : ui->pbDown->setIcon(QIcon(getThemedIcon(":/img/down.svg"))); ui->pbUp->setIcon(QIcon(getThemedIcon(":/img/up.svg"))); cw=new qmpCustomizeWindow(this); + dps=new qmpDevPropDialog(this); } qmpSettingsWindow::~qmpSettingsWindow() { - delete cw; + delete cw;delete dps; delete settings;settings=nullptr; delete ui; } @@ -740,3 +741,8 @@ void QFileEdit::chooseFile() QString s=QFileDialog::getOpenFileName(nullptr,tr("Select a file"),QFileInfo(text()).dir().absolutePath()); if(s.length())setText(s); } + +void qmpSettingsWindow::on_pbExtDevSetup_clicked() +{ + dps->launch(); +} diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp index f186969..72b0aa1 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.hpp +++ b/qmidiplayer-desktop/qmpsettingswindow.hpp @@ -14,6 +14,7 @@ #include <QFormLayout> #include "qmpplugin.hpp" #include "qmpcustomizewindow.hpp" +#include "qmpdevpropdialog.hpp" namespace Ui { class qmpSettingsWindow; @@ -130,6 +131,8 @@ class qmpSettingsWindow:public QDialog void on_pbCustomizeAct_clicked(); + void on_pbExtDevSetup_clicked(); + private: Ui::qmpSettingsWindow *ui; void settingsUpdate(); @@ -137,6 +140,7 @@ class qmpSettingsWindow:public QDialog std::map<std::string,QGridLayout*> customOptPages; void updateCustomOptions(); qmpCustomizeWindow *cw; + qmpDevPropDialog *dps; static QSettings *settings; static QComboBox* outwidget; public: diff --git a/qmidiplayer-desktop/qmpsettingswindow.ui b/qmidiplayer-desktop/qmpsettingswindow.ui index dc9a8b0..a2400c5 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.ui +++ b/qmidiplayer-desktop/qmpsettingswindow.ui @@ -35,7 +35,7 @@ <item> <widget class="QLabel" name="lbOutputDevice"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -48,7 +48,7 @@ <item> <widget class="QComboBox" name="cbOutputDevice"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -101,7 +101,7 @@ <item> <widget class="QLabel" name="lbEncoding"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -178,6 +178,36 @@ </item> </layout> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="lbExtDevSetup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>External MIDI output device setup</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbExtDevSetup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> <widget class="QWidget" name="tab_2"> |