mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-28 06:13:01 +00:00
ui/updater: Apply workaround for OBS Studio checking for modals
In order to work around a bug in the OBS Studio UI code, we have to swap our modal status right before showing and right after hiding, so that the OBS Studio tray menu continuous working correctly. This is a bit of a weird solution, but it does work as expected. Related: https://github.com/obsproject/obs-studio/issues/3518
This commit is contained in:
parent
4ed1f3d481
commit
3dbf9c9dbc
3 changed files with 29 additions and 9 deletions
|
@ -103,9 +103,16 @@ void streamfx::ui::updater_dialog::show(streamfx::update_info current, streamfx:
|
||||||
|
|
||||||
_update_url = QUrl(QString::fromStdString(update.url));
|
_update_url = QUrl(QString::fromStdString(update.url));
|
||||||
|
|
||||||
|
this->setModal(true);
|
||||||
QDialog::show();
|
QDialog::show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void streamfx::ui::updater_dialog::hide()
|
||||||
|
{
|
||||||
|
this->setModal(false);
|
||||||
|
QDialog::hide();
|
||||||
|
}
|
||||||
|
|
||||||
void streamfx::ui::updater_dialog::on_ok()
|
void streamfx::ui::updater_dialog::on_ok()
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl(_update_url);
|
QDesktopServices::openUrl(_update_url);
|
||||||
|
@ -122,14 +129,6 @@ streamfx::ui::updater::updater(QMenu* menu)
|
||||||
// Create dialog.
|
// Create dialog.
|
||||||
_dialog = new updater_dialog();
|
_dialog = new updater_dialog();
|
||||||
|
|
||||||
// Create GitHub message box.
|
|
||||||
_gdpr = new QMessageBox(reinterpret_cast<QWidget*>(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.
|
{ // Create the necessary menu entries.
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
|
@ -179,6 +178,7 @@ streamfx::ui::updater::updater(QMenu* menu)
|
||||||
if (_updater->gdpr()) {
|
if (_updater->gdpr()) {
|
||||||
_updater->refresh();
|
_updater->refresh();
|
||||||
} else {
|
} else {
|
||||||
|
create_gdpr_box();
|
||||||
_gdpr->exec();
|
_gdpr->exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,7 @@ void streamfx::ui::updater::on_gdpr_button(QAbstractButton* btn)
|
||||||
void streamfx::ui::updater::on_cfu_triggered(bool)
|
void streamfx::ui::updater::on_cfu_triggered(bool)
|
||||||
{
|
{
|
||||||
if (!_updater->gdpr()) {
|
if (!_updater->gdpr()) {
|
||||||
|
create_gdpr_box();
|
||||||
_gdpr->exec();
|
_gdpr->exec();
|
||||||
} else {
|
} else {
|
||||||
emit check_active(true);
|
emit check_active(true);
|
||||||
|
@ -287,3 +288,19 @@ void streamfx::ui::updater::on_check_active(bool active)
|
||||||
_channel_stable->setEnabled(!active);
|
_channel_stable->setEnabled(!active);
|
||||||
_channel_menu->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<QWidget*>(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);
|
||||||
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace streamfx::ui {
|
||||||
~updater_dialog();
|
~updater_dialog();
|
||||||
|
|
||||||
void show(streamfx::update_info current, streamfx::update_info update);
|
void show(streamfx::update_info current, streamfx::update_info update);
|
||||||
|
void hide();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
; // Needed by some linters.
|
; // Needed by some linters.
|
||||||
|
@ -83,6 +84,8 @@ namespace streamfx::ui {
|
||||||
updater(QMenu* menu);
|
updater(QMenu* menu);
|
||||||
~updater();
|
~updater();
|
||||||
|
|
||||||
|
void create_gdpr_box();
|
||||||
|
|
||||||
void on_updater_automation_changed(streamfx::updater&, bool);
|
void on_updater_automation_changed(streamfx::updater&, bool);
|
||||||
void on_updater_channel_changed(streamfx::updater&, streamfx::update_channel);
|
void on_updater_channel_changed(streamfx::updater&, streamfx::update_channel);
|
||||||
void on_updater_refreshed(streamfx::updater&);
|
void on_updater_refreshed(streamfx::updater&);
|
||||||
|
|
|
@ -41,7 +41,7 @@ QWidget[objectName="ok"]:hover {
|
||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
|
Loading…
Reference in a new issue