#4323 Refactored ElevateMode into its own header

This commit is contained in:
Andrew Nelless 2016-06-10 15:33:30 +01:00 committed by Jerry (Xinyu Hou)
parent fa9f30ff81
commit d42ea08a1d
5 changed files with 46 additions and 25 deletions

View File

@ -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 {

View File

@ -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";

View File

@ -21,6 +21,7 @@
#define APPCONFIG_H
#include <QString>
#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;

41
src/gui/src/ElevateMode.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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;

View File

@ -21,7 +21,7 @@
#include <QObject>
#include <QAbstractSocket>
#include "AppConfig.h"
#include "ElevateMode.h"
class QTcpSocket;
class IpcReader;