From deb76a6364d29708701efe51040009459e145c41 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 18 Sep 2015 09:08:33 +0200 Subject: [PATCH] =?UTF-8?q?GUI:=20merge:=20option=20=C2=BBone=20new=20merg?= =?UTF-8?q?e=20tab=20for=20each=20dropped=20input=20file=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements #1380. --- ChangeLog | 7 ++++++ .../merge/adding_appending_files_dialog.ui | 11 ++++++-- .../merge/adding_appending_files_dialog.cpp | 11 ++++---- .../merge/adding_appending_files_dialog.h | 1 + src/mkvtoolnix-gui/merge/input.cpp | 5 +++- src/mkvtoolnix-gui/merge/tool.cpp | 25 +++++++++++++++---- src/mkvtoolnix-gui/merge/tool.h | 2 +- 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4889fc75e..f27680593 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-09-18 Moritz Bunkus + + * MKVToolNix GUI: merge tool enhancement: when dragging & dropping + files onto merge settings already containing a file the dialog + asking the user what to do has received a new option for creating + one new merge tab for each of the dropped files. Implements #1380. + 2015-09-17 Moritz Bunkus * mkvmerge: bug fix: the pixel dimensions reported for VC-1 in diff --git a/src/mkvtoolnix-gui/forms/merge/adding_appending_files_dialog.ui b/src/mkvtoolnix-gui/forms/merge/adding_appending_files_dialog.ui index d18227b41..583412bec 100644 --- a/src/mkvtoolnix-gui/forms/merge/adding_appending_files_dialog.ui +++ b/src/mkvtoolnix-gui/forms/merge/adding_appending_files_dialog.ui @@ -6,8 +6,8 @@ 0 0 - 485 - 303 + 560 + 315 @@ -76,6 +76,13 @@ + + + + Create new merge settings for &each file + + + diff --git a/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.cpp b/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.cpp index 4c56884b6..f6ec14d04 100644 --- a/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.cpp +++ b/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.cpp @@ -35,11 +35,12 @@ AddingAppendingFilesDialog::~AddingAppendingFilesDialog() { AddingAppendingFilesDialog::Decision AddingAppendingFilesDialog::decision() const { - return ui->rbAdd->isChecked() ? Decision::Add - : ui->rbAlwaysAdd->isChecked() ? Decision::AlwaysAdd - : ui->rbAppend->isChecked() ? Decision::Append - : ui->rbAddToNew->isChecked() ? Decision::AddToNew - : Decision::AddAdditionalParts; + return ui->rbAdd->isChecked() ? Decision::Add + : ui->rbAlwaysAdd->isChecked() ? Decision::AlwaysAdd + : ui->rbAppend->isChecked() ? Decision::Append + : ui->rbAddToNew->isChecked() ? Decision::AddToNew + : ui->rbAddEachToNew->isChecked() ? Decision::AddEachToNew + : Decision::AddAdditionalParts; } int diff --git a/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.h b/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.h index 23b92ead3..40fedbcbf 100644 --- a/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.h +++ b/src/mkvtoolnix-gui/merge/adding_appending_files_dialog.h @@ -22,6 +22,7 @@ public: Append, AddAdditionalParts, AddToNew, + AddEachToNew, }; protected: diff --git a/src/mkvtoolnix-gui/merge/input.cpp b/src/mkvtoolnix-gui/merge/input.cpp index 1984346dd..f39327148 100644 --- a/src/mkvtoolnix-gui/merge/input.cpp +++ b/src/mkvtoolnix-gui/merge/input.cpp @@ -1145,7 +1145,10 @@ Tab::addOrAppendDroppedFiles(QStringList const &fileNames) { m_filesModel->addAdditionalParts(fileIdx, fileNames); else if (AddingAppendingFilesDialog::Decision::AddToNew == decision) - MainWindow::mergeTool()->addMultipleFilesToNewSettings(fileNames); + MainWindow::mergeTool()->addMultipleFilesToNewSettings(fileNames, false); + + else if (AddingAppendingFilesDialog::Decision::AddEachToNew == decision) + MainWindow::mergeTool()->addMultipleFilesToNewSettings(fileNames, true); else { if (AddingAppendingFilesDialog::Decision::AlwaysAdd == decision) { diff --git a/src/mkvtoolnix-gui/merge/tool.cpp b/src/mkvtoolnix-gui/merge/tool.cpp index d2104098a..642c91de8 100644 --- a/src/mkvtoolnix-gui/merge/tool.cpp +++ b/src/mkvtoolnix-gui/merge/tool.cpp @@ -309,13 +309,28 @@ Tool::openMultipleConfigFilesFromCommandLine(QStringList const &fileNames) { } void -Tool::addMultipleFilesToNewSettings(QStringList const &fileNames) { - newConfig(); +Tool::addMultipleFilesToNewSettings(QStringList const &fileNames, + bool newSettingsForEachFile) { + auto toProcess = fileNames; - auto tab = currentTab(); - Q_ASSERT(!!tab); + while (!toProcess.isEmpty()) { + auto fileNamesToAdd = QStringList{}; - tab->addFilesToBeAddedOrAppendedDelayed(fileNames); + if (newSettingsForEachFile) + fileNamesToAdd << toProcess.takeFirst(); + + else { + fileNamesToAdd = toProcess; + toProcess.clear(); + } + + newConfig(); + + auto tab = currentTab(); + Q_ASSERT(!!tab); + + tab->addFilesToBeAddedOrAppendedDelayed(fileNamesToAdd); + } } void diff --git a/src/mkvtoolnix-gui/merge/tool.h b/src/mkvtoolnix-gui/merge/tool.h index 85d0c1c45..f7fa2abce 100644 --- a/src/mkvtoolnix-gui/merge/tool.h +++ b/src/mkvtoolnix-gui/merge/tool.h @@ -63,7 +63,7 @@ public slots: virtual void addMultipleFiles(QStringList const &fileNames); virtual void addMultipleFilesFromCommandLine(QStringList const &fileNames); virtual void openMultipleConfigFilesFromCommandLine(QStringList const &fileNames); - virtual void addMultipleFilesToNewSettings(QStringList const &fileNames); + virtual void addMultipleFilesToNewSettings(QStringList const &fileNames, bool newSettingsForEachFile); virtual void setupTabPositions();