aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp44
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp70
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp4
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.ui14
5 files changed, 91 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index d1457fd..20a6fc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
2016-05-28 0.8.2 alpha
+Allow disabling soundfonts in the soundfont setting tab.
+
+2016-05-28 0.8.2 alpha
Add option to tweak the OSD. More info shown in the OSD.
Bump version. We have stayed at 0.8.1 for a long time
and the visualization plugin is almost fully functional now.
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index 633489c..aaca753 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -8,6 +8,7 @@
#include <QDirIterator>
#include <QDesktopWidget>
#include <QMessageBox>
+#include <QCheckBox>
#include "qmpmainwindow.hpp"
#include "ui_qmpmainwindow.h"
#include "../core/qmpmidiplay.hpp"
@@ -23,7 +24,7 @@ char* wcsto8bit(const wchar_t* s)
}
#define LOAD_SOUNDFONT \
{\
- char* c=wcsto8bit(settingsw->getSFWidget()->item(i)->text().toStdWString().c_str());\
+ char* c=wcsto8bit(settingsw->getSFWidget()->item(i,1)->text().toStdWString().c_str());\
player->pushSoundFont(c);\
free(c);\
}
@@ -36,7 +37,7 @@ char* wcsto8bit(const wchar_t* s)
}
#else
#define LOAD_SOUNDFONT \
- player->pushSoundFont(settingsw->getSFWidget()->item(i)->text().toStdString().c_str())
+ player->pushSoundFont(settingsw->getSFWidget()->item(i,1)->text().toStdString().c_str())
#define LOAD_FILE \
{\
for(int i=0;i<16;++i)if(VIs[i])VIs[i]->reset();\
@@ -96,8 +97,9 @@ void qmpMainWindow::init()
ui->lbFileName->addAction(fnA3);
pmgr->scanPlugins();settingsw->updatePluginList(pmgr);pmgr->initPlugins();
if(singleFS){player->fluidPreInitialize();playerSetup();player->fluidInitialize();
- for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;}
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }}
if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus",0).toInt())
{
QRect g=geometry();
@@ -257,8 +259,9 @@ void qmpMainWindow::updateWidgets()
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()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;}
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }}
for(int i=0;i<16;++i)if(VIs[i])VIs[i]->start();
player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
@@ -283,8 +286,9 @@ void qmpMainWindow::updateWidgets()
player->fluidPreInitialize();
playerSetup();
player->fluidInitialize();
- for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }
}
}
}
@@ -380,8 +384,10 @@ void qmpMainWindow::on_pbPlayPause_clicked()
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()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;}
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }
+ }
for(int i=0;i<16;++i)if(VIs[i])VIs[i]->start();
player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
@@ -535,8 +541,9 @@ void qmpMainWindow::on_pbPrev_clicked()
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()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;}
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }}
for(int i=0;i<16;++i)if(VIs[i])VIs[i]->start();
player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
@@ -564,8 +571,9 @@ void qmpMainWindow::on_pbNext_clicked()
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()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;}
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }}
for(int i=0;i<16;++i)if(VIs[i])VIs[i]->start();
player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
@@ -596,8 +604,9 @@ void qmpMainWindow::selectionChanged()
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()->count()-1;i>=0;--i)
- LOAD_SOUNDFONT;}
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
+ LOAD_SOUNDFONT;
+ }}
for(int i=0;i<16;++i)if(VIs[i])VIs[i]->start();
player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();
player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt());
@@ -676,8 +685,9 @@ void qmpMainWindow::onfnA2()
playerSetup();player->rendererInit(plistw->getSelectedItem().toStdString().c_str());
#endif
ui->centralWidget->setEnabled(false);
- for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i)
+ for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue;
LOAD_SOUNDFONT;
+ }
player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();timer->start(UPDATE_INTERVAL);
renderTh=new std::thread(&CMidiPlayer::rendererThread,player);
}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index 7e441e8..67bfbb2 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -40,7 +40,7 @@ void qmpSettingsWindow::closeEvent(QCloseEvent *event)
event->accept();
}
-QListWidget* qmpSettingsWindow::getSFWidget(){return ui->lwSoundfont;}
+QTableWidget* qmpSettingsWindow::getSFWidget(){return ui->twSoundfont;}
QComboBox* qmpSettingsWindow::getDefaultOutWidget(){return outwidget;}
void qmpSettingsWindow::on_buttonBox_accepted()
@@ -153,8 +153,17 @@ void qmpSettingsWindow::settingsInit()
settings->setValue("Audio/Gain",settings->value("Audio/Gain",50));
int sfc=settings->value("SoundFonts/SFCount",0).toInt();
- ui->lwSoundfont->clear();for(int i=1;i<=sfc;++i)
- ui->lwSoundfont->addItem(settings->value("SoundFonts/SF"+QString::number(i),"").toString());
+ ui->twSoundfont->clear();for(int i=1;i<=sfc;++i)
+ {
+ ui->twSoundfont->insertRow(i-1);
+ ui->twSoundfont->setItem(i-1,1,new QTableWidgetItem(settings->value("SoundFonts/SF"+QString::number(i),"").toString()));
+ ui->twSoundfont->setCellWidget(i-1,0,new QCheckBox(""));
+ ((QCheckBox*)ui->twSoundfont->cellWidget(i-1,0))->setChecked(settings->value("SoundFonts/SF"+QString::number(i)+"Enabled",1).toInt());
+ }
+ ui->twSoundfont->setColumnWidth(0,22*logicalDpiX()/96.);
+ ui->twSoundfont->setColumnWidth(1,400*logicalDpiX()/96.);
+ QStringList qs;qs.push_back("E");qs.push_back("Path");
+ ui->twSoundfont->setHorizontalHeaderLabels(qs);
settings->setValue("SoundFonts/SFCount",sfc);
settings->setValue("Behavior/RestorePlaylist",settings->value("Behavior/RestorePlaylist",0));
@@ -206,9 +215,12 @@ void qmpSettingsWindow::settingsUpdate()
settings->setValue("Audio/BankSelect",ui->cbBSMode->currentText());
- settings->setValue("SoundFonts/SFCount",ui->lwSoundfont->count());
- for(int i=0;i<ui->lwSoundfont->count();++i)
- settings->setValue("SoundFonts/SF"+QString::number(i+1),ui->lwSoundfont->item(i)->text());
+ settings->setValue("SoundFonts/SFCount",ui->twSoundfont->rowCount());
+ for(int i=0;i<ui->twSoundfont->rowCount();++i)
+ {
+ settings->setValue("SoundFonts/SF"+QString::number(i+1),ui->twSoundfont->item(i,1)->text());
+ settings->setValue("SoundFonts/SF"+QString::number(i+1)+"Enabled",int(((QCheckBox*)ui->twSoundfont->cellWidget(i,0))->isChecked()));
+ }
settings->setValue("Behavior/RestorePlaylist",ui->cbRestorePlaylist->isChecked()?1:0);
@@ -267,34 +279,46 @@ void qmpSettingsWindow::on_cbBufCnt_currentTextChanged(const QString &s)
void qmpSettingsWindow::on_pbAdd_clicked()
{
QStringList sl=QFileDialog::getOpenFileNames(this,"Add File","","SoundFont files (*.sf2)");
- for(int i=0;i<sl.size();++i)
- ui->lwSoundfont->addItem(new QListWidgetItem(sl.at(i)));
+ for(int i=0;i<sl.size();++i){
+ ui->twSoundfont->insertRow(ui->twSoundfont->rowCount());
+ ui->twSoundfont->setItem(ui->twSoundfont->rowCount()-1,1,new QTableWidgetItem(sl.at(i)));
+ ui->twSoundfont->setCellWidget(ui->twSoundfont->rowCount()-1,0,new QCheckBox(""));
+ }
}
void qmpSettingsWindow::on_pbRemove_clicked()
{
- QList<QListWidgetItem*> sl=ui->lwSoundfont->selectedItems();
+ QList<QTableWidgetItem*> sl=ui->twSoundfont->selectedItems();
for(int i=0;i<sl.size();++i)
{
- ui->lwSoundfont->removeItemWidget(sl.at(i));
- delete sl.at(i);
+ ui->twSoundfont->removeRow(ui->twSoundfont->row(sl[i]));
}
}
void qmpSettingsWindow::on_pbUp_clicked()
{
- int cid=ui->lwSoundfont->currentRow();
- QListWidgetItem *ci=ui->lwSoundfont->takeItem(cid);
- ui->lwSoundfont->insertItem(cid-1,ci);
- ui->lwSoundfont->setCurrentRow(cid-1);
+ int cid=ui->twSoundfont->currentRow();if(!cid)return;
+ QTableWidgetItem *ci=ui->twSoundfont->takeItem(cid,1);
+ bool e=((QCheckBox*)ui->twSoundfont->cellWidget(cid,0))->isChecked();
+ ui->twSoundfont->removeRow(cid);
+ ui->twSoundfont->insertRow(cid-1);
+ ui->twSoundfont->setCellWidget(cid-1,0,new QCheckBox(""));
+ ((QCheckBox*)ui->twSoundfont->cellWidget(cid-1,0))->setChecked(e);
+ ui->twSoundfont->setItem(cid-1,1,ci);
+ ui->twSoundfont->setCurrentCell(cid-1,1);
}
void qmpSettingsWindow::on_pbDown_clicked()
{
- int cid=ui->lwSoundfont->currentRow();
- QListWidgetItem *ci=ui->lwSoundfont->takeItem(cid);
- ui->lwSoundfont->insertItem(cid+1,ci);
- ui->lwSoundfont->setCurrentRow(cid+1);
+ int cid=ui->twSoundfont->currentRow();if(cid==ui->twSoundfont->rowCount()-1)return;
+ QTableWidgetItem *ci=ui->twSoundfont->takeItem(cid,1);
+ bool e=((QCheckBox*)ui->twSoundfont->cellWidget(cid,0))->isChecked();
+ ui->twSoundfont->removeRow(cid);
+ ui->twSoundfont->insertRow(cid+1);
+ ui->twSoundfont->setCellWidget(cid+1,0,new QCheckBox(""));
+ ((QCheckBox*)ui->twSoundfont->cellWidget(cid+1,0))->setChecked(e);
+ ui->twSoundfont->setItem(cid+1,1,ci);
+ ui->twSoundfont->setCurrentCell(cid+1,1);
}
void qmpSettingsWindow::on_cbAutoBS_stateChanged()
@@ -319,10 +343,10 @@ void qmpSettingsWindow::updatePluginList(qmpPluginManager *pmgr)
for(int j=1;j<=3;++j)
ui->twPluginList->item(i,j)->setFlags(ui->twPluginList->item(i,j)->flags()^Qt::ItemIsEditable);
}
- ui->twPluginList->setColumnWidth(0,22);
- ui->twPluginList->setColumnWidth(1,192);
- ui->twPluginList->setColumnWidth(2,64);
- ui->twPluginList->setColumnWidth(3,128);
+ ui->twPluginList->setColumnWidth(0,22*logicalDpiX()/96.);
+ ui->twPluginList->setColumnWidth(1,192*logicalDpiX()/96.);
+ ui->twPluginList->setColumnWidth(2,64*logicalDpiX()/96.);
+ ui->twPluginList->setColumnWidth(3,128*logicalDpiX()/96.);
}
void qmpSettingsWindow::updateCustomOptions()
diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp
index 9f5e6cf..15c720a 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.hpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.hpp
@@ -7,7 +7,7 @@
#include <QDialog>
#include <QCloseEvent>
#include <QSettings>
-#include <QListWidget>
+#include <QTableWidget>
#include <QComboBox>
#include <QSpinBox>
#include <QFormLayout>
@@ -68,7 +68,7 @@ class qmpSettingsWindow:public QDialog
~qmpSettingsWindow();
void closeEvent(QCloseEvent *event);
void settingsInit();
- QListWidget* getSFWidget();
+ QTableWidget *getSFWidget();
void updatePluginList(qmpPluginManager *pmgr);
void registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval);
int getOptionInt(std::string key);
diff --git a/qmidiplayer-desktop/qmpsettingswindow.ui b/qmidiplayer-desktop/qmpsettingswindow.ui
index cc9064f..253ef6d 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.ui
+++ b/qmidiplayer-desktop/qmpsettingswindow.ui
@@ -23,7 +23,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@@ -442,10 +442,20 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QListWidget" name="lwSoundfont">
+ <widget class="QTableWidget" name="twSoundfont">
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
+ <column>
+ <property name="text">
+ <string>E</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Path</string>
+ </property>
+ </column>
</widget>
</item>
<item>