aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop')
-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
11 files changed, 129 insertions, 58 deletions
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();