diff --git a/source/ui/ui-updater.cpp b/source/ui/ui-updater.cpp index f72545ea..628d084d 100644 --- a/source/ui/ui-updater.cpp +++ b/source/ui/ui-updater.cpp @@ -103,9 +103,16 @@ void streamfx::ui::updater_dialog::show(streamfx::update_info current, streamfx: _update_url = QUrl(QString::fromStdString(update.url)); + this->setModal(true); QDialog::show(); } +void streamfx::ui::updater_dialog::hide() +{ + this->setModal(false); + QDialog::hide(); +} + void streamfx::ui::updater_dialog::on_ok() { QDesktopServices::openUrl(_update_url); @@ -122,14 +129,6 @@ streamfx::ui::updater::updater(QMenu* menu) // Create dialog. _dialog = new updater_dialog(); - // Create GitHub message box. - _gdpr = new QMessageBox(reinterpret_cast(obs_frontend_get_main_window())); - _gdpr->setWindowTitle(QString::fromUtf8(D_TRANSLATE(D_I18N_GITHUBPERMISSION_TITLE))); - _gdpr->setTextFormat(Qt::TextFormat::RichText); - _gdpr->setText(QString::fromUtf8(D_TRANSLATE(D_I18N_GITHUBPERMISSION_TEXT))); - _gdpr->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - connect(_gdpr, &QMessageBox::buttonClicked, this, &streamfx::ui::updater::on_gdpr_button); - { // Create the necessary menu entries. menu->addSeparator(); @@ -179,6 +178,7 @@ streamfx::ui::updater::updater(QMenu* menu) if (_updater->gdpr()) { _updater->refresh(); } else { + create_gdpr_box(); _gdpr->exec(); } } @@ -243,6 +243,7 @@ void streamfx::ui::updater::on_gdpr_button(QAbstractButton* btn) void streamfx::ui::updater::on_cfu_triggered(bool) { if (!_updater->gdpr()) { + create_gdpr_box(); _gdpr->exec(); } else { emit check_active(true); @@ -287,3 +288,19 @@ void streamfx::ui::updater::on_check_active(bool active) _channel_stable->setEnabled(!active); _channel_menu->setEnabled(!active); } + +void streamfx::ui::updater::create_gdpr_box() +{ + if (_gdpr) { + _gdpr->deleteLater(); + _gdpr = nullptr; + } + + // Create GitHub message box. + _gdpr = new QMessageBox(reinterpret_cast(obs_frontend_get_main_window())); + _gdpr->setWindowTitle(QString::fromUtf8(D_TRANSLATE(D_I18N_GITHUBPERMISSION_TITLE))); + _gdpr->setTextFormat(Qt::TextFormat::RichText); + _gdpr->setText(QString::fromUtf8(D_TRANSLATE(D_I18N_GITHUBPERMISSION_TEXT))); + _gdpr->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + connect(_gdpr, &QMessageBox::buttonClicked, this, &streamfx::ui::updater::on_gdpr_button); +} diff --git a/source/ui/ui-updater.hpp b/source/ui/ui-updater.hpp index 8d24ae0f..eeacdc83 100644 --- a/source/ui/ui-updater.hpp +++ b/source/ui/ui-updater.hpp @@ -54,6 +54,7 @@ namespace streamfx::ui { ~updater_dialog(); void show(streamfx::update_info current, streamfx::update_info update); + void hide(); public slots: ; // Needed by some linters. @@ -83,6 +84,8 @@ namespace streamfx::ui { updater(QMenu* menu); ~updater(); + void create_gdpr_box(); + void on_updater_automation_changed(streamfx::updater&, bool); void on_updater_channel_changed(streamfx::updater&, streamfx::update_channel); void on_updater_refreshed(streamfx::updater&); diff --git a/ui/updater.ui b/ui/updater.ui index ee0790d0..42571db3 100644 --- a/ui/updater.ui +++ b/ui/updater.ui @@ -41,7 +41,7 @@ QWidget[objectName="ok"]:hover { } - true + false