diff --git a/deskflow b/deskflow index db7682f70..4217966da 160000 --- a/deskflow +++ b/deskflow @@ -1 +1 @@ -Subproject commit db7682f70fbe707522d33cab5a7557bb282221ac +Subproject commit 4217966da742088dc57cc5b4b792162dd2601a18 diff --git a/src/lib/synergy/gui/ActivationDialog.cpp b/src/lib/synergy/gui/ActivationDialog.cpp index 8b6ccd030..918dde628 100644 --- a/src/lib/synergy/gui/ActivationDialog.cpp +++ b/src/lib/synergy/gui/ActivationDialog.cpp @@ -24,7 +24,7 @@ #include "synergy/gui/constants.h" #include "synergy/gui/license/LicenseHandler.h" #include "synergy/gui/license/license_notices.h" -#include "synergy/license/ProductEdition.h" +#include "synergy/license/Product.h" #include "synergy/license/parse_serial_key.h" #include "ui_ActivationDialog.h" @@ -85,7 +85,7 @@ ActivationDialog::~ActivationDialog() { delete m_ui; } void ActivationDialog::reject() { // don't show the cancel confirmation dialog if they've already registered, // since it's not relevant to customers who are changing their serial key. - if (m_licenseHandler.productEdition() != Edition::kUnregistered) { + if (m_licenseHandler.productEdition() != Product::Edition::kUnregistered) { QDialog::reject(); return; } diff --git a/src/lib/synergy/gui/license/LicenseHandler.cpp b/src/lib/synergy/gui/license/LicenseHandler.cpp index 15903f735..37a9566fc 100644 --- a/src/lib/synergy/gui/license/LicenseHandler.cpp +++ b/src/lib/synergy/gui/license/LicenseHandler.cpp @@ -21,7 +21,7 @@ #include "constants.h" #include "dialogs/UpgradeDialog.h" #include "synergy/gui/license/license_utils.h" -#include "synergy/license/ProductEdition.h" +#include "synergy/license/Product.h" #include #include @@ -47,8 +47,12 @@ bool LicenseHandler::handleStart(QMainWindow *parent, AppConfig *appConfig) { m_mainWindow = parent; m_appConfig = appConfig; - const auto serialKeyAction = parent->addAction( - "Change serial key", &LicenseHandler::onChangeSerialKey); + const auto onChangeSerialKey = [this] { + showActivationDialog(m_mainWindow, m_appConfig); + }; + + const auto serialKeyAction = + parent->addAction("Change serial key", onChangeSerialKey); const auto licenseMenu = new QMenu("License"); licenseMenu->addAction(serialKeyAction); @@ -66,10 +70,6 @@ bool LicenseHandler::handleStart(QMainWindow *parent, AppConfig *appConfig) { return showActivationDialog(parent, appConfig); } -void LicenseHandler::onChangeSerialKey() { - showActivationDialog(m_mainWindow, m_appConfig); -} - bool LicenseHandler::showActivationDialog(QMainWindow *parent, AppConfig *appConfig) { ActivationDialog dialog(parent, *appConfig, *this); @@ -92,7 +92,7 @@ void LicenseHandler::updateMainWindow() const { } void LicenseHandler::handleSettings(QDialog *parent, - QCheckBox *checkBoxEnableTls) { + QCheckBox *checkBoxEnableTls) const { const auto onTlsToggle = [this, parent, checkBoxEnableTls] { qDebug("tls checkbox toggled"); @@ -106,7 +106,7 @@ void LicenseHandler::handleSettings(QDialog *parent, void LicenseHandler::checkTlsCheckBox(QDialog *parent, QCheckBox *checkBoxEnableTls, - bool showDialog) { + bool showDialog) const { if (!m_license.isTlsAvailable() && checkBoxEnableTls->isChecked()) { qDebug("tls not available, showing upgrade dialog"); checkBoxEnableTls->setChecked(false); @@ -140,7 +140,7 @@ const synergy::license::License &LicenseHandler::license() const { return m_license; } -Edition LicenseHandler::productEdition() const { +Product::Edition LicenseHandler::productEdition() const { return m_license.productEdition(); } @@ -158,7 +158,6 @@ LicenseHandler::changeSerialKey(const QString &hexString) { if (hexString.isEmpty()) { qFatal("serial key is empty"); - return kFatal; } qDebug() << "changing serial key to:" << hexString; diff --git a/src/lib/synergy/gui/license/LicenseHandler.h b/src/lib/synergy/gui/license/LicenseHandler.h index 49b921068..0e81e4cdb 100644 --- a/src/lib/synergy/gui/license/LicenseHandler.h +++ b/src/lib/synergy/gui/license/LicenseHandler.h @@ -21,14 +21,12 @@ #include "synergy/gui/license/LicenseSettings.h" #include "synergy/gui/license/license_utils.h" #include "synergy/license/License.h" -#include "synergy/license/ProductEdition.h" - -#include -#include -#include -#include +#include "synergy/license/Product.h" class AppConfig; +class QMainWindow; +class QDialog; +class QCheckBox; /** * @brief A convenience wrapper for `License` that provides Qt signals, etc. @@ -52,19 +50,18 @@ class LicenseHandler : public QObject { void load(); void save(); - Edition productEdition() const; + Product::Edition productEdition() const; const License &license() const; void validate() const; QString productName() const; ChangeSerialKeyResult changeSerialKey(const QString &hexString); void setEnabled(bool enabled) { m_enabled = enabled; } bool handleStart(QMainWindow *parent, AppConfig *appConfig); - void handleSettings(QDialog *parent, QCheckBox *checkBoxEnableTls); + void handleSettings(QDialog *parent, QCheckBox *checkBoxEnableTls) const; void checkTlsCheckBox(QDialog *parent, QCheckBox *checkBoxEnableTls, - bool showDialog); + bool showDialog) const; void updateMainWindow() const; bool showActivationDialog(QMainWindow *parent, AppConfig *appConfig); - void onChangeSerialKey(); signals: void serialKeyChanged(const QString &serialKey) const; diff --git a/src/lib/synergy/gui/license/LicenseSettings.h b/src/lib/synergy/gui/license/LicenseSettings.h index f6e5300f9..0cd8912cd 100644 --- a/src/lib/synergy/gui/license/LicenseSettings.h +++ b/src/lib/synergy/gui/license/LicenseSettings.h @@ -17,8 +17,8 @@ #pragma once +#include #include -#include namespace synergy::gui::license { diff --git a/src/lib/synergy/license/License.cpp b/src/lib/synergy/license/License.cpp index 430f1c8ed..72ca334e5 100644 --- a/src/lib/synergy/license/License.cpp +++ b/src/lib/synergy/license/License.cpp @@ -51,7 +51,7 @@ bool License::isTlsAvailable() const { return m_serialKey.product.isTlsAvailable(); } -Edition License::productEdition() const { +Product::Edition License::productEdition() const { return m_serialKey.product.edition(); } diff --git a/src/lib/synergy/license/License.h b/src/lib/synergy/license/License.h index c1d4f0bd4..279937dab 100644 --- a/src/lib/synergy/license/License.h +++ b/src/lib/synergy/license/License.h @@ -60,7 +60,7 @@ class License : public ILicense { bool isSubscription() const; bool isTimeLimited() const; days daysLeft() const; - Edition productEdition() const; + Product::Edition productEdition() const; std::string productName() const; const SerialKey &serialKey() const { return m_serialKey; } void invalidate() { m_serialKey = SerialKey::invalid(); } diff --git a/src/lib/synergy/license/ProductEdition.h b/src/lib/synergy/license/ProductEdition.h deleted file mode 100644 index 637dcf8d8..000000000 --- a/src/lib/synergy/license/ProductEdition.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Synergy -- mouse and keyboard sharing utility - * Copyright (C) 2015 Symless Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file LICENSE that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include "Product.h" - -/// @deprecated Use `Product::Edition` instead -using Edition = Product::Edition; diff --git a/src/lib/synergy/license/SerialKey.h b/src/lib/synergy/license/SerialKey.h index f617f5358..5ab50dd20 100644 --- a/src/lib/synergy/license/SerialKey.h +++ b/src/lib/synergy/license/SerialKey.h @@ -17,10 +17,8 @@ #pragma once -#include "ProductEdition.h" +#include "Product.h" #include "SerialKeyType.h" -#include "synergy/license/Product.h" -#include "synergy/license/ProductEdition.h" #include #include @@ -54,7 +52,7 @@ struct SerialKey { std::optional expireTime = std::nullopt; private: - explicit SerialKey(Edition edition) : product(edition) {} + explicit SerialKey(Product::Edition edition) : product(edition) {} }; } // namespace synergy::license diff --git a/src/test/unittests/license/LicenseTests.cpp b/src/test/unittests/license/LicenseTests.cpp index be7e61b1d..c1ec401e2 100644 --- a/src/test/unittests/license/LicenseTests.cpp +++ b/src/test/unittests/license/LicenseTests.cpp @@ -18,14 +18,13 @@ #include #define TEST_ENV -#include "synergy/license/ProductEdition.h" - #include "synergy/license/License.h" +#include "synergy/license/Product.h" #include #include -using enum Edition; +using enum Product::Edition; using namespace synergy::license; using time_point = std::chrono::system_clock::time_point; using seconds = std::chrono::seconds;