Skip to content

Commit

Permalink
Support for older Qt6 without lambda callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nbolton committed Sep 27, 2024
1 parent 8a12307 commit 91b85ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/lib/synergy/gui/license/LicenseHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {

Expand All @@ -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()) {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/synergy/gui/license/LicenseHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 91b85ce

Please sign in to comment.