Make Clang param and arg alignment more readable (#7387)
* Turn off alignment of params * Apply Clang format * Change AlignAfterOpenBracket to AlwaysBreak and add extra bin pack settings * Restore default bin packing * Apply format
This commit is contained in:
@ -9,3 +9,20 @@
|
||||
# $ pip install clang-format==<version>
|
||||
|
||||
BasedOnStyle: LLVM
|
||||
|
||||
# Turn off LLVM default alignment of params with the opening bracket,
|
||||
# which can be less readable in some cases in our code base.
|
||||
#
|
||||
# Using `AlwaysBreak` will result in:
|
||||
# void fooBarBazQuxHelloWorld(
|
||||
# int a,
|
||||
# int b);
|
||||
#
|
||||
# Instead of:
|
||||
# void fooBarBazQuxHelloWorld(int a,
|
||||
# int b);
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
|
||||
# Turn off LLVM default packing of ctor initializers.
|
||||
# This makes it easier to see which members were initialized and in what order.
|
||||
PackConstructorInitializers: CurrentLine
|
||||
|
||||
@ -40,7 +40,9 @@ const UINT MSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] = {
|
||||
MSWindowsClientTaskBarReceiver::MSWindowsClientTaskBarReceiver(
|
||||
HINSTANCE appInstance, const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events)
|
||||
: ClientTaskBarReceiver(events), m_appInstance(appInstance), m_window(NULL),
|
||||
: ClientTaskBarReceiver(events),
|
||||
m_appInstance(appInstance),
|
||||
m_window(NULL),
|
||||
m_logBuffer(logBuffer) {
|
||||
for (UInt32 i = 0; i < kMaxState; ++i) {
|
||||
m_icon[i] = loadIcon(s_stateToIconID[i]);
|
||||
@ -135,8 +137,8 @@ void MSWindowsClientTaskBarReceiver::runMenu(int x, int y) {
|
||||
HMENU menu = GetSubMenu(m_menu, 0);
|
||||
SetMenuDefaultItem(menu, IDC_TASKBAR_STATUS, FALSE);
|
||||
HMENU logLevelMenu = GetSubMenu(menu, 3);
|
||||
CheckMenuRadioItem(logLevelMenu, 0, 6, CLOG->getFilter() - kERROR,
|
||||
MF_BYPOSITION);
|
||||
CheckMenuRadioItem(
|
||||
logLevelMenu, 0, 6, CLOG->getFilter() - kERROR, MF_BYPOSITION);
|
||||
int n = TrackPopupMenu(
|
||||
menu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, x,
|
||||
y, 0, m_window, NULL);
|
||||
@ -226,8 +228,8 @@ void MSWindowsClientTaskBarReceiver::onStatusChanged() {
|
||||
|
||||
HICON
|
||||
MSWindowsClientTaskBarReceiver::loadIcon(UINT id) {
|
||||
HANDLE icon = LoadImage(m_appInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0,
|
||||
LR_DEFAULTCOLOR);
|
||||
HANDLE icon = LoadImage(
|
||||
m_appInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
|
||||
return static_cast<HICON>(icon);
|
||||
}
|
||||
|
||||
@ -267,8 +269,8 @@ void MSWindowsClientTaskBarReceiver::destroyWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
BOOL MSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
LPARAM) {
|
||||
BOOL MSWindowsClientTaskBarReceiver::dlgProc(
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM) {
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
// use default focus
|
||||
@ -284,9 +286,8 @@ BOOL MSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK MSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd, UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
BOOL CALLBACK MSWindowsClientTaskBarReceiver::staticDlgProc(
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
// if msg is WM_INITDIALOG, extract the MSWindowsClientTaskBarReceiver*
|
||||
// and put it in the extra window data then forward the call.
|
||||
MSWindowsClientTaskBarReceiver *self = NULL;
|
||||
@ -310,15 +311,15 @@ BOOL CALLBACK MSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd, UINT msg,
|
||||
}
|
||||
}
|
||||
|
||||
IArchTaskBarReceiver *
|
||||
createTaskBarReceiver(const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events) {
|
||||
ArchMiscWindows::setIcons((HICON)LoadImage(ArchMiscWindows::instanceWin32(),
|
||||
MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 32, 32, LR_SHARED),
|
||||
(HICON)LoadImage(ArchMiscWindows::instanceWin32(),
|
||||
MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 16, 16, LR_SHARED));
|
||||
IArchTaskBarReceiver *createTaskBarReceiver(
|
||||
const BufferedLogOutputter *logBuffer, IEventQueue *events) {
|
||||
ArchMiscWindows::setIcons(
|
||||
(HICON)LoadImage(
|
||||
ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 32, 32, LR_SHARED),
|
||||
(HICON)LoadImage(
|
||||
ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 16, 16, LR_SHARED));
|
||||
|
||||
return new MSWindowsClientTaskBarReceiver(
|
||||
MSWindowsScreen::getWindowInstance(), logBuffer, events);
|
||||
|
||||
@ -29,8 +29,8 @@ class IEventQueue;
|
||||
//! Implementation of ClientTaskBarReceiver for Microsoft Windows
|
||||
class MSWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
|
||||
public:
|
||||
MSWindowsClientTaskBarReceiver(HINSTANCE, const BufferedLogOutputter *,
|
||||
IEventQueue *events);
|
||||
MSWindowsClientTaskBarReceiver(
|
||||
HINSTANCE, const BufferedLogOutputter *, IEventQueue *events);
|
||||
virtual ~MSWindowsClientTaskBarReceiver();
|
||||
|
||||
// IArchTaskBarReceiver overrides
|
||||
@ -53,8 +53,8 @@ private:
|
||||
void destroyWindow();
|
||||
|
||||
BOOL dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static BOOL CALLBACK staticDlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
static BOOL CALLBACK
|
||||
staticDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
private:
|
||||
HINSTANCE m_appInstance;
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
// OSXClientTaskBarReceiver
|
||||
//
|
||||
|
||||
OSXClientTaskBarReceiver::OSXClientTaskBarReceiver(const BufferedLogOutputter *,
|
||||
IEventQueue *events)
|
||||
OSXClientTaskBarReceiver::OSXClientTaskBarReceiver(
|
||||
const BufferedLogOutputter *, IEventQueue *events)
|
||||
: ClientTaskBarReceiver(events) {
|
||||
// add ourself to the task bar
|
||||
ARCH->addReceiver(this);
|
||||
@ -50,8 +50,7 @@ const IArchTaskBarReceiver::Icon OSXClientTaskBarReceiver::getIcon() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IArchTaskBarReceiver *
|
||||
createTaskBarReceiver(const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events) {
|
||||
IArchTaskBarReceiver *createTaskBarReceiver(
|
||||
const BufferedLogOutputter *logBuffer, IEventQueue *events) {
|
||||
return new OSXClientTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
||||
@ -51,8 +51,7 @@ CXWindowsClientTaskBarReceiver::getIcon() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IArchTaskBarReceiver *
|
||||
createTaskBarReceiver(const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events) {
|
||||
IArchTaskBarReceiver *createTaskBarReceiver(
|
||||
const BufferedLogOutputter *logBuffer, IEventQueue *events) {
|
||||
return new CXWindowsClientTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@ class IEventQueue;
|
||||
//! Implementation of ClientTaskBarReceiver for X Windows
|
||||
class CXWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
|
||||
public:
|
||||
CXWindowsClientTaskBarReceiver(const BufferedLogOutputter *,
|
||||
IEventQueue *events);
|
||||
CXWindowsClientTaskBarReceiver(
|
||||
const BufferedLogOutputter *, IEventQueue *events);
|
||||
CXWindowsClientTaskBarReceiver(const CXWindowsClientTaskBarReceiver &) =
|
||||
delete;
|
||||
CXWindowsClientTaskBarReceiver(CXWindowsClientTaskBarReceiver &&) = delete;
|
||||
|
||||
@ -41,8 +41,11 @@ const UINT MSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] = {
|
||||
MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver(
|
||||
HINSTANCE appInstance, const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events)
|
||||
: ServerTaskBarReceiver(events), m_events(events),
|
||||
m_appInstance(appInstance), m_window(NULL), m_logBuffer(logBuffer) {
|
||||
: ServerTaskBarReceiver(events),
|
||||
m_events(events),
|
||||
m_appInstance(appInstance),
|
||||
m_window(NULL),
|
||||
m_logBuffer(logBuffer) {
|
||||
for (UInt32 i = 0; i < kMaxState; ++i) {
|
||||
m_icon[i] = loadIcon(s_stateToIconID[i]);
|
||||
}
|
||||
@ -150,8 +153,8 @@ void MSWindowsServerTaskBarReceiver::runMenu(int x, int y) {
|
||||
HMENU menu = GetSubMenu(m_menu, 0);
|
||||
SetMenuDefaultItem(menu, IDC_TASKBAR_STATUS, FALSE);
|
||||
HMENU logLevelMenu = GetSubMenu(menu, 3);
|
||||
CheckMenuRadioItem(logLevelMenu, 0, 6, CLOG->getFilter() - kERROR,
|
||||
MF_BYPOSITION);
|
||||
CheckMenuRadioItem(
|
||||
logLevelMenu, 0, 6, CLOG->getFilter() - kERROR, MF_BYPOSITION);
|
||||
int n = TrackPopupMenu(
|
||||
menu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, x,
|
||||
y, 0, m_window, NULL);
|
||||
@ -172,18 +175,19 @@ void MSWindowsServerTaskBarReceiver::runMenu(int x, int y) {
|
||||
break;
|
||||
|
||||
case IDC_RELOAD_CONFIG:
|
||||
m_events->addEvent(Event(m_events->forServerApp().reloadConfig(),
|
||||
m_events->getSystemTarget()));
|
||||
m_events->addEvent(Event(
|
||||
m_events->forServerApp().reloadConfig(), m_events->getSystemTarget()));
|
||||
break;
|
||||
|
||||
case IDC_FORCE_RECONNECT:
|
||||
m_events->addEvent(Event(m_events->forServerApp().forceReconnect(),
|
||||
m_events->getSystemTarget()));
|
||||
m_events->addEvent(Event(
|
||||
m_events->forServerApp().forceReconnect(),
|
||||
m_events->getSystemTarget()));
|
||||
break;
|
||||
|
||||
case ID_SYNERGY_RESETSERVER:
|
||||
m_events->addEvent(Event(m_events->forServerApp().resetServer(),
|
||||
m_events->getSystemTarget()));
|
||||
m_events->addEvent(Event(
|
||||
m_events->forServerApp().resetServer(), m_events->getSystemTarget()));
|
||||
break;
|
||||
|
||||
case IDC_TASKBAR_LOG_LEVEL_ERROR:
|
||||
@ -256,8 +260,8 @@ void MSWindowsServerTaskBarReceiver::onStatusChanged() {
|
||||
|
||||
HICON
|
||||
MSWindowsServerTaskBarReceiver::loadIcon(UINT id) {
|
||||
HANDLE icon = LoadImage(m_appInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0,
|
||||
LR_DEFAULTCOLOR);
|
||||
HANDLE icon = LoadImage(
|
||||
m_appInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
|
||||
return static_cast<HICON>(icon);
|
||||
}
|
||||
|
||||
@ -297,8 +301,8 @@ void MSWindowsServerTaskBarReceiver::destroyWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
BOOL MSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
LPARAM) {
|
||||
BOOL MSWindowsServerTaskBarReceiver::dlgProc(
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM) {
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
// use default focus
|
||||
@ -314,9 +318,8 @@ BOOL MSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK MSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd, UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
BOOL CALLBACK MSWindowsServerTaskBarReceiver::staticDlgProc(
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
// if msg is WM_INITDIALOG, extract the MSWindowsServerTaskBarReceiver*
|
||||
// and put it in the extra window data then forward the call.
|
||||
MSWindowsServerTaskBarReceiver *self = NULL;
|
||||
@ -341,15 +344,15 @@ BOOL CALLBACK MSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd, UINT msg,
|
||||
}
|
||||
}
|
||||
|
||||
IArchTaskBarReceiver *
|
||||
createTaskBarReceiver(const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events) {
|
||||
ArchMiscWindows::setIcons((HICON)LoadImage(ArchMiscWindows::instanceWin32(),
|
||||
MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 32, 32, LR_SHARED),
|
||||
(HICON)LoadImage(ArchMiscWindows::instanceWin32(),
|
||||
MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 16, 16, LR_SHARED));
|
||||
IArchTaskBarReceiver *createTaskBarReceiver(
|
||||
const BufferedLogOutputter *logBuffer, IEventQueue *events) {
|
||||
ArchMiscWindows::setIcons(
|
||||
(HICON)LoadImage(
|
||||
ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 32, 32, LR_SHARED),
|
||||
(HICON)LoadImage(
|
||||
ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY),
|
||||
IMAGE_ICON, 16, 16, LR_SHARED));
|
||||
|
||||
return new MSWindowsServerTaskBarReceiver(
|
||||
MSWindowsScreen::getWindowInstance(), logBuffer, events);
|
||||
|
||||
@ -29,8 +29,8 @@ class IEventQueue;
|
||||
//! Implementation of ServerTaskBarReceiver for Microsoft Windows
|
||||
class MSWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
|
||||
public:
|
||||
MSWindowsServerTaskBarReceiver(HINSTANCE, const BufferedLogOutputter *,
|
||||
IEventQueue *events);
|
||||
MSWindowsServerTaskBarReceiver(
|
||||
HINSTANCE, const BufferedLogOutputter *, IEventQueue *events);
|
||||
virtual ~MSWindowsServerTaskBarReceiver();
|
||||
|
||||
// IArchTaskBarReceiver overrides
|
||||
@ -53,8 +53,8 @@ private:
|
||||
void destroyWindow();
|
||||
|
||||
BOOL dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static BOOL CALLBACK staticDlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
static BOOL CALLBACK
|
||||
staticDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
private:
|
||||
HINSTANCE m_appInstance;
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
// OSXServerTaskBarReceiver
|
||||
//
|
||||
|
||||
OSXServerTaskBarReceiver::OSXServerTaskBarReceiver(const BufferedLogOutputter *,
|
||||
IEventQueue *events)
|
||||
OSXServerTaskBarReceiver::OSXServerTaskBarReceiver(
|
||||
const BufferedLogOutputter *, IEventQueue *events)
|
||||
: ServerTaskBarReceiver(events) {
|
||||
// add ourself to the task bar
|
||||
ARCH->addReceiver(this);
|
||||
@ -50,8 +50,7 @@ const IArchTaskBarReceiver::Icon OSXServerTaskBarReceiver::getIcon() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IArchTaskBarReceiver *
|
||||
createTaskBarReceiver(const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events) {
|
||||
IArchTaskBarReceiver *createTaskBarReceiver(
|
||||
const BufferedLogOutputter *logBuffer, IEventQueue *events) {
|
||||
return new OSXServerTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
||||
@ -51,8 +51,7 @@ CXWindowsServerTaskBarReceiver::getIcon() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IArchTaskBarReceiver *
|
||||
createTaskBarReceiver(const BufferedLogOutputter *logBuffer,
|
||||
IEventQueue *events) {
|
||||
IArchTaskBarReceiver *createTaskBarReceiver(
|
||||
const BufferedLogOutputter *logBuffer, IEventQueue *events) {
|
||||
return new CXWindowsServerTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@ class IEventQueue;
|
||||
//! Implementation of ServerTaskBarReceiver for X Windows
|
||||
class CXWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
|
||||
public:
|
||||
CXWindowsServerTaskBarReceiver(const BufferedLogOutputter *,
|
||||
IEventQueue *events);
|
||||
CXWindowsServerTaskBarReceiver(
|
||||
const BufferedLogOutputter *, IEventQueue *events);
|
||||
CXWindowsServerTaskBarReceiver(const CXWindowsServerTaskBarReceiver &) =
|
||||
delete;
|
||||
CXWindowsServerTaskBarReceiver(CXWindowsServerTaskBarReceiver &&) = delete;
|
||||
|
||||
@ -91,6 +91,6 @@ QString AboutDialog::getCopyright() const {
|
||||
QString copyright("Copyright © 2012-%%YEAR%% Symless Ltd.\n"
|
||||
"Copyright © 2009-2012 Nick Bolton\n"
|
||||
"Copyright © 2002-2009 Chris Schoeneman");
|
||||
return copyright.replace(QString("%%YEAR%%"),
|
||||
QString::number(buildDate.year()));
|
||||
return copyright.replace(
|
||||
QString("%%YEAR%%"), QString::number(buildDate.year()));
|
||||
}
|
||||
|
||||
@ -32,15 +32,19 @@ const char *Action::m_SwitchDirectionNames[] = {"left", "right", "up", "down"};
|
||||
const char *Action::m_LockCursorModeNames[] = {"toggle", "on", "off"};
|
||||
|
||||
Action::Action()
|
||||
: m_KeySequence(), m_Type(keystroke), m_TypeScreenNames(),
|
||||
m_SwitchScreenName(), m_SwitchDirection(switchLeft),
|
||||
m_LockCursorMode(lockCursorToggle), m_ActiveOnRelease(false),
|
||||
: m_KeySequence(),
|
||||
m_Type(keystroke),
|
||||
m_TypeScreenNames(),
|
||||
m_SwitchScreenName(),
|
||||
m_SwitchDirection(switchLeft),
|
||||
m_LockCursorMode(lockCursorToggle),
|
||||
m_ActiveOnRelease(false),
|
||||
m_HasScreens(false) {}
|
||||
|
||||
QString Action::text() const {
|
||||
QString text =
|
||||
QString(m_ActionTypeNames[keySequence().isMouseButton() ? type() + 6
|
||||
: type()]) +
|
||||
QString(m_ActionTypeNames
|
||||
[keySequence().isMouseButton() ? type() + 6 : type()]) +
|
||||
"(";
|
||||
|
||||
switch (type()) {
|
||||
|
||||
@ -27,22 +27,26 @@
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
||||
ActionDialog::ActionDialog(QWidget *parent, ServerConfig &config,
|
||||
Hotkey &hotkey, Action &action)
|
||||
ActionDialog::ActionDialog(
|
||||
QWidget *parent, ServerConfig &config, Hotkey &hotkey, Action &action)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::ActionDialogBase(), m_ServerConfig(config), m_Hotkey(hotkey),
|
||||
m_Action(action), m_pButtonGroupType(new QButtonGroup(this)) {
|
||||
Ui::ActionDialogBase(),
|
||||
m_ServerConfig(config),
|
||||
m_Hotkey(hotkey),
|
||||
m_Action(action),
|
||||
m_pButtonGroupType(new QButtonGroup(this)) {
|
||||
setupUi(this);
|
||||
|
||||
// work around Qt Designer's lack of a QButtonGroup; we need it to get
|
||||
// at the button id of the checked radio button
|
||||
QRadioButton *const typeButtons[] = {m_pRadioPress,
|
||||
m_pRadioRelease,
|
||||
m_pRadioPressAndRelease,
|
||||
m_pRadioSwitchToScreen,
|
||||
m_pRadioSwitchInDirection,
|
||||
m_pRadioLockCursorToScreen,
|
||||
m_pRadioRestartAllConnections};
|
||||
QRadioButton *const typeButtons[] = {
|
||||
m_pRadioPress,
|
||||
m_pRadioRelease,
|
||||
m_pRadioPressAndRelease,
|
||||
m_pRadioSwitchToScreen,
|
||||
m_pRadioSwitchInDirection,
|
||||
m_pRadioLockCursorToScreen,
|
||||
m_pRadioRestartAllConnections};
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(typeButtons) / sizeof(typeButtons[0]);
|
||||
i++)
|
||||
|
||||
@ -34,8 +34,8 @@ class ActionDialog : public QDialog, public Ui::ActionDialogBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActionDialog(QWidget *parent, ServerConfig &config, Hotkey &hotkey,
|
||||
Action &action);
|
||||
ActionDialog(
|
||||
QWidget *parent, ServerConfig &config, Hotkey &hotkey, Action &action);
|
||||
|
||||
protected slots:
|
||||
void accept();
|
||||
|
||||
@ -13,9 +13,11 @@
|
||||
#include <QThread>
|
||||
#include <iostream>
|
||||
|
||||
ActivationDialog::ActivationDialog(QWidget *parent, AppConfig &appConfig,
|
||||
LicenseManager &licenseManager)
|
||||
: QDialog(parent), ui(new Ui::ActivationDialog), m_appConfig(&appConfig),
|
||||
ActivationDialog::ActivationDialog(
|
||||
QWidget *parent, AppConfig &appConfig, LicenseManager &licenseManager)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::ActivationDialog),
|
||||
m_appConfig(&appConfig),
|
||||
m_LicenseManager(&licenseManager) {
|
||||
ui->setupUi(this);
|
||||
refreshSerialKey();
|
||||
@ -92,9 +94,10 @@ void ActivationDialog::accept() {
|
||||
if (m_LicenseManager->serialKey().isTrial()) {
|
||||
message.information(this, "Thanks!", thanksMessage);
|
||||
} else {
|
||||
message.information(this, "Activated!",
|
||||
tr("Thanks for activating %1!")
|
||||
.arg(m_LicenseManager->getEditionName(edition)));
|
||||
message.information(
|
||||
this, "Activated!",
|
||||
tr("Thanks for activating %1!")
|
||||
.arg(m_LicenseManager->getEditionName(edition)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ class ActivationDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActivationDialog(QWidget *parent, AppConfig &appConfig,
|
||||
LicenseManager &licenseManager);
|
||||
ActivationDialog(
|
||||
QWidget *parent, AppConfig &appConfig, LicenseManager &licenseManager);
|
||||
~ActivationDialog();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -25,9 +25,9 @@ void ActivationNotifier::setIdentity(QString identity) {
|
||||
m_Identity = identity;
|
||||
}
|
||||
|
||||
void ActivationNotifier::setUpdateInfo(QString const &fromVersion,
|
||||
QString const &toVersion,
|
||||
QString const &serialKey) {
|
||||
void ActivationNotifier::setUpdateInfo(
|
||||
QString const &fromVersion, QString const &toVersion,
|
||||
QString const &serialKey) {
|
||||
m_fromVersion = fromVersion;
|
||||
m_toVersion = toVersion;
|
||||
m_serialKey = serialKey;
|
||||
|
||||
@ -26,8 +26,9 @@ public:
|
||||
explicit ActivationNotifier(QObject *parent = 0);
|
||||
|
||||
void setIdentity(QString identity);
|
||||
void setUpdateInfo(QString const &fromVersion, QString const &toVersion,
|
||||
QString const &serialKey);
|
||||
void setUpdateInfo(
|
||||
QString const &fromVersion, QString const &toVersion,
|
||||
QString const &serialKey);
|
||||
|
||||
public slots:
|
||||
void notify();
|
||||
|
||||
@ -23,12 +23,14 @@
|
||||
|
||||
AddClientDialog::AddClientDialog(const QString &clientName, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::AddClientDialog(), m_AddResult(kAddClientIgnore) {
|
||||
Ui::AddClientDialog(),
|
||||
m_AddResult(kAddClientIgnore) {
|
||||
setupUi(this);
|
||||
|
||||
m_pLabelHead->setText("A client wants to connect. "
|
||||
"Please choose a location for " +
|
||||
clientName + ".");
|
||||
m_pLabelHead->setText(
|
||||
"A client wants to connect. "
|
||||
"Please choose a location for " +
|
||||
clientName + ".");
|
||||
|
||||
QIcon icon(":res/icons/64x64/video-display.png");
|
||||
QSize IconSize(32, 32);
|
||||
|
||||
@ -85,13 +85,26 @@ const char *AppConfig::m_SynergySettingsName[] = {
|
||||
static const char *logLevelNames[] = {"INFO", "DEBUG", "DEBUG1", "DEBUG2"};
|
||||
|
||||
AppConfig::AppConfig(bool globalLoad)
|
||||
: m_ScreenName(), m_Port(24800), m_Interface(), m_LogLevel(0),
|
||||
m_LogToFile(), m_WizardLastRun(0), m_ProcessMode(kDefaultProcessMode),
|
||||
m_StartedBefore(), m_ElevateMode(kDefaultElevateMode),
|
||||
m_Edition(kUnregistered), m_CryptoEnabled(false), m_AutoHide(false),
|
||||
m_LastExpiringWarningTime(0), m_ActivationHasRun(),
|
||||
m_MinimizeToTray(false), m_ServerGroupChecked(), m_UseExternalConfig(),
|
||||
m_UseInternalConfig(), m_ClientGroupChecked(), m_LoadFromSystemScope() {
|
||||
: m_ScreenName(),
|
||||
m_Port(24800),
|
||||
m_Interface(),
|
||||
m_LogLevel(0),
|
||||
m_LogToFile(),
|
||||
m_WizardLastRun(0),
|
||||
m_ProcessMode(kDefaultProcessMode),
|
||||
m_StartedBefore(),
|
||||
m_ElevateMode(kDefaultElevateMode),
|
||||
m_Edition(kUnregistered),
|
||||
m_CryptoEnabled(false),
|
||||
m_AutoHide(false),
|
||||
m_LastExpiringWarningTime(0),
|
||||
m_ActivationHasRun(),
|
||||
m_MinimizeToTray(false),
|
||||
m_ServerGroupChecked(),
|
||||
m_UseExternalConfig(),
|
||||
m_UseInternalConfig(),
|
||||
m_ClientGroupChecked(),
|
||||
m_LoadFromSystemScope() {
|
||||
|
||||
auto writer = ConfigWriter::make();
|
||||
|
||||
@ -105,13 +118,13 @@ AppConfig::AppConfig(bool globalLoad)
|
||||
}
|
||||
|
||||
// User settings exist and the load from system scope variable is true
|
||||
if (writer->hasSetting(settingName(Setting::kLoadSystemSettings),
|
||||
ConfigWriter::kUser)) {
|
||||
if (writer->hasSetting(
|
||||
settingName(Setting::kLoadSystemSettings), ConfigWriter::kUser)) {
|
||||
setLoadFromSystemScope(m_LoadFromSystemScope);
|
||||
}
|
||||
// If user setting don't exist but system ones do, load the system settings
|
||||
else if (writer->hasSetting(settingName(Setting::kScreenName),
|
||||
ConfigWriter::kSystem)) {
|
||||
else if (writer->hasSetting(
|
||||
settingName(Setting::kScreenName), ConfigWriter::kSystem)) {
|
||||
setLoadFromSystemScope(true);
|
||||
}
|
||||
}
|
||||
@ -187,9 +200,9 @@ void AppConfig::loadSettings() {
|
||||
// TODO Investigate why kElevateModeEnum isn't loaded fully
|
||||
QVariant elevateMode = loadSetting(Setting::kElevateModeEnum);
|
||||
if (!elevateMode.isValid()) {
|
||||
elevateMode =
|
||||
loadSetting(Setting::kElevateModeSetting,
|
||||
QVariant(static_cast<int>(kDefaultElevateMode)));
|
||||
elevateMode = loadSetting(
|
||||
Setting::kElevateModeSetting,
|
||||
QVariant(static_cast<int>(kDefaultElevateMode)));
|
||||
}
|
||||
m_ElevateMode = static_cast<ElevateMode>(elevateMode.toInt());
|
||||
}
|
||||
@ -208,9 +221,10 @@ void AppConfig::loadSettings() {
|
||||
loadSetting(Setting::kGroupServerCheck, false).toBool();
|
||||
m_UseExternalConfig =
|
||||
loadSetting(Setting::kUseExternalConfig, false).toBool();
|
||||
m_ConfigFile = loadSetting(Setting::kConfigFile,
|
||||
QDir::homePath() + "/" + m_SynergyConfigName)
|
||||
.toString();
|
||||
m_ConfigFile =
|
||||
loadSetting(
|
||||
Setting::kConfigFile, QDir::homePath() + "/" + m_SynergyConfigName)
|
||||
.toString();
|
||||
m_UseInternalConfig =
|
||||
loadSetting(Setting::kUseInternalConfig, false).toBool();
|
||||
m_ClientGroupChecked =
|
||||
@ -221,10 +235,10 @@ void AppConfig::loadSettings() {
|
||||
m_InvertScrollDirection =
|
||||
loadSetting(Setting::kInvertScrollDirection, false).toBool();
|
||||
m_guid = loadCommonSetting(Setting::kGuid, QUuid::createUuid()).toString();
|
||||
m_licenseRegistryUrl =
|
||||
loadCommonSetting(Setting::kLicenseRegistryUrl,
|
||||
"https://api2.prod.symless.com/license/register")
|
||||
.toString();
|
||||
m_licenseRegistryUrl = loadCommonSetting(
|
||||
Setting::kLicenseRegistryUrl,
|
||||
"https://api2.prod.symless.com/license/register")
|
||||
.toString();
|
||||
m_licenseNextCheck =
|
||||
loadCommonSetting(Setting::kLicenseNextCheck, 0).toULongLong();
|
||||
m_ClientHostMode = loadSetting(Setting::kClientHostMode, true).toBool();
|
||||
@ -394,8 +408,9 @@ bool AppConfig::isCryptoAvailable() const {
|
||||
bool result{true};
|
||||
|
||||
#ifdef SYNERGY_ENABLE_LICENSING
|
||||
result = (edition() == kPro || edition() == kProChina ||
|
||||
edition() == kBusiness || edition() == kUltimate);
|
||||
result =
|
||||
(edition() == kPro || edition() == kProChina || edition() == kBusiness ||
|
||||
edition() == kUltimate);
|
||||
#endif // SYNERGY_ENABLE_LICENSING
|
||||
|
||||
return result;
|
||||
@ -471,18 +486,18 @@ template <typename T> void AppConfig::setSetting(Setting name, T value) {
|
||||
}
|
||||
|
||||
template <typename T> void AppConfig::setCommonSetting(Setting name, T value) {
|
||||
ConfigWriter::make()->setSetting(settingName(name), value,
|
||||
ConfigWriter::kUser);
|
||||
ConfigWriter::make()->setSetting(settingName(name), value,
|
||||
ConfigWriter::kSystem);
|
||||
ConfigWriter::make()->setSetting(
|
||||
settingName(name), value, ConfigWriter::kUser);
|
||||
ConfigWriter::make()->setSetting(
|
||||
settingName(name), value, ConfigWriter::kSystem);
|
||||
}
|
||||
|
||||
QVariant AppConfig::loadSetting(Setting name, const QVariant &defaultValue) {
|
||||
return ConfigWriter::make()->loadSetting(settingName(name), defaultValue);
|
||||
}
|
||||
|
||||
QVariant AppConfig::loadCommonSetting(Setting name,
|
||||
const QVariant &defaultValue) const {
|
||||
QVariant
|
||||
AppConfig::loadCommonSetting(Setting name, const QVariant &defaultValue) const {
|
||||
QVariant result(defaultValue);
|
||||
QString setting(settingName(name));
|
||||
auto &writer = *ConfigWriter::make();
|
||||
@ -506,8 +521,8 @@ void AppConfig::loadScope(ConfigWriter::Scope scope) {
|
||||
if (writer->getScope() != scope) {
|
||||
setDefaultValues();
|
||||
writer->setScope(scope);
|
||||
if (writer->hasSetting(settingName(Setting::kScreenName),
|
||||
writer->getScope())) {
|
||||
if (writer->hasSetting(
|
||||
settingName(Setting::kScreenName), writer->getScope())) {
|
||||
// If the user already has settings, then load them up now.
|
||||
writer->globalLoad();
|
||||
}
|
||||
@ -608,7 +623,7 @@ void AppConfig::setTLSKeyLength(const QString &length) {
|
||||
|
||||
void AppConfig::generateCertificate(bool forceGeneration) const {
|
||||
SslCertificate sslCertificate;
|
||||
sslCertificate.generateCertificate(getTLSCertPath(), getTLSKeyLength(),
|
||||
forceGeneration);
|
||||
sslCertificate.generateCertificate(
|
||||
getTLSCertPath(), getTLSKeyLength(), forceGeneration);
|
||||
emit sslToggled();
|
||||
}
|
||||
|
||||
@ -303,14 +303,14 @@ private:
|
||||
/// @brief Loads a setting
|
||||
/// @param [in] name The setting to be loaded
|
||||
/// @param [in] defaultValue The default value of the setting
|
||||
QVariant loadSetting(AppConfig::Setting name,
|
||||
const QVariant &defaultValue = QVariant());
|
||||
QVariant loadSetting(
|
||||
AppConfig::Setting name, const QVariant &defaultValue = QVariant());
|
||||
|
||||
/// @brief Loads a common setting
|
||||
/// @param [in] name The setting to be loaded
|
||||
/// @param [in] defaultValue The default value of the setting
|
||||
QVariant loadCommonSetting(AppConfig::Setting name,
|
||||
const QVariant &defaultValue = QVariant()) const;
|
||||
QVariant loadCommonSetting(
|
||||
AppConfig::Setting name, const QVariant &defaultValue = QVariant()) const;
|
||||
|
||||
/// @brief As the settings will be accessible by multiple objects this lock
|
||||
/// will ensure that
|
||||
|
||||
@ -8,8 +8,9 @@ extern "C" {
|
||||
#if OSX_DEPLOYMENT_TARGET >= 1014
|
||||
#import <UserNotifications/UNUserNotificationCenter.h>
|
||||
@interface AppDelegate
|
||||
: NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate,
|
||||
UNUserNotificationCenterDelegate>
|
||||
: NSObject <
|
||||
NSApplicationDelegate, NSUserNotificationCenterDelegate,
|
||||
UNUserNotificationCenterDelegate>
|
||||
#else
|
||||
@interface AppDelegate
|
||||
: NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate>
|
||||
|
||||
@ -25,5 +25,5 @@ const char *BaseConfig::m_FixNames[] = {
|
||||
"halfDuplexCapsLock", "halfDuplexNumLock", "halfDuplexScrollLock",
|
||||
"xtestIsXineramaUnaware"};
|
||||
|
||||
const char *BaseConfig::m_SwitchCornerNames[] = {"top-left", "top-right",
|
||||
"bottom-left", "bottom-right"};
|
||||
const char *BaseConfig::m_SwitchCornerNames[] = {
|
||||
"top-left", "top-right", "bottom-left", "bottom-right"};
|
||||
|
||||
@ -51,8 +51,9 @@ protected:
|
||||
|
||||
protected:
|
||||
template <typename T1, typename T2>
|
||||
void readSettings(QSettings &settings, T1 &array, const QString &arrayName,
|
||||
const T2 &deflt) {
|
||||
void readSettings(
|
||||
QSettings &settings, T1 &array, const QString &arrayName,
|
||||
const T2 &deflt) {
|
||||
int entries = settings.beginReadArray(arrayName + "Array");
|
||||
array.clear();
|
||||
for (int i = 0; i < entries; i++) {
|
||||
@ -64,8 +65,9 @@ protected:
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void readSettings(QSettings &settings, T1 &array, const QString &arrayName,
|
||||
const T2 &deflt, int entries) {
|
||||
void readSettings(
|
||||
QSettings &settings, T1 &array, const QString &arrayName, const T2 &deflt,
|
||||
int entries) {
|
||||
Q_ASSERT(array.size() >= entries);
|
||||
settings.beginReadArray(arrayName + "Array");
|
||||
for (int i = 0; i < entries; i++) {
|
||||
@ -77,8 +79,8 @@ protected:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void writeSettings(QSettings &settings, const T &array,
|
||||
const QString &arrayName) const {
|
||||
void writeSettings(
|
||||
QSettings &settings, const T &array, const QString &arrayName) const {
|
||||
settings.beginWriteArray(arrayName + "Array");
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
settings.setArrayIndex(i);
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
#include "ui_CancelActivationDialog.h"
|
||||
|
||||
CancelActivationDialog::CancelActivationDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::CancelActivationDialog) {
|
||||
: QDialog(parent),
|
||||
ui(new Ui::CancelActivationDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
@ -20,9 +20,11 @@
|
||||
#include <QProcess>
|
||||
#include <stdexcept>
|
||||
|
||||
CommandProcess::CommandProcess(QString cmd, QStringList arguments,
|
||||
QString input)
|
||||
: m_Command(cmd), m_Arguments(arguments), m_Input(input) {}
|
||||
CommandProcess::CommandProcess(
|
||||
QString cmd, QStringList arguments, QString input)
|
||||
: m_Command(cmd),
|
||||
m_Arguments(arguments),
|
||||
m_Input(input) {}
|
||||
|
||||
QString CommandProcess::run() {
|
||||
QProcess process;
|
||||
|
||||
@ -48,11 +48,12 @@ QString getSystemSettingPath() {
|
||||
#if defined(Q_OS_WIN)
|
||||
void loadOldSystemSettings(QSettings &settings) {
|
||||
if (!QFile(settings.fileName()).exists()) {
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope,
|
||||
"SystemConfig.ini");
|
||||
QSettings oldSystemSettings(QSettings::IniFormat, QSettings::SystemScope,
|
||||
QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName());
|
||||
QSettings::setPath(
|
||||
QSettings::IniFormat, QSettings::SystemScope, "SystemConfig.ini");
|
||||
QSettings oldSystemSettings(
|
||||
QSettings::IniFormat, QSettings::SystemScope,
|
||||
QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName());
|
||||
|
||||
if (QFile(oldSystemSettings.fileName()).exists()) {
|
||||
for (const auto &key : oldSystemSettings.allKeys()) {
|
||||
@ -61,8 +62,8 @@ void loadOldSystemSettings(QSettings &settings) {
|
||||
}
|
||||
|
||||
// Restore system settings path
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope,
|
||||
getSystemSettingPath());
|
||||
QSettings::setPath(
|
||||
QSettings::IniFormat, QSettings::SystemScope, getSystemSettingPath());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -83,15 +84,16 @@ ConfigWriter *ConfigWriter::make() {
|
||||
}
|
||||
|
||||
ConfigWriter::ConfigWriter() {
|
||||
QSettings::setPath(QSettings::Format::IniFormat,
|
||||
QSettings::Scope::SystemScope, getSystemSettingPath());
|
||||
QSettings::setPath(
|
||||
QSettings::Format::IniFormat, QSettings::Scope::SystemScope,
|
||||
getSystemSettingPath());
|
||||
|
||||
// Config will default to User settings if they exist,
|
||||
// otherwise it will load System setting and save them to User settings
|
||||
m_pSettingsSystem =
|
||||
new QSettings(QSettings::Format::IniFormat, QSettings::Scope::SystemScope,
|
||||
QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName());
|
||||
m_pSettingsSystem = new QSettings(
|
||||
QSettings::Format::IniFormat, QSettings::Scope::SystemScope,
|
||||
QCoreApplication::organizationName(),
|
||||
QCoreApplication::applicationName());
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// This call is needed for backwardcapability with old settings.
|
||||
@ -134,8 +136,8 @@ bool ConfigWriter::isWritable() const {
|
||||
return m_pSettingsCurrent->isWritable();
|
||||
}
|
||||
|
||||
QVariant ConfigWriter::loadSetting(const QString &name,
|
||||
const QVariant &defaultValue, Scope scope) {
|
||||
QVariant ConfigWriter::loadSetting(
|
||||
const QString &name, const QVariant &defaultValue, Scope scope) {
|
||||
switch (scope) {
|
||||
case kUser:
|
||||
return m_pSettingsUser->value(name, defaultValue);
|
||||
|
||||
@ -67,9 +67,9 @@ public:
|
||||
/// @param [in] defaultValue The default value of the setting
|
||||
/// @param [in] scope The scope to get the value from, default is current
|
||||
/// scope
|
||||
QVariant loadSetting(const QString &name,
|
||||
const QVariant &defaultValue = QVariant(),
|
||||
Scope scope = kCurrent);
|
||||
QVariant loadSetting(
|
||||
const QString &name, const QVariant &defaultValue = QVariant(),
|
||||
Scope scope = kCurrent);
|
||||
|
||||
/// @brief Changes the setting save and load location between System and User
|
||||
/// scope
|
||||
|
||||
@ -18,9 +18,12 @@
|
||||
#include "DataDownloader.h"
|
||||
|
||||
DataDownloader::DataDownloader(QObject *parent)
|
||||
: QObject(parent), m_pReply(nullptr), m_IsFinished(false) {
|
||||
connect(&m_NetworkManager, SIGNAL(finished(QNetworkReply *)),
|
||||
SLOT(complete(QNetworkReply *)));
|
||||
: QObject(parent),
|
||||
m_pReply(nullptr),
|
||||
m_IsFinished(false) {
|
||||
connect(
|
||||
&m_NetworkManager, SIGNAL(finished(QNetworkReply *)),
|
||||
SLOT(complete(QNetworkReply *)));
|
||||
}
|
||||
|
||||
DataDownloader::~DataDownloader() {}
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
#include "ui_FailedLoginDialog.h"
|
||||
|
||||
FailedLoginDialog::FailedLoginDialog(QWidget *parent, QString message)
|
||||
: QDialog(parent), ui(new Ui::FailedLoginDialog) {
|
||||
: QDialog(parent),
|
||||
ui(new Ui::FailedLoginDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->messageLabel->setText(ui->messageLabel->text().arg(message));
|
||||
}
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
|
||||
HotkeyDialog::HotkeyDialog(QWidget *parent, Hotkey &hotkey)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::HotkeyDialogBase(), m_Hotkey(hotkey) {
|
||||
Ui::HotkeyDialogBase(),
|
||||
m_Hotkey(hotkey) {
|
||||
setupUi(this);
|
||||
|
||||
m_pKeySequenceWidgetHotkey->setText(m_Hotkey.text());
|
||||
|
||||
@ -26,55 +26,56 @@
|
||||
static const struct {
|
||||
int key;
|
||||
const char *name;
|
||||
} keyname[] = {{Qt::Key_Space, "Space"},
|
||||
{Qt::Key_Escape, "Escape"},
|
||||
{Qt::Key_Tab, "Tab"},
|
||||
{Qt::Key_Backtab, "LeftTab"},
|
||||
{Qt::Key_Backspace, "BackSpace"},
|
||||
{Qt::Key_Return, "Return"},
|
||||
{Qt::Key_Insert, "Insert"},
|
||||
{Qt::Key_Delete, "Delete"},
|
||||
{Qt::Key_Pause, "Pause"},
|
||||
{Qt::Key_Print, "Print"},
|
||||
{Qt::Key_SysReq, "SysReq"},
|
||||
{Qt::Key_Home, "Home"},
|
||||
{Qt::Key_End, "End"},
|
||||
{Qt::Key_Left, "Left"},
|
||||
{Qt::Key_Up, "Up"},
|
||||
{Qt::Key_Right, "Right"},
|
||||
{Qt::Key_Down, "Down"},
|
||||
{Qt::Key_PageUp, "PageUp"},
|
||||
{Qt::Key_PageDown, "PageDown"},
|
||||
{Qt::Key_CapsLock, "CapsLock"},
|
||||
{Qt::Key_NumLock, "NumLock"},
|
||||
{Qt::Key_ScrollLock, "ScrollLock"},
|
||||
{Qt::Key_Menu, "Menu"},
|
||||
{Qt::Key_Help, "Help"},
|
||||
{Qt::Key_Enter, "KP_Enter"},
|
||||
{Qt::Key_Clear, "Clear"},
|
||||
} keyname[] = {
|
||||
{Qt::Key_Space, "Space"},
|
||||
{Qt::Key_Escape, "Escape"},
|
||||
{Qt::Key_Tab, "Tab"},
|
||||
{Qt::Key_Backtab, "LeftTab"},
|
||||
{Qt::Key_Backspace, "BackSpace"},
|
||||
{Qt::Key_Return, "Return"},
|
||||
{Qt::Key_Insert, "Insert"},
|
||||
{Qt::Key_Delete, "Delete"},
|
||||
{Qt::Key_Pause, "Pause"},
|
||||
{Qt::Key_Print, "Print"},
|
||||
{Qt::Key_SysReq, "SysReq"},
|
||||
{Qt::Key_Home, "Home"},
|
||||
{Qt::Key_End, "End"},
|
||||
{Qt::Key_Left, "Left"},
|
||||
{Qt::Key_Up, "Up"},
|
||||
{Qt::Key_Right, "Right"},
|
||||
{Qt::Key_Down, "Down"},
|
||||
{Qt::Key_PageUp, "PageUp"},
|
||||
{Qt::Key_PageDown, "PageDown"},
|
||||
{Qt::Key_CapsLock, "CapsLock"},
|
||||
{Qt::Key_NumLock, "NumLock"},
|
||||
{Qt::Key_ScrollLock, "ScrollLock"},
|
||||
{Qt::Key_Menu, "Menu"},
|
||||
{Qt::Key_Help, "Help"},
|
||||
{Qt::Key_Enter, "KP_Enter"},
|
||||
{Qt::Key_Clear, "Clear"},
|
||||
|
||||
{Qt::Key_Back, "WWWBack"},
|
||||
{Qt::Key_Forward, "WWWForward"},
|
||||
{Qt::Key_Stop, "WWWStop"},
|
||||
{Qt::Key_Refresh, "WWWRefresh"},
|
||||
{Qt::Key_VolumeDown, "AudioDown"},
|
||||
{Qt::Key_VolumeMute, "AudioMute"},
|
||||
{Qt::Key_VolumeUp, "AudioUp"},
|
||||
{Qt::Key_MediaPlay, "AudioPlay"},
|
||||
{Qt::Key_MediaStop, "AudioStop"},
|
||||
{Qt::Key_MediaPrevious, "AudioPrev"},
|
||||
{Qt::Key_MediaNext, "AudioNext"},
|
||||
{Qt::Key_HomePage, "WWWHome"},
|
||||
{Qt::Key_Favorites, "WWWFavorites"},
|
||||
{Qt::Key_Search, "WWWSearch"},
|
||||
{Qt::Key_Standby, "Sleep"},
|
||||
{Qt::Key_LaunchMail, "AppMail"},
|
||||
{Qt::Key_LaunchMedia, "AppMedia"},
|
||||
{Qt::Key_Launch0, "AppUser1"},
|
||||
{Qt::Key_Launch1, "AppUser2"},
|
||||
{Qt::Key_Select, "Select"},
|
||||
{Qt::Key_Back, "WWWBack"},
|
||||
{Qt::Key_Forward, "WWWForward"},
|
||||
{Qt::Key_Stop, "WWWStop"},
|
||||
{Qt::Key_Refresh, "WWWRefresh"},
|
||||
{Qt::Key_VolumeDown, "AudioDown"},
|
||||
{Qt::Key_VolumeMute, "AudioMute"},
|
||||
{Qt::Key_VolumeUp, "AudioUp"},
|
||||
{Qt::Key_MediaPlay, "AudioPlay"},
|
||||
{Qt::Key_MediaStop, "AudioStop"},
|
||||
{Qt::Key_MediaPrevious, "AudioPrev"},
|
||||
{Qt::Key_MediaNext, "AudioNext"},
|
||||
{Qt::Key_HomePage, "WWWHome"},
|
||||
{Qt::Key_Favorites, "WWWFavorites"},
|
||||
{Qt::Key_Search, "WWWSearch"},
|
||||
{Qt::Key_Standby, "Sleep"},
|
||||
{Qt::Key_LaunchMail, "AppMail"},
|
||||
{Qt::Key_LaunchMedia, "AppMedia"},
|
||||
{Qt::Key_Launch0, "AppUser1"},
|
||||
{Qt::Key_Launch1, "AppUser2"},
|
||||
{Qt::Key_Select, "Select"},
|
||||
|
||||
{0, 0}};
|
||||
{0, 0}};
|
||||
|
||||
KeySequence::KeySequence() : m_Sequence(), m_Modifiers(0), m_IsValid(false) {}
|
||||
|
||||
@ -207,8 +208,8 @@ QString KeySequence::keyToString(int key) {
|
||||
|
||||
// representable in ucs2?
|
||||
if (key < 0x10000)
|
||||
return QString("\\u%1").arg(QChar(key).toLower().unicode(), 4, 16,
|
||||
QChar('0'));
|
||||
return QString("\\u%1").arg(
|
||||
QChar(key).toLower().unicode(), 4, 16, QChar('0'));
|
||||
|
||||
// give up, synergy probably won't handle this
|
||||
return "";
|
||||
|
||||
@ -22,9 +22,14 @@
|
||||
#include <iostream>
|
||||
|
||||
KeySequenceWidget::KeySequenceWidget(QWidget *parent, const KeySequence &seq)
|
||||
: QPushButton(parent), m_KeySequence(seq), m_BackupSequence(seq),
|
||||
m_Status(Stopped), m_MousePrefix("mousebutton("), m_MousePostfix(")"),
|
||||
m_KeyPrefix("keystroke("), m_KeyPostfix(")") {
|
||||
: QPushButton(parent),
|
||||
m_KeySequence(seq),
|
||||
m_BackupSequence(seq),
|
||||
m_Status(Stopped),
|
||||
m_MousePrefix("mousebutton("),
|
||||
m_MousePostfix(")"),
|
||||
m_KeyPrefix("keystroke("),
|
||||
m_KeyPostfix(")") {
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
updateOutput();
|
||||
}
|
||||
|
||||
@ -66,7 +66,8 @@ void checkSerialKey(const SerialKey &serialKey, bool acceptExpired) {
|
||||
} // namespace
|
||||
|
||||
LicenseManager::LicenseManager(AppConfig *appConfig)
|
||||
: m_AppConfig(appConfig), m_serialKey(appConfig->edition()),
|
||||
: m_AppConfig(appConfig),
|
||||
m_serialKey(appConfig->edition()),
|
||||
m_registry(*appConfig) {}
|
||||
|
||||
void LicenseManager::setSerialKey(SerialKey serialKey, bool acceptExpired) {
|
||||
@ -88,15 +89,15 @@ void LicenseManager::setSerialKey(SerialKey serialKey, bool acceptExpired) {
|
||||
}
|
||||
}
|
||||
|
||||
void LicenseManager::notifyUpdate(QString fromVersion,
|
||||
QString toVersion) const {
|
||||
void LicenseManager::notifyUpdate(
|
||||
QString fromVersion, QString toVersion) const {
|
||||
if ((fromVersion == "Unknown") && (m_serialKey == SerialKey(kUnregistered))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ActivationNotifier *notifier = new ActivationNotifier();
|
||||
notifier->setUpdateInfo(fromVersion, toVersion,
|
||||
QString::fromStdString(m_serialKey.toString()));
|
||||
notifier->setUpdateInfo(
|
||||
fromVersion, toVersion, QString::fromStdString(m_serialKey.toString()));
|
||||
|
||||
QThread *thread = new QThread();
|
||||
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
@ -227,8 +228,8 @@ QString LicenseManager::getTemporaryNotice() const {
|
||||
void LicenseManager::validateSerialKey() const {
|
||||
if (m_serialKey.isValid()) {
|
||||
if (m_serialKey.isTemporary()) {
|
||||
QTimer::singleShot(m_serialKey.getSpanLeft(), this,
|
||||
SLOT(validateSerialKey()));
|
||||
QTimer::singleShot(
|
||||
m_serialKey.getSpanLeft(), this, SLOT(validateSerialKey()));
|
||||
}
|
||||
} else {
|
||||
emit InvalidLicense();
|
||||
|
||||
@ -37,8 +37,9 @@ void LicenseRegistry::registerLicense() {
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
m_manager.post(request, getRequestData());
|
||||
connect(&m_manager, SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(handleResponse(QNetworkReply *)));
|
||||
connect(
|
||||
&m_manager, SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(handleResponse(QNetworkReply *)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -83,15 +83,24 @@ MainWindow::MainWindow(AppConfig &appConfig)
|
||||
#endif
|
||||
:
|
||||
#ifdef SYNERGY_ENABLE_LICENSING
|
||||
m_LicenseManager(&licenseManager), m_ActivationDialogRunning(false),
|
||||
m_LicenseManager(&licenseManager),
|
||||
m_ActivationDialogRunning(false),
|
||||
#endif
|
||||
m_AppConfig(&appConfig), m_pSynergy(NULL),
|
||||
m_AppConfig(&appConfig),
|
||||
m_pSynergy(NULL),
|
||||
m_SynergyState(synergyDisconnected),
|
||||
m_ServerConfig(5, 3, m_AppConfig, this), m_AlreadyHidden(false),
|
||||
m_pMenuBar(NULL), m_pMenuFile(NULL), m_pMenuEdit(NULL),
|
||||
m_pMenuWindow(NULL), m_pMenuHelp(NULL), m_pCancelButton(NULL),
|
||||
m_ExpectedRunningState(kStopped), m_SecureSocket(false),
|
||||
m_serverConnection(*this), m_clientConnection(*this) {
|
||||
m_ServerConfig(5, 3, m_AppConfig, this),
|
||||
m_AlreadyHidden(false),
|
||||
m_pMenuBar(NULL),
|
||||
m_pMenuFile(NULL),
|
||||
m_pMenuEdit(NULL),
|
||||
m_pMenuWindow(NULL),
|
||||
m_pMenuHelp(NULL),
|
||||
m_pCancelButton(NULL),
|
||||
m_ExpectedRunningState(kStopped),
|
||||
m_SecureSocket(false),
|
||||
m_serverConnection(*this),
|
||||
m_clientConnection(*this) {
|
||||
|
||||
setupUi(this);
|
||||
|
||||
@ -108,22 +117,26 @@ MainWindow::MainWindow(AppConfig &appConfig)
|
||||
m_VersionChecker.setApp(appPath(appConfig.synergycName()));
|
||||
|
||||
updateScreenName();
|
||||
connect(m_AppConfig, SIGNAL(screenNameChanged()), this,
|
||||
SLOT(updateScreenName()));
|
||||
connect(
|
||||
m_AppConfig, SIGNAL(screenNameChanged()), this, SLOT(updateScreenName()));
|
||||
m_pLabelIpAddresses->setText(
|
||||
tr("This computer's IP addresses: %1").arg(getIPAddresses()));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// ipc must always be enabled, so that we can disable command when switching
|
||||
// to desktop mode.
|
||||
connect(&m_IpcClient, SIGNAL(readLogLine(const QString &)), this,
|
||||
SLOT(appendLogRaw(const QString &)));
|
||||
connect(&m_IpcClient, SIGNAL(errorMessage(const QString &)), this,
|
||||
SLOT(appendLogError(const QString &)));
|
||||
connect(&m_IpcClient, SIGNAL(infoMessage(const QString &)), this,
|
||||
SLOT(appendLogInfo(const QString &)));
|
||||
connect(&m_IpcClient, SIGNAL(readLogLine(const QString &)), this,
|
||||
SLOT(handleIdleService(const QString &)));
|
||||
connect(
|
||||
&m_IpcClient, SIGNAL(readLogLine(const QString &)), this,
|
||||
SLOT(appendLogRaw(const QString &)));
|
||||
connect(
|
||||
&m_IpcClient, SIGNAL(errorMessage(const QString &)), this,
|
||||
SLOT(appendLogError(const QString &)));
|
||||
connect(
|
||||
&m_IpcClient, SIGNAL(infoMessage(const QString &)), this,
|
||||
SLOT(appendLogInfo(const QString &)));
|
||||
connect(
|
||||
&m_IpcClient, SIGNAL(readLogLine(const QString &)), this,
|
||||
SLOT(handleIdleService(const QString &)));
|
||||
m_IpcClient.connectToHost();
|
||||
#endif
|
||||
|
||||
@ -141,21 +154,26 @@ MainWindow::MainWindow(AppConfig &appConfig)
|
||||
// hide padlock icon
|
||||
secureSocket(false);
|
||||
|
||||
connect(this, SIGNAL(windowShown()), this, SLOT(on_windowShown()),
|
||||
Qt::QueuedConnection);
|
||||
connect(
|
||||
this, SIGNAL(windowShown()), this, SLOT(on_windowShown()),
|
||||
Qt::QueuedConnection);
|
||||
#ifdef SYNERGY_ENABLE_LICENSING
|
||||
connect(m_LicenseManager, SIGNAL(editionChanged(Edition)), this,
|
||||
SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||
connect(
|
||||
m_LicenseManager, SIGNAL(editionChanged(Edition)), this,
|
||||
SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||
|
||||
connect(m_LicenseManager, SIGNAL(showLicenseNotice(QString)), this,
|
||||
SLOT(showLicenseNotice(QString)), Qt::QueuedConnection);
|
||||
connect(
|
||||
m_LicenseManager, SIGNAL(showLicenseNotice(QString)), this,
|
||||
SLOT(showLicenseNotice(QString)), Qt::QueuedConnection);
|
||||
|
||||
connect(m_LicenseManager, SIGNAL(InvalidLicense()), this,
|
||||
SLOT(InvalidLicense()), Qt::QueuedConnection);
|
||||
connect(
|
||||
m_LicenseManager, SIGNAL(InvalidLicense()), this, SLOT(InvalidLicense()),
|
||||
Qt::QueuedConnection);
|
||||
#endif
|
||||
|
||||
connect(m_AppConfig, SIGNAL(sslToggled()), this,
|
||||
SLOT(updateLocalFingerprint()), Qt::QueuedConnection);
|
||||
connect(
|
||||
m_AppConfig, SIGNAL(sslToggled()), this, SLOT(updateLocalFingerprint()),
|
||||
Qt::QueuedConnection);
|
||||
|
||||
updateWindowTitle();
|
||||
|
||||
@ -260,12 +278,13 @@ void MainWindow::loadSettings() {
|
||||
void MainWindow::initConnections() {
|
||||
connect(m_pActionMinimize, SIGNAL(triggered()), this, SLOT(hide()));
|
||||
connect(m_pActionRestore, SIGNAL(triggered()), this, SLOT(showNormal()));
|
||||
connect(m_pActionStartSynergy, SIGNAL(triggered()), this,
|
||||
SLOT(actionStart()));
|
||||
connect(
|
||||
m_pActionStartSynergy, SIGNAL(triggered()), this, SLOT(actionStart()));
|
||||
connect(m_pActionStopSynergy, SIGNAL(triggered()), this, SLOT(stopSynergy()));
|
||||
connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||
connect(&m_VersionChecker, SIGNAL(updateFound(const QString &)), this,
|
||||
SLOT(updateFound(const QString &)));
|
||||
connect(
|
||||
&m_VersionChecker, SIGNAL(updateFound(const QString &)), this,
|
||||
SLOT(updateFound(const QString &)));
|
||||
}
|
||||
|
||||
void MainWindow::saveSettings() {
|
||||
@ -421,8 +440,9 @@ void MainWindow::checkConnected(const QString &line) {
|
||||
}
|
||||
} else if (line.contains("started server")) {
|
||||
setSynergyState(synergyListening);
|
||||
} else if (line.contains("disconnected from server") ||
|
||||
line.contains("process exited")) {
|
||||
} else if (
|
||||
line.contains("disconnected from server") ||
|
||||
line.contains("process exited")) {
|
||||
setSynergyState(synergyDisconnected);
|
||||
} else if (line.contains("connecting to")) {
|
||||
setSynergyState(synergyConnecting);
|
||||
@ -497,10 +517,10 @@ void MainWindow::checkOSXNotification(const QString &line) {
|
||||
if (line.contains(OSXNotificationSubstring) && line.contains('|')) {
|
||||
int delimterPosition = line.indexOf('|');
|
||||
int notificationStartPosition = line.indexOf(OSXNotificationSubstring);
|
||||
QString title =
|
||||
line.mid(notificationStartPosition + OSXNotificationSubstring.length(),
|
||||
delimterPosition - notificationStartPosition -
|
||||
OSXNotificationSubstring.length());
|
||||
QString title = line.mid(
|
||||
notificationStartPosition + OSXNotificationSubstring.length(),
|
||||
delimterPosition - notificationStartPosition -
|
||||
OSXNotificationSubstring.length());
|
||||
QString body =
|
||||
line.mid(delimterPosition + 1, line.length() - delimterPosition);
|
||||
if (!showOSXNotification(title, body)) {
|
||||
@ -616,8 +636,9 @@ void MainWindow::startSynergy() {
|
||||
if (!m_pLogOutput->toPlainText().isEmpty())
|
||||
appendLogRaw("");
|
||||
|
||||
appendLogInfo("starting " +
|
||||
QString(synergyType() == synergyServer ? "server" : "client"));
|
||||
appendLogInfo(
|
||||
"starting " +
|
||||
QString(synergyType() == synergyServer ? "server" : "client"));
|
||||
|
||||
if ((synergyType() == synergyClient && !clientArgs(args, app)) ||
|
||||
(synergyType() == synergyServer && !serverArgs(args, app))) {
|
||||
@ -626,12 +647,15 @@ void MainWindow::startSynergy() {
|
||||
}
|
||||
|
||||
if (desktopMode) {
|
||||
connect(synergyProcess(), SIGNAL(finished(int, QProcess::ExitStatus)), this,
|
||||
SLOT(synergyFinished(int, QProcess::ExitStatus)));
|
||||
connect(synergyProcess(), SIGNAL(readyReadStandardOutput()), this,
|
||||
SLOT(logOutput()));
|
||||
connect(synergyProcess(), SIGNAL(readyReadStandardError()), this,
|
||||
SLOT(logError()));
|
||||
connect(
|
||||
synergyProcess(), SIGNAL(finished(int, QProcess::ExitStatus)), this,
|
||||
SLOT(synergyFinished(int, QProcess::ExitStatus)));
|
||||
connect(
|
||||
synergyProcess(), SIGNAL(readyReadStandardOutput()), this,
|
||||
SLOT(logOutput()));
|
||||
connect(
|
||||
synergyProcess(), SIGNAL(readyReadStandardError()), this,
|
||||
SLOT(logError()));
|
||||
}
|
||||
|
||||
qDebug() << args;
|
||||
@ -712,9 +736,10 @@ bool MainWindow::clientArgs(QStringList &args, QString &app) {
|
||||
if (m_pLineEditHostname->text().isEmpty() &&
|
||||
!appConfig().getClientHostMode()) {
|
||||
show();
|
||||
QMessageBox::warning(this, tr("Hostname is empty"),
|
||||
tr("Please fill in a hostname for the synergy "
|
||||
"client to connect to."));
|
||||
QMessageBox::warning(
|
||||
this, tr("Hostname is empty"),
|
||||
tr("Please fill in a hostname for the synergy "
|
||||
"client to connect to."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -769,8 +794,8 @@ QString MainWindow::configFilename() {
|
||||
}
|
||||
|
||||
if (configFullPath.isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Cannot write configuration file"),
|
||||
errors.join('\n'));
|
||||
QMessageBox::critical(
|
||||
this, tr("Cannot write configuration file"), errors.join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,8 +832,9 @@ bool MainWindow::serverArgs(QStringList &args, QString &app) {
|
||||
|
||||
if (appConfig().getServerClientMode() &&
|
||||
m_pLineEditClienIp->text().isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Client IP address or name is empty"),
|
||||
tr("Please fill in a client IP address or name."));
|
||||
QMessageBox::warning(
|
||||
this, tr("Client IP address or name is empty"),
|
||||
tr("Please fill in a client IP address or name."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -911,17 +937,21 @@ void MainWindow::setSynergyState(qSynergyState state) {
|
||||
|
||||
if ((state == synergyConnected) || (state == synergyConnecting) ||
|
||||
(state == synergyListening) || (state == synergyPendingRetry)) {
|
||||
disconnect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy,
|
||||
SLOT(trigger()));
|
||||
connect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy,
|
||||
SLOT(trigger()));
|
||||
disconnect(
|
||||
m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy,
|
||||
SLOT(trigger()));
|
||||
connect(
|
||||
m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy,
|
||||
SLOT(trigger()));
|
||||
m_pButtonToggleStart->setText(tr("&Stop"));
|
||||
m_pButtonApply->setEnabled(true);
|
||||
} else if (state == synergyDisconnected) {
|
||||
disconnect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy,
|
||||
SLOT(trigger()));
|
||||
connect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy,
|
||||
SLOT(trigger()));
|
||||
disconnect(
|
||||
m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy,
|
||||
SLOT(trigger()));
|
||||
connect(
|
||||
m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy,
|
||||
SLOT(trigger()));
|
||||
m_pButtonToggleStart->setText(tr("&Start"));
|
||||
m_pButtonApply->setEnabled(false);
|
||||
}
|
||||
@ -1060,8 +1090,8 @@ bool MainWindow::on_m_pActionSave_triggered() {
|
||||
QFileDialog::getSaveFileName(this, tr("Save configuration as..."));
|
||||
|
||||
if (!fileName.isEmpty() && !serverConfig().save(fileName)) {
|
||||
QMessageBox::warning(this, tr("Save failed"),
|
||||
tr("Could not save configuration to file."));
|
||||
QMessageBox::warning(
|
||||
this, tr("Save failed"), tr("Could not save configuration to file."));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1218,8 +1248,8 @@ void MainWindow::on_m_pLabelComputerName_linkActivated(const QString &) {
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pLabelFingerprint_linkActivated(const QString &) {
|
||||
QMessageBox::information(this, "SSL/TLS fingerprint",
|
||||
Fingerprint::local().readFirst());
|
||||
QMessageBox::information(
|
||||
this, "SSL/TLS fingerprint", Fingerprint::local().readFirst());
|
||||
}
|
||||
|
||||
void MainWindow::windowStateChanged() {
|
||||
|
||||
@ -169,8 +169,8 @@ protected:
|
||||
bool clientArgs(QStringList &args, QString &app);
|
||||
bool serverArgs(QStringList &args, QString &app);
|
||||
void setStatus(const QString &status);
|
||||
void sendIpcMessage(qIpcMessageType type, const char *buffer,
|
||||
bool showErrors);
|
||||
void
|
||||
sendIpcMessage(qIpcMessageType type, const char *buffer, bool showErrors);
|
||||
void updateFromLogLine(const QString &line);
|
||||
QString getIPAddresses();
|
||||
void stopService();
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
#include <QTimer>
|
||||
|
||||
QIpcClient::QIpcClient(const StreamProvider &streamProvider)
|
||||
: m_ReaderStarted(false), m_Enabled(false),
|
||||
: m_ReaderStarted(false),
|
||||
m_Enabled(false),
|
||||
m_StreamProvider(streamProvider) {
|
||||
|
||||
m_Socket = new QTcpSocket(this);
|
||||
@ -36,12 +37,14 @@ QIpcClient::QIpcClient(const StreamProvider &streamProvider)
|
||||
}
|
||||
|
||||
connect(m_Socket, SIGNAL(connected()), this, SLOT(connected()));
|
||||
connect(m_Socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this,
|
||||
SLOT(error(QAbstractSocket::SocketError)));
|
||||
connect(
|
||||
m_Socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this,
|
||||
SLOT(error(QAbstractSocket::SocketError)));
|
||||
|
||||
m_Reader = new IpcReader(m_Socket);
|
||||
connect(m_Reader, SIGNAL(readLogLine(const QString &)), this,
|
||||
SLOT(handleReadLogLine(const QString &)));
|
||||
connect(
|
||||
m_Reader, SIGNAL(readLogLine(const QString &)), this,
|
||||
SLOT(handleReadLogLine(const QString &)));
|
||||
}
|
||||
|
||||
QIpcClient::~QIpcClient() {
|
||||
@ -106,8 +109,8 @@ void QIpcClient::sendHello() {
|
||||
stream->writeRawData(typeBuf, 1);
|
||||
}
|
||||
|
||||
void QIpcClient::sendCommand(const QString &command,
|
||||
ElevateMode const elevate) {
|
||||
void QIpcClient::sendCommand(
|
||||
const QString &command, ElevateMode const elevate) {
|
||||
auto stream = m_StreamProvider();
|
||||
stream->writeRawData(kIpcMsgCommand, 4);
|
||||
|
||||
|
||||
@ -64,10 +64,11 @@ void Screen::loadSettings(QSettings &settings) {
|
||||
setSwitchCornerSize(settings.value("switchCornerSize").toInt());
|
||||
|
||||
readSettings(settings, aliases(), "alias", QString(""));
|
||||
readSettings(settings, modifiers(), "modifier", static_cast<int>(DefaultMod),
|
||||
NumModifiers);
|
||||
readSettings(settings, switchCorners(), "switchCorner", false,
|
||||
NumSwitchCorners);
|
||||
readSettings(
|
||||
settings, modifiers(), "modifier", static_cast<int>(DefaultMod),
|
||||
NumModifiers);
|
||||
readSettings(
|
||||
settings, switchCorners(), "switchCorner", false, NumSwitchCorners);
|
||||
readSettings(settings, fixes(), "fix", false, NumFixes);
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,11 @@
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
||||
ScreenSettingsDialog::ScreenSettingsDialog(QWidget *parent, Screen *pScreen,
|
||||
const ScreenList *pScreens)
|
||||
ScreenSettingsDialog::ScreenSettingsDialog(
|
||||
QWidget *parent, Screen *pScreen, const ScreenList *pScreens)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::ScreenSettingsDialogBase(), m_pScreen(pScreen) {
|
||||
Ui::ScreenSettingsDialogBase(),
|
||||
m_pScreen(pScreen) {
|
||||
setupUi(this);
|
||||
|
||||
m_pLineEditName->setText(m_pScreen->name());
|
||||
@ -97,14 +98,14 @@ void ScreenSettingsDialog::accept() {
|
||||
m_pScreen->setModifier(Screen::Meta, m_pComboBoxMeta->currentIndex());
|
||||
m_pScreen->setModifier(Screen::Super, m_pComboBoxSuper->currentIndex());
|
||||
|
||||
m_pScreen->setSwitchCorner(Screen::TopLeft,
|
||||
m_pCheckBoxCornerTopLeft->isChecked());
|
||||
m_pScreen->setSwitchCorner(Screen::TopRight,
|
||||
m_pCheckBoxCornerTopRight->isChecked());
|
||||
m_pScreen->setSwitchCorner(Screen::BottomLeft,
|
||||
m_pCheckBoxCornerBottomLeft->isChecked());
|
||||
m_pScreen->setSwitchCorner(Screen::BottomRight,
|
||||
m_pCheckBoxCornerBottomRight->isChecked());
|
||||
m_pScreen->setSwitchCorner(
|
||||
Screen::TopLeft, m_pCheckBoxCornerTopLeft->isChecked());
|
||||
m_pScreen->setSwitchCorner(
|
||||
Screen::TopRight, m_pCheckBoxCornerTopRight->isChecked());
|
||||
m_pScreen->setSwitchCorner(
|
||||
Screen::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked());
|
||||
m_pScreen->setSwitchCorner(
|
||||
Screen::BottomRight, m_pCheckBoxCornerBottomRight->isChecked());
|
||||
m_pScreen->setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value());
|
||||
|
||||
m_pScreen->setFix(Screen::CapsLock, m_pCheckBoxCapsLock->isChecked());
|
||||
@ -126,8 +127,8 @@ void ScreenSettingsDialog::on_m_pButtonAddAlias_clicked() {
|
||||
|
||||
void ScreenSettingsDialog::on_m_pLineEditAlias_textChanged(
|
||||
const QString &text) {
|
||||
m_pButtonAddAlias->setEnabled(!text.isEmpty() &&
|
||||
m_pLabelAliasError->text().isEmpty());
|
||||
m_pButtonAddAlias->setEnabled(
|
||||
!text.isEmpty() && m_pLabelAliasError->text().isEmpty());
|
||||
}
|
||||
|
||||
void ScreenSettingsDialog::on_m_pButtonRemoveAlias_clicked() {
|
||||
|
||||
@ -36,8 +36,9 @@ class ScreenSettingsDialog : public QDialog,
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ScreenSettingsDialog(QWidget *parent, Screen *pScreen = nullptr,
|
||||
const ScreenList *pScreens = nullptr);
|
||||
ScreenSettingsDialog(
|
||||
QWidget *parent, Screen *pScreen = nullptr,
|
||||
const ScreenList *pScreens = nullptr);
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
||||
@ -24,14 +24,17 @@
|
||||
|
||||
const QString ScreenSetupModel::m_MimeType = "application/x-qsynergy-screen";
|
||||
|
||||
ScreenSetupModel::ScreenSetupModel(ScreenList &screens, int numColumns,
|
||||
int numRows)
|
||||
: QAbstractTableModel(NULL), m_Screens(screens), m_NumColumns(numColumns),
|
||||
ScreenSetupModel::ScreenSetupModel(
|
||||
ScreenList &screens, int numColumns, int numRows)
|
||||
: QAbstractTableModel(NULL),
|
||||
m_Screens(screens),
|
||||
m_NumColumns(numColumns),
|
||||
m_NumRows(numRows) {
|
||||
if (m_NumColumns * m_NumRows > screens.size())
|
||||
qFatal("Not enough elements (%lld) in screens QList for %d columns and %d "
|
||||
"rows",
|
||||
screens.size(), m_NumColumns, m_NumRows);
|
||||
qFatal(
|
||||
"Not enough elements (%lld) in screens QList for %d columns and %d "
|
||||
"rows",
|
||||
screens.size(), m_NumColumns, m_NumRows);
|
||||
}
|
||||
|
||||
QVariant ScreenSetupModel::data(const QModelIndex &index, int role) const {
|
||||
@ -96,9 +99,9 @@ QMimeData *ScreenSetupModel::mimeData(const QModelIndexList &indexes) const {
|
||||
return pMimeData;
|
||||
}
|
||||
|
||||
bool ScreenSetupModel::dropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action, int row, int column,
|
||||
const QModelIndex &parent) {
|
||||
bool ScreenSetupModel::dropMimeData(
|
||||
const QMimeData *data, Qt::DropAction action, int row, int column,
|
||||
const QModelIndex &parent) {
|
||||
if (action == Qt::IgnoreAction)
|
||||
return true;
|
||||
|
||||
@ -145,9 +148,9 @@ void ScreenSetupModel::addScreen(const Screen &newScreen) {
|
||||
}
|
||||
|
||||
bool ScreenSetupModel::isFull() const {
|
||||
auto emptyScreen =
|
||||
std::find_if(m_Screens.cbegin(), m_Screens.cend(),
|
||||
[](const Screen &item) { return item.isNull(); });
|
||||
auto emptyScreen = std::find_if(
|
||||
m_Screens.cbegin(), m_Screens.cend(),
|
||||
[](const Screen &item) { return item.isNull(); });
|
||||
|
||||
return (emptyScreen == m_Screens.cend());
|
||||
}
|
||||
|
||||
@ -56,8 +56,9 @@ signals:
|
||||
void screensChanged();
|
||||
|
||||
protected:
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row,
|
||||
int column, const QModelIndex &parent);
|
||||
bool dropMimeData(
|
||||
const QMimeData *data, Qt::DropAction action, int row, int column,
|
||||
const QModelIndex &parent);
|
||||
const Screen &screen(const QModelIndex &index) const {
|
||||
return screen(index.column(), index.row());
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ void ScreenSetupView::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
int row = rowAt(event->pos().y());
|
||||
|
||||
if (!model()->screen(col, row).isNull()) {
|
||||
ScreenSettingsDialog dlg(this, &model()->screen(col, row),
|
||||
&model()->m_Screens);
|
||||
ScreenSettingsDialog dlg(
|
||||
this, &model()->screen(col, row), &model()->m_Screens);
|
||||
dlg.exec();
|
||||
emit model() -> screensChanged();
|
||||
}
|
||||
|
||||
@ -40,13 +40,17 @@ static const struct {
|
||||
|
||||
const int serverDefaultIndex = 7;
|
||||
|
||||
ServerConfig::ServerConfig(int numColumns, int numRows, AppConfig *appConfig,
|
||||
MainWindow *mainWindow)
|
||||
ServerConfig::ServerConfig(
|
||||
int numColumns, int numRows, AppConfig *appConfig, MainWindow *mainWindow)
|
||||
:
|
||||
|
||||
m_Screens(numColumns), m_NumColumns(numColumns), m_NumRows(numRows),
|
||||
m_pAppConfig(appConfig), m_EnableDragAndDrop(false),
|
||||
m_DisableLockToScreen(false), m_ClipboardSharing(true),
|
||||
m_Screens(numColumns),
|
||||
m_NumColumns(numColumns),
|
||||
m_NumRows(numRows),
|
||||
m_pAppConfig(appConfig),
|
||||
m_EnableDragAndDrop(false),
|
||||
m_DisableLockToScreen(false),
|
||||
m_ClipboardSharing(true),
|
||||
m_ClipboardSharingSize(defaultClipboardSharingSize()),
|
||||
m_pMainWindow(mainWindow) {
|
||||
GUI::Config::ConfigWriter::make()->registerClass(this);
|
||||
@ -131,8 +135,8 @@ void ServerConfig::saveSettings() {
|
||||
settings().setValue("disableLockToScreen", disableLockToScreen());
|
||||
settings().setValue("enableDragAndDrop", enableDragAndDrop());
|
||||
settings().setValue("clipboardSharing", clipboardSharing());
|
||||
settings().setValue("clipboardSharingSize",
|
||||
QVariant::fromValue(clipboardSharingSize()));
|
||||
settings().setValue(
|
||||
"clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
|
||||
|
||||
if (!getClientAddress().isEmpty()) {
|
||||
settings().setValue("clientAddress", getClientAddress());
|
||||
@ -190,14 +194,15 @@ void ServerConfig::loadSettings() {
|
||||
setEnableDragAndDrop(settings().value("enableDragAndDrop", false).toBool());
|
||||
setClipboardSharingSize(
|
||||
settings()
|
||||
.value("clipboardSharingSize",
|
||||
(int)ServerConfig::defaultClipboardSharingSize())
|
||||
.value(
|
||||
"clipboardSharingSize",
|
||||
(int)ServerConfig::defaultClipboardSharingSize())
|
||||
.toULongLong());
|
||||
setClipboardSharing(settings().value("clipboardSharing", true).toBool());
|
||||
setClientAddress(settings().value("clientAddress", "").toString());
|
||||
|
||||
readSettings(settings(), switchCorners(), "switchCorner", false,
|
||||
NumSwitchCorners);
|
||||
readSettings(
|
||||
settings(), switchCorners(), "switchCorner", false, NumSwitchCorners);
|
||||
|
||||
int numScreens = settings().beginReadArray("screens");
|
||||
Q_ASSERT(numScreens <= screens().size());
|
||||
@ -222,8 +227,8 @@ void ServerConfig::loadSettings() {
|
||||
settings().endGroup();
|
||||
}
|
||||
|
||||
int ServerConfig::adjacentScreenIndex(int idx, int deltaColumn,
|
||||
int deltaRow) const {
|
||||
int ServerConfig::adjacentScreenIndex(
|
||||
int idx, int deltaColumn, int deltaRow) const {
|
||||
if (screens()[idx].isNull())
|
||||
return -1;
|
||||
|
||||
@ -266,8 +271,8 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config) {
|
||||
|
||||
for (unsigned int j = 0;
|
||||
j < sizeof(neighbourDirs) / sizeof(neighbourDirs[0]); j++) {
|
||||
int idx = config.adjacentScreenIndex(i, neighbourDirs[j].x,
|
||||
neighbourDirs[j].y);
|
||||
int idx = config.adjacentScreenIndex(
|
||||
i, neighbourDirs[j].x, neighbourDirs[j].y);
|
||||
if (idx != -1 && !config.screens()[idx].isNull())
|
||||
outStream << "\t\t" << neighbourDirs[j].name << " = "
|
||||
<< config.screens()[idx].name() << Qt::endl;
|
||||
@ -380,8 +385,8 @@ int ServerConfig::autoAddScreen(const QString name) {
|
||||
dirIndex = 3;
|
||||
}
|
||||
|
||||
int idx = adjacentScreenIndex(startIndex, neighbourDirs[dirIndex].x,
|
||||
neighbourDirs[dirIndex].y);
|
||||
int idx = adjacentScreenIndex(
|
||||
startIndex, neighbourDirs[dirIndex].x, neighbourDirs[dirIndex].y);
|
||||
while (idx != -1) {
|
||||
if (screens()[idx].isNull()) {
|
||||
m_Screens[idx].setName(name);
|
||||
@ -390,8 +395,8 @@ int ServerConfig::autoAddScreen(const QString name) {
|
||||
}
|
||||
|
||||
startIndex += offset;
|
||||
idx = adjacentScreenIndex(startIndex, neighbourDirs[dirIndex].x,
|
||||
neighbourDirs[dirIndex].y);
|
||||
idx = adjacentScreenIndex(
|
||||
startIndex, neighbourDirs[dirIndex].x, neighbourDirs[dirIndex].y);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
|
||||
@ -38,12 +38,13 @@ class AppConfig;
|
||||
class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase {
|
||||
friend class ServerConfigDialog;
|
||||
friend class ServerConnection;
|
||||
friend QTextStream &operator<<(QTextStream &outStream,
|
||||
const ServerConfig &config);
|
||||
friend QTextStream &
|
||||
operator<<(QTextStream &outStream, const ServerConfig &config);
|
||||
|
||||
public:
|
||||
ServerConfig(int numColumns, int numRows, AppConfig *appConfig,
|
||||
MainWindow *mainWindow);
|
||||
ServerConfig(
|
||||
int numColumns, int numRows, AppConfig *appConfig,
|
||||
MainWindow *mainWindow);
|
||||
|
||||
ServerConfig(const ServerConfig &src) = default;
|
||||
ServerConfig(ServerConfig &&) = default;
|
||||
|
||||
@ -29,16 +29,19 @@
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
||||
ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config,
|
||||
AppConfig &appConfig)
|
||||
ServerConfigDialog::ServerConfigDialog(
|
||||
QWidget *parent, ServerConfig &config, AppConfig &appConfig)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::ServerConfigDialogBase(), m_OrigServerConfig(config),
|
||||
Ui::ServerConfigDialogBase(),
|
||||
m_OrigServerConfig(config),
|
||||
m_OrigServerAppConfigUseExternalConfig(config.getUseExternalConfig()),
|
||||
m_OrigServerAppConfigExternalConfigFile(config.getConfigFile()),
|
||||
m_ServerConfig(config),
|
||||
m_ScreenSetupModel(serverConfig().screens(), serverConfig().numColumns(),
|
||||
serverConfig().numRows()),
|
||||
m_Message(""), m_appConfig(appConfig) {
|
||||
m_ScreenSetupModel(
|
||||
serverConfig().screens(), serverConfig().numColumns(),
|
||||
serverConfig().numRows()),
|
||||
m_Message(""),
|
||||
m_appConfig(appConfig) {
|
||||
setupUi(this);
|
||||
|
||||
m_pEditConfigFile->setText(serverConfig().getConfigFile());
|
||||
@ -90,115 +93,135 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config,
|
||||
if (server == screens.end()) {
|
||||
Screen serverScreen(serverConfig().getServerName());
|
||||
serverScreen.markAsServer();
|
||||
model().screen(serverConfig().numColumns() / 2,
|
||||
serverConfig().numRows() / 2) = serverScreen;
|
||||
model().screen(
|
||||
serverConfig().numColumns() / 2, serverConfig().numRows() / 2) =
|
||||
serverScreen;
|
||||
} else {
|
||||
server->markAsServer();
|
||||
}
|
||||
|
||||
m_pButtonAddComputer->setEnabled(!model().isFull());
|
||||
connect(m_pTrashScreenWidget, SIGNAL(screenRemoved()), this,
|
||||
SLOT(onScreenRemoved()));
|
||||
connect(
|
||||
m_pTrashScreenWidget, SIGNAL(screenRemoved()), this,
|
||||
SLOT(onScreenRemoved()));
|
||||
|
||||
onChange();
|
||||
|
||||
// computers
|
||||
connect(&m_ScreenSetupModel, &ScreenSetupModel::screensChanged, this,
|
||||
&ServerConfigDialog::onChange);
|
||||
connect(
|
||||
&m_ScreenSetupModel, &ScreenSetupModel::screensChanged, this,
|
||||
&ServerConfigDialog::onChange);
|
||||
|
||||
// advanced
|
||||
connect(m_pCheckBoxSwitchDelay, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().haveSwitchDelay(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pSpinBoxSwitchDelay,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchDelay(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxSwitchDoubleTap, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().haveSwitchDoubleTap(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pSpinBoxSwitchDoubleTap,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchDoubleTap(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxEnableClipboard, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setClipboardSharing(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pSpinBoxClipboardSizeLimit,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setClipboardSharingSize(v * 1024);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxHeartbeat, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().haveHeartbeat(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pSpinBoxHeartbeat,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setHeartbeat(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxRelativeMouseMoves, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setRelativeMouseMoves(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxWin32KeepForeground, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setWin32KeepForeground(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxDisableLockToScreen, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setDisableLockToScreen(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxCornerTopLeft, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::TopLeft, v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxCornerTopRight, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::TopRight, v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxCornerBottomLeft, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::BottomLeft, v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pCheckBoxCornerBottomRight, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::BottomRight, v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pSpinBoxSwitchCornerSize,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCornerSize(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxSwitchDelay, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().haveSwitchDelay(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pSpinBoxSwitchDelay,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchDelay(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxSwitchDoubleTap, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().haveSwitchDoubleTap(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pSpinBoxSwitchDoubleTap,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchDoubleTap(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxEnableClipboard, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setClipboardSharing(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pSpinBoxClipboardSizeLimit,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setClipboardSharingSize(v * 1024);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxHeartbeat, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().haveHeartbeat(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pSpinBoxHeartbeat,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setHeartbeat(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxRelativeMouseMoves, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setRelativeMouseMoves(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxWin32KeepForeground, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setWin32KeepForeground(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxDisableLockToScreen, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setDisableLockToScreen(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxCornerTopLeft, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::TopLeft, v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxCornerTopRight, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::TopRight, v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxCornerBottomLeft, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::BottomLeft, v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxCornerBottomRight, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCorner(BaseConfig::BottomRight, v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pSpinBoxSwitchCornerSize,
|
||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setSwitchCornerSize(v);
|
||||
onChange();
|
||||
});
|
||||
|
||||
// config
|
||||
connect(m_pCheckBoxUseExternalConfig, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setUseExternalConfig(v);
|
||||
onChange();
|
||||
});
|
||||
connect(
|
||||
m_pCheckBoxUseExternalConfig, &QCheckBox::stateChanged, this,
|
||||
[this](const int &v) {
|
||||
serverConfig().setUseExternalConfig(v);
|
||||
onChange();
|
||||
});
|
||||
connect(m_pEditConfigFile, &QLineEdit::textChanged, this, [this]() {
|
||||
serverConfig().setConfigFile(m_pEditConfigFile->text());
|
||||
onChange();
|
||||
@ -441,6 +464,6 @@ void ServerConfigDialog::onChange() {
|
||||
serverConfig().getUseExternalConfig() &&
|
||||
m_OrigServerAppConfigExternalConfigFile == serverConfig().getConfigFile();
|
||||
m_pButtonBox->button(QDialogButtonBox::Ok)
|
||||
->setEnabled(!isAppConfigDataEqual ||
|
||||
!(m_OrigServerConfig == m_ServerConfig));
|
||||
->setEnabled(
|
||||
!isAppConfigDataEqual || !(m_OrigServerConfig == m_ServerConfig));
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ServerConfigDialog(QWidget *parent, ServerConfig &config,
|
||||
AppConfig &appConfig);
|
||||
ServerConfigDialog(
|
||||
QWidget *parent, ServerConfig &config, AppConfig &appConfig);
|
||||
bool addClient(const QString &clientName);
|
||||
|
||||
public slots:
|
||||
|
||||
@ -55,8 +55,8 @@ void ServerConnection::addClient(const QString &clientName) {
|
||||
checkMainWindow()) {
|
||||
QMessageBox message(&m_parent);
|
||||
message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
|
||||
message.addButton(QObject::tr("Accept and configure"),
|
||||
QMessageBox::AcceptRole);
|
||||
message.addButton(
|
||||
QObject::tr("Accept and configure"), QMessageBox::AcceptRole);
|
||||
message.setText(
|
||||
QObject::tr("%1 client has made a connection request").arg(clientName));
|
||||
|
||||
@ -69,8 +69,8 @@ void ServerConnection::addClient(const QString &clientName) {
|
||||
}
|
||||
|
||||
void ServerConnection::configureClient(const QString &clientName) {
|
||||
ServerConfigDialog dlg(&m_parent, m_parent.serverConfig(),
|
||||
m_parent.appConfig());
|
||||
ServerConfigDialog dlg(
|
||||
&m_parent, m_parent.serverConfig(), m_parent.appConfig());
|
||||
|
||||
if (dlg.addClient(clientName) && dlg.exec() == QDialog::Accepted) {
|
||||
m_parent.restartSynergy();
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
#include "ServerMessage.h"
|
||||
|
||||
ServerMessage::ServerMessage(const QString &message)
|
||||
: m_message(message), m_clienName(parseClientName(message)) {}
|
||||
: m_message(message),
|
||||
m_clienName(parseClientName(message)) {}
|
||||
|
||||
bool ServerMessage::isNewClientMessage() const {
|
||||
return m_message.contains("unrecognised client name");
|
||||
|
||||
@ -34,7 +34,8 @@
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent, AppConfig &config)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::SettingsDialogBase(), m_appConfig(config) {
|
||||
Ui::SettingsDialogBase(),
|
||||
m_appConfig(config) {
|
||||
setupUi(this);
|
||||
|
||||
// TODO: maybe just accept MainWindow type in ctor?
|
||||
@ -52,28 +53,34 @@ SettingsDialog::SettingsDialog(QWidget *parent, AppConfig &config)
|
||||
m_pLineEditScreenName->setValidator(new validators::ScreenNameValidator(
|
||||
m_pLineEditScreenName, m_pLabelNameError, (&serveConfig.screens())));
|
||||
|
||||
connect(m_pLineEditLogFilename, SIGNAL(textChanged(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onChange()));
|
||||
connect(m_pLineEditCertificatePath, SIGNAL(textChanged(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pLineEditLogFilename, SIGNAL(textChanged(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pComboLogLevel, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pLineEditCertificatePath, SIGNAL(textChanged(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(m_pCheckBoxMinimizeToTray, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
connect(m_pCheckBoxAutoHide, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
connect(m_pCheckBoxPreventSleep, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
connect(m_pLineEditInterface, SIGNAL(textEdited(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pLineEditInterface, SIGNAL(textEdited(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(m_pSpinBoxPort, SIGNAL(valueChanged(int)), this, SLOT(onChange()));
|
||||
connect(m_pLineEditScreenName, SIGNAL(textEdited(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(m_pComboElevate, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pLineEditScreenName, SIGNAL(textEdited(QString)), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pComboElevate, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(onChange()));
|
||||
connect(m_pCheckBoxLanguageSync, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
connect(m_pCheckBoxScrollDirection, SIGNAL(clicked()), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pCheckBoxScrollDirection, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
connect(m_pCheckBoxClientHostMode, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
connect(m_pCheckBoxServerClientMode, SIGNAL(clicked()), this,
|
||||
SLOT(onChange()));
|
||||
connect(
|
||||
m_pCheckBoxServerClientMode, SIGNAL(clicked()), this, SLOT(onChange()));
|
||||
|
||||
adjustSize();
|
||||
}
|
||||
@ -266,8 +273,8 @@ void SettingsDialog::updateRegenButton() {
|
||||
// NOR the above bools, if any have changed regen should be disabled as it
|
||||
// will be done on save
|
||||
auto nor = !(keyChanged || pathChanged);
|
||||
m_pPushButtonRegenCert->setEnabled(nor &&
|
||||
m_pCheckBoxEnableCrypto->isChecked());
|
||||
m_pPushButtonRegenCert->setEnabled(
|
||||
nor && m_pCheckBoxEnableCrypto->isChecked());
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pPushButtonRegenCert_clicked() {
|
||||
|
||||
@ -34,10 +34,10 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase {
|
||||
|
||||
public:
|
||||
SettingsDialog(QWidget *parent, AppConfig &config);
|
||||
static QString browseForSynergyc(QWidget *parent, const QString &programDir,
|
||||
const QString &synergycName);
|
||||
static QString browseForSynergys(QWidget *parent, const QString &programDir,
|
||||
const QString &synergysName);
|
||||
static QString browseForSynergyc(
|
||||
QWidget *parent, const QString &programDir, const QString &synergycName);
|
||||
static QString browseForSynergys(
|
||||
QWidget *parent, const QString &programDir, const QString &synergysName);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
||||
@ -27,8 +27,9 @@ SetupWizard::SetupWizard(MainWindow &mainWindow) : m_MainWindow(mainWindow) {
|
||||
new validators::ScreenNameValidator(m_pLineEditName, label_ErrorMessage));
|
||||
|
||||
connect(m_pButtonApply, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
connect(m_pLineEditName, SIGNAL(textEdited(QString)), this,
|
||||
SLOT(onNameChanged()));
|
||||
connect(
|
||||
m_pLineEditName, SIGNAL(textEdited(QString)), this,
|
||||
SLOT(onNameChanged()));
|
||||
}
|
||||
|
||||
void SetupWizard::accept() {
|
||||
|
||||
@ -32,8 +32,8 @@ static const std::vector<const char *> blockerText = {
|
||||
"Please switch to Xorg if you wish to continue using Synergy today.",
|
||||
};
|
||||
|
||||
SetupWizardBlocker::SetupWizardBlocker(MainWindow &mainWindow,
|
||||
qBlockerType type)
|
||||
SetupWizardBlocker::SetupWizardBlocker(
|
||||
MainWindow &mainWindow, qBlockerType type)
|
||||
: m_MainWindow(mainWindow) {
|
||||
setupUi(this);
|
||||
|
||||
@ -41,10 +41,12 @@ SetupWizardBlocker::SetupWizardBlocker(MainWindow &mainWindow,
|
||||
|
||||
label_HelpInfo->setText(blockerText[static_cast<int>(type)]);
|
||||
|
||||
connect(m_pButtonSupport, &QPushButton::released, this,
|
||||
&SetupWizardBlocker::onlineSupport);
|
||||
connect(m_pButtonCancel, &QPushButton::released, this,
|
||||
&SetupWizardBlocker::cancel);
|
||||
connect(
|
||||
m_pButtonSupport, &QPushButton::released, this,
|
||||
&SetupWizardBlocker::onlineSupport);
|
||||
connect(
|
||||
m_pButtonCancel, &QPushButton::released, this,
|
||||
&SetupWizardBlocker::cancel);
|
||||
}
|
||||
|
||||
void SetupWizardBlocker::onlineSupport() {
|
||||
|
||||
@ -85,9 +85,8 @@ bool SslCertificate::runTool(const QStringList &args) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void SslCertificate::generateCertificate(const QString &path,
|
||||
const QString &keyLength,
|
||||
bool forceGen) {
|
||||
void SslCertificate::generateCertificate(
|
||||
const QString &path, const QString &keyLength, bool forceGen) {
|
||||
QString sslDirPath =
|
||||
QString("%1%2%3").arg(m_ProfileDir).arg(QDir::separator()).arg(kSslDir);
|
||||
|
||||
|
||||
@ -34,9 +34,9 @@ public slots:
|
||||
/// @param [in] QString keyLength The size of the private key. default: 2048
|
||||
/// @param [in] bool Should the file be created regardless of if the file
|
||||
/// already exists
|
||||
void generateCertificate(const QString &path = QString(),
|
||||
const QString &keyLength = "2048",
|
||||
bool forceGen = false);
|
||||
void generateCertificate(
|
||||
const QString &path = QString(), const QString &keyLength = "2048",
|
||||
bool forceGen = false);
|
||||
|
||||
/// @brief Get the key length of a TLS private key
|
||||
/// @param [in] QString path The path of the file to checked
|
||||
|
||||
@ -9,8 +9,9 @@ void TrayIcon::tryCreate() const {
|
||||
// underlying DBus connection
|
||||
// (on DBus)
|
||||
m_pTrayIcon->show();
|
||||
m_connector(m_pTrayIcon.get(),
|
||||
SIGNAL(activated(QSystemTrayIcon::ActivationReason)));
|
||||
m_connector(
|
||||
m_pTrayIcon.get(),
|
||||
SIGNAL(activated(QSystemTrayIcon::ActivationReason)));
|
||||
} else {
|
||||
QTimer::singleShot(2500, this, &TrayIcon::tryCreate);
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@ public:
|
||||
}
|
||||
|
||||
template <typename TActionContainer>
|
||||
void create(TActionContainer const &actionContainer,
|
||||
TConnector const &connector) {
|
||||
void
|
||||
create(TActionContainer const &actionContainer, TConnector const &connector) {
|
||||
m_connector = connector;
|
||||
m_pTrayIconMenu = std::make_unique<QMenu>();
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ void UpgradeDialog::showDialog(const QString &text) {
|
||||
setText(QObject::tr(text.toStdString().c_str()));
|
||||
|
||||
if (exec() == QMessageBox::Accepted) {
|
||||
QDesktopServices::openUrl(QUrl(QCoreApplication::organizationDomain() +
|
||||
"/synergy/purchase/upgrade?source=gui"));
|
||||
QDesktopServices::openUrl(QUrl(
|
||||
QCoreApplication::organizationDomain() +
|
||||
"/synergy/purchase/upgrade?source=gui"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,18 +28,20 @@
|
||||
|
||||
VersionChecker::VersionChecker(std::shared_ptr<QNetworkAccessManager> nam)
|
||||
: m_manager(nam ? nam : std::make_shared<QNetworkAccessManager>(this)) {
|
||||
connect(m_manager.get(), SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(replyFinished(QNetworkReply *)));
|
||||
connect(
|
||||
m_manager.get(), SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(replyFinished(QNetworkReply *)));
|
||||
}
|
||||
|
||||
void VersionChecker::checkLatest() {
|
||||
auto request = QNetworkRequest(QUrl(SYNERGY_VERSION_URL));
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader,
|
||||
QString("Synergy (") + SYNERGY_VERSION + ") " +
|
||||
QSysInfo::prettyProductName());
|
||||
request.setHeader(
|
||||
QNetworkRequest::UserAgentHeader, QString("Synergy (") + SYNERGY_VERSION +
|
||||
") " +
|
||||
QSysInfo::prettyProductName());
|
||||
request.setRawHeader("X-Synergy-Version", SYNERGY_VERSION);
|
||||
request.setRawHeader("X-Synergy-Language",
|
||||
QLocale::system().name().toStdString().c_str());
|
||||
request.setRawHeader(
|
||||
"X-Synergy-Language", QLocale::system().name().toStdString().c_str());
|
||||
m_manager->get(request);
|
||||
}
|
||||
|
||||
|
||||
@ -66,9 +66,10 @@ int main(int argc, char *argv[]) {
|
||||
#if defined(Q_OS_MAC)
|
||||
|
||||
if (app.applicationDirPath().startsWith("/Volumes/")) {
|
||||
QMessageBox::information(NULL, "Synergy",
|
||||
"Please drag Synergy to the Applications folder, "
|
||||
"and open it from there.");
|
||||
QMessageBox::information(
|
||||
NULL, "Synergy",
|
||||
"Please drag Synergy to the Applications folder, "
|
||||
"and open it from there.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -93,8 +94,9 @@ int main(int argc, char *argv[]) {
|
||||
MainWindow mainWindow(appConfig);
|
||||
#endif
|
||||
|
||||
QObject::connect(dynamic_cast<QObject *>(&app), SIGNAL(aboutToQuit()),
|
||||
&mainWindow, SLOT(saveSettings()));
|
||||
QObject::connect(
|
||||
dynamic_cast<QObject *>(&app), SIGNAL(aboutToQuit()), &mainWindow,
|
||||
SLOT(saveSettings()));
|
||||
|
||||
std::unique_ptr<SetupWizardBlocker> setupBlocker;
|
||||
if (qgetenv("XDG_SESSION_TYPE") == "wayland") {
|
||||
@ -143,10 +145,11 @@ bool checkMacAssistiveDevices() {
|
||||
// now deprecated in mavericks.
|
||||
bool result = AXAPIEnabled();
|
||||
if (!result) {
|
||||
QMessageBox::information(NULL, "Synergy",
|
||||
"Please enable access to assistive devices "
|
||||
"System Preferences -> Security & Privacy -> "
|
||||
"Privacy -> Accessibility, then re-open Synergy.");
|
||||
QMessageBox::information(
|
||||
NULL, "Synergy",
|
||||
"Please enable access to assistive devices "
|
||||
"System Preferences -> Security & Privacy -> "
|
||||
"Privacy -> Accessibility, then re-open Synergy.");
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@ namespace validators {
|
||||
|
||||
class AliasValidator : public LineEditValidator {
|
||||
public:
|
||||
explicit AliasValidator(QLineEdit *parent = nullptr,
|
||||
QLabel *errors = nullptr);
|
||||
explicit AliasValidator(
|
||||
QLineEdit *parent = nullptr, QLabel *errors = nullptr);
|
||||
};
|
||||
|
||||
} // namespace validators
|
||||
|
||||
@ -25,8 +25,8 @@ ComputerNameValidator::ComputerNameValidator(const QString &message)
|
||||
: IStringValidator(message) {}
|
||||
|
||||
bool ComputerNameValidator::validate(const QString &input) const {
|
||||
const QRegularExpression re("^[\\w\\._-]{0,255}$",
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
const QRegularExpression re(
|
||||
"^[\\w\\._-]{0,255}$", QRegularExpression::CaseInsensitiveOption);
|
||||
auto match = re.match(input);
|
||||
auto result = match.hasMatch();
|
||||
return result;
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
namespace validators {
|
||||
|
||||
LineEditValidator::LineEditValidator(QLineEdit *parent, QLabel *errors)
|
||||
: m_pErrors(errors), m_pControl(parent) {
|
||||
: m_pErrors(errors),
|
||||
m_pControl(parent) {
|
||||
if (m_pErrors) {
|
||||
m_pErrors->hide();
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ namespace validators {
|
||||
|
||||
class LineEditValidator : public QValidator {
|
||||
public:
|
||||
explicit LineEditValidator(QLineEdit *parent = nullptr,
|
||||
QLabel *errors = nullptr);
|
||||
explicit LineEditValidator(
|
||||
QLineEdit *parent = nullptr, QLabel *errors = nullptr);
|
||||
QValidator::State validate(QString &input, int &pos) const override;
|
||||
void addValidator(std::unique_ptr<IStringValidator> validator);
|
||||
|
||||
|
||||
@ -22,7 +22,8 @@ namespace validators {
|
||||
ScreenDuplicationsValidator::ScreenDuplicationsValidator(
|
||||
const QString &message, const QString &defaultName,
|
||||
const ScreenList *pScreens)
|
||||
: IStringValidator(message), m_defaultName(defaultName),
|
||||
: IStringValidator(message),
|
||||
m_defaultName(defaultName),
|
||||
m_pScreenList(pScreens) {}
|
||||
|
||||
bool ScreenDuplicationsValidator::validate(const QString &input) const {
|
||||
|
||||
@ -28,9 +28,9 @@ class ScreenDuplicationsValidator : public IStringValidator {
|
||||
const ScreenList *m_pScreenList = nullptr;
|
||||
|
||||
public:
|
||||
ScreenDuplicationsValidator(const QString &message,
|
||||
const QString &defaultName,
|
||||
const ScreenList *pScreens);
|
||||
ScreenDuplicationsValidator(
|
||||
const QString &message, const QString &defaultName,
|
||||
const ScreenList *pScreens);
|
||||
bool validate(const QString &input) const override;
|
||||
};
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
|
||||
namespace validators {
|
||||
|
||||
ScreenNameValidator::ScreenNameValidator(QLineEdit *parent, QLabel *errors,
|
||||
const ScreenList *pScreens)
|
||||
ScreenNameValidator::ScreenNameValidator(
|
||||
QLineEdit *parent, QLabel *errors, const ScreenList *pScreens)
|
||||
: LineEditValidator(parent, errors) {
|
||||
addValidator(
|
||||
std::make_unique<EmptyStringValidator>("Computer name cannot be empty"));
|
||||
|
||||
@ -25,9 +25,9 @@ namespace validators {
|
||||
|
||||
class ScreenNameValidator : public LineEditValidator {
|
||||
public:
|
||||
explicit ScreenNameValidator(QLineEdit *parent = nullptr,
|
||||
QLabel *errors = nullptr,
|
||||
const ScreenList *pScreens = nullptr);
|
||||
explicit ScreenNameValidator(
|
||||
QLineEdit *parent = nullptr, QLabel *errors = nullptr,
|
||||
const ScreenList *pScreens = nullptr);
|
||||
};
|
||||
|
||||
} // namespace validators
|
||||
|
||||
@ -24,8 +24,9 @@ ClientStateLabel::ClientStateLabel(QWidget *parent) : QLabel(parent) { hide(); }
|
||||
void ClientStateLabel::updateClientState(const QString &line) {
|
||||
if (line.contains("connected to server")) {
|
||||
show();
|
||||
} else if (line.contains("disconnected from server") ||
|
||||
line.contains("process exited")) {
|
||||
} else if (
|
||||
line.contains("disconnected from server") ||
|
||||
line.contains("process exited")) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ ArchDaemonNone::~ArchDaemonNone() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void ArchDaemonNone::installDaemon(const char *, const char *, const char *,
|
||||
const char *, const char *) {
|
||||
void ArchDaemonNone::installDaemon(
|
||||
const char *, const char *, const char *, const char *, const char *) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -35,9 +35,9 @@ public:
|
||||
virtual ~ArchDaemonNone();
|
||||
|
||||
// IArchDaemon overrides
|
||||
virtual void installDaemon(const char *name, const char *description,
|
||||
const char *pathname, const char *commandLine,
|
||||
const char *dependencies);
|
||||
virtual void installDaemon(
|
||||
const char *name, const char *description, const char *pathname,
|
||||
const char *commandLine, const char *dependencies);
|
||||
virtual void uninstallDaemon(const char *name);
|
||||
virtual int daemonize(const char *name, DaemonFunc func);
|
||||
virtual bool canInstallDaemon(const char *name);
|
||||
|
||||
@ -47,9 +47,9 @@ public:
|
||||
followed by a NUL; the daemon will be configured to startup after
|
||||
the listed daemons. Throws an \c XArchDaemon exception on failure.
|
||||
*/
|
||||
virtual void installDaemon(const char *name, const char *description,
|
||||
const char *pathname, const char *commandLine,
|
||||
const char *dependencies) = 0;
|
||||
virtual void installDaemon(
|
||||
const char *name, const char *description, const char *pathname,
|
||||
const char *commandLine, const char *dependencies) = 0;
|
||||
|
||||
//! Uninstall daemon
|
||||
/*!
|
||||
|
||||
@ -85,8 +85,8 @@ public:
|
||||
is longer than allowed by the system; we'll rely on the
|
||||
system calls to tell us that.
|
||||
*/
|
||||
virtual std::string concatPath(const std::string &prefix,
|
||||
const std::string &suffix) = 0;
|
||||
virtual std::string
|
||||
concatPath(const std::string &prefix, const std::string &suffix) = 0;
|
||||
|
||||
//@}
|
||||
//! Set the user's profile directory
|
||||
|
||||
@ -37,8 +37,8 @@ IArchString::~IArchString() {
|
||||
}
|
||||
}
|
||||
|
||||
int IArchString::convStringWCToMB(char *dst, const wchar_t *src, UInt32 n,
|
||||
bool *errors) {
|
||||
int IArchString::convStringWCToMB(
|
||||
char *dst, const wchar_t *src, UInt32 n, bool *errors) {
|
||||
ptrdiff_t len = 0;
|
||||
|
||||
bool dummyErrors;
|
||||
@ -94,8 +94,8 @@ int IArchString::convStringWCToMB(char *dst, const wchar_t *src, UInt32 n,
|
||||
return static_cast<int>(len);
|
||||
}
|
||||
|
||||
int IArchString::convStringMBToWC(wchar_t *dst, const char *src, UInt32 n,
|
||||
bool *errors) {
|
||||
int IArchString::convStringMBToWC(
|
||||
wchar_t *dst, const char *src, UInt32 n, bool *errors) {
|
||||
ptrdiff_t len = 0;
|
||||
wchar_t dummy;
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ public:
|
||||
/*!
|
||||
Writes a Synergy setting from the system.
|
||||
*/
|
||||
virtual void setting(const std::string &valueName,
|
||||
const std::string &valueString) const = 0;
|
||||
virtual void setting(
|
||||
const std::string &valueName, const std::string &valueString) const = 0;
|
||||
//@}
|
||||
};
|
||||
|
||||
@ -113,8 +113,8 @@ std::string ArchFileUnix::getProfileDirectory() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
std::string ArchFileUnix::concatPath(const std::string &prefix,
|
||||
const std::string &suffix) {
|
||||
std::string
|
||||
ArchFileUnix::concatPath(const std::string &prefix, const std::string &suffix) {
|
||||
std::string path;
|
||||
path.reserve(prefix.size() + 1 + suffix.size());
|
||||
path += prefix;
|
||||
|
||||
@ -36,8 +36,8 @@ public:
|
||||
virtual std::string getLogDirectory();
|
||||
virtual std::string getPluginDirectory();
|
||||
virtual std::string getProfileDirectory();
|
||||
virtual std::string concatPath(const std::string &prefix,
|
||||
const std::string &suffix);
|
||||
virtual std::string
|
||||
concatPath(const std::string &prefix, const std::string &suffix);
|
||||
virtual void setProfileDirectory(const String &s);
|
||||
virtual void setPluginDirectory(const String &s);
|
||||
|
||||
|
||||
@ -77,8 +77,14 @@ public:
|
||||
};
|
||||
|
||||
ArchThreadImpl::ArchThreadImpl()
|
||||
: m_refCount(1), m_id(0), m_func(NULL), m_userData(NULL), m_cancel(false),
|
||||
m_cancelling(false), m_exited(false), m_result(NULL),
|
||||
: m_refCount(1),
|
||||
m_id(0),
|
||||
m_func(NULL),
|
||||
m_userData(NULL),
|
||||
m_cancel(false),
|
||||
m_cancelling(false),
|
||||
m_exited(false),
|
||||
m_result(NULL),
|
||||
m_networkData(NULL) {
|
||||
// do nothing
|
||||
}
|
||||
@ -90,7 +96,8 @@ ArchThreadImpl::ArchThreadImpl()
|
||||
ArchMultithreadPosix *ArchMultithreadPosix::s_instance = NULL;
|
||||
|
||||
ArchMultithreadPosix::ArchMultithreadPosix()
|
||||
: m_newThreadCalled(false), m_nextID(0) {
|
||||
: m_newThreadCalled(false),
|
||||
m_nextID(0) {
|
||||
assert(s_instance == NULL);
|
||||
|
||||
s_instance = this;
|
||||
@ -186,8 +193,8 @@ void ArchMultithreadPosix::broadcastCondVar(ArchCond cond) {
|
||||
assert(status == 0);
|
||||
}
|
||||
|
||||
bool ArchMultithreadPosix::waitCondVar(ArchCond cond, ArchMutex mutex,
|
||||
double timeout) {
|
||||
bool ArchMultithreadPosix::waitCondVar(
|
||||
ArchCond cond, ArchMutex mutex, double timeout) {
|
||||
// we can't wait on a condition variable and also wake it up for
|
||||
// cancellation since we don't use posix cancellation. so we
|
||||
// must wake up periodically to check for cancellation. we
|
||||
@ -326,8 +333,8 @@ ArchThread ArchMultithreadPosix::newThread(ThreadFunc func, void *data) {
|
||||
pthread_attr_t attr;
|
||||
int status = pthread_attr_init(&attr);
|
||||
if (status == 0) {
|
||||
status = pthread_create(&thread->m_thread, &attr,
|
||||
&ArchMultithreadPosix::threadFunc, thread);
|
||||
status = pthread_create(
|
||||
&thread->m_thread, &attr, &ArchMultithreadPosix::threadFunc, thread);
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
|
||||
@ -471,8 +478,8 @@ bool ArchMultithreadPosix::wait(ArchThread target, double timeout) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ArchMultithreadPosix::isSameThread(ArchThread thread1,
|
||||
ArchThread thread2) {
|
||||
bool ArchMultithreadPosix::isSameThread(
|
||||
ArchThread thread1, ArchThread thread2) {
|
||||
return (thread1 == thread2);
|
||||
}
|
||||
|
||||
@ -495,8 +502,8 @@ ArchMultithreadPosix::getIDOfThread(ArchThread thread) {
|
||||
return thread->m_id;
|
||||
}
|
||||
|
||||
void ArchMultithreadPosix::setSignalHandler(ESignal signal, SignalFunc func,
|
||||
void *userData) {
|
||||
void ArchMultithreadPosix::setSignalHandler(
|
||||
ESignal signal, SignalFunc func, void *userData) {
|
||||
lockMutex(m_threadMutex);
|
||||
m_signalFunc[signal] = func;
|
||||
m_signalUserData[signal] = userData;
|
||||
@ -528,8 +535,9 @@ void ArchMultithreadPosix::startSignalHandler() {
|
||||
pthread_attr_t attr;
|
||||
int status = pthread_attr_init(&attr);
|
||||
if (status == 0) {
|
||||
status = pthread_create(&m_signalThread, &attr,
|
||||
&ArchMultithreadPosix::threadSignalHandler, NULL);
|
||||
status = pthread_create(
|
||||
&m_signalThread, &attr, &ArchMultithreadPosix::threadSignalHandler,
|
||||
NULL);
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
if (status != 0) {
|
||||
|
||||
@ -406,9 +406,10 @@ int ArchNetworkBSD::pollSocket(PollEntry pe[], int num, double timeout) {
|
||||
}
|
||||
|
||||
// do the select
|
||||
n = select((SELECT_TYPE_ARG1)n + 1, SELECT_TYPE_ARG234 readSetP,
|
||||
SELECT_TYPE_ARG234 writeSetP, SELECT_TYPE_ARG234 errSetP,
|
||||
SELECT_TYPE_ARG5 timeout2P);
|
||||
n = select(
|
||||
(SELECT_TYPE_ARG1)n + 1, SELECT_TYPE_ARG234 readSetP,
|
||||
SELECT_TYPE_ARG234 writeSetP, SELECT_TYPE_ARG234 errSetP,
|
||||
SELECT_TYPE_ARG5 timeout2P);
|
||||
|
||||
// reset the unblock pipe
|
||||
if (n > 0 && unblockPipe != NULL && FD_ISSET(unblockPipe[0], &readSet)) {
|
||||
@ -493,8 +494,9 @@ void ArchNetworkBSD::throwErrorOnSocket(ArchSocket s) {
|
||||
// get the error from the socket layer
|
||||
int err = 0;
|
||||
auto size = static_cast<socklen_t>(sizeof(err));
|
||||
if (getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR,
|
||||
reinterpret_cast<optval_t *>(&err), &size) == -1) {
|
||||
if (getsockopt(
|
||||
s->m_fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<optval_t *>(&err),
|
||||
&size) == -1) {
|
||||
err = errno;
|
||||
}
|
||||
|
||||
@ -527,15 +529,17 @@ bool ArchNetworkBSD::setNoDelayOnSocket(ArchSocket s, bool noDelay) {
|
||||
// get old state
|
||||
int oflag;
|
||||
auto size = static_cast<socklen_t>(sizeof(oflag));
|
||||
if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
reinterpret_cast<optval_t *>(&oflag), &size) == -1) {
|
||||
if (getsockopt(
|
||||
s->m_fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
reinterpret_cast<optval_t *>(&oflag), &size) == -1) {
|
||||
throwError(errno);
|
||||
}
|
||||
|
||||
int flag = noDelay ? 1 : 0;
|
||||
size = static_cast<socklen_t>(sizeof(flag));
|
||||
if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
reinterpret_cast<optval_t *>(&flag), size) == -1) {
|
||||
if (setsockopt(
|
||||
s->m_fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
reinterpret_cast<optval_t *>(&flag), size) == -1) {
|
||||
throwError(errno);
|
||||
}
|
||||
|
||||
@ -548,15 +552,17 @@ bool ArchNetworkBSD::setReuseAddrOnSocket(ArchSocket s, bool reuse) {
|
||||
// get old state
|
||||
int oflag;
|
||||
auto size = static_cast<socklen_t>(sizeof(oflag));
|
||||
if (getsockopt(s->m_fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
reinterpret_cast<optval_t *>(&oflag), &size) == -1) {
|
||||
if (getsockopt(
|
||||
s->m_fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
reinterpret_cast<optval_t *>(&oflag), &size) == -1) {
|
||||
throwError(errno);
|
||||
}
|
||||
|
||||
int flag = reuse ? 1 : 0;
|
||||
size = static_cast<socklen_t>(sizeof(flag));
|
||||
if (setsockopt(s->m_fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
reinterpret_cast<optval_t *>(&flag), size) == -1) {
|
||||
if (setsockopt(
|
||||
s->m_fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
reinterpret_cast<optval_t *>(&flag), size) == -1) {
|
||||
throwError(errno);
|
||||
}
|
||||
|
||||
@ -648,8 +654,8 @@ ArchNetworkBSD::nameToAddr(const std::string &name) {
|
||||
addresses.back()->m_len = (socklen_t)sizeof(struct sockaddr_in6);
|
||||
}
|
||||
|
||||
memcpy(&addresses.back()->m_addr, address->ai_addr,
|
||||
addresses.back()->m_len);
|
||||
memcpy(
|
||||
&addresses.back()->m_addr, address->ai_addr, addresses.back()->m_len);
|
||||
}
|
||||
|
||||
freeaddrinfo(pResult);
|
||||
@ -671,8 +677,9 @@ std::string ArchNetworkBSD::addrToName(ArchNetAddress addr) {
|
||||
ARCH->lockMutex(m_mutex);
|
||||
char host[1024];
|
||||
char service[20];
|
||||
int ret = getnameinfo(TYPED_ADDR(struct sockaddr, addr), addr->m_len, host,
|
||||
sizeof(host), service, sizeof(service), 0);
|
||||
int ret = getnameinfo(
|
||||
TYPED_ADDR(struct sockaddr, addr), addr->m_len, host, sizeof(host),
|
||||
service, sizeof(service), 0);
|
||||
if (ret != 0) {
|
||||
ARCH->unlockMutex(m_mutex);
|
||||
throwNameError(ret);
|
||||
@ -777,16 +784,18 @@ bool ArchNetworkBSD::isAnyAddr(ArchNetAddress addr) {
|
||||
switch (getAddrFamily(addr)) {
|
||||
case kINET: {
|
||||
auto *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
||||
return (ipAddr->sin_addr.s_addr == INADDR_ANY &&
|
||||
addr->m_len == static_cast<socklen_t>(sizeof(struct sockaddr_in)));
|
||||
return (
|
||||
ipAddr->sin_addr.s_addr == INADDR_ANY &&
|
||||
addr->m_len == static_cast<socklen_t>(sizeof(struct sockaddr_in)));
|
||||
}
|
||||
|
||||
case kINET6: {
|
||||
struct sockaddr_in6 *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
||||
return (addr->m_len == (socklen_t)sizeof(struct sockaddr_in6) &&
|
||||
memcmp(static_cast<const void *>(&ipAddr->sin6_addr),
|
||||
static_cast<const void *>(&in6addr_any),
|
||||
sizeof(in6_addr)) == 0);
|
||||
return (
|
||||
addr->m_len == (socklen_t)sizeof(struct sockaddr_in6) &&
|
||||
memcmp(
|
||||
static_cast<const void *>(&ipAddr->sin6_addr),
|
||||
static_cast<const void *>(&in6addr_any), sizeof(in6_addr)) == 0);
|
||||
}
|
||||
|
||||
default:
|
||||
@ -796,8 +805,8 @@ bool ArchNetworkBSD::isAnyAddr(ArchNetAddress addr) {
|
||||
}
|
||||
|
||||
bool ArchNetworkBSD::isEqualAddr(ArchNetAddress a, ArchNetAddress b) {
|
||||
return (a->m_len == b->m_len &&
|
||||
memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0);
|
||||
return (
|
||||
a->m_len == b->m_len && memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0);
|
||||
}
|
||||
|
||||
const int *ArchNetworkBSD::getUnblockPipe() {
|
||||
|
||||
@ -77,9 +77,9 @@ void ArchSleepUnix::sleep(double timeout) {
|
||||
struct timeval timeout2;
|
||||
timeout2.tv_sec = static_cast<int>(timeLeft);
|
||||
timeout2.tv_usec = static_cast<int>(1.0e+6 * (timeLeft - timeout2.tv_sec));
|
||||
select((SELECT_TYPE_ARG1)0, SELECT_TYPE_ARG234 NULL,
|
||||
SELECT_TYPE_ARG234 NULL, SELECT_TYPE_ARG234 NULL,
|
||||
SELECT_TYPE_ARG5 & timeout2);
|
||||
select(
|
||||
(SELECT_TYPE_ARG1)0, SELECT_TYPE_ARG234 NULL, SELECT_TYPE_ARG234 NULL,
|
||||
SELECT_TYPE_ARG234 NULL, SELECT_TYPE_ARG5 & timeout2);
|
||||
ARCH->testCancelThread();
|
||||
timeLeft = timeout - (ARCH->time() - startTime);
|
||||
}
|
||||
|
||||
@ -69,13 +69,13 @@ std::string ArchSystemUnix::getLibsUsed(void) const {
|
||||
}
|
||||
|
||||
#ifndef __APPLE__
|
||||
bool ArchSystemUnix::DBusInhibitScreenCall(InhibitScreenServices serviceID,
|
||||
bool state, std::string &error) {
|
||||
bool ArchSystemUnix::DBusInhibitScreenCall(
|
||||
InhibitScreenServices serviceID, bool state, std::string &error) {
|
||||
error = "";
|
||||
static const std::array<QString, 2> services = {"org.freedesktop.ScreenSaver",
|
||||
"org.gnome.SessionManager"};
|
||||
static const std::array<QString, 2> paths = {"/org/freedesktop/ScreenSaver",
|
||||
"/org/gnome/SessionManager"};
|
||||
static const std::array<QString, 2> services = {
|
||||
"org.freedesktop.ScreenSaver", "org.gnome.SessionManager"};
|
||||
static const std::array<QString, 2> paths = {
|
||||
"/org/freedesktop/ScreenSaver", "/org/gnome/SessionManager"};
|
||||
static std::array<uint, 2> cookies;
|
||||
|
||||
auto serviceNum = static_cast<uint8_t>(serviceID);
|
||||
@ -86,8 +86,8 @@ bool ArchSystemUnix::DBusInhibitScreenCall(InhibitScreenServices serviceID,
|
||||
return false;
|
||||
}
|
||||
|
||||
QDBusInterface screenSaverInterface(services[serviceNum], paths[serviceNum],
|
||||
services[serviceNum], bus);
|
||||
QDBusInterface screenSaverInterface(
|
||||
services[serviceNum], paths[serviceNum], services[serviceNum], bus);
|
||||
|
||||
if (!screenSaverInterface.isValid()) {
|
||||
error = "screen saver interface failed to initialize";
|
||||
|
||||
@ -37,7 +37,7 @@ public:
|
||||
|
||||
#ifndef __APPLE__
|
||||
enum class InhibitScreenServices { kScreenSaver, kSessionManager };
|
||||
static bool DBusInhibitScreenCall(InhibitScreenServices serviceID, bool state,
|
||||
std::string &error);
|
||||
static bool DBusInhibitScreenCall(
|
||||
InhibitScreenServices serviceID, bool state, std::string &error);
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -62,10 +62,9 @@ void ArchDaemonWindows::daemonFailed(int result) {
|
||||
throw XArchDaemonRunFailed(result);
|
||||
}
|
||||
|
||||
void ArchDaemonWindows::installDaemon(const char *name, const char *description,
|
||||
const char *pathname,
|
||||
const char *commandLine,
|
||||
const char *dependencies) {
|
||||
void ArchDaemonWindows::installDaemon(
|
||||
const char *name, const char *description, const char *pathname,
|
||||
const char *commandLine, const char *dependencies) {
|
||||
// open service manager
|
||||
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE);
|
||||
if (mgr == NULL) {
|
||||
@ -74,11 +73,11 @@ void ArchDaemonWindows::installDaemon(const char *name, const char *description,
|
||||
}
|
||||
|
||||
// create the service
|
||||
SC_HANDLE service =
|
||||
CreateService(mgr, name, name, 0,
|
||||
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
|
||||
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, pathname, NULL,
|
||||
NULL, dependencies, NULL, NULL);
|
||||
SC_HANDLE service = CreateService(
|
||||
mgr, name, name, 0,
|
||||
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
|
||||
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, pathname, NULL, NULL,
|
||||
dependencies, NULL, NULL);
|
||||
|
||||
if (service == NULL) {
|
||||
// can't create service
|
||||
@ -255,8 +254,8 @@ bool ArchDaemonWindows::isDaemonInstalled(const char *name) {
|
||||
}
|
||||
|
||||
HKEY ArchDaemonWindows::openNTServicesKey() {
|
||||
static const char *s_keyNames[] = {_T("SYSTEM"), _T("CurrentControlSet"),
|
||||
_T("Services"), NULL};
|
||||
static const char *s_keyNames[] = {
|
||||
_T("SYSTEM"), _T("CurrentControlSet"), _T("Services"), NULL};
|
||||
|
||||
return ArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_keyNames);
|
||||
}
|
||||
@ -606,8 +605,8 @@ void ArchDaemonWindows::installDaemon() {
|
||||
ss << path;
|
||||
ss << '"';
|
||||
|
||||
installDaemon(DEFAULT_DAEMON_NAME, DEFAULT_DAEMON_INFO, ss.str().c_str(),
|
||||
"", "");
|
||||
installDaemon(
|
||||
DEFAULT_DAEMON_NAME, DEFAULT_DAEMON_INFO, ss.str().c_str(), "", "");
|
||||
}
|
||||
|
||||
start(DEFAULT_DAEMON_NAME);
|
||||
|
||||
@ -75,9 +75,9 @@ public:
|
||||
static UINT getDaemonQuitMessage();
|
||||
|
||||
// IArchDaemon overrides
|
||||
virtual void installDaemon(const char *name, const char *description,
|
||||
const char *pathname, const char *commandLine,
|
||||
const char *dependencies);
|
||||
virtual void installDaemon(
|
||||
const char *name, const char *description, const char *pathname,
|
||||
const char *commandLine, const char *dependencies);
|
||||
virtual void uninstallDaemon(const char *name);
|
||||
virtual void installDaemon();
|
||||
virtual void uninstallDaemon();
|
||||
|
||||
@ -155,8 +155,8 @@ std::string ArchFileWindows::getProfileDirectory() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
std::string ArchFileWindows::concatPath(const std::string &prefix,
|
||||
const std::string &suffix) {
|
||||
std::string ArchFileWindows::concatPath(
|
||||
const std::string &prefix, const std::string &suffix) {
|
||||
std::string path;
|
||||
path.reserve(prefix.size() + 1 + suffix.size());
|
||||
path += prefix;
|
||||
|
||||
@ -36,8 +36,8 @@ public:
|
||||
virtual std::string getLogDirectory();
|
||||
virtual std::string getPluginDirectory();
|
||||
virtual std::string getProfileDirectory();
|
||||
virtual std::string concatPath(const std::string &prefix,
|
||||
const std::string &suffix);
|
||||
virtual std::string
|
||||
concatPath(const std::string &prefix, const std::string &suffix);
|
||||
virtual void setProfileDirectory(const String &s);
|
||||
virtual void setPluginDirectory(const String &s);
|
||||
|
||||
|
||||
@ -74,11 +74,12 @@ void ArchLogWindows::writeLog(ELevel level, const char *msg) {
|
||||
// just dump our string into the raw data section of the event
|
||||
// so users can at least see the message. note that we use our
|
||||
// level as the event category.
|
||||
ReportEvent(m_eventLog, type, static_cast<WORD>(level),
|
||||
0, // event ID
|
||||
NULL, 0,
|
||||
(DWORD)strlen(msg) + 1, // raw data size
|
||||
NULL,
|
||||
const_cast<char *>(msg)); // raw data
|
||||
ReportEvent(
|
||||
m_eventLog, type, static_cast<WORD>(level),
|
||||
0, // event ID
|
||||
NULL, 0,
|
||||
(DWORD)strlen(msg) + 1, // raw data size
|
||||
NULL,
|
||||
const_cast<char *>(msg)); // raw data
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,8 +114,9 @@ HKEY ArchMiscWindows::openKey(HKEY key, const TCHAR *keyName, bool create) {
|
||||
RegOpenKeyEx(key, keyName, 0, KEY_WRITE | KEY_QUERY_VALUE, &newKey);
|
||||
if (result != ERROR_SUCCESS && create) {
|
||||
DWORD disp;
|
||||
result = RegCreateKeyEx(key, keyName, 0, NULL, 0,
|
||||
KEY_WRITE | KEY_QUERY_VALUE, NULL, &newKey, &disp);
|
||||
result = RegCreateKeyEx(
|
||||
key, keyName, 0, NULL, 0, KEY_WRITE | KEY_QUERY_VALUE, NULL, &newKey,
|
||||
&disp);
|
||||
}
|
||||
if (result != ERROR_SUCCESS) {
|
||||
RegCloseKey(key);
|
||||
@ -127,8 +128,8 @@ HKEY ArchMiscWindows::openKey(HKEY key, const TCHAR *keyName, bool create) {
|
||||
return newKey;
|
||||
}
|
||||
|
||||
HKEY ArchMiscWindows::openKey(HKEY key, const TCHAR *const *keyNames,
|
||||
bool create) {
|
||||
HKEY ArchMiscWindows::openKey(
|
||||
HKEY key, const TCHAR *const *keyNames, bool create) {
|
||||
for (size_t i = 0; key != NULL && keyNames[i] != NULL; ++i) {
|
||||
// open next key
|
||||
key = openKey(key, keyNames[i], create);
|
||||
@ -165,8 +166,8 @@ bool ArchMiscWindows::hasValue(HKEY key, const TCHAR *name) {
|
||||
return (result == ERROR_SUCCESS && (type == REG_DWORD || type == REG_SZ));
|
||||
}
|
||||
|
||||
ArchMiscWindows::EValueType ArchMiscWindows::typeOfValue(HKEY key,
|
||||
const TCHAR *name) {
|
||||
ArchMiscWindows::EValueType
|
||||
ArchMiscWindows::typeOfValue(HKEY key, const TCHAR *name) {
|
||||
DWORD type;
|
||||
LONG result = RegQueryValueEx(key, name, 0, &type, NULL, NULL);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
@ -187,16 +188,16 @@ ArchMiscWindows::EValueType ArchMiscWindows::typeOfValue(HKEY key,
|
||||
}
|
||||
}
|
||||
|
||||
void ArchMiscWindows::setValue(HKEY key, const TCHAR *name,
|
||||
const std::string &value) {
|
||||
void ArchMiscWindows::setValue(
|
||||
HKEY key, const TCHAR *name, const std::string &value) {
|
||||
assert(key != NULL);
|
||||
if (key == NULL) {
|
||||
// TODO: throw exception
|
||||
return;
|
||||
}
|
||||
RegSetValueEx(key, name, 0, REG_SZ,
|
||||
reinterpret_cast<const BYTE *>(value.c_str()),
|
||||
(DWORD)value.size() + 1);
|
||||
RegSetValueEx(
|
||||
key, name, 0, REG_SZ, reinterpret_cast<const BYTE *>(value.c_str()),
|
||||
(DWORD)value.size() + 1);
|
||||
}
|
||||
|
||||
void ArchMiscWindows::setValue(HKEY key, const TCHAR *name, DWORD value) {
|
||||
@ -205,25 +206,26 @@ void ArchMiscWindows::setValue(HKEY key, const TCHAR *name, DWORD value) {
|
||||
// TODO: throw exception
|
||||
return;
|
||||
}
|
||||
RegSetValueEx(key, name, 0, REG_DWORD, reinterpret_cast<CONST BYTE *>(&value),
|
||||
sizeof(DWORD));
|
||||
RegSetValueEx(
|
||||
key, name, 0, REG_DWORD, reinterpret_cast<CONST BYTE *>(&value),
|
||||
sizeof(DWORD));
|
||||
}
|
||||
|
||||
void ArchMiscWindows::setValueBinary(HKEY key, const TCHAR *name,
|
||||
const std::string &value) {
|
||||
void ArchMiscWindows::setValueBinary(
|
||||
HKEY key, const TCHAR *name, const std::string &value) {
|
||||
assert(key != NULL);
|
||||
assert(name != NULL);
|
||||
if (key == NULL || name == NULL) {
|
||||
// TODO: throw exception
|
||||
return;
|
||||
}
|
||||
RegSetValueEx(key, name, 0, REG_BINARY,
|
||||
reinterpret_cast<const BYTE *>(value.data()),
|
||||
(DWORD)value.size());
|
||||
RegSetValueEx(
|
||||
key, name, 0, REG_BINARY, reinterpret_cast<const BYTE *>(value.data()),
|
||||
(DWORD)value.size());
|
||||
}
|
||||
|
||||
std::string ArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR *name,
|
||||
DWORD type) {
|
||||
std::string
|
||||
ArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR *name, DWORD type) {
|
||||
// get the size of the string
|
||||
DWORD actualType;
|
||||
DWORD size = 0;
|
||||
@ -241,8 +243,8 @@ std::string ArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR *name,
|
||||
char *buffer = new char[size];
|
||||
|
||||
// read it
|
||||
result = RegQueryValueEx(key, name, 0, &actualType,
|
||||
reinterpret_cast<BYTE *>(buffer), &size);
|
||||
result = RegQueryValueEx(
|
||||
key, name, 0, &actualType, reinterpret_cast<BYTE *>(buffer), &size);
|
||||
if (result != ERROR_SUCCESS || actualType != type) {
|
||||
delete[] buffer;
|
||||
return std::string();
|
||||
@ -271,8 +273,8 @@ ArchMiscWindows::readValueInt(HKEY key, const TCHAR *name) {
|
||||
DWORD type;
|
||||
DWORD value;
|
||||
DWORD size = sizeof(value);
|
||||
LONG result = RegQueryValueEx(key, name, 0, &type,
|
||||
reinterpret_cast<BYTE *>(&value), &size);
|
||||
LONG result = RegQueryValueEx(
|
||||
key, name, 0, &type, reinterpret_cast<BYTE *>(&value), &size);
|
||||
if (result != ERROR_SUCCESS || type != REG_DWORD) {
|
||||
return 0;
|
||||
}
|
||||
@ -396,13 +398,13 @@ BOOL WINAPI ArchMiscWindows::getParentProcessEntry(PROCESSENTRY32 &entry) {
|
||||
return getProcessEntry(entry, selfEntry.th32ParentProcessID);
|
||||
}
|
||||
|
||||
BOOL WINAPI ArchMiscWindows::getProcessEntry(PROCESSENTRY32 &entry,
|
||||
DWORD processID) {
|
||||
BOOL WINAPI
|
||||
ArchMiscWindows::getProcessEntry(PROCESSENTRY32 &entry, DWORD processID) {
|
||||
// first we need to take a snapshot of the running processes
|
||||
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (snapshot == INVALID_HANDLE_VALUE) {
|
||||
LOG((CLOG_ERR "could not get process snapshot (error: %i)",
|
||||
GetLastError()));
|
||||
LOG((
|
||||
CLOG_ERR "could not get process snapshot (error: %i)", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -412,7 +414,8 @@ BOOL WINAPI ArchMiscWindows::getProcessEntry(PROCESSENTRY32 &entry,
|
||||
// unlikely we can go any further
|
||||
BOOL gotEntry = Process32First(snapshot, &entry);
|
||||
if (!gotEntry) {
|
||||
LOG((CLOG_ERR "could not get first process entry (error: %i)",
|
||||
LOG(
|
||||
(CLOG_ERR "could not get first process entry (error: %i)",
|
||||
GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -114,8 +114,8 @@ public:
|
||||
/*!
|
||||
Sets the \p name value of \p key to \p value.data().
|
||||
*/
|
||||
static void setValueBinary(HKEY key, const TCHAR *name,
|
||||
const std::string &value);
|
||||
static void
|
||||
setValueBinary(HKEY key, const TCHAR *name, const std::string &value);
|
||||
|
||||
//! Read a string value from the registry
|
||||
static std::string readValueString(HKEY, const TCHAR *name);
|
||||
|
||||
@ -59,8 +59,14 @@ public:
|
||||
};
|
||||
|
||||
ArchThreadImpl::ArchThreadImpl()
|
||||
: m_refCount(1), m_thread(NULL), m_id(0), m_func(NULL), m_userData(NULL),
|
||||
m_cancelling(false), m_result(NULL), m_networkData(NULL) {
|
||||
: m_refCount(1),
|
||||
m_thread(NULL),
|
||||
m_id(0),
|
||||
m_func(NULL),
|
||||
m_userData(NULL),
|
||||
m_cancelling(false),
|
||||
m_result(NULL),
|
||||
m_networkData(NULL) {
|
||||
m_exit = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
m_cancel = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
@ -177,8 +183,8 @@ void ArchMultithreadWindows::broadcastCondVar(ArchCond cond) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ArchMultithreadWindows::waitCondVar(ArchCond cond, ArchMutex mutex,
|
||||
double timeout) {
|
||||
bool ArchMultithreadWindows::waitCondVar(
|
||||
ArchCond cond, ArchMutex mutex, double timeout) {
|
||||
// prepare to wait
|
||||
const DWORD winTimeout =
|
||||
(timeout < 0.0) ? INFINITE : static_cast<DWORD>(1000.0 * timeout);
|
||||
@ -451,8 +457,8 @@ bool ArchMultithreadWindows::wait(ArchThread target, double timeout) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ArchMultithreadWindows::isSameThread(ArchThread thread1,
|
||||
ArchThread thread2) {
|
||||
bool ArchMultithreadWindows::isSameThread(
|
||||
ArchThread thread1, ArchThread thread2) {
|
||||
return (thread1 == thread2);
|
||||
}
|
||||
|
||||
@ -473,8 +479,8 @@ ArchMultithreadWindows::getIDOfThread(ArchThread thread) {
|
||||
return static_cast<ThreadID>(thread->m_id);
|
||||
}
|
||||
|
||||
void ArchMultithreadWindows::setSignalHandler(ESignal signal, SignalFunc func,
|
||||
void *userData) {
|
||||
void ArchMultithreadWindows::setSignalHandler(
|
||||
ESignal signal, SignalFunc func, void *userData) {
|
||||
lockMutex(m_threadMutex);
|
||||
m_signalFunc[signal] = func;
|
||||
m_signalUserData[signal] = userData;
|
||||
|
||||
@ -31,34 +31,32 @@ static const int s_family[] = {
|
||||
};
|
||||
static const int s_type[] = {SOCK_DGRAM, SOCK_STREAM};
|
||||
|
||||
static SOCKET(PASCAL FAR *accept_winsock)(SOCKET s, struct sockaddr FAR *addr,
|
||||
int FAR *addrlen);
|
||||
static int(PASCAL FAR *bind_winsock)(SOCKET s, const struct sockaddr FAR *addr,
|
||||
int namelen);
|
||||
static SOCKET(PASCAL FAR *accept_winsock)(
|
||||
SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen);
|
||||
static int(PASCAL FAR *bind_winsock)(
|
||||
SOCKET s, const struct sockaddr FAR *addr, int namelen);
|
||||
static int(PASCAL FAR *close_winsock)(SOCKET s);
|
||||
static int(PASCAL FAR *connect_winsock)(SOCKET s,
|
||||
const struct sockaddr FAR *name,
|
||||
int namelen);
|
||||
static int(PASCAL FAR *connect_winsock)(
|
||||
SOCKET s, const struct sockaddr FAR *name, int namelen);
|
||||
static int(PASCAL FAR *gethostname_winsock)(char FAR *name, int namelen);
|
||||
static int(PASCAL FAR *getsockerror_winsock)(void);
|
||||
static int(PASCAL FAR *getsockopt_winsock)(SOCKET s, int level, int optname,
|
||||
void FAR *optval, int FAR *optlen);
|
||||
static int(PASCAL FAR *getsockopt_winsock)(
|
||||
SOCKET s, int level, int optname, void FAR *optval, int FAR *optlen);
|
||||
static u_short(PASCAL FAR *htons_winsock)(u_short v);
|
||||
static char FAR *(PASCAL FAR *inet_ntoa_winsock)(struct in_addr in);
|
||||
static unsigned long(PASCAL FAR *inet_addr_winsock)(const char FAR *cp);
|
||||
static int(PASCAL FAR *ioctl_winsock)(SOCKET s, int cmd, void FAR *data);
|
||||
static int(PASCAL FAR *listen_winsock)(SOCKET s, int backlog);
|
||||
static u_short(PASCAL FAR *ntohs_winsock)(u_short v);
|
||||
static int(PASCAL FAR *recv_winsock)(SOCKET s, void FAR *buf, int len,
|
||||
int flags);
|
||||
static int(PASCAL FAR *select_winsock)(int nfds, fd_set FAR *readfds,
|
||||
fd_set FAR *writefds,
|
||||
fd_set FAR *exceptfds,
|
||||
const struct timeval FAR *timeout);
|
||||
static int(PASCAL FAR *send_winsock)(SOCKET s, const void FAR *buf, int len,
|
||||
int flags);
|
||||
static int(PASCAL FAR *setsockopt_winsock)(SOCKET s, int level, int optname,
|
||||
const void FAR *optval, int optlen);
|
||||
static int(PASCAL FAR *recv_winsock)(
|
||||
SOCKET s, void FAR *buf, int len, int flags);
|
||||
static int(PASCAL FAR *select_winsock)(
|
||||
int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds,
|
||||
const struct timeval FAR *timeout);
|
||||
static int(PASCAL FAR *send_winsock)(
|
||||
SOCKET s, const void FAR *buf, int len, int flags);
|
||||
static int(PASCAL FAR *setsockopt_winsock)(
|
||||
SOCKET s, int level, int optname, const void FAR *optval, int optlen);
|
||||
static int(PASCAL FAR *shutdown_winsock)(SOCKET s, int how);
|
||||
static SOCKET(PASCAL FAR *socket_winsock)(int af, int type, int protocol);
|
||||
static struct hostent FAR *(PASCAL FAR *gethostbyaddr_winsock)(
|
||||
@ -72,11 +70,10 @@ static BOOL(PASCAL FAR *WSACloseEvent_winsock)(WSAEVENT);
|
||||
static BOOL(PASCAL FAR *WSASetEvent_winsock)(WSAEVENT);
|
||||
static BOOL(PASCAL FAR *WSAResetEvent_winsock)(WSAEVENT);
|
||||
static int(PASCAL FAR *WSAEventSelect_winsock)(SOCKET, WSAEVENT, long);
|
||||
static DWORD(PASCAL FAR *WSAWaitForMultipleEvents_winsock)(DWORD,
|
||||
const WSAEVENT FAR *,
|
||||
BOOL, DWORD, BOOL);
|
||||
static int(PASCAL FAR *WSAEnumNetworkEvents_winsock)(SOCKET, WSAEVENT,
|
||||
LPWSANETWORKEVENTS);
|
||||
static DWORD(PASCAL FAR *WSAWaitForMultipleEvents_winsock)(
|
||||
DWORD, const WSAEVENT FAR *, BOOL, DWORD, BOOL);
|
||||
static int(PASCAL FAR *WSAEnumNetworkEvents_winsock)(
|
||||
SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
|
||||
|
||||
#undef FD_ISSET
|
||||
#define FD_ISSET(fd, set) WSAFDIsSet_winsock((SOCKET)(fd), (fd_set FAR *)(set))
|
||||
@ -167,69 +164,89 @@ void ArchNetworkWinsock::initModule(HMODULE module) {
|
||||
}
|
||||
|
||||
// get function addresses
|
||||
setfunc(accept_winsock, accept,
|
||||
SOCKET(PASCAL FAR *)(SOCKET s, struct sockaddr FAR * addr,
|
||||
int FAR *addrlen));
|
||||
setfunc(bind_winsock, bind,
|
||||
int(PASCAL FAR *)(SOCKET s, const struct sockaddr FAR *addr,
|
||||
int namelen));
|
||||
setfunc(
|
||||
accept_winsock, accept,
|
||||
SOCKET(PASCAL FAR *)(
|
||||
SOCKET s, struct sockaddr FAR * addr, int FAR *addrlen));
|
||||
setfunc(
|
||||
bind_winsock, bind,
|
||||
int(PASCAL FAR *)(
|
||||
SOCKET s, const struct sockaddr FAR *addr, int namelen));
|
||||
setfunc(close_winsock, closesocket, int(PASCAL FAR *)(SOCKET s));
|
||||
setfunc(connect_winsock, connect,
|
||||
int(PASCAL FAR *)(SOCKET s, const struct sockaddr FAR *name,
|
||||
int namelen));
|
||||
setfunc(gethostname_winsock, gethostname,
|
||||
int(PASCAL FAR *)(char FAR *name, int namelen));
|
||||
setfunc(
|
||||
connect_winsock, connect,
|
||||
int(PASCAL FAR *)(
|
||||
SOCKET s, const struct sockaddr FAR *name, int namelen));
|
||||
setfunc(
|
||||
gethostname_winsock, gethostname,
|
||||
int(PASCAL FAR *)(char FAR *name, int namelen));
|
||||
setfunc(getsockerror_winsock, WSAGetLastError, int(PASCAL FAR *)(void));
|
||||
setfunc(getsockopt_winsock, getsockopt,
|
||||
int(PASCAL FAR *)(SOCKET s, int level, int optname, void FAR *optval,
|
||||
int FAR *optlen));
|
||||
setfunc(
|
||||
getsockopt_winsock, getsockopt,
|
||||
int(PASCAL FAR *)(
|
||||
SOCKET s, int level, int optname, void FAR *optval, int FAR *optlen));
|
||||
setfunc(htons_winsock, htons, u_short(PASCAL FAR *)(u_short v));
|
||||
setfunc(inet_ntoa_winsock, inet_ntoa,
|
||||
char FAR *(PASCAL FAR *)(struct in_addr in));
|
||||
setfunc(inet_addr_winsock, inet_addr,
|
||||
unsigned long(PASCAL FAR *)(const char FAR *cp));
|
||||
setfunc(ioctl_winsock, ioctlsocket,
|
||||
int(PASCAL FAR *)(SOCKET s, int cmd, void FAR *));
|
||||
setfunc(
|
||||
inet_ntoa_winsock, inet_ntoa,
|
||||
char FAR *(PASCAL FAR *)(struct in_addr in));
|
||||
setfunc(
|
||||
inet_addr_winsock, inet_addr,
|
||||
unsigned long(PASCAL FAR *)(const char FAR *cp));
|
||||
setfunc(
|
||||
ioctl_winsock, ioctlsocket,
|
||||
int(PASCAL FAR *)(SOCKET s, int cmd, void FAR *));
|
||||
setfunc(listen_winsock, listen, int(PASCAL FAR *)(SOCKET s, int backlog));
|
||||
setfunc(ntohs_winsock, ntohs, u_short(PASCAL FAR *)(u_short v));
|
||||
setfunc(recv_winsock, recv,
|
||||
int(PASCAL FAR *)(SOCKET s, void FAR *buf, int len, int flags));
|
||||
setfunc(select_winsock, select,
|
||||
int(PASCAL FAR *)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds,
|
||||
fd_set FAR *exceptfds,
|
||||
const struct timeval FAR *timeout));
|
||||
setfunc(send_winsock, send,
|
||||
int(PASCAL FAR *)(SOCKET s, const void FAR *buf, int len, int flags));
|
||||
setfunc(setsockopt_winsock, setsockopt,
|
||||
int(PASCAL FAR *)(SOCKET s, int level, int optname,
|
||||
const void FAR *optval, int optlen));
|
||||
setfunc(
|
||||
recv_winsock, recv,
|
||||
int(PASCAL FAR *)(SOCKET s, void FAR *buf, int len, int flags));
|
||||
setfunc(
|
||||
select_winsock, select,
|
||||
int(PASCAL FAR *)(
|
||||
int nfds, fd_set FAR *readfds, fd_set FAR *writefds,
|
||||
fd_set FAR *exceptfds, const struct timeval FAR *timeout));
|
||||
setfunc(
|
||||
send_winsock, send,
|
||||
int(PASCAL FAR *)(SOCKET s, const void FAR *buf, int len, int flags));
|
||||
setfunc(
|
||||
setsockopt_winsock, setsockopt,
|
||||
int(PASCAL FAR *)(
|
||||
SOCKET s, int level, int optname, const void FAR *optval,
|
||||
int optlen));
|
||||
setfunc(shutdown_winsock, shutdown, int(PASCAL FAR *)(SOCKET s, int how));
|
||||
setfunc(socket_winsock, socket,
|
||||
SOCKET(PASCAL FAR *)(int af, int type, int protocol));
|
||||
setfunc(gethostbyaddr_winsock, gethostbyaddr,
|
||||
struct hostent FAR *
|
||||
(PASCAL FAR *)(const char FAR *addr, int len, int type));
|
||||
setfunc(gethostbyname_winsock, gethostbyname,
|
||||
struct hostent FAR * (PASCAL FAR *)(const char FAR *name));
|
||||
setfunc(
|
||||
socket_winsock, socket,
|
||||
SOCKET(PASCAL FAR *)(int af, int type, int protocol));
|
||||
setfunc(
|
||||
gethostbyaddr_winsock, gethostbyaddr,
|
||||
struct hostent FAR *
|
||||
(PASCAL FAR *)(const char FAR *addr, int len, int type));
|
||||
setfunc(
|
||||
gethostbyname_winsock, gethostbyname,
|
||||
struct hostent FAR * (PASCAL FAR *)(const char FAR *name));
|
||||
setfunc(WSACleanup_winsock, WSACleanup, int(PASCAL FAR *)(void));
|
||||
setfunc(WSAFDIsSet_winsock, __WSAFDIsSet,
|
||||
int(PASCAL FAR *)(SOCKET, fd_set FAR *));
|
||||
setfunc(
|
||||
WSAFDIsSet_winsock, __WSAFDIsSet,
|
||||
int(PASCAL FAR *)(SOCKET, fd_set FAR *));
|
||||
setfunc(WSACreateEvent_winsock, WSACreateEvent, WSAEVENT(PASCAL FAR *)(void));
|
||||
setfunc(WSACloseEvent_winsock, WSACloseEvent, BOOL(PASCAL FAR *)(WSAEVENT));
|
||||
setfunc(WSASetEvent_winsock, WSASetEvent, BOOL(PASCAL FAR *)(WSAEVENT));
|
||||
setfunc(WSAResetEvent_winsock, WSAResetEvent, BOOL(PASCAL FAR *)(WSAEVENT));
|
||||
setfunc(WSAEventSelect_winsock, WSAEventSelect,
|
||||
int(PASCAL FAR *)(SOCKET, WSAEVENT, long));
|
||||
setfunc(WSAWaitForMultipleEvents_winsock, WSAWaitForMultipleEvents,
|
||||
DWORD(PASCAL FAR *)(DWORD, const WSAEVENT FAR *, BOOL, DWORD, BOOL));
|
||||
setfunc(WSAEnumNetworkEvents_winsock, WSAEnumNetworkEvents,
|
||||
int(PASCAL FAR *)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS));
|
||||
setfunc(
|
||||
WSAEventSelect_winsock, WSAEventSelect,
|
||||
int(PASCAL FAR *)(SOCKET, WSAEVENT, long));
|
||||
setfunc(
|
||||
WSAWaitForMultipleEvents_winsock, WSAWaitForMultipleEvents,
|
||||
DWORD(PASCAL FAR *)(DWORD, const WSAEVENT FAR *, BOOL, DWORD, BOOL));
|
||||
setfunc(
|
||||
WSAEnumNetworkEvents_winsock, WSAEnumNetworkEvents,
|
||||
int(PASCAL FAR *)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS));
|
||||
|
||||
s_networkModule = module;
|
||||
}
|
||||
|
||||
ArchSocket ArchNetworkWinsock::newSocket(EAddressFamily family,
|
||||
ESocketType type) {
|
||||
ArchSocket
|
||||
ArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type) {
|
||||
// create socket
|
||||
SOCKET fd = socket_winsock(s_family[family], s_type[type], 0);
|
||||
if (fd == INVALID_SOCKET) {
|
||||
@ -314,8 +331,9 @@ void ArchNetworkWinsock::bindSocket(ArchSocket s, ArchNetAddress addr) {
|
||||
assert(s != NULL);
|
||||
assert(addr != NULL);
|
||||
|
||||
if (bind_winsock(s->m_socket, TYPED_ADDR(struct sockaddr, addr),
|
||||
addr->m_len) == SOCKET_ERROR) {
|
||||
if (bind_winsock(
|
||||
s->m_socket, TYPED_ADDR(struct sockaddr, addr), addr->m_len) ==
|
||||
SOCKET_ERROR) {
|
||||
throwError(getsockerror_winsock());
|
||||
}
|
||||
}
|
||||
@ -329,8 +347,8 @@ void ArchNetworkWinsock::listenOnSocket(ArchSocket s) {
|
||||
}
|
||||
}
|
||||
|
||||
ArchSocket ArchNetworkWinsock::acceptSocket(ArchSocket s,
|
||||
ArchNetAddress *const addr) {
|
||||
ArchSocket
|
||||
ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress *const addr) {
|
||||
assert(s != NULL);
|
||||
|
||||
// create new socket and temporary address
|
||||
@ -338,8 +356,8 @@ ArchSocket ArchNetworkWinsock::acceptSocket(ArchSocket s,
|
||||
ArchNetAddress tmp = ArchNetAddressImpl::alloc(sizeof(struct sockaddr_in6));
|
||||
|
||||
// accept on socket
|
||||
SOCKET fd = accept_winsock(s->m_socket, TYPED_ADDR(struct sockaddr, tmp),
|
||||
&tmp->m_len);
|
||||
SOCKET fd = accept_winsock(
|
||||
s->m_socket, TYPED_ADDR(struct sockaddr, tmp), &tmp->m_len);
|
||||
if (fd == INVALID_SOCKET) {
|
||||
int err = getsockerror_winsock();
|
||||
delete socket;
|
||||
@ -384,8 +402,9 @@ bool ArchNetworkWinsock::connectSocket(ArchSocket s, ArchNetAddress addr) {
|
||||
assert(s != NULL);
|
||||
assert(addr != NULL);
|
||||
|
||||
if (connect_winsock(s->m_socket, TYPED_ADDR(struct sockaddr, addr),
|
||||
addr->m_len) == SOCKET_ERROR) {
|
||||
if (connect_winsock(
|
||||
s->m_socket, TYPED_ADDR(struct sockaddr, addr), addr->m_len) ==
|
||||
SOCKET_ERROR) {
|
||||
if (getsockerror_winsock() == WSAEISCONN) {
|
||||
return true;
|
||||
}
|
||||
@ -437,8 +456,8 @@ int ArchNetworkWinsock::pollSocket(PollEntry pe[], int num, double timeout) {
|
||||
}
|
||||
|
||||
// select socket for desired events
|
||||
WSAEventSelect_winsock(pe[i].m_socket->m_socket, pe[i].m_socket->m_event,
|
||||
socketEvents);
|
||||
WSAEventSelect_winsock(
|
||||
pe[i].m_socket->m_socket, pe[i].m_socket->m_event, socketEvents);
|
||||
|
||||
// add socket event to wait list
|
||||
events[n++] = pe[i].m_socket->m_event;
|
||||
@ -500,9 +519,9 @@ int ArchNetworkWinsock::pollSocket(PollEntry pe[], int num, double timeout) {
|
||||
|
||||
// get events
|
||||
WSANETWORKEVENTS info;
|
||||
if (WSAEnumNetworkEvents_winsock(pe[i].m_socket->m_socket,
|
||||
pe[i].m_socket->m_event,
|
||||
&info) == SOCKET_ERROR) {
|
||||
if (WSAEnumNetworkEvents_winsock(
|
||||
pe[i].m_socket->m_socket, pe[i].m_socket->m_event, &info) ==
|
||||
SOCKET_ERROR) {
|
||||
continue;
|
||||
}
|
||||
if ((info.lNetworkEvents & FD_READ) != 0) {
|
||||
@ -569,8 +588,8 @@ size_t ArchNetworkWinsock::readSocket(ArchSocket s, void *buf, size_t len) {
|
||||
return static_cast<size_t>(n);
|
||||
}
|
||||
|
||||
size_t ArchNetworkWinsock::writeSocket(ArchSocket s, const void *buf,
|
||||
size_t len) {
|
||||
size_t
|
||||
ArchNetworkWinsock::writeSocket(ArchSocket s, const void *buf, size_t len) {
|
||||
assert(s != NULL);
|
||||
|
||||
int n = send_winsock(s->m_socket, buf, (int)len, 0);
|
||||
@ -620,8 +639,9 @@ bool ArchNetworkWinsock::setNoDelayOnSocket(ArchSocket s, bool noDelay) {
|
||||
// get old state
|
||||
BOOL oflag;
|
||||
int size = sizeof(oflag);
|
||||
if (getsockopt_winsock(s->m_socket, IPPROTO_TCP, TCP_NODELAY, &oflag,
|
||||
&size) == SOCKET_ERROR) {
|
||||
if (getsockopt_winsock(
|
||||
s->m_socket, IPPROTO_TCP, TCP_NODELAY, &oflag, &size) ==
|
||||
SOCKET_ERROR) {
|
||||
throwError(getsockerror_winsock());
|
||||
}
|
||||
|
||||
@ -642,8 +662,9 @@ bool ArchNetworkWinsock::setReuseAddrOnSocket(ArchSocket s, bool reuse) {
|
||||
// get old state
|
||||
BOOL oflag;
|
||||
int size = sizeof(oflag);
|
||||
if (getsockopt_winsock(s->m_socket, SOL_SOCKET, SO_REUSEADDR, &oflag,
|
||||
&size) == SOCKET_ERROR) {
|
||||
if (getsockopt_winsock(
|
||||
s->m_socket, SOL_SOCKET, SO_REUSEADDR, &oflag, &size) ==
|
||||
SOCKET_ERROR) {
|
||||
throwError(getsockerror_winsock());
|
||||
}
|
||||
|
||||
@ -728,8 +749,8 @@ ArchNetworkWinsock::nameToAddr(const std::string &name) {
|
||||
addresses.back()->m_len = (socklen_t)sizeof(struct sockaddr_in6);
|
||||
}
|
||||
|
||||
memcpy(&addresses.back()->m_addr, address->ai_addr,
|
||||
addresses.back()->m_len);
|
||||
memcpy(
|
||||
&addresses.back()->m_addr, address->ai_addr, addresses.back()->m_len);
|
||||
}
|
||||
|
||||
freeaddrinfo(pResult);
|
||||
@ -748,8 +769,9 @@ std::string ArchNetworkWinsock::addrToName(ArchNetAddress addr) {
|
||||
|
||||
char host[1024];
|
||||
char service[20];
|
||||
int ret = getnameinfo(TYPED_ADDR(struct sockaddr, addr), addr->m_len, host,
|
||||
sizeof(host), service, sizeof(service), 0);
|
||||
int ret = getnameinfo(
|
||||
TYPED_ADDR(struct sockaddr, addr), addr->m_len, host, sizeof(host),
|
||||
service, sizeof(service), 0);
|
||||
|
||||
if (ret != NULL) {
|
||||
throwNameError(ret);
|
||||
@ -846,14 +868,16 @@ bool ArchNetworkWinsock::isAnyAddr(ArchNetAddress addr) {
|
||||
switch (getAddrFamily(addr)) {
|
||||
case kINET: {
|
||||
struct sockaddr_in *ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
|
||||
return (addr->m_len == sizeof(struct sockaddr_in) &&
|
||||
ipAddr->sin_addr.s_addr == INADDR_ANY);
|
||||
return (
|
||||
addr->m_len == sizeof(struct sockaddr_in) &&
|
||||
ipAddr->sin_addr.s_addr == INADDR_ANY);
|
||||
}
|
||||
|
||||
case kINET6: {
|
||||
struct sockaddr_in6 *ipAddr = TYPED_ADDR(struct sockaddr_in6, addr);
|
||||
return (addr->m_len == sizeof(struct sockaddr_in) &&
|
||||
memcmp(&ipAddr->sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0);
|
||||
return (
|
||||
addr->m_len == sizeof(struct sockaddr_in) &&
|
||||
memcmp(&ipAddr->sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0);
|
||||
}
|
||||
|
||||
default:
|
||||
@ -863,8 +887,9 @@ bool ArchNetworkWinsock::isAnyAddr(ArchNetAddress addr) {
|
||||
}
|
||||
|
||||
bool ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b) {
|
||||
return (a == b || (a->m_len == b->m_len &&
|
||||
memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0));
|
||||
return (
|
||||
a == b ||
|
||||
(a->m_len == b->m_len && memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0));
|
||||
}
|
||||
|
||||
void ArchNetworkWinsock::throwError(int err) {
|
||||
|
||||
@ -85,8 +85,8 @@ std::string ArchSystemWindows::setting(const std::string &valueName) const {
|
||||
return ArchMiscWindows::readValueString(key, valueName.c_str());
|
||||
}
|
||||
|
||||
void ArchSystemWindows::setting(const std::string &valueName,
|
||||
const std::string &valueString) const {
|
||||
void ArchSystemWindows::setting(
|
||||
const std::string &valueName, const std::string &valueString) const {
|
||||
HKEY key = ArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_settingsKeyNames);
|
||||
if (key == NULL)
|
||||
throw XArch(std::string("could not access registry key: ") + valueName);
|
||||
|
||||
@ -32,8 +32,8 @@ public:
|
||||
virtual std::string getOSName() const;
|
||||
virtual std::string getPlatformName() const;
|
||||
virtual std::string setting(const std::string &valueName) const;
|
||||
virtual void setting(const std::string &valueName,
|
||||
const std::string &valueString) const;
|
||||
virtual void
|
||||
setting(const std::string &valueName, const std::string &valueString) const;
|
||||
|
||||
bool isWOW64() const;
|
||||
};
|
||||
|
||||
@ -39,8 +39,13 @@ static const UINT kFirstReceiverID = WM_USER + 14;
|
||||
ArchTaskBarWindows *ArchTaskBarWindows::s_instance = NULL;
|
||||
|
||||
ArchTaskBarWindows::ArchTaskBarWindows()
|
||||
: m_mutex(NULL), m_condVar(NULL), m_ready(false), m_result(0),
|
||||
m_thread(NULL), m_hwnd(NULL), m_taskBarRestart(0),
|
||||
: m_mutex(NULL),
|
||||
m_condVar(NULL),
|
||||
m_ready(false),
|
||||
m_result(0),
|
||||
m_thread(NULL),
|
||||
m_hwnd(NULL),
|
||||
m_taskBarRestart(0),
|
||||
m_nextID(kFirstReceiverID) {
|
||||
// save the singleton instance
|
||||
s_instance = this;
|
||||
@ -256,8 +261,8 @@ void ArchTaskBarWindows::removeIconNoLock(UINT id) {
|
||||
}
|
||||
}
|
||||
|
||||
void ArchTaskBarWindows::handleIconMessage(IArchTaskBarReceiver *receiver,
|
||||
LPARAM lParam) {
|
||||
void ArchTaskBarWindows::handleIconMessage(
|
||||
IArchTaskBarReceiver *receiver, LPARAM lParam) {
|
||||
// process message
|
||||
switch (lParam) {
|
||||
case WM_LBUTTONDOWN:
|
||||
@ -375,9 +380,8 @@ ArchTaskBarWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
LRESULT CALLBACK ArchTaskBarWindows::staticWndProc(
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
// if msg is WM_NCCREATE, extract the ArchTaskBarWindows* and put
|
||||
// it in the extra window data then forward the call.
|
||||
ArchTaskBarWindows *self = NULL;
|
||||
@ -385,8 +389,8 @@ LRESULT CALLBACK ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
|
||||
CREATESTRUCT *createInfo;
|
||||
createInfo = reinterpret_cast<CREATESTRUCT *>(lParam);
|
||||
self = static_cast<ArchTaskBarWindows *>(createInfo->lpCreateParams);
|
||||
SetWindowLongPtr(hwnd, 0,
|
||||
reinterpret_cast<LONG_PTR>(createInfo->lpCreateParams));
|
||||
SetWindowLongPtr(
|
||||
hwnd, 0, reinterpret_cast<LONG_PTR>(createInfo->lpCreateParams));
|
||||
} else {
|
||||
// get the extra window data and forward the call
|
||||
LONG_PTR data = GetWindowLongPtr(hwnd, 0);
|
||||
@ -425,9 +429,9 @@ void ArchTaskBarWindows::threadMainLoop() {
|
||||
ATOM windowClass = RegisterClassEx(&classInfo);
|
||||
|
||||
// create window
|
||||
m_hwnd = CreateWindowEx(WS_EX_TOOLWINDOW, className, TEXT("Synergy Task Bar"),
|
||||
WS_POPUP, 0, 0, 1, 1, NULL, NULL, instanceWin32(),
|
||||
static_cast<void *>(this));
|
||||
m_hwnd = CreateWindowEx(
|
||||
WS_EX_TOOLWINDOW, className, TEXT("Synergy Task Bar"), WS_POPUP, 0, 0, 1,
|
||||
1, NULL, NULL, instanceWin32(), static_cast<void *>(this));
|
||||
|
||||
// signal ready
|
||||
ARCH->lockMutex(m_mutex);
|
||||
|
||||
@ -74,8 +74,8 @@ private:
|
||||
void updateIcon(UINT);
|
||||
void addAllIcons();
|
||||
void removeAllIcons();
|
||||
void modifyIconNoLock(ReceiverToInfoMap::const_iterator,
|
||||
DWORD taskBarMessage);
|
||||
void
|
||||
modifyIconNoLock(ReceiverToInfoMap::const_iterator, DWORD taskBarMessage);
|
||||
void removeIconNoLock(UINT id);
|
||||
void handleIconMessage(IArchTaskBarReceiver *, LPARAM);
|
||||
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
|
||||
std::string XArchEvalWindows::eval() const throw() {
|
||||
char *cmsg;
|
||||
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, m_error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&cmsg, 0, NULL) == 0) {
|
||||
if (FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, m_error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&cmsg,
|
||||
0, NULL) == 0) {
|
||||
cmsg = NULL;
|
||||
return synergy::string::sprintf("Unknown error, code %d", m_error);
|
||||
}
|
||||
|
||||
@ -24,19 +24,28 @@
|
||||
//
|
||||
|
||||
Event::Event()
|
||||
: m_type(kUnknown), m_target(NULL), m_data(NULL), m_flags(0),
|
||||
: m_type(kUnknown),
|
||||
m_target(NULL),
|
||||
m_data(NULL),
|
||||
m_flags(0),
|
||||
m_dataObject(nullptr) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
Event::Event(Type type, void *target, void *data, Flags flags)
|
||||
: m_type(type), m_target(target), m_data(data), m_flags(flags),
|
||||
: m_type(type),
|
||||
m_target(target),
|
||||
m_data(data),
|
||||
m_flags(flags),
|
||||
m_dataObject(nullptr) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
Event::Event(Type type, void *target, EventData *dataObject)
|
||||
: m_type(type), m_target(target), m_data(nullptr), m_flags(kNone),
|
||||
: m_type(type),
|
||||
m_target(target),
|
||||
m_data(nullptr),
|
||||
m_flags(kNone),
|
||||
m_dataObject(dataObject) {}
|
||||
|
||||
Event::Type Event::getType() const { return m_type; }
|
||||
|
||||
@ -60,16 +60,28 @@ static void interrupt(Arch::ESignal, void *data) {
|
||||
//
|
||||
|
||||
EventQueue::EventQueue()
|
||||
: m_systemTarget(0), m_nextType(Event::kLast), m_typesForClient(NULL),
|
||||
m_typesForIStream(NULL), m_typesForIpcClient(NULL),
|
||||
m_typesForIpcClientProxy(NULL), m_typesForIpcServer(NULL),
|
||||
m_typesForIpcServerProxy(NULL), m_typesForIDataSocket(NULL),
|
||||
m_typesForIListenSocket(NULL), m_typesForISocket(NULL),
|
||||
m_typesForOSXScreen(NULL), m_typesForClientListener(NULL),
|
||||
m_typesForClientProxy(NULL), m_typesForClientProxyUnknown(NULL),
|
||||
m_typesForServer(NULL), m_typesForServerApp(NULL),
|
||||
m_typesForIKeyState(NULL), m_typesForIPrimaryScreen(NULL),
|
||||
m_typesForIScreen(NULL), m_typesForClipboard(NULL), m_typesForFile(NULL),
|
||||
: m_systemTarget(0),
|
||||
m_nextType(Event::kLast),
|
||||
m_typesForClient(NULL),
|
||||
m_typesForIStream(NULL),
|
||||
m_typesForIpcClient(NULL),
|
||||
m_typesForIpcClientProxy(NULL),
|
||||
m_typesForIpcServer(NULL),
|
||||
m_typesForIpcServerProxy(NULL),
|
||||
m_typesForIDataSocket(NULL),
|
||||
m_typesForIListenSocket(NULL),
|
||||
m_typesForISocket(NULL),
|
||||
m_typesForOSXScreen(NULL),
|
||||
m_typesForClientListener(NULL),
|
||||
m_typesForClientProxy(NULL),
|
||||
m_typesForClientProxyUnknown(NULL),
|
||||
m_typesForServer(NULL),
|
||||
m_typesForServerApp(NULL),
|
||||
m_typesForIKeyState(NULL),
|
||||
m_typesForIPrimaryScreen(NULL),
|
||||
m_typesForIScreen(NULL),
|
||||
m_typesForClipboard(NULL),
|
||||
m_typesForFile(NULL),
|
||||
m_readyMutex(new Mutex),
|
||||
m_readyCondVar(new CondVar<bool>(m_readyMutex, false)) {
|
||||
m_mutex = ARCH->newMutex();
|
||||
@ -328,8 +340,8 @@ void EventQueue::deleteTimer(EventQueueTimer *timer) {
|
||||
m_buffer->deleteTimer(timer);
|
||||
}
|
||||
|
||||
void EventQueue::adoptHandler(Event::Type type, void *target,
|
||||
IEventJob *handler) {
|
||||
void EventQueue::adoptHandler(
|
||||
Event::Type type, void *target, IEventJob *handler) {
|
||||
ArchMutexLock lock(m_mutex);
|
||||
IEventJob *&job = m_handlers[target][type];
|
||||
delete job;
|
||||
@ -508,9 +520,13 @@ void EventQueue::waitForReady() const {
|
||||
// EventQueue::Timer
|
||||
//
|
||||
|
||||
EventQueue::Timer::Timer(EventQueueTimer *timer, double timeout,
|
||||
double initialTime, void *target, bool oneShot)
|
||||
: m_timer(timer), m_timeout(timeout), m_target(target), m_oneShot(oneShot),
|
||||
EventQueue::Timer::Timer(
|
||||
EventQueueTimer *timer, double timeout, double initialTime, void *target,
|
||||
bool oneShot)
|
||||
: m_timer(timer),
|
||||
m_timeout(timeout),
|
||||
m_target(target),
|
||||
m_oneShot(oneShot),
|
||||
m_time(initialTime) {
|
||||
assert(m_timeout > 0.0);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user