aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpmainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-03-19 10:50:45 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-03-19 10:50:45 +0800
commit9e228490ffc7deb2969fa5e2b5fd81d763986eed (patch)
treefcf260cb5008966e65521846d23e3b4cec712e6d /qmidiplayer-desktop/qmpmainwindow.cpp
parenta667b0719a31bfac32cff5f77bd1a52aee204ce3 (diff)
downloadQMidiPlayer-9e228490ffc7deb2969fa5e2b5fd81d763986eed.tar.xz
Unified meta event reading code, fixing #6.
Fixed playlist dialog behaving oddly.
Diffstat (limited to 'qmidiplayer-desktop/qmpmainwindow.cpp')
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp42
1 files changed, 12 insertions, 30 deletions
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index 558f827..ea1db75 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -41,7 +41,7 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
setButtonHeight(ui->pbPrev,36);setButtonHeight(ui->pbSettings,36);setButtonHeight(ui->pbStop,36);
playing=false;stopped=true;dragging=false;fin=false;
settingsw=new qmpSettingsWindow(this);pmgr=new qmpPluginManager();
- plistw=new qmpPlistWindow(this);player=NULL;timer=NULL;fluidrenderer=NULL;
+ player=NULL;timer=NULL;fluidrenderer=NULL;
}
qmpMainWindow::~qmpMainWindow()
@@ -95,6 +95,7 @@ void qmpMainWindow::init()
while(f.wait_for(std::chrono::milliseconds(100))==std::future_status::timeout);
ui->centralWidget->setEnabled(true);
+ plistw=new qmpPlistWindow(this);
chnlw=new qmpChannelsWindow(this);
efxw=new qmpEfxWindow(this);
infow=new qmpInfoWindow(this);
@@ -102,6 +103,11 @@ void qmpMainWindow::init()
timer=new QTimer(this);
renderf=new qmpRenderFunc(this);
panicf=new qmpPanicFunc(this);
+ if(havemidi)
+ {
+ plistw->emptyList();
+ for(auto&i:argfiles)plistw->insertItem(i);
+ }
registerFunctionality(renderf,"Render",tr("Render to wave").toStdString(),getThemedIconc(":/img/render.svg"),0,false);
registerFunctionality(panicf,"Panic",tr("Panic").toStdString(),getThemedIconc(":/img/panic.svg"),0,false);
registerFunctionality(reloadsynf,"ReloadSynth",tr("Restart fluidsynth").toStdString(),getThemedIconc(":/img/repeat-base.svg"),0,false);
@@ -120,7 +126,7 @@ void qmpMainWindow::init()
setupWidget();settingsw->verifySF();
}
-int qmpMainWindow::pharseArgs()
+int qmpMainWindow::parseArgs()
{
bool loadfolder=false;havemidi=false;
QStringList args=QApplication::arguments();
@@ -146,45 +152,21 @@ int qmpMainWindow::pharseArgs()
loadfolder=true;
}
else
-#ifdef _WIN32
+ if(QFileInfo(args.at(i)).exists())
{
- char* c=wcsto8bit(args.at(i).toStdWString().c_str());
- if(fluid_is_midifile(c))
- {
- if(!havemidi){havemidi=true;plistw->emptyList();}
- if(loadfolder||qmpSettingsWindow::getSettingsIntf()->value("Behavior/LoadFolder",0).toInt())
- {
- QDirIterator di(QFileInfo(args.at(i)).absolutePath());
- while(di.hasNext())
- {
- QString c=di.next();char* cc=wcsto8bit(c.toStdWString().c_str());
- if((c.endsWith(".mid")||c.endsWith(".midi"))&&fluid_is_midifile(cc))
- plistw->insertItem(c);free(cc);
- }
- }
- else
- plistw->insertItem(args.at(i));
- }
- free(c);
- }
-#else
- if(fluid_is_midifile(args.at(i).toStdString().c_str()))
- {
- if(!havemidi){havemidi=true;plistw->emptyList();}
+ if(!havemidi)havemidi=true;
if(loadfolder||qmpSettingsWindow::getSettingsIntf()->value("Behavior/LoadFolder",0).toInt())
{
QDirIterator di(QFileInfo(args.at(i)).absolutePath());
while(di.hasNext())
{
QString c=di.next();
- if((c.endsWith(".mid")||c.endsWith(".midi"))&&fluid_is_midifile(c.toStdString().c_str()))
- plistw->insertItem(c.toStdString().c_str());
+ argfiles.push_back(c);
}
}
else
- plistw->insertItem(args.at(i).toStdString().c_str());
+ argfiles.push_back(args.at(i));
}
-#endif
}
return 0;
}