diff --git a/doc/Changelog.html b/doc/Changelog.html
index 8ee9dc50..cf2264dd 100644
--- a/doc/Changelog.html
+++ b/doc/Changelog.html
@@ -24,6 +24,7 @@ a:visited { color: #0000EE; }
Added Avisynth input (audio only!) using 'avs2wav' tool, partly based on code by Jory Stone
Added a method to use custom tools instead of the "built-in" ones (see FAQ doc for details)
Added an option to copy all meta information of a single file over to the "meta information" tab
+Added two new command-line switches: "--add-folder <path>" and "--add-recursive <path>"
Added one new translation: Korean
Updated Qt runtime libraries to v4.7.3
Updated LAME encoder to v3.99.1.0 (2011-04-15), compiled with ICL 12.0.3 and MSVC 10.0 (details)
diff --git a/src/Config.h b/src/Config.h
index 7c097dbf..566536e2 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -29,8 +29,8 @@
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE RC
-#define VER_LAMEXP_PATCH 1
-#define VER_LAMEXP_BUILD 570
+#define VER_LAMEXP_PATCH 2
+#define VER_LAMEXP_BUILD 572
///////////////////////////////////////////////////////////////////////////////
// Tools versions
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 7d5d7b6c..c786f52a 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -381,6 +381,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
m_delayedFileTimer->setInterval(5000);
connect(m_messageHandler, SIGNAL(otherInstanceDetected()), this, SLOT(notifyOtherInstance()), Qt::QueuedConnection);
connect(m_messageHandler, SIGNAL(fileReceived(QString)), this, SLOT(addFileDelayed(QString)), Qt::QueuedConnection);
+ connect(m_messageHandler, SIGNAL(folderReceived(QString, bool)), this, SLOT(addFolderDelayed(QString, bool)), Qt::QueuedConnection);
connect(m_messageHandler, SIGNAL(killSignalReceived()), this, SLOT(close()), Qt::QueuedConnection);
connect(m_delayedFileTimer, SIGNAL(timeout()), this, SLOT(handleDelayedFiles()));
m_messageHandler->start();
@@ -490,7 +491,7 @@ void MainWindow::addFiles(const QStringList &files)
/*
* Add folder to source list
*/
-void MainWindow::addFolder(const QString &path, bool recursive)
+void MainWindow::addFolder(const QString &path, bool recursive, bool delayed)
{
QFileInfoList folderInfoList;
folderInfoList << QFileInfo(path);
@@ -533,7 +534,14 @@ void MainWindow::addFolder(const QString &path, bool recursive)
if(!fileList.isEmpty())
{
- addFiles(fileList);
+ if(delayed)
+ {
+ addFilesDelayed(fileList);
+ }
+ else
+ {
+ addFiles(fileList);
+ }
}
}
@@ -776,8 +784,7 @@ void MainWindow::dropEvent(QDropEvent *event)
if(!droppedFiles.isEmpty())
{
- m_delayedFileList->append(droppedFiles);
- QTimer::singleShot(0, this, SLOT(handleDelayedFiles()));
+ addFilesDelayed(droppedFiles, true);
}
}
@@ -999,18 +1006,34 @@ void MainWindow::windowShown(void)
//Add files from the command-line
for(int i = 0; i < arguments.count() - 1; i++)
{
+ QStringList addedFiles;
if(!arguments[i].compare("--add", Qt::CaseInsensitive))
{
QFileInfo currentFile(arguments[++i].trimmed());
- qDebug("Adding file from CLI: %s", currentFile.canonicalFilePath().toUtf8().constData());
- m_delayedFileList->append(currentFile.canonicalFilePath());
+ qDebug("Adding file from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
+ addedFiles.append(currentFile.absoluteFilePath());
+ }
+ if(!addedFiles.isEmpty())
+ {
+ addFilesDelayed(addedFiles);
}
}
- //Start delayed files timer
- if(!m_delayedFileList->isEmpty() && !m_delayedFileTimer->isActive())
+ //Add folders from the command-line
+ for(int i = 0; i < arguments.count() - 1; i++)
{
- m_delayedFileTimer->start(5000);
+ if(!arguments[i].compare("--add-folder", Qt::CaseInsensitive))
+ {
+ QFileInfo currentFile(arguments[++i].trimmed());
+ qDebug("Adding folder from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
+ addFolder(currentFile.absoluteFilePath(), false, true);
+ }
+ if(!arguments[i].compare("--add-recursive", Qt::CaseInsensitive))
+ {
+ QFileInfo currentFile(arguments[++i].trimmed());
+ qDebug("Adding folder recursively from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
+ addFolder(currentFile.absoluteFilePath(), true, true);
+ }
}
//Enable shell integration
@@ -1885,14 +1908,16 @@ void MainWindow::findFileContextActionTriggered(void)
*/
void MainWindow::handleDelayedFiles(void)
{
- if(m_banner->isVisible())
+ m_delayedFileTimer->stop();
+
+ if(m_delayedFileList->isEmpty())
{
return;
}
-
- m_delayedFileTimer->stop();
- if(m_delayedFileList->isEmpty())
+
+ if(m_banner->isVisible())
{
+ m_delayedFileTimer->start(5000);
return;
}
@@ -1902,23 +1927,11 @@ void MainWindow::handleDelayedFiles(void)
while(!m_delayedFileList->isEmpty())
{
QFileInfo currentFile = QFileInfo(m_delayedFileList->takeFirst());
- if(!currentFile.exists())
+ if(!currentFile.exists() || !currentFile.isFile())
{
continue;
}
- if(currentFile.isFile())
- {
- selectedFiles << currentFile.canonicalFilePath();
- continue;
- }
- if(currentFile.isDir())
- {
- QList list = QDir(currentFile.canonicalFilePath()).entryInfoList(QDir::Files);
- for(int j = 0; j < list.count(); j++)
- {
- selectedFiles << list.at(j).canonicalFilePath();
- }
- }
+ selectedFiles << currentFile.canonicalFilePath();
}
addFiles(selectedFiles);
@@ -2745,14 +2758,50 @@ void MainWindow::notifyOtherInstance(void)
/*
* Add file from another instance
*/
-void MainWindow::addFileDelayed(const QString &filePath)
+void MainWindow::addFileDelayed(const QString &filePath, bool tryASAP)
{
+ if(tryASAP && !m_delayedFileTimer->isActive())
+ {
+ qDebug("Received file: %s", filePath.toUtf8().constData());
+ m_delayedFileList->append(filePath);
+ QTimer::singleShot(0, this, SLOT(handleDelayedFiles()));
+ }
+
m_delayedFileTimer->stop();
qDebug("Received file: %s", filePath.toUtf8().constData());
m_delayedFileList->append(filePath);
m_delayedFileTimer->start(5000);
}
+/*
+ * Add files from another instance
+ */
+void MainWindow::addFilesDelayed(const QStringList &filePaths, bool tryASAP)
+{
+ if(tryASAP && !m_delayedFileTimer->isActive())
+ {
+ qDebug("Received %d files.", filePaths.count());
+ m_delayedFileList->append(filePaths);
+ QTimer::singleShot(0, this, SLOT(handleDelayedFiles()));
+ }
+
+ m_delayedFileTimer->stop();
+ qDebug("Received %d files.", filePaths.count());
+ m_delayedFileList->append(filePaths);
+ m_delayedFileTimer->start(5000);
+}
+
+/*
+ * Add folder from another instance
+ */
+void MainWindow::addFolderDelayed(const QString &folderPath, bool recursive)
+{
+ if(!m_banner->isVisible())
+ {
+ addFolder(folderPath, recursive, true);
+ }
+}
+
// =========================================================
// Misc slots
// =========================================================
diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h
index bf5a39ce..f25f5bc4 100644
--- a/src/Dialog_MainWindow.h
+++ b/src/Dialog_MainWindow.h
@@ -48,8 +48,10 @@ public:
private slots:
void aboutButtonClicked(void);
- void addFileDelayed(const QString &filePath);
+ void addFileDelayed(const QString &filePath, bool tryASAP = false);
void addFilesButtonClicked(void);
+ void addFilesDelayed(const QStringList &filePaths, bool tryASAP = false);
+ void addFolderDelayed(const QString &folderPath, bool recursive);
void aftenCodingModeChanged(int value);
void aftenDRCModeChanged(int value);
void aftenFastAllocationChanged(bool checked);
@@ -137,7 +139,7 @@ protected:
private:
void addFiles(const QStringList &files);
- void addFolder(const QString &path, bool recursive = false);
+ void addFolder(const QString &path, bool recursive = false, bool delayed = false);
bool checkForUpdates(void);
bool installWMADecoder(void);
diff --git a/src/Thread_MessageHandler.cpp b/src/Thread_MessageHandler.cpp
index 22c535d4..ce0cedc1 100644
--- a/src/Thread_MessageHandler.cpp
+++ b/src/Thread_MessageHandler.cpp
@@ -60,6 +60,12 @@ void MessageHandlerThread::run()
case 1:
emit fileReceived(QString::fromUtf8(m_parameter));
break;
+ case 2:
+ emit folderReceived(QString::fromUtf8(m_parameter), false);
+ break;
+ case 3:
+ emit folderReceived(QString::fromUtf8(m_parameter), true);
+ break;
case 666:
if(!_stricmp(m_parameter, "Force!"))
{
diff --git a/src/Thread_MessageHandler.h b/src/Thread_MessageHandler.h
index fb8e8fd9..29d0fee7 100644
--- a/src/Thread_MessageHandler.h
+++ b/src/Thread_MessageHandler.h
@@ -40,5 +40,6 @@ private:
signals:
void otherInstanceDetected(void);
void fileReceived(const QString &filePath);
+ void folderReceived(const QString &filePath, bool recursive);
void killSignalReceived(void);
};
diff --git a/src/Thread_MessageProducer.cpp b/src/Thread_MessageProducer.cpp
index 642c9fbd..e8569c20 100644
--- a/src/Thread_MessageProducer.cpp
+++ b/src/Thread_MessageProducer.cpp
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
@@ -65,7 +66,29 @@ void MessageProducerThread::run()
{
if(!arguments[i].compare("--add", Qt::CaseInsensitive))
{
- lamexp_ipc_send(1, QFileInfo(arguments[++i]).canonicalFilePath().toUtf8().constData());
+ QFileInfo file = QFileInfo(arguments[++i]);
+ if(file.exists() && file.isFile())
+ {
+ lamexp_ipc_send(1, file.canonicalFilePath().toUtf8().constData());
+ }
+ bSentFiles = true;
+ }
+ if(!arguments[i].compare("--add-folder", Qt::CaseInsensitive))
+ {
+ QDir dir = QDir(arguments[++i]);
+ if(dir.exists())
+ {
+ lamexp_ipc_send(2, dir.canonicalPath().toUtf8().constData());
+ }
+ bSentFiles = true;
+ }
+ if(!arguments[i].compare("--add-recursive", Qt::CaseInsensitive))
+ {
+ QDir dir = QDir(arguments[++i]);
+ if(dir.exists())
+ {
+ lamexp_ipc_send(3, dir.canonicalPath().toUtf8().constData());
+ }
bSentFiles = true;
}
}