From d42ea08a1dd1a98ab5b04fe322a089a227b37aac Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Fri, 10 Jun 2016 15:33:30 +0100 Subject: [PATCH] #4323 Refactored ElevateMode into its own header --- src/gui/gui.pro | 3 ++- src/gui/src/AppConfig.cpp | 1 + src/gui/src/AppConfig.h | 24 +---------------------- src/gui/src/ElevateMode.h | 41 +++++++++++++++++++++++++++++++++++++++ src/gui/src/IpcClient.h | 2 +- 5 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 src/gui/src/ElevateMode.h diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 73368b84..408d44dd 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -111,7 +111,8 @@ HEADERS += src/MainWindow.h \ src/WebClient.h \ ../lib/common/PluginVersion.h \ src/SubscriptionManager.h \ - src/ActivationNotifier.h + src/ActivationNotifier.h \ + src/ElevateMode.h RESOURCES += res/Synergy.qrc RC_FILE = res/win/Synergy.rc macx { diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index 9f659738..e6309d04 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -27,6 +27,7 @@ const char AppConfig::m_SynergysName[] = "synergys.exe"; const char AppConfig::m_SynergycName[] = "synergyc.exe"; const char AppConfig::m_SynergyLogDir[] = "log/"; +const ElevateMode defaultElevateMode = ElevateAsNeeded; #define DEFAULT_PROCESS_MODE Service #else const char AppConfig::m_SynergysName[] = "synergys"; diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index dcd5a482..713753f9 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -21,6 +21,7 @@ #define APPCONFIG_H #include +#include "ElevateMode.h" // this should be incremented each time a new page is added. this is // saved to settings when the user finishes running the wizard. if @@ -46,29 +47,6 @@ enum ProcessMode { Desktop }; -// The elevate mode tristate determines two behaviours on Windows. -// The first, switch-on-desk-switch (SodS), passed through synergyd as a -// command line argument to synergy core, determines if the server restarts -// when switching Windows desktops (e.g. when Windows UAC dialog pops up). -// The second, passed as a boolean flag to Synergyd over the IPC inside -// kIpcCommandMessage, determines whether Synergy should be started with -// elevated privileges. -// -// The matrix for these two behaviours is as follows: -// SodS Elevate -// ___________________________ -// ElevateAsNeeded | true | false -// ElevateAlways | false | true -// ElevateNever | false | false -// -enum ElevateMode { - ElevateAsNeeded = 0, - ElevateAlways = 1, - ElevateNever = 2 -}; - -static const ElevateMode defaultElevateMode = ElevateAsNeeded; - class AppConfig { friend class SettingsDialog; diff --git a/src/gui/src/ElevateMode.h b/src/gui/src/ElevateMode.h new file mode 100644 index 00000000..7e39eb52 --- /dev/null +++ b/src/gui/src/ElevateMode.h @@ -0,0 +1,41 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2016 Symless + * + * 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 + +// The elevate mode tristate determines two behaviours on Windows. +// The first, switch-on-desk-switch (SodS), passed through synergyd as a +// command line argument to synergy core, determines if the server restarts +// when switching Windows desktops (e.g. when Windows UAC dialog pops up). +// The second, passed as a boolean flag to Synergyd over the IPC inside +// kIpcCommandMessage, determines whether Synergy should be started with +// elevated privileges. +// +// The matrix for these two behaviours is as follows: +// SodS Elevate +// ___________________________ +// ElevateAsNeeded | true | false +// ElevateAlways | false | true +// ElevateNever | false | false +// +enum ElevateMode { + ElevateAsNeeded = 0, + ElevateAlways = 1, + ElevateNever = 2 +}; + +extern const ElevateMode defaultElevateMode; diff --git a/src/gui/src/IpcClient.h b/src/gui/src/IpcClient.h index 439211bd..b49d9e6a 100644 --- a/src/gui/src/IpcClient.h +++ b/src/gui/src/IpcClient.h @@ -21,7 +21,7 @@ #include #include -#include "AppConfig.h" +#include "ElevateMode.h" class QTcpSocket; class IpcReader;