GUI: merge: add menu to "add source files" button

This optional menu contains the same "add files", "append files", "add
files as additional parts" actions that are also present in the
right-click context menu. However, due to an arrow being painted on the
button this should be easier to discover for new or inexperienced users.
This commit is contained in:
Moritz Bunkus 2015-12-29 20:12:36 +01:00
parent aeb0add9b5
commit bb86d274ae
5 changed files with 45 additions and 7 deletions

View File

@ -1,5 +1,11 @@
2015-12-29 Moritz Bunkus <moritz@bunkus.org>
* MKVToolNix GUI: merge tool enhancement: the "add source files"
button now has optional popup menu containing actions for
adding/appending files and adding files as additional parts for
easier discovery of those actions. This popup is only shown if the
user clicks on the arrow shown on the right of the button.
* mkvmerge: new feature: TrueHD tracks that contain Dolby Atmos
will be identified as "TrueHD Atmos". Implements #1519.

View File

@ -1572,7 +1572,7 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="addFiles">
<widget class="QToolButton" name="addFiles">
<property name="text">
<string>&amp;Add source files</string>
</property>
@ -1580,6 +1580,15 @@
<iconset resource="../../qt_resources.qrc">
<normaloff>:/icons/16x16/list-add.png</normaloff>:/icons/16x16/list-add.png</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
<item>

View File

@ -233,11 +233,17 @@ Tab::setupInputControls() {
m_selectTracksOfTypeMenu->addAction(m_selectAllAudioTracksAction);
m_selectTracksOfTypeMenu->addAction(m_selectAllSubtitlesTracksAction);
// "add source files" menu
m_addFilesMenu->addAction(m_addFilesAction2);
m_addFilesMenu->addAction(m_appendFilesAction2);
m_addFilesMenu->addAction(m_addAdditionalPartsAction2);
ui->addFiles->setMenu(m_addFilesMenu);
// Connect signals & slots.
auto mw = MainWindow::get();
connect(ui->aacIsSBR, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &Tab::onAacIsSBRChanged);
connect(ui->addFiles, &QPushButton::clicked, this, &Tab::onAddFiles);
connect(ui->addFiles, &QToolButton::clicked, this, &Tab::onAddFiles);
connect(ui->addToJobQueue, &QPushButton::clicked, this, &Tab::onAddToJobQueue);
connect(ui->additionalTrackOptions, &QLineEdit::textChanged, this, &Tab::onAdditionalTrackOptionsChanged);
connect(ui->aspectRatio, static_cast<void (QComboBox::*)(QString const &)>(&QComboBox::currentIndexChanged), this, &Tab::onAspectRatioChanged);
@ -290,8 +296,11 @@ Tab::setupInputControls() {
connect(ui->tracks->selectionModel(), &QItemSelectionModel::selectionChanged, this, &Tab::onTrackSelectionChanged);
connect(m_addFilesAction, &QAction::triggered, this, &Tab::onAddFiles);
connect(m_addFilesAction2, &QAction::triggered, this, &Tab::onAddFiles);
connect(m_appendFilesAction, &QAction::triggered, this, &Tab::onAppendFiles);
connect(m_appendFilesAction2, &QAction::triggered, this, &Tab::onAppendFiles);
connect(m_addAdditionalPartsAction, &QAction::triggered, this, &Tab::onAddAdditionalParts);
connect(m_addAdditionalPartsAction2, &QAction::triggered, this, &Tab::onAddAdditionalParts);
connect(m_removeFilesAction, &QAction::triggered, this, &Tab::onRemoveFiles);
connect(m_removeAllFilesAction, &QAction::triggered, this, &Tab::onRemoveAllFiles);
connect(m_openFilesInMediaInfoAction, &QAction::triggered, this, &Tab::onOpenFilesInMediaInfo);
@ -304,6 +313,8 @@ Tab::setupInputControls() {
connect(m_enableAllTracksAction, &QAction::triggered, this, &Tab::enableAllTracks);
connect(m_disableAllTracksAction, &QAction::triggered, this, &Tab::disableAllTracks);
connect(m_addFilesMenu, &QMenu::aboutToShow, this, &Tab::enableFilesActions);
connect(m_filesModel, &SourceFileModel::rowsInserted, this, &Tab::onFileRowsInserted);
connect(m_tracksModel, &TrackModel::rowsInserted, this, &Tab::onTrackRowsInserted);
connect(m_tracksModel, &TrackModel::itemChanged, this, &Tab::onTrackItemChanged);
@ -1138,8 +1149,11 @@ Tab::enableFilesActions() {
hasRegularTrack = m_config.m_files.end() != brng::find_if(m_config.m_files, [](SourceFilePtr const &file) { return file->hasRegularTrack(); });
m_addFilesAction->setEnabled(true);
m_addFilesAction2->setEnabled(true);
m_appendFilesAction->setEnabled((1 == numSelected) && hasRegularTrack);
m_appendFilesAction2->setEnabled((1 == numSelected) && hasRegularTrack);
m_addAdditionalPartsAction->setEnabled(1 == numSelected);
m_addAdditionalPartsAction2->setEnabled(1 == numSelected);
m_removeFilesAction->setEnabled(0 < numSelected);
m_removeAllFilesAction->setEnabled(!m_config.m_files.isEmpty());
m_openFilesInMediaInfoAction->setEnabled(0 < numSelected);
@ -1170,9 +1184,13 @@ Tab::retranslateInputUI() {
resizeFilesColumnsToContents();
resizeTracksColumnsToContents();
m_addFilesAction->setText(QY("&Add files"));
m_appendFilesAction->setText(QY("A&ppend files"));
m_addAdditionalPartsAction->setText(QY("Add files as a&dditional parts"));
m_addFilesAction ->setText(QY("&Add files"));
m_addFilesAction2->setText(QY("&Add files"));
m_appendFilesAction ->setText(QY("A&ppend files"));
m_appendFilesAction2->setText(QY("A&ppend files"));
m_addAdditionalPartsAction ->setText(QY("Add files as a&dditional parts"));
m_addAdditionalPartsAction2->setText(QY("Add files as a&dditional parts"));
m_removeFilesAction->setText(QY("&Remove files"));
m_removeAllFilesAction->setText(QY("Remove a&ll files"));
m_openFilesInMediaInfoAction->setText(QY("Open in &MediaInfo"));

View File

@ -42,6 +42,9 @@ Tab::Tab(QWidget *parent)
, m_addFilesAction{new QAction{this}}
, m_appendFilesAction{new QAction{this}}
, m_addAdditionalPartsAction{new QAction{this}}
, m_addFilesAction2{new QAction{this}}
, m_appendFilesAction2{new QAction{this}}
, m_addAdditionalPartsAction2{new QAction{this}}
, m_removeFilesAction{new QAction{this}}
, m_removeAllFilesAction{new QAction{this}}
, m_selectAllTracksAction{new QAction{this}}
@ -56,6 +59,7 @@ Tab::Tab(QWidget *parent)
, m_tracksMenu{new QMenu{this}}
, m_attachmentsMenu{new QMenu{this}}
, m_selectTracksOfTypeMenu{new QMenu{this}}
, m_addFilesMenu{new QMenu{this}}
, m_attachmentsModel{new AttachmentModel{this}}
, m_addAttachmentsAction{new QAction{this}}
, m_removeAttachmentsAction{new QAction{this}}

View File

@ -47,9 +47,10 @@ protected:
QList<QComboBox *> m_comboBoxControls;
bool m_currentlySettingInputControlValues;
QAction *m_addFilesAction, *m_appendFilesAction, *m_addAdditionalPartsAction, *m_removeFilesAction, *m_removeAllFilesAction, *m_selectAllTracksAction, *m_enableAllTracksAction, *m_disableAllTracksAction;
QAction *m_addFilesAction, *m_appendFilesAction, *m_addAdditionalPartsAction, *m_addFilesAction2, *m_appendFilesAction2, *m_addAdditionalPartsAction2;
QAction *m_removeFilesAction, *m_removeAllFilesAction, *m_selectAllTracksAction, *m_enableAllTracksAction, *m_disableAllTracksAction;
QAction *m_selectAllVideoTracksAction, *m_selectAllAudioTracksAction, *m_selectAllSubtitlesTracksAction, *m_openFilesInMediaInfoAction, *m_openTracksInMediaInfoAction;
QMenu *m_filesMenu, *m_tracksMenu, *m_attachmentsMenu, *m_selectTracksOfTypeMenu;
QMenu *m_filesMenu, *m_tracksMenu, *m_attachmentsMenu, *m_selectTracksOfTypeMenu, *m_addFilesMenu;
// "Attachments" tab:
AttachmentModel *m_attachmentsModel;