From 05ce7f37bc9b16acd404252a2ea765543674baf5 Mon Sep 17 00:00:00 2001 From: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com> Date: Mon, 15 Feb 2021 14:44:46 +0300 Subject: [PATCH] SYNERGY-826 Add a new option SYNERGY_AUTOCONFIG (#6949) * SYNERGY-826 Add a new option SYNERGY_AUTOCONFIG * Update ChangeLog * Update Version.cmake * SYNERGY-826 Return stage back --- CMakeLists.txt | 8 +++++++- ChangeLog | 1 + cmake/Version.cmake | 4 ++++ src/gui/CMakeLists.txt | 10 +++++++--- src/gui/src/AppConfig.cpp | 2 +- src/gui/src/MainWindow.cpp | 16 ++++++++-------- src/gui/src/SettingsDialog.cpp | 13 ++++++++----- 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e9c46b22..10a50691d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,12 @@ else() option (SYNERGY_ENTERPRISE "Build Enterprise" OFF) endif() +if (DEFINED ENV{SYNERGY_AUTOCONFIG}) + option (SYNERGY_AUTOCONFIG "Build with Autoconfig" ON) +else() + option (SYNERGY_AUTOCONFIG "Build without Autoconfig" OFF) +endif() + set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_EXTENSIONS OFF) set (CMAKE_CXX_STANDARD_REQUIRED ON) @@ -254,7 +260,7 @@ if (UNIX) list (APPEND libs Xi) endif() - if (NOT SYNERGY_ENTERPRISE AND SYNERGY_BUILD_LEGACY_GUI) + if (NOT SYNERGY_ENTERPRISE AND SYNERGY_BUILD_LEGACY_GUI AND SYNERGY_AUTOCONFIG) set (DnsSdlib "dns_sd.h") set (CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};${DnsSdlib}") check_include_files ("${DnsSdlib}" HAVE_DNS_SD) diff --git a/ChangeLog b/ChangeLog index 3497ee7d3..15e20db53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ Enhancements: - #6937 Modern C++ compiler for centOS7 - #6938 Remove auto config message from the main window - #6941 Add Raspberry Pi Builds +- #6949 Add a new option SYNERGY_AUTOCONFIG to exclude autoconfig from the standard version v1.13.0-stable =========== diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 7db1ffb45..50d190a02 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -77,3 +77,7 @@ endif() if (SYNERGY_ENTERPRISE) add_definitions (-DSYNERGY_ENTERPRISE=1) endif() + +if (SYNERGY_AUTOCONFIG) + add_definitions (-DSYNERGY_AUTOCONFIG=1) +endif() diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index a80d9b615..ce81e0734 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -38,6 +38,10 @@ if (SYNERGY_ENTERPRISE) list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ZEROCONF_FILES}) endif () +if (NOT SYNERGY_AUTOCONFIG) + list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ZEROCONF_FILES}) +endif () + if (WIN32) set (LEGACY_GUI_RC_FILES res/win/Synergy.rc) endif() @@ -54,7 +58,7 @@ add_executable (synergy WIN32 include_directories (./src) target_link_libraries (synergy shared) -if (NOT SYNERGY_ENTERPRISE) +if (NOT SYNERGY_ENTERPRISE AND SYNERGY_AUTOCONFIG) if (WIN32) include_directories ($ENV{BONJOUR_SDK_HOME}/Include) if (CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -80,7 +84,7 @@ target_compile_definitions (synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_V target_compile_definitions (synergy PRIVATE -DSYNERGY_REVISION="${SYNERGY_REVISION}") if (WIN32) -if (NOT SYNERGY_ENTERPRISE) +if (NOT SYNERGY_ENTERPRISE AND SYNERGY_AUTOCONFIG) target_link_libraries (synergy ${DNSSD_LIB}) endif () set_target_properties (synergy PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT") @@ -121,4 +125,4 @@ if (WIN32) COMMAND Qt5::windeployqt "$/$" ) endif() -endif() \ No newline at end of file +endif() diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index b4d68b429..af19c52f6 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -187,7 +187,7 @@ const QString &AppConfig::language() const { return m_Language; } bool AppConfig::startedBefore() const { return m_StartedBefore; } bool AppConfig::autoConfig() const { -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) return m_AutoConfig; #else // always disable auto config for enterprise edition. diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 8c0f06d79..765729a88 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -122,7 +122,7 @@ MainWindow::MainWindow (AppConfig& appConfig, m_ExpectedRunningState(kStopped), m_SecureSocket(false) { -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) m_pZeroconf = new Zeroconf(this); #endif @@ -202,7 +202,7 @@ MainWindow::MainWindow (AppConfig& appConfig, m_pActivate->setVisible(false); #endif -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) updateZeroconfService(); addZeroconfServer(m_AppConfig->autoConfigServer()); @@ -218,7 +218,7 @@ MainWindow::~MainWindow() stopDesktop(); } -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) delete m_pZeroconf; #endif } @@ -346,7 +346,7 @@ void MainWindow::saveSettings() } void MainWindow::zeroConfToggled() { -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) updateZeroconfService(); addZeroconfServer(m_AppConfig->autoConfigServer()); @@ -754,7 +754,7 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) args << "--log" << appConfig().logFilenameCmd(); } -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) // check auto config first, if it is disabled or no server detected, // use line edit host name if it is not empty if (appConfig().autoConfig()) { @@ -775,7 +775,7 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) if (m_pLineEditHostname->text().isEmpty()) { -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) //check if autoconfig mode is enabled if (!appConfig().autoConfig()) { @@ -786,7 +786,7 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) tr("Please fill in a hostname for the synergy client to connect to.")); return false; -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) } else { @@ -1223,7 +1223,7 @@ void MainWindow::on_m_pActionHelp_triggered() void MainWindow::updateZeroconfService() { -#ifndef SYNERGY_ENTERPRISE +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) // reset the server list in case one has gone away. // it'll be re-added after the zeroconf service restarts. diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index e25da8c7e..ca29d08d2 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -177,17 +177,20 @@ void SettingsDialog::loadFromConfig() { m_pCheckBoxEnableCrypto->setEnabled(true); m_pLabelProUpgrade->hide(); - m_pCheckBoxAutoConfig->hide(); - m_pLabelInstallBonjour->hide(); - #else m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.isCryptoAvailable()); m_pLabelProUpgrade->setVisible(!m_appConfig.isCryptoAvailable()); - m_pCheckBoxAutoConfig->setChecked(appConfig().autoConfig()); - #endif + +#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG) + m_pCheckBoxAutoConfig->setChecked(appConfig().autoConfig()); +#else + m_pCheckBoxAutoConfig->hide(); + m_pLabelInstallBonjour->hide(); +#endif + adjustSize(); }