ui: made os integration more universal

ProgressDialog doesn't have to worry about the platform anymore, now
MainWindow will determine what to do or whether to ignore certain progress
indicator functions.
This commit is contained in:
itsmattkc
2020-06-16 16:55:11 +10:00
parent e979ce4d7a
commit cadb703ed8
3 changed files with 54 additions and 32 deletions
+4 -12
View File
@@ -68,18 +68,14 @@ void ProgressDialog::showEvent(QShowEvent *e)
elapsed_timer_lbl_->Start();
#ifdef Q_OS_WINDOWS
Core::instance()->main_window()->SetTaskbarButtonState(TBPF_NORMAL);
#endif
Core::instance()->main_window()->SetApplicationProgressStatus(MainWindow::kProgressShow);
}
void ProgressDialog::closeEvent(QCloseEvent *e)
{
QDialog::closeEvent(e);
#ifdef Q_OS_WINDOWS
Core::instance()->main_window()->SetTaskbarButtonState(TBPF_NOPROGRESS);
#endif
Core::instance()->main_window()->SetApplicationProgressStatus(MainWindow::kProgressNone);
}
void ProgressDialog::SetProgress(double value)
@@ -89,16 +85,12 @@ void ProgressDialog::SetProgress(double value)
bar_->setValue(percent);
elapsed_timer_lbl_->SetProgress(value);
#ifdef Q_OS_WINDOWS
Core::instance()->main_window()->SetTaskbarButtonProgress(percent, 100);
#endif
Core::instance()->main_window()->SetApplicationProgressValue(percent);
}
void ProgressDialog::ShowErrorMessage(const QString &title, const QString &message)
{
#ifdef Q_OS_WINDOWS
Core::instance()->main_window()->SetTaskbarButtonState(TBPF_ERROR);
#endif
Core::instance()->main_window()->SetApplicationProgressStatus(MainWindow::kProgressError);
QMessageBox b(this);
b.setIcon(QMessageBox::Critical);