mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-09 03:31:41 +00:00
GUI: status bar warnings/errors: only one context menu, always show
This commit is contained in:
parent
dad298d317
commit
d2af08f770
@ -26,8 +26,8 @@ StatusBarProgressWidget::StatusBarProgressWidget(QWidget *parent)
|
||||
|
||||
connect(&m_timer, &QTimer::timeout, this, &StatusBarProgressWidget::updateWarningsAndErrorsIcons);
|
||||
|
||||
connect(ui->warningsContainer, &QWidget::customContextMenuRequested, this, &StatusBarProgressWidget::showWarningsContextMenu);
|
||||
connect(ui->errorsContainer, &QWidget::customContextMenuRequested, this, &StatusBarProgressWidget::showErrorsContextMenu);
|
||||
connect(ui->warningsContainer, &QWidget::customContextMenuRequested, this, &StatusBarProgressWidget::showContextMenu);
|
||||
connect(ui->errorsContainer, &QWidget::customContextMenuRequested, this, &StatusBarProgressWidget::showContextMenu);
|
||||
}
|
||||
|
||||
StatusBarProgressWidget::~StatusBarProgressWidget() {
|
||||
@ -103,35 +103,23 @@ StatusBarProgressWidget::updateWarningsAndErrorsIcons() {
|
||||
}
|
||||
|
||||
void
|
||||
StatusBarProgressWidget::showWarningsContextMenu(QPoint const &pos) {
|
||||
if (!m_numWarnings)
|
||||
return;
|
||||
|
||||
StatusBarProgressWidget::showContextMenu(QPoint const &pos) {
|
||||
QMenu menu{this};
|
||||
|
||||
auto acknowledge = new QAction{&menu};
|
||||
acknowledge->setText(QY("Acknowledge all &warnings"));
|
||||
auto acknowledgeWarnings = new QAction{&menu};
|
||||
auto acknowledgeErrors = new QAction{&menu};
|
||||
|
||||
connect(acknowledge, &QAction::triggered, MainWindow::jobTool()->model(), &mtx::gui::Jobs::Model::acknowledgeAllWarnings);
|
||||
acknowledgeWarnings->setText(QY("Acknowledge all &warnings"));
|
||||
acknowledgeErrors->setText(QY("Acknowledge all &errors"));
|
||||
|
||||
menu.addAction(acknowledge);
|
||||
acknowledgeWarnings->setEnabled(!!m_numWarnings);
|
||||
acknowledgeErrors->setEnabled(!!m_numErrors);
|
||||
|
||||
menu.exec(static_cast<QWidget *>(sender())->mapToGlobal(pos));
|
||||
}
|
||||
connect(acknowledgeWarnings, &QAction::triggered, MainWindow::jobTool()->model(), &mtx::gui::Jobs::Model::acknowledgeAllWarnings);
|
||||
connect(acknowledgeErrors, &QAction::triggered, MainWindow::jobTool()->model(), &mtx::gui::Jobs::Model::acknowledgeAllErrors);
|
||||
|
||||
void
|
||||
StatusBarProgressWidget::showErrorsContextMenu(QPoint const &pos) {
|
||||
if (!m_numErrors)
|
||||
return;
|
||||
|
||||
QMenu menu{this};
|
||||
|
||||
auto acknowledge = new QAction{&menu};
|
||||
acknowledge->setText(QY("Acknowledge all &errors"));
|
||||
|
||||
connect(acknowledge, &QAction::triggered, MainWindow::jobTool()->model(), &mtx::gui::Jobs::Model::acknowledgeAllErrors);
|
||||
|
||||
menu.addAction(acknowledge);
|
||||
menu.addAction(acknowledgeWarnings);
|
||||
menu.addAction(acknowledgeErrors);
|
||||
|
||||
menu.exec(static_cast<QWidget *>(sender())->mapToGlobal(pos));
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ public slots:
|
||||
void setNumUnacknowledgedWarningsOrErrors(int numWarnings, int numErrors);
|
||||
void updateWarningsAndErrorsIcons();
|
||||
|
||||
void showWarningsContextMenu(QPoint const &pos);
|
||||
void showErrorsContextMenu(QPoint const &pos);
|
||||
void showContextMenu(QPoint const &pos);
|
||||
|
||||
void reset();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user