diff --git a/src/Config.h b/src/Config.h index f91ba959..ddb10c56 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 11 +#define VER_LAMEXP_BUILD 12 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index d76f71f8..8e981e38 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -47,6 +47,8 @@ #include #include #include +#include +#include //Win32 includes #include @@ -205,6 +207,9 @@ MainWindow::MainWindow(QWidget *parent) connect(m_messageHandler, SIGNAL(killSignalReceived()), this, SLOT(close()), Qt::QueuedConnection); connect(m_delayedFileTimer, SIGNAL(timeout()), this, SLOT(handleDelayedFiles())); m_messageHandler->start(); + + //Enable Drag & Drop + this->setAcceptDrops(true); } //////////////////////////////////////////////////////////// @@ -284,6 +289,34 @@ void MainWindow::showEvent(QShowEvent *event) QTimer::singleShot(0, this, SLOT(windowShown())); } +void MainWindow::dragEnterEvent(QDragEnterEvent *event) +{ + QStringList formats = event->mimeData()->formats(); + + for(int i = 0; i < formats.count(); i++) + { + if(formats[i].indexOf("FileNameW") >= 0) + { + event->acceptProposedAction(); + } + } +} + +void MainWindow::dropEvent(QDropEvent *event) +{ + ABORT_IF_BUSY; + + QStringList droppedFiles; + const QList urls = event->mimeData()->urls(); + + for(int i = 0; i < urls.count(); i++) + { + droppedFiles << QFileInfo(urls.at(i).toLocalFile()).absoluteFilePath(); + } + + addFiles(droppedFiles); +} + //////////////////////////////////////////////////////////// // Slots //////////////////////////////////////////////////////////// diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index 7a0c08d5..0837c089 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -71,6 +71,8 @@ private slots: protected: void showEvent(QShowEvent *event); + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); private: void addFiles(const QStringList &files);