GUI: hide spinner when no jobs are running

Implements #3225.
This commit is contained in:
Moritz Bunkus 2021-11-13 17:30:13 +01:00
parent d1bc156c95
commit 1f92f220cd
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 18 additions and 3 deletions

View File

@ -15,6 +15,8 @@
`und` ("undetermined") as that is the language the track will have in the
Matroska file anyway. Before this change it wasn't possible to match such
tracks via language codes.
* MKVToolNix GUI: the spinner in the bottom right corner will now be hidden
when no jobs are currently running. Implements #3225.
## Bug fixes

View File

@ -7,6 +7,7 @@
#include <QLabel>
#include <QMessageBox>
#include <QRegularExpression>
#include <QStackedWidget>
#include <QStaticText>
#include <QVBoxLayout>
#include <QtConcurrent>
@ -52,6 +53,7 @@ class MainWindowPrivate {
std::unique_ptr<Ui::MainWindow> ui;
StatusBarProgressWidget *statusBarProgress{};
QStackedWidget *queueSpinnerStack{};
Util::WaitingSpinnerWidget *queueSpinner{};
Merge::Tool *toolMerge{};
Info::Tool *toolInfo{};
@ -174,7 +176,14 @@ MainWindow::setupAuxiliaryWidgets() {
p->queueSpinner->setRevolutionsPerSecond(1);
p->queueSpinner->setColor(QColor(0, 0, 0));
p->ui->statusBar->addPermanentWidget(p->queueSpinner);
p->queueSpinnerStack = new QStackedWidget;
p->queueSpinnerStack->addWidget(new QWidget);
p->queueSpinnerStack->addWidget(p->queueSpinner);
p->queueSpinnerStack->widget(0)->resize(p->queueSpinner->size());
p->queueSpinnerStack->setMinimumSize(p->queueSpinner->size());
p->queueSpinnerStack->setMaximumSize(p->queueSpinner->size());
p->ui->statusBar->addPermanentWidget(p->queueSpinnerStack);
}
void
@ -876,13 +885,17 @@ MainWindow::startStopQueueSpinner(bool start) {
if (start) {
++p->spinnerIsSpinning;
if (p->spinnerIsSpinning)
if (p->spinnerIsSpinning) {
p->queueSpinnerStack->setCurrentIndex(1);
p->queueSpinner->start();
}
} else if (p->spinnerIsSpinning > 0) {
--p->spinnerIsSpinning;
if (!p->spinnerIsSpinning)
if (!p->spinnerIsSpinning) {
p->queueSpinnerStack->setCurrentIndex(0);
p->queueSpinner->stop();
}
}
}