From 91b85ce9dceb591bf32865e6be7563af8166d768 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 27 Sep 2024 19:27:55 +0100 Subject: [PATCH] Support for older Qt6 without lambda callback --- .../synergy/gui/license/LicenseHandler.cpp | 24 +++++++++---------- src/lib/synergy/gui/license/LicenseHandler.h | 3 +++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/lib/synergy/gui/license/LicenseHandler.cpp b/src/lib/synergy/gui/license/LicenseHandler.cpp index 28aa629a8..d0378fcf2 100644 --- a/src/lib/synergy/gui/license/LicenseHandler.cpp +++ b/src/lib/synergy/gui/license/LicenseHandler.cpp @@ -47,12 +47,8 @@ bool LicenseHandler::handleStart(QMainWindow *parent, AppConfig *appConfig) { m_mainWindow = parent; m_appConfig = appConfig; - const auto onChangeSerialKey = [this] { - showActivationDialog(m_mainWindow, m_appConfig); - }; - - const auto serialKeyAction = - parent->addAction("Change serial key", onChangeSerialKey); + const auto serialKeyAction = parent->addAction( + "Change serial key", this, &LicenseHandler::onChangeSerialKey); const auto licenseMenu = new QMenu("License"); licenseMenu->addAction(serialKeyAction); @@ -85,12 +81,6 @@ bool LicenseHandler::showActivationDialog( } } -void LicenseHandler::updateMainWindow() const { - const auto productName = QString::fromStdString(m_license.productName()); - qDebug("updating main window title: %s", qPrintable(productName)); - m_mainWindow->setWindowTitle(m_license.productName().c_str()); -} - void LicenseHandler::handleSettings( QDialog *parent, QCheckBox *checkBoxEnableTls) const { @@ -104,6 +94,16 @@ void LicenseHandler::handleSettings( checkTlsCheckBox(parent, checkBoxEnableTls, false); } +void LicenseHandler::onChangeSerialKey() { + showActivationDialog(m_mainWindow, m_appConfig); +} + +void LicenseHandler::updateMainWindow() const { + const auto productName = QString::fromStdString(m_license.productName()); + qDebug("updating main window title: %s", qPrintable(productName)); + m_mainWindow->setWindowTitle(m_license.productName().c_str()); +} + void LicenseHandler::checkTlsCheckBox( QDialog *parent, QCheckBox *checkBoxEnableTls, bool showDialog) const { if (!m_license.isTlsAvailable() && checkBoxEnableTls->isChecked()) { diff --git a/src/lib/synergy/gui/license/LicenseHandler.h b/src/lib/synergy/gui/license/LicenseHandler.h index c3f983627..87e35ad77 100644 --- a/src/lib/synergy/gui/license/LicenseHandler.h +++ b/src/lib/synergy/gui/license/LicenseHandler.h @@ -63,6 +63,9 @@ class LicenseHandler : public QObject { void updateMainWindow() const; bool showActivationDialog(QMainWindow *parent, AppConfig *appConfig); +private slots: + void onChangeSerialKey(); + signals: void serialKeyChanged(const QString &serialKey) const; void invalidLicense() const;