aboutsummaryrefslogtreecommitdiff
path: root/qmpplistwindow.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-01-04 23:50:11 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-01-04 23:50:11 +0800
commit8099672c3fd0bfc7804b0a92d05c57dcd4307268 (patch)
treeabef139577986617a3fa31f31474ab9cd8b4627f /qmpplistwindow.cpp
parent84634010422f578b27105bbbaf6b8ee4c1232e86 (diff)
downloadQMidiPlayer-8099672c3fd0bfc7804b0a92d05c57dcd4307268.tar.xz
Shadow Pow"d"er. (WTF)
Diffstat (limited to 'qmpplistwindow.cpp')
-rw-r--r--qmpplistwindow.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/qmpplistwindow.cpp b/qmpplistwindow.cpp
index 695afa0..dd6f67d 100644
--- a/qmpplistwindow.cpp
+++ b/qmpplistwindow.cpp
@@ -1,6 +1,7 @@
#include <cstdlib>
#include <ctime>
#include <QFileDialog>
+#include <QDirIterator>
#include <QSettings>
#include "qmpplistwindow.hpp"
#include "ui_qmpplistwindow.h"
@@ -101,17 +102,30 @@ void qmpPlistWindow::moveEvent(QMoveEvent *event)
void qmpPlistWindow::on_pbAdd_clicked()
{
- QStringList sl=QFileDialog::getOpenFileNames(this,"Add File","","Midi files (*.mid *.midi)");
+ QStringList sl;
+ if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
+ sl=QFileDialog::getOpenFileNames(this,"Add File",qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/FileDialogPath","").toString(),"Midi files (*.mid *.midi)");
+ else
+ sl=QFileDialog::getOpenFileNames(this,"Add File","","Midi files (*.mid *.midi)");
+ if(sl.empty())return;
for(int i=0;i<sl.size();++i)
{
ui->lwFiles->addItem(new QListWidgetItem(sl.at(i)));
}
+ if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus","").toInt())
+ qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/FileDialogPath",
+ QUrl(sl.at(0)).toString(QUrl::RemoveFilename));
}
void qmpPlistWindow::on_pbAddFolder_clicked()
{
- QFileDialog::getExistingDirectory(this,"Add Folder");
- //...
+ QDirIterator di(QFileDialog::getExistingDirectory(this,"Add Folder"));
+ while(di.hasNext())
+ {
+ QString c=di.next();
+ if(c.endsWith(".mid")||c.endsWith(".midi"))
+ ui->lwFiles->addItem(new QListWidgetItem(c));
+ }
}
void qmpPlistWindow::on_pbRemove_clicked()