Compare result of clickedButton instead of exec (#7438)

* Compare result of `clickedButton` instead of `exec` to workaround Qt 6.5 bug

* Update ChangeLog

* Fixed typo

* Add missing backticks

* Init as nullptr
This commit is contained in:
Nick Bolton
2024-08-13 11:29:59 +01:00
committed by GitHub
parent 7fa9379a24
commit da02fca602
3 changed files with 22 additions and 8 deletions

View File

@ -2,7 +2,7 @@
Enhancements:
- #7254 Bind client to a network interface with --address
- #7254 Bind client to a network interface with `--address`
- #7262 Backward compatibility for M1 and M2 builds
- #7263 Change name of Flatpak uploaded to snapshots
- #7265 Remove obtrusive Linux key press log messages
@ -13,10 +13,10 @@ Enhancements:
- #7284 Change session ID info log message to DEBUG2
- #7283 Update all workflows and fix broken macOS workflows
- #7313 Fix CodeQL workflow: Failed to perl 404 Not Found
- #7317 Bump sonar-scanner-cli to 5.0.1.3006
- #7317 Bump `sonar-scanner-cli` to 5.0.1.3006
- #7318 Remove Azure Pipelines config entirely
- #7319 Remove workflows for slow self-hosted RPi runners
- #7320 Move build_version.py script to scripts dir
- #7320 Move `build_version.py` script to scripts dir
- #7321 Switch to GitHub hosted Mac M1 runner
- #7322 Use C++20 and add Windows CMake preset
- #7323 Add Linux and macOS CMake presets
@ -41,7 +41,7 @@ Enhancements:
- #7364 Format all source with Clang and introduce lint workflow
- #7368 Make version check URL v1-specific and configurable
- #7369 Re-implement packaging for GitHub workflows (Linux ARM)
- #7372 Add Git SHA to about screen and --version
- #7372 Add Git SHA to about screen and `--version`
- #7373 Upgrade from Qt5 to Qt6 for more modern UI
- #7374 Add missing DEB and RPM dependencies
- #7376 Automated weekly build of Docker images for Linux runners
@ -80,6 +80,7 @@ Enhancements:
- #7435 Add reset settings menu action and env var
- #7436 Introduced new env vars for testing
- #7437 Show message box explaining why settings are read-only
- #7438 Compare result of `clickedButton` instead of `exec`
# 1.14.6

View File

@ -24,14 +24,22 @@
UpgradeDialog::UpgradeDialog(QWidget *parent) : QMessageBox(parent) {
setWindowTitle("Upgrade to access this feature");
addButton("Cancel", QMessageBox::RejectRole);
addButton("Upgrade", QMessageBox::AcceptRole);
m_cancel = addButton("Cancel", QMessageBox::RejectRole);
m_upgrade = addButton("Upgrade", QMessageBox::AcceptRole);
}
void UpgradeDialog::showDialog(const QString &text) {
setText(text);
exec();
if (exec() == QMessageBox::Accepted) {
QDesktopServices::openUrl(QUrl(synergy::gui::kUrlUpgrade));
if (clickedButton() == m_upgrade) {
const auto url = QUrl(synergy::gui::kUrlUpgrade);
if (QDesktopServices::openUrl(url)) {
qDebug("opened url: %s", qUtf8Printable(url.toString()));
} else {
qCritical("failed to open url: %s", qUtf8Printable(url.toString()));
}
} else {
qDebug("upgrade was declined");
}
}

View File

@ -18,9 +18,14 @@
#pragma once
#include <QMessageBox>
#include <QPushButton>
class UpgradeDialog : public QMessageBox {
public:
explicit UpgradeDialog(QWidget *parent = nullptr);
void showDialog(const QString &text);
private:
QPushButton *m_upgrade = nullptr;
QPushButton *m_cancel = nullptr;
};