aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-13 17:31:42 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-13 17:31:42 +0800
commita0da9bca472043e7f13d4d6ea1809f6b63a598b0 (patch)
treef318a37656b5b25c4028739b8e59ebb4d132d34d
parent3312e495cf54a8bd6451552216f5aeea1a06d486 (diff)
downloadQMidiPlayer-a0da9bca472043e7f13d4d6ea1809f6b63a598b0.tar.xz
Fix pitch bend range handling.
Allow registering a string option as file path. Provide an easier way to set path values in options. Revert to old geometry storage mechanism and improved it. Hope this one will work on Windows. Make the time slider less ugly.
-rw-r--r--ChangeLog8
-rw-r--r--core/qmpmidiplay.cpp12
-rw-r--r--include/qmpcorepublic.hpp2
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp21
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.hpp1
-rw-r--r--qmidiplayer-desktop/qmpefxwindow.cpp21
-rw-r--r--qmidiplayer-desktop/qmpefxwindow.hpp1
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp8
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.ui8
-rw-r--r--qmidiplayer-desktop/qmpplistwindow.cpp22
-rw-r--r--qmidiplayer-desktop/qmpplistwindow.hpp1
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp4
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp80
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp20
-rw-r--r--qmidiplayer.pro12
-rw-r--r--visualization/qmpvisualization.cpp15
16 files changed, 159 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index e4abb40..8ba8018 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-02-13 0.8.5 indev
+Fix pitch bend range handling.
+Allow registering a string option as file path.
+Provide an easier way to set path values in options.
+Revert to old geometry storage mechanism and improved
+it. Hope this one will work on Windows.
+Make the time slider less ugly.
+
2017-02-12 0.8.5 indev
UI revolution cont'd. Powered by @BLumia.
Expose new APIs to plugin developer.
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index ec9f059..b72ebe8 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -98,9 +98,9 @@ void CMidiPlayer::processEvent(const SEvent *e)
case 0xE0://PW
pbv[e->type&0x0F]=(e->p1|(e->p2<<7))&0x3FFF;;
if(mappedoutput[e->type&0x0F])
- mapper->pitchBend(mappedoutput[e->type&0x0F]-1,e->type&0x0F,(e->p1|(e->p2<<7))&0x3FFF);
+ mapper->pitchBend(mappedoutput[e->type&0x0F]-1,e->type&0x0F,pbv[e->type&0x0F]);
else
- fluid_synth_pitch_bend(synth,e->type&0x0F,(e->p1|(e->p2<<7))&0x3FFF);
+ fluid_synth_pitch_bend(synth,e->type&0x0F,pbv[e->type&0x0F]);
break;
case 0xF0://Meta/SysEx
if((e->type&0x0F)==0x0F)
@@ -249,8 +249,8 @@ void CMidiPlayer::fileTimer2Pass()
ccc[i][11]=127;ccc[i][71]=64;ccc[i][72]=64;
ccc[i][73]=64;ccc[i][74]=64;ccc[i][75]=64;
ccc[i][76]=64;ccc[i][77]=64;ccc[i][78]=64;
- ccc[0][131]=dpt;ccc[0][132]=0x04021808;
- ccc[0][133]=0;ccc[0][134]=2;
+ ccc[i][131]=dpt;ccc[i][132]=0x04021808;
+ ccc[i][133]=0;ccc[i][134]=2;
}if(midiReaders->getStandard()!=4)ccc[9][0]=128;
for(int i=0;i<16;++i)for(int j=0;j<135;++j)
ccstamps[0][i][j]=ccc[i][j];
@@ -317,9 +317,9 @@ void CMidiPlayer::playerPanic(bool reset)
fluid_synth_cc(synth,i,10,64);
fluid_synth_cc(synth,i,11,127);
fluid_synth_cc(synth,i,32,0);
+ fluid_synth_pitch_wheel_sens(synth,i,2);
}
fluid_synth_cc(synth,i,64,0);
- fluid_synth_pitch_wheel_sens(synth,i,2);
fluid_synth_pitch_bend(synth,i,8192);
//all sounds off causes the minus polyphone bug...
fluid_synth_all_notes_off(synth,i);
@@ -405,6 +405,8 @@ void CMidiPlayer::setTCeptr(uint32_t ep,uint32_t st)
for(int j=0;j<120;++j)fluid_synth_cc(synth,i,j,ccstamps[st][i][j]);
fluid_synth_program_change(synth,i,ccstamps[st][i][128]);
//fluid_synth_pitch_bend(synth,i,ccstamps[st][i][130]);
+ fluid_synth_pitch_wheel_sens(synth,i,ccstamps[st][i][134]);
+ pbr[i]=ccstamps[st][i][134];
dpt=ccstamps[st][0][131];ctempo=dpt*divs/1000;
ctsn=ccstamps[st][0][132]>>24;ctsd=1<<((ccstamps[st][0][132]>>16)&0xFF);
cks=ccstamps[st][0][133];
diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp
index 1d0a7a4..4adb83a 100644
--- a/include/qmpcorepublic.hpp
+++ b/include/qmpcorepublic.hpp
@@ -162,7 +162,7 @@ class qmpPluginAPI
virtual void registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval);
virtual double getOptionDouble(std::string key);
virtual void setOptionDouble(std::string key,double val);
- virtual void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval);
+ virtual void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval,bool ispath=false);
virtual std::string getOptionString(std::string key);
virtual void setOptionString(std::string key,std::string val);
virtual void registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval);
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index bd021f1..9b6df60 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -80,8 +80,8 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
0,
true
);
- if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QByteArray()).toByteArray().length())
- restoreGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QRect(-999,-999,-999,-999)).toByteArray());
+ if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QRect(-999,-999,999,999)).toRect()!=QRect(-999,-999,999,999))
+ setGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QRect(-999,-999,999,999)).toRect());
if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlWShown",0).toInt())
{show();qmpMainWindow::getInstance()->setFuncState("Channel",true);}
}
@@ -92,13 +92,17 @@ void qmpChannelsWindow::showEvent(QShowEvent *event)
{
qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/ChnlWShown",1);
}
- if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QByteArray()).toByteArray().length())
- restoreGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QRect(-999,-999,-999,-999)).toByteArray());
+ if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QRect(-999,-999,999,999)).toRect()!=QRect(-999,-999,999,999))
+ setGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/ChnlW",QRect(-999,-999,999,999)).toRect());
event->accept();
}
void qmpChannelsWindow::closeEvent(QCloseEvent *event)
{
+ if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
+ {
+ qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/ChnlW",geometry());
+ }
setVisible(false);
if(!qmpMainWindow::getInstance()->isFinalizing()&&qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
{
@@ -108,15 +112,6 @@ void qmpChannelsWindow::closeEvent(QCloseEvent *event)
event->accept();
}
-void qmpChannelsWindow::moveEvent(QMoveEvent *event)
-{
- if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
- {
- qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/ChnlW",saveGeometry());
- }
- event->accept();
-}
-
void qmpChannelsWindow::resetAcitivity()
{
for(int i=0;i<16;++i)ui->twChannels->item(i,0)->setIcon(*chi);
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp
index 57be0ca..9db3689 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.hpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.hpp
@@ -90,7 +90,6 @@ class qmpChannelsWindow:public QDialog
~qmpChannelsWindow();
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
- void moveEvent(QMoveEvent *event);
void resetAcitivity();
public slots:
void channelWindowsUpdate();
diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp
index 507880e..6546547 100644
--- a/qmidiplayer-desktop/qmpefxwindow.cpp
+++ b/qmidiplayer-desktop/qmpefxwindow.cpp
@@ -36,8 +36,8 @@ qmpEfxWindow::qmpEfxWindow(QWidget *parent) :
0,
true
);
- if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QByteArray()).toByteArray().length())
- restoreGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QRect(-999,-999,-999,-999)).toByteArray());
+ if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QRect(-999,-999,999,999)).toRect()!=QRect(-999,-999,999,999))
+ setGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QRect(-999,-999,999,999)).toRect());
if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxWShown",0).toInt())
{show();qmpMainWindow::getInstance()->setFuncState("Effects",true);}
}
@@ -52,6 +52,10 @@ qmpEfxWindow::~qmpEfxWindow()
void qmpEfxWindow::closeEvent(QCloseEvent *event)
{
+ if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
+ {
+ qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/EfxW",geometry());
+ }
setVisible(false);
if(!qmpMainWindow::getInstance()->isFinalizing()&&qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
{
@@ -82,8 +86,8 @@ void qmpEfxWindow::showEvent(QShowEvent *event)
if(ct==FLUID_CHORUS_MOD_SINE)ui->rbSine->setChecked(true),ui->rbTriangle->setChecked(false);
if(ct==FLUID_CHORUS_MOD_TRIANGLE)ui->rbSine->setChecked(false),ui->rbTriangle->setChecked(true);
initialized=true;
- if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QByteArray()).toByteArray().length())
- restoreGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QRect(-999,-999,-999,-999)).toByteArray());
+ if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QRect(-999,-999,999,999)).toRect()!=QRect(-999,-999,999,999))
+ setGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxW",QRect(-999,-999,999,999)).toRect());
if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
{
qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/EfxWShown",1);
@@ -91,15 +95,6 @@ void qmpEfxWindow::showEvent(QShowEvent *event)
event->accept();
}
-void qmpEfxWindow::moveEvent(QMoveEvent *event)
-{
- if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
- {
- qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/EfxW",saveGeometry());
- }
- event->accept();
-}
-
void qmpEfxWindow::sendEfxChange()
{
if(!qmpMainWindow::getInstance()||!initialized)return;
diff --git a/qmidiplayer-desktop/qmpefxwindow.hpp b/qmidiplayer-desktop/qmpefxwindow.hpp
index 1adadd0..b016254 100644
--- a/qmidiplayer-desktop/qmpefxwindow.hpp
+++ b/qmidiplayer-desktop/qmpefxwindow.hpp
@@ -34,7 +34,6 @@ class qmpEfxWindow : public QDialog
~qmpEfxWindow();
void closeEvent(QCloseEvent *event);
void showEvent(QShowEvent *event);
- void moveEvent(QMoveEvent *event);
void sendEfxChange();
private slots:
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index fc7f850..12fa2a1 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -121,7 +121,7 @@ void qmpMainWindow::init()
ui->pbSettings->setIcon(QIcon(getThemedIcon(":/img/settings.svg")));
ui->pbAdd->setIcon(QIcon(getThemedIcon(":/img/open.svg")));
if(havemidi)on_pbPlayPause_clicked();
- setupWidget();
+ setupWidget();settingsw->verifySF();
}
int qmpMainWindow::pharseArgs()
@@ -437,8 +437,8 @@ void qmpMainWindow::on_hsTimer_sliderReleased()
if(playing)
{
if(ui->hsTimer->value()==100){on_pbNext_clicked();return;}
- player->setTCeptr(player->getStamp(ui->hsTimer->value()),ui->hsTimer->value());
player->playerPanic();
+ player->setTCeptr(player->getStamp(ui->hsTimer->value()),ui->hsTimer->value());
offset=ui->hsTimer->value()/100.*player->getFtime();
st=std::chrono::steady_clock::now();
}
@@ -461,8 +461,8 @@ void qmpMainWindow::playerSeek(uint32_t percentage)
if(playing)
{
if(percentage==100){on_pbNext_clicked();return;}
- player->setTCeptr(player->getStamp(percentage),percentage);
player->playerPanic();ui->hsTimer->setValue(percentage);
+ player->setTCeptr(player->getStamp(percentage),percentage);
offset=percentage/100.*player->getFtime();
st=std::chrono::steady_clock::now();
}
@@ -630,6 +630,7 @@ void qmpMainWindow::setupWidget()
}
for(unsigned i=0;i<enabled_buttons.size();++i)
{
+ if(mfunc.find(enabled_buttons[i])==mfunc.end())continue;
QReflectivePushButton *pb=new QReflectivePushButton(
mfunc[enabled_buttons[i]].icon(),
tr(mfunc[enabled_buttons[i]].desc().c_str()),
@@ -649,6 +650,7 @@ void qmpMainWindow::setupWidget()
}
for(unsigned i=0;i<enabled_actions.size();++i)
{
+ if(mfunc.find(enabled_actions[i])==mfunc.end())continue;
QReflectiveAction *a=new QReflectiveAction(
mfunc[enabled_actions[i]].icon(),
tr(mfunc[enabled_actions[i]].desc().c_str()),
diff --git a/qmidiplayer-desktop/qmpmainwindow.ui b/qmidiplayer-desktop/qmpmainwindow.ui
index 9ed0849..e2522d6 100644
--- a/qmidiplayer-desktop/qmpmainwindow.ui
+++ b/qmidiplayer-desktop/qmpmainwindow.ui
@@ -268,7 +268,10 @@
</sizepolicy>
</property>
<property name="styleSheet">
- <string notr="true">QSlider::handle{border:none;background:none;color:none;}</string>
+ <string notr="true">QSlider::handle{border:none;background:none;color:none;}
+QSlider::sub-page{background-color:#3daee9;color:none;}
+QSlider::groove{background-color:#cdcecf;color:none;}
+QSlider{height:10px;}</string>
</property>
<property name="maximum">
<number>100</number>
@@ -286,6 +289,9 @@
<property name="spacing">
<number>0</number>
</property>
+ <property name="topMargin">
+ <number>6</number>
+ </property>
<item>
<widget class="QPushButton" name="pbPlayPause">
<property name="sizePolicy">
diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp
index d010198..7185e5e 100644
--- a/qmidiplayer-desktop/qmpplistwindow.cpp
+++ b/qmidiplayer-desktop/qmpplistwindow.cpp
@@ -76,8 +76,8 @@ qmpPlistWindow::qmpPlistWindow(QWidget *parent) :
0,
true
);
- if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QByteArray()).toByteArray().length())
- restoreGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QRect(-999,-999,-999,-999)).toByteArray());
+ if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QRect(-999,-999,999,999)).toRect()!=QRect(-999,-999,999,999))
+ setGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QRect(-999,-999,999,999)).toRect());
if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListWShown",0).toInt())
{show();qmpMainWindow::getInstance()->setFuncState("Playlist",true);}
}
@@ -95,14 +95,19 @@ void qmpPlistWindow::showEvent(QShowEvent *event)
{
qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/PListWShown",1);
}
- if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QByteArray()).toByteArray().length())
- restoreGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QRect(-999,-999,-999,-999)).toByteArray());
+ if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QRect(-999,-999,999,999)).toRect()!=QRect(-999,-999,999,999))
+ setGeometry(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/PListW",QRect(-999,-999,999,999)).toRect());
event->accept();
}
void qmpPlistWindow::closeEvent(QCloseEvent *event)
{
+ if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
+ {
+ qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/PListW",geometry());
+ }
setVisible(false);
+ if(!qmpMainWindow::getInstance()->isFinalizing())
while(ui->lwFiles->count()>1)delete ui->lwFiles->item(0);
if(!qmpMainWindow::getInstance()->isFinalizing()&&qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
{
@@ -124,15 +129,6 @@ void qmpPlistWindow::closeEvent(QCloseEvent *event)
event->accept();
}
-void qmpPlistWindow::moveEvent(QMoveEvent *event)
-{
- if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
- {
- qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/PListW",saveGeometry());
- }
- event->accept();
-}
-
void qmpPlistWindow::dropEvent(QDropEvent *event)
{
QList<QUrl> l=event->mimeData()->urls();
diff --git a/qmidiplayer-desktop/qmpplistwindow.hpp b/qmidiplayer-desktop/qmpplistwindow.hpp
index 9e1b501..05dcee9 100644
--- a/qmidiplayer-desktop/qmpplistwindow.hpp
+++ b/qmidiplayer-desktop/qmpplistwindow.hpp
@@ -35,7 +35,6 @@ class qmpPlistWindow : public QDialog
~qmpPlistWindow();
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
- void moveEvent(QMoveEvent *event);
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
int getRepeat();
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index f93cddf..c9a3671 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -223,8 +223,8 @@ void qmpPluginAPI::registerOptionDouble(std::string tab,std::string desc,std::st
{qsw->registerOptionDouble(tab,desc,key,min,max,defaultval);}
double qmpPluginAPI::getOptionDouble(std::string key){return qsw->getOptionDouble(key);}
void qmpPluginAPI::setOptionDouble(std::string key,double val){qsw->setOptionDouble(key,val);}
-void qmpPluginAPI::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval)
-{qsw->registerOptionString(tab,desc,key,defaultval);}
+void qmpPluginAPI::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval,bool ispath)
+{qsw->registerOptionString(tab,desc,key,defaultval,ispath);}
std::string qmpPluginAPI::getOptionString(std::string key){return qsw->getOptionString(key);}
void qmpPluginAPI::setOptionString(std::string key,std::string val){return qsw->setOptionString(key,val);}
void qmpPluginAPI::registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval)
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index 3be0a3e..4249161 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -1,6 +1,8 @@
#include <QLineEdit>
+#include <QToolButton>
#include <QFileDialog>
#include <QDir>
+#include <QMessageBox>
#include "qmpsettingswindow.hpp"
#include "ui_qmpsettingswindow.h"
#include "qmpmainwindow.hpp"
@@ -351,7 +353,7 @@ void qmpSettingsWindow::updatePluginList(qmpPluginManager *pmgr)
{
ui->twPluginList->insertRow(i);
ui->twPluginList->setCellWidget(i,0,new QCheckBox(""));
- if(settings->value(QString("PluginSwitch/")+QString(plugins->at(i).name.c_str()),0).toInt())
+ if(settings->value(QString("PluginSwitch/")+QString(plugins->at(i).name.c_str()),1).toInt())
{((QCheckBox*)ui->twPluginList->cellWidget(i,0))->setChecked(true);plugins->at(i).enabled=true;}
else
{((QCheckBox*)ui->twPluginList->cellWidget(i,0))->setChecked(false);plugins->at(i).enabled=false;}
@@ -367,6 +369,24 @@ void qmpSettingsWindow::updatePluginList(qmpPluginManager *pmgr)
ui->twPluginList->setColumnWidth(3,128*logicalDpiX()/96.);
}
+void qmpSettingsWindow::verifySF()
+{
+ int sf=0;
+ for(int i=0;i<ui->twSoundfont->rowCount();++i)
+ if(((QCheckBox*)ui->twSoundfont->cellWidget(i,0))->isChecked())++sf;
+ if(settings->value("Midi/DefaultOutput","Internal FluidSynth").toString()=="Internal FluidSynth"&&!sf)
+ {
+ if(QMessageBox::question(this,
+ tr("No soundfont loaded"),
+ tr("Internal fluidsynth was chosen as the default output but it has no soundfont set. "
+ "Would you like to setup soundfonts now?"))==QMessageBox::Yes)
+ {
+ show();
+ ui->tabWidget->setCurrentWidget(ui->tab_3);
+ }
+ }
+}
+
void qmpSettingsWindow::updateCustomOptions()
{
for(auto i=customOptions.begin();i!=customOptions.end();++i)
@@ -409,6 +429,12 @@ void qmpSettingsWindow::updateCustomOptions()
settings->setValue(QString(i->first.c_str()),cb->currentIndex());
break;
}
+ case 6:
+ {
+ QFileEdit* fe=(QFileEdit*)i->second.widget;if(!i->second.widget)break;
+ settings->setValue(QString(i->first.c_str()),fe->text());
+ break;
+ }
}
}
@@ -580,12 +606,13 @@ void qmpSettingsWindow::setOptionDouble(std::string key,double val)
((QDoubleSpinBox*)customOptions[key].widget)->setValue(val);
}
-void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval)
+void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval,bool ispath)
{
customOptions[key].widget=NULL;
customOptions[key].desc=desc;
customOptions[key].defaultval=QString(defaultval.c_str());
customOptions[key].type=4;
+ if(ispath)customOptions[key].type=6;
if(desc.length())
{
QGridLayout* page=NULL;
@@ -598,15 +625,26 @@ void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,st
ui->tabWidget->addTab(w,QString(tab.c_str()));
customOptPages[tab]=page;
}
- QLineEdit* te=new QLineEdit(page->parentWidget());
+ int row=page->rowCount();
+ if(ispath)
+ {
+ QFileEdit* fe=new QFileEdit(page->parentWidget());
+ fe->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ customOptions[key].widget=fe;
+ fe->setText(settings->value(QString(key.c_str()),defaultval.c_str()).toString());
+ page->addWidget(fe,row,1);
+ }
+ else
+ {
+ QLineEdit* te=new QLineEdit(page->parentWidget());
+ te->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ customOptions[key].widget=te;
+ te->setText(settings->value(QString(key.c_str()),defaultval.c_str()).toString());
+ page->addWidget(te,row,1);
+ }
QLabel* lb=new QLabel(desc.c_str(),page->parentWidget());
- customOptions[key].widget=te;
- te->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
- int row=page->rowCount();
page->addWidget(lb,row,0);
- page->addWidget(te,row,1);
- te->setText(settings->value(QString(key.c_str()),defaultval.c_str()).toString());
}
}
std::string qmpSettingsWindow::getOptionString(std::string key)
@@ -617,7 +655,12 @@ void qmpSettingsWindow::setOptionString(std::string key,std::string val)
{
settings->setValue(QString(key.c_str()),QString(val.c_str()));
if(customOptions[key].widget)
- ((QLineEdit*)customOptions[key].widget)->setText(val.c_str());
+ {
+ if(customOptions[key].type==4)
+ ((QLineEdit*)customOptions[key].widget)->setText(val.c_str());
+ else if(customOptions[key].type==6)
+ ((QFileEdit*)customOptions[key].widget)->setText(val.c_str());
+ }
}
void qmpSettingsWindow::registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval)
@@ -671,3 +714,22 @@ void qmpSettingsWindow::on_pbCustomizeAct_clicked()
{
cw->launch(1);
}
+
+QFileEdit::QFileEdit(QWidget *par):QWidget(par)
+{
+ QHBoxLayout *layout=new QHBoxLayout(this);
+ layout->setMargin(0);
+ le=new QLineEdit(this);
+ layout->addWidget(le);
+ tb=new QToolButton(this);
+ tb->setText("...");
+ layout->addWidget(tb);
+ connect(tb,SIGNAL(clicked()),this,SLOT(chooseFile()));
+}
+QString QFileEdit::text(){return le->text();}
+void QFileEdit::setText(const QString& s){le->setText(s);}
+void QFileEdit::chooseFile()
+{
+ QString s=QFileDialog::getOpenFileName(NULL,tr("Select a file"),QFileInfo(text()).dir().absolutePath());
+ if(s.length())setText(s);
+}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp
index 16faa0f..a7d5cbb 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.hpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.hpp
@@ -25,8 +25,25 @@ struct qmpCustomOption
QVariant defaultval,minv,maxv;
};
+class QLineEdit;
+class QToolButton;
+class QFileEdit:public QWidget
+{
+ Q_OBJECT
+ private:
+ QLineEdit *le;
+ QToolButton *tb;
+ private slots:
+ void chooseFile();
+ public:
+ QFileEdit(QWidget* par=NULL);
+ QString text();
+ void setText(const QString& s);
+};
+
class QHexSpinBox:public QSpinBox
{
+ Q_OBJECT
public:
QHexSpinBox(QWidget *parent=0):QSpinBox(parent)
{
@@ -83,12 +100,13 @@ class qmpSettingsWindow:public QDialog
void registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval);
double getOptionDouble(std::string key);
void setOptionDouble(std::string key,double val);
- void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval);
+ void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval,bool ispath);
std::string getOptionString(std::string key);
void setOptionString(std::string key,std::string val);
void registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval);
int getOptionEnumInt(std::string key);
void setOptionEnumInt(std::string key,int val);
+ void verifySF();
signals:
void dialogClosing();
diff --git a/qmidiplayer.pro b/qmidiplayer.pro
index c6f2ac6..86d69bd 100644
--- a/qmidiplayer.pro
+++ b/qmidiplayer.pro
@@ -2,15 +2,15 @@ TEMPLATE = subdirs
!android {
SUBDIRS = \
- qmidiplayer-desktop \
- qmidiplayer-lite \
- sample-plugin \
- visualization
+ qmidiplayer-desktop \
+ qmidiplayer-lite \
+ sample-plugin \
+ visualization \
+ midifmt-plugin
}
android {
SUBDIRS = \
- qmidiplayer-lite
+ qmidiplayer-lite
}
SUBDIRS += \
- midifmt-plugin
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index 86b8900..831c1af 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -156,17 +156,18 @@ void qmpVisualization::showThread()
if(!api->getOptionString("Visualization/font2").length()||!font.loadTTF(api->getOptionString("Visualization/font2").c_str(),fontsize))
if(!font.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",fontsize))
if(!font.loadTTF("/usr/share/fonts/gnu-free/FreeMono.otf",fontsize))
- if(!font.loadTTF("C:/Windows/Fonts/cour.ttf",fontsize))
+ if(!font.loadTTF((std::string(getenv("windir"))+"/Fonts/cour.ttf").c_str(),fontsize))
printf("W: Font load failed.\n");
- if(!api->getOptionString("Visualization/font2").length()||!font.loadTTF(api->getOptionString("Visualization/font2").c_str(),180))
+ if(!api->getOptionString("Visualization/font2").length()||!fonthdpi.loadTTF(api->getOptionString("Visualization/font2").c_str(),180))
if(!fonthdpi.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",180))
if(!fonthdpi.loadTTF("/usr/share/fonts/gnu-free/FreeMono.otf",180))
- if(!fonthdpi.loadTTF("C:/Windows/Fonts/cour.ttf",180))
+ if(!fonthdpi.loadTTF((std::string(getenv("windir"))+"/Fonts/cour.ttf").c_str(),180))
printf("W: Font load failed.\n");
- if(!api->getOptionString("Visualization/font1").length()||!font.loadTTF(api->getOptionString("Visualization/font1").c_str(),fontsize))
+ if(!api->getOptionString("Visualization/font1").length()||!font2.loadTTF(api->getOptionString("Visualization/font1").c_str(),fontsize))
if(!font2.loadTTF("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",fontsize))
if(!font2.loadTTF("/usr/share/fonts/wenquanyi/wqy-microhei/wqy-microhei.ttc",fontsize))
- if(!font2.loadTTF("C:/Windows/Fonts/segoeui.ttf",fontsize))
+ if(!font2.loadTTF((std::string(getenv("windir"))+"/Fonts/msyh.ttc").c_str(),fontsize))
+ if(!font2.loadTTF((std::string(getenv("windir"))+"/Fonts/segoeui.ttf").c_str(),fontsize))
printf("W: Font load failed.\n");
if(horizontal)
{
@@ -778,8 +779,8 @@ void qmpVisualization::init()
std::vector<std::string> tv;tv.push_back("Bottom left");tv.push_back("Bottom right");tv.push_back("Top left");tv.push_back("Top right");tv.push_back("Hidden");
api->registerOptionEnumInt("Visualization-Video","OSD Position","Visualization/osdpos",tv,0);
api->registerOptionInt("Visualization-Video","Font Size","Visualization/fontsize",6,180,16);
- api->registerOptionString("Visualization-Video","Custom Sans Font","Visualization/font1","");
- api->registerOptionString("Visualization-Video","Custom Monospace Font","Visualization/font2","");
+ api->registerOptionString("Visualization-Video","Custom Sans Font","Visualization/font1","",true);
+ api->registerOptionString("Visualization-Video","Custom Monospace Font","Visualization/font2","",true);
api->registerOptionInt("Visualization-Appearance","View distance","Visualization/viewdist",20,1000,100);
api->registerOptionInt("Visualization-Appearance","Note stretch","Visualization/notestretch",20,500,100);
api->registerOptionInt("Visualization-Appearance","Minimum note length","Visualization/minnotelen",20,500,100);