From c7305aa2f03cc542ab0a55bce666ea3a9a624aa4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 31 Jul 2024 14:12:48 +0200 Subject: [PATCH] GUI: merge: disable "Merge" menu actions during identification --- src/mkvtoolnix-gui/merge/tool.cpp | 48 ++++++++++++++++++------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/mkvtoolnix-gui/merge/tool.cpp b/src/mkvtoolnix-gui/merge/tool.cpp index ab15c4d4c..03eeed53e 100644 --- a/src/mkvtoolnix-gui/merge/tool.cpp +++ b/src/mkvtoolnix-gui/merge/tool.cpp @@ -253,27 +253,31 @@ Tool::applyPreferences() { void Tool::enableMenuActions() { - auto mwUi = MainWindow::getUi(); - auto tab = currentTab(); - auto hasTab = !!tab; + auto &p = *p_func(); + auto mwUi = MainWindow::getUi(); + auto tab = currentTab(); + auto hasTab = !!tab; + auto identifying = !p.ui->overlordWidget->isEnabled(); - mwUi->actionMergeSave->setEnabled(hasTab); - mwUi->actionMergeSaveAs->setEnabled(hasTab); - mwUi->actionMergeSaveOptionFile->setEnabled(hasTab); - mwUi->actionMergeClose->setEnabled(hasTab); - mwUi->actionMergeStartMuxing->setEnabled(hasTab); - mwUi->actionMergeAddToJobQueue->setEnabled(hasTab); - mwUi->actionMergeShowMkvmergeCommandLine->setEnabled(hasTab); - mwUi->actionMergeCopyFirstFileNameToTitle->setEnabled(hasTab && tab->hasSourceFiles()); - mwUi->actionMergeCopyOutputFileNameToTitle->setEnabled(hasTab && tab->hasDestinationFileName()); - mwUi->actionMergeCopyTitleToOutputFileName->setEnabled(hasTab && tab->hasTitle()); - mwUi->menuMergeAll->setEnabled(hasTab); - mwUi->actionMergeSaveAll->setEnabled(hasTab); - mwUi->actionMergeCloseAll->setEnabled(hasTab); - mwUi->actionMergeStartMuxingAll->setEnabled(hasTab); - mwUi->actionMergeAddAllToJobQueue->setEnabled(hasTab); - mwUi->actionMergeAddFilesFromClipboard->setEnabled(!fileNamesFromClipboard().isEmpty()); - mwUi->menuMergeModifySelectedTracks->setEnabled(hasTab && tab->hasSelectedNotAppendedRegularTracks()); + mwUi->actionMergeNew->setEnabled(!identifying); + mwUi->actionMergeOpen->setEnabled(!identifying); + mwUi->actionMergeSave->setEnabled(!identifying && hasTab); + mwUi->actionMergeSaveAs->setEnabled(!identifying && hasTab); + mwUi->actionMergeSaveOptionFile->setEnabled(!identifying && hasTab); + mwUi->actionMergeClose->setEnabled(!identifying && hasTab); + mwUi->actionMergeStartMuxing->setEnabled(!identifying && hasTab); + mwUi->actionMergeAddToJobQueue->setEnabled(!identifying && hasTab); + mwUi->actionMergeShowMkvmergeCommandLine->setEnabled(!identifying && hasTab); + mwUi->actionMergeCopyFirstFileNameToTitle->setEnabled(!identifying && hasTab && tab->hasSourceFiles()); + mwUi->actionMergeCopyOutputFileNameToTitle->setEnabled(!identifying && hasTab && tab->hasDestinationFileName()); + mwUi->actionMergeCopyTitleToOutputFileName->setEnabled(!identifying && hasTab && tab->hasTitle()); + mwUi->menuMergeAll->setEnabled(!identifying && hasTab); + mwUi->actionMergeSaveAll->setEnabled(!identifying && hasTab); + mwUi->actionMergeCloseAll->setEnabled(!identifying && hasTab); + mwUi->actionMergeStartMuxingAll->setEnabled(!identifying && hasTab); + mwUi->actionMergeAddAllToJobQueue->setEnabled(!identifying && hasTab); + mwUi->actionMergeAddFilesFromClipboard->setEnabled(!identifying && !fileNamesFromClipboard().isEmpty()); + mwUi->menuMergeModifySelectedTracks->setEnabled(!identifying && hasTab && tab->hasSelectedNotAppendedRegularTracks()); } void @@ -955,6 +959,8 @@ Tool::fileIdentificationStarted(unsigned int numberOfQueuedFiles) { p.ui->overlordWidget->setEnabled(false); + enableMenuActions(); + if (!p.identifyingFilesDialog) p.identifyingFilesDialog = new QProgressDialog{ QY("Identifying files"), QY("Cancel"), 0, static_cast(numberOfQueuedFiles), this }; p.identifyingFilesDialog->setWindowTitle(QY("Identifying files" )); @@ -973,6 +979,8 @@ Tool::fileIdentificationFinished() { p.identifyingFilesDialog = nullptr; p.ui->overlordWidget->setEnabled(true); + + enableMenuActions(); } void