aboutsummaryrefslogtreecommitdiff
path: root/qmpmainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-01-14 21:47:06 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-01-14 21:47:06 +0800
commit1e1036e705b20ea407bbb922e40c0f44147b3691 (patch)
treefe0d5560c3c44be62de50b8e433b81da0a135f70 /qmpmainwindow.cpp
parentfab7ae34311b9bbb001c98baafa4b1a99aa3c18f (diff)
downloadQMidiPlayer-1e1036e705b20ea407bbb922e40c0f44147b3691.tar.xz
Innocent Treasure. (WTF)
Diffstat (limited to 'qmpmainwindow.cpp')
-rw-r--r--qmpmainwindow.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/qmpmainwindow.cpp b/qmpmainwindow.cpp
index 6e88f37..646f3ad 100644
--- a/qmpmainwindow.cpp
+++ b/qmpmainwindow.cpp
@@ -1,5 +1,6 @@
#include <cstdio>
#include <QUrl>
+#include <QMimeData>
#include <QDirIterator>
#include <QDesktopWidget>
#include "qmpmainwindow.hpp"
@@ -122,6 +123,19 @@ void qmpMainWindow::moveEvent(QMoveEvent *event)
qmpSettingsWindow::getSettingsIntf()->setValue("DialogStatus/MainW",event->pos());
}
}
+void qmpMainWindow::dropEvent(QDropEvent *event)
+{
+ QList<QUrl> l=event->mimeData()->urls();
+ QStringList sl;
+ for(int i=0;i<l.size();++i)
+ sl.push_back(l.at(i).path());
+ plistw->insertItems(sl);
+}
+void qmpMainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+ //if(event->mimeData()->hasFormat("application/x-midi"))
+ event->acceptProposedAction();
+}
void qmpMainWindow::updateWidgets()
{
@@ -148,7 +162,7 @@ void qmpMainWindow::updateWidgets()
chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
QString fns=plistw->getNextItem();
ui->lbFileName->setText(QUrl(fns).fileName());
- player->playerLoadFile(fns.toStdString().c_str());
+ if(!player->playerLoadFile(fns.toStdString().c_str()))return;
char ts[100];
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);
@@ -236,7 +250,7 @@ void qmpMainWindow::on_pbPlayPause_clicked()
if(!fns.length())return(void)(playing=false);
}
ui->lbFileName->setText(QUrl(fns).fileName());
- player->playerLoadFile(fns.toStdString().c_str());
+ if(!player->playerLoadFile(fns.toStdString().c_str()))return;
char ts[100];
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);
@@ -353,7 +367,7 @@ void qmpMainWindow::on_pbPrev_clicked()
ui->hsTimer->setValue(0);chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
QString fns=plistw->getPrevItem();if(fns.length()==0)return on_pbStop_clicked();
ui->lbFileName->setText(QUrl(fns).fileName());
- player->playerLoadFile(fns.toStdString().c_str());
+ if(!player->playerLoadFile(fns.toStdString().c_str()))return;
char ts[100];
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);
@@ -373,7 +387,7 @@ void qmpMainWindow::on_pbNext_clicked()
ui->hsTimer->setValue(0);chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
QString fns=plistw->getNextItem();if(fns.length()==0)return on_pbStop_clicked();
ui->lbFileName->setText(QUrl(fns).fileName());
- player->playerLoadFile(fns.toStdString().c_str());
+ if(!player->playerLoadFile(fns.toStdString().c_str()))return;
char ts[100];
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);
@@ -396,7 +410,7 @@ void qmpMainWindow::selectionChanged()
chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked();
QString fns=plistw->getSelectedItem();
ui->lbFileName->setText(QUrl(fns).fileName());
- player->playerLoadFile(fns.toStdString().c_str());
+ if(!player->playerLoadFile(fns.toStdString().c_str()))return;
char ts[100];
sprintf(ts,"%02d:%02d",(int)player->getFtime()/60,(int)player->getFtime()%60);
ui->lbFinTime->setText(ts);