#6301 Disable activation for Enterprise builds
This commit is contained in:
parent
4e59954d94
commit
b396b1092d
|
@ -20,6 +20,7 @@ project (synergy C CXX)
|
||||||
option (SYNERGY_BUILD_LEGACY_GUI "Build the legacy GUI" ON)
|
option (SYNERGY_BUILD_LEGACY_GUI "Build the legacy GUI" ON)
|
||||||
option (SYNERGY_BUILD_LEGACY_SERVICE "Build the legacy service (synergyd)" ON)
|
option (SYNERGY_BUILD_LEGACY_SERVICE "Build the legacy service (synergyd)" ON)
|
||||||
option (SYNERGY_BUILD_LEGACY_INSTALLER "Build the legacy installer" ON)
|
option (SYNERGY_BUILD_LEGACY_INSTALLER "Build the legacy installer" ON)
|
||||||
|
option (SYNERGY_ENTERPRISE "Build Enterprise" OFF)
|
||||||
|
|
||||||
set (CMAKE_CXX_STANDARD 14)
|
set (CMAKE_CXX_STANDARD 14)
|
||||||
set (CMAKE_CXX_EXTENSIONS OFF)
|
set (CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
|
@ -15,7 +15,7 @@ if (NOT DEFINED SYNERGY_VERSION_MINOR)
|
||||||
if (DEFINED ENV{SYNERGY_VERSION_MINOR})
|
if (DEFINED ENV{SYNERGY_VERSION_MINOR})
|
||||||
set (SYNERGY_VERSION_MINOR $ENV{SYNERGY_VERSION_MINOR})
|
set (SYNERGY_VERSION_MINOR $ENV{SYNERGY_VERSION_MINOR})
|
||||||
else()
|
else()
|
||||||
set (SYNERGY_VERSION_MINOR 9)
|
set (SYNERGY_VERSION_MINOR 10)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -88,3 +88,6 @@ if (SYNERGY_DEVELOPER_MODE)
|
||||||
add_definitions (-DSYNERGY_DEVELOPER_MODE=1)
|
add_definitions (-DSYNERGY_DEVELOPER_MODE=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (SYNERGY_ENTERPRISE)
|
||||||
|
add_definitions (-DSYNERGY_ENTERPRISE=1)
|
||||||
|
endif()
|
||||||
|
|
|
@ -8,6 +8,12 @@ set (CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
file (GLOB LEGACY_GUI_SOURCE_FILES src/*.cpp src/*.h)
|
file (GLOB LEGACY_GUI_SOURCE_FILES src/*.cpp src/*.h)
|
||||||
file (GLOB LEGACY_GUI_UI_FILES src/*.ui)
|
file (GLOB LEGACY_GUI_UI_FILES src/*.ui)
|
||||||
|
file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*)
|
||||||
|
|
||||||
|
if (SYNERGY_ENTERPRISE)
|
||||||
|
list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ACTIVATION_FILES})
|
||||||
|
list (REMOVE_ITEM LEGACY_GUI_UI_FILES ${LEGACY_ACTIVATION_FILES})
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set (LEGACY_GUI_RC_FILES res/win/Synergy.rc)
|
set (LEGACY_GUI_RC_FILES res/win/Synergy.rc)
|
||||||
|
|
|
@ -86,8 +86,8 @@ const QString &AppConfig::logFilename() const { return m_LogFilename; }
|
||||||
|
|
||||||
QString AppConfig::synergyLogDir() const
|
QString AppConfig::synergyLogDir() const
|
||||||
{
|
{
|
||||||
// by default log to home dir
|
// by default log to home dir
|
||||||
return QDir::home().absolutePath() + "/";
|
return QDir::home().absolutePath() + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AppConfig::synergyProgramDir() const
|
QString AppConfig::synergyProgramDir() const
|
||||||
|
@ -188,6 +188,7 @@ void AppConfig::saveSettings()
|
||||||
settings().sync();
|
settings().sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
bool AppConfig::activationHasRun() const
|
bool AppConfig::activationHasRun() const
|
||||||
{
|
{
|
||||||
return m_ActivationHasRun;
|
return m_ActivationHasRun;
|
||||||
|
@ -198,6 +199,7 @@ AppConfig& AppConfig::activationHasRun(bool value)
|
||||||
m_ActivationHasRun = value;
|
m_ActivationHasRun = value;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QString AppConfig::lastVersion() const
|
QString AppConfig::lastVersion() const
|
||||||
{
|
{
|
||||||
|
@ -242,6 +244,7 @@ void AppConfig::setAutoConfigPrompted(bool prompted)
|
||||||
m_AutoConfigPrompted = prompted;
|
m_AutoConfigPrompted = prompted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
void AppConfig::setEdition(Edition e) {
|
void AppConfig::setEdition(Edition e) {
|
||||||
m_Edition = e;
|
m_Edition = e;
|
||||||
}
|
}
|
||||||
|
@ -264,6 +267,7 @@ QString AppConfig::serialKey() { return m_Serialkey; }
|
||||||
int AppConfig::lastExpiringWarningTime() const { return m_LastExpiringWarningTime; }
|
int AppConfig::lastExpiringWarningTime() const { return m_LastExpiringWarningTime; }
|
||||||
|
|
||||||
void AppConfig::setLastExpiringWarningTime(int t) { m_LastExpiringWarningTime = t; }
|
void AppConfig::setLastExpiringWarningTime(int t) { m_LastExpiringWarningTime = t; }
|
||||||
|
#endif
|
||||||
|
|
||||||
QString AppConfig::synergysName() const { return m_SynergysName; }
|
QString AppConfig::synergysName() const { return m_SynergysName; }
|
||||||
|
|
||||||
|
@ -280,7 +284,11 @@ void AppConfig::setCryptoEnabled(bool e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppConfig::getCryptoEnabled() const {
|
bool AppConfig::getCryptoEnabled() const {
|
||||||
return (edition() == kPro) && m_CryptoEnabled;
|
return
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
|
(edition() == kPro) &&
|
||||||
|
#endif
|
||||||
|
m_CryptoEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
||||||
|
|
|
@ -79,6 +79,7 @@ class AppConfig: public QObject
|
||||||
void setAutoConfig(bool autoConfig);
|
void setAutoConfig(bool autoConfig);
|
||||||
bool autoConfigPrompted();
|
bool autoConfigPrompted();
|
||||||
void setAutoConfigPrompted(bool prompted);
|
void setAutoConfigPrompted(bool prompted);
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
void setEdition(Edition);
|
void setEdition(Edition);
|
||||||
Edition edition() const;
|
Edition edition() const;
|
||||||
QString setSerialKey(QString serial);
|
QString setSerialKey(QString serial);
|
||||||
|
@ -86,6 +87,7 @@ class AppConfig: public QObject
|
||||||
QString serialKey();
|
QString serialKey();
|
||||||
int lastExpiringWarningTime() const;
|
int lastExpiringWarningTime() const;
|
||||||
void setLastExpiringWarningTime(int t);
|
void setLastExpiringWarningTime(int t);
|
||||||
|
#endif
|
||||||
|
|
||||||
QString synergysName() const;
|
QString synergysName() const;
|
||||||
QString synergycName() const;
|
QString synergycName() const;
|
||||||
|
@ -101,9 +103,10 @@ class AppConfig: public QObject
|
||||||
|
|
||||||
void setAutoHide(bool b);
|
void setAutoHide(bool b);
|
||||||
bool getAutoHide();
|
bool getAutoHide();
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
bool activationHasRun() const;
|
bool activationHasRun() const;
|
||||||
AppConfig& activationHasRun(bool value);
|
AppConfig& activationHasRun(bool value);
|
||||||
|
#endif
|
||||||
|
|
||||||
QString lastVersion() const;
|
QString lastVersion() const;
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,17 @@ static const char* synergyIconFiles[] =
|
||||||
":/res/icons/16x16/synergy-transfering.png"
|
":/res/icons/16x16/synergy-transfering.png"
|
||||||
};
|
};
|
||||||
|
|
||||||
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
#ifdef SYNERGY_ENTERPRISE
|
||||||
LicenseManager& licenseManager) :
|
MainWindow::MainWindow (QSettings& settings, AppConfig& appConfig)
|
||||||
m_Settings(settings),
|
#else
|
||||||
|
MainWindow::MainWindow (QSettings& settings, AppConfig& appConfig,
|
||||||
|
LicenseManager& licenseManager)
|
||||||
|
#endif
|
||||||
|
: m_Settings(settings),
|
||||||
m_AppConfig(&appConfig),
|
m_AppConfig(&appConfig),
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
m_LicenseManager(&licenseManager),
|
m_LicenseManager(&licenseManager),
|
||||||
|
#endif
|
||||||
m_pSynergy(NULL),
|
m_pSynergy(NULL),
|
||||||
m_SynergyState(synergyDisconnected),
|
m_SynergyState(synergyDisconnected),
|
||||||
m_ServerConfig(&m_Settings, 5, 3, m_AppConfig->screenName(), this),
|
m_ServerConfig(&m_Settings, 5, 3, m_AppConfig->screenName(), this),
|
||||||
|
@ -101,8 +107,10 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
m_BonjourInstall(NULL),
|
m_BonjourInstall(NULL),
|
||||||
m_SuppressEmptyServerWarning(false),
|
m_SuppressEmptyServerWarning(false),
|
||||||
m_ExpectedRunningState(kStopped),
|
m_ExpectedRunningState(kStopped),
|
||||||
m_pSslCertificate(NULL),
|
m_pSslCertificate(NULL)
|
||||||
m_ActivationDialogRunning(false)
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
|
, m_ActivationDialogRunning(false)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
@ -142,7 +150,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
|
|
||||||
connect (this, SIGNAL(windowShown()),
|
connect (this, SIGNAL(windowShown()),
|
||||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
connect (m_LicenseManager, SIGNAL(editionChanged(Edition)),
|
connect (m_LicenseManager, SIGNAL(editionChanged(Edition)),
|
||||||
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||||
|
|
||||||
|
@ -151,20 +159,31 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
|
|
||||||
connect (m_LicenseManager, SIGNAL(endTrial(bool)),
|
connect (m_LicenseManager, SIGNAL(endTrial(bool)),
|
||||||
this, SLOT(endTrial(bool)), Qt::QueuedConnection);
|
this, SLOT(endTrial(bool)), Qt::QueuedConnection);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
||||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||||
|
|
||||||
|
#ifdef SYNERGY_ENTERPRISE
|
||||||
|
setWindowTitle ("Synergy Enterprise");
|
||||||
|
#else
|
||||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||||
m_LicenseManager->refresh();
|
m_LicenseManager->refresh();
|
||||||
|
#endif
|
||||||
|
|
||||||
QString lastVersion = m_AppConfig->lastVersion();
|
QString lastVersion = m_AppConfig->lastVersion();
|
||||||
QString currentVersion = m_VersionChecker.getVersion();
|
QString currentVersion = m_VersionChecker.getVersion();
|
||||||
if (lastVersion != currentVersion) {
|
if (lastVersion != currentVersion) {
|
||||||
m_AppConfig->setLastVersion (currentVersion);
|
m_AppConfig->setLastVersion (currentVersion);
|
||||||
m_AppConfig->saveSettings();
|
m_AppConfig->saveSettings();
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
m_LicenseManager->notifyUpdate (lastVersion, currentVersion);
|
m_LicenseManager->notifyUpdate (lastVersion, currentVersion);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SYNERGY_ENTERPRISE
|
||||||
|
m_pActivate->setVisible(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -431,7 +450,9 @@ void MainWindow::updateFromLogLine(const QString &line)
|
||||||
// TODO: this code makes Andrew cry
|
// TODO: this code makes Andrew cry
|
||||||
checkConnected(line);
|
checkConnected(line);
|
||||||
checkFingerprint(line);
|
checkFingerprint(line);
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
checkLicense(line);
|
checkLicense(line);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkConnected(const QString& line)
|
void MainWindow::checkConnected(const QString& line)
|
||||||
|
@ -456,6 +477,7 @@ void MainWindow::checkConnected(const QString& line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
void MainWindow::checkLicense(const QString &line)
|
void MainWindow::checkLicense(const QString &line)
|
||||||
{
|
{
|
||||||
if (line.contains("trial has expired")) {
|
if (line.contains("trial has expired")) {
|
||||||
|
@ -463,6 +485,7 @@ void MainWindow::checkLicense(const QString &line)
|
||||||
raiseActivationDialog();
|
raiseActivationDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::checkFingerprint(const QString& line)
|
void MainWindow::checkFingerprint(const QString& line)
|
||||||
{
|
{
|
||||||
|
@ -532,8 +555,9 @@ void MainWindow::restartSynergy()
|
||||||
|
|
||||||
void MainWindow::proofreadInfo()
|
void MainWindow::proofreadInfo()
|
||||||
{
|
{
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
setEdition(m_AppConfig->edition()); // Why is this here?
|
setEdition(m_AppConfig->edition()); // Why is this here?
|
||||||
|
#endif
|
||||||
int oldState = m_SynergyState;
|
int oldState = m_SynergyState;
|
||||||
m_SynergyState = synergyDisconnected;
|
m_SynergyState = synergyDisconnected;
|
||||||
setSynergyState((qSynergyState)oldState);
|
setSynergyState((qSynergyState)oldState);
|
||||||
|
@ -552,6 +576,7 @@ void MainWindow::clearLog()
|
||||||
|
|
||||||
void MainWindow::startSynergy()
|
void MainWindow::startSynergy()
|
||||||
{
|
{
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
SerialKey serialKey = m_LicenseManager->serialKey();
|
SerialKey serialKey = m_LicenseManager->serialKey();
|
||||||
time_t currentTime = ::time(0);
|
time_t currentTime = ::time(0);
|
||||||
if (serialKey.isExpired(currentTime)) {
|
if (serialKey.isExpired(currentTime)) {
|
||||||
|
@ -559,7 +584,7 @@ void MainWindow::startSynergy()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
bool desktopMode = appConfig().processMode() == Desktop;
|
bool desktopMode = appConfig().processMode() == Desktop;
|
||||||
bool serviceMode = appConfig().processMode() == Service;
|
bool serviceMode = appConfig().processMode() == Service;
|
||||||
|
|
||||||
|
@ -804,9 +829,11 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||||
#endif
|
#endif
|
||||||
args << "-c" << configFilename << "--address" << address();
|
args << "-c" << configFilename << "--address" << address();
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
if (!appConfig().serialKey().isEmpty()) {
|
if (!appConfig().serialKey().isEmpty()) {
|
||||||
args << "--serial-key" << appConfig().serialKey();
|
args << "--serial-key" << appConfig().serialKey();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1083,9 @@ void MainWindow::serverDetected(const QString name)
|
||||||
|
|
||||||
void MainWindow::setEdition(Edition edition)
|
void MainWindow::setEdition(Edition edition)
|
||||||
{
|
{
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
setWindowTitle(m_LicenseManager->getEditionName (edition));
|
setWindowTitle(m_LicenseManager->getEditionName (edition));
|
||||||
|
#endif
|
||||||
if (m_AppConfig->getCryptoEnabled()) {
|
if (m_AppConfig->getCryptoEnabled()) {
|
||||||
m_pSslCertificate = new SslCertificate(this);
|
m_pSslCertificate = new SslCertificate(this);
|
||||||
m_pSslCertificate->generateCertificate();
|
m_pSslCertificate->generateCertificate();
|
||||||
|
@ -1065,6 +1094,7 @@ void MainWindow::setEdition(Edition edition)
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
void MainWindow::beginTrial(bool isExpiring)
|
void MainWindow::beginTrial(bool isExpiring)
|
||||||
{
|
{
|
||||||
//Hack
|
//Hack
|
||||||
|
@ -1115,6 +1145,7 @@ void MainWindow::endTrial(bool isExpired)
|
||||||
}
|
}
|
||||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::updateLocalFingerprint()
|
void MainWindow::updateLocalFingerprint()
|
||||||
{
|
{
|
||||||
|
@ -1129,11 +1160,13 @@ void MainWindow::updateLocalFingerprint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
LicenseManager&
|
LicenseManager&
|
||||||
MainWindow::licenseManager() const
|
MainWindow::licenseManager() const
|
||||||
{
|
{
|
||||||
return *m_LicenseManager;
|
return *m_LicenseManager;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||||
{
|
{
|
||||||
|
@ -1199,6 +1232,7 @@ void MainWindow::on_m_pActionSettings_triggered()
|
||||||
void MainWindow::autoAddScreen(const QString name)
|
void MainWindow::autoAddScreen(const QString name)
|
||||||
{
|
{
|
||||||
if (!m_ServerConfig.ignoreAutoConfigClient()) {
|
if (!m_ServerConfig.ignoreAutoConfigClient()) {
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
if (m_ActivationDialogRunning) {
|
if (m_ActivationDialogRunning) {
|
||||||
// TODO: refactor this code
|
// TODO: refactor this code
|
||||||
// add this screen to the pending list and check this list until
|
// add this screen to the pending list and check this list until
|
||||||
|
@ -1206,6 +1240,7 @@ void MainWindow::autoAddScreen(const QString name)
|
||||||
m_PendingClientNames.append(name);
|
m_PendingClientNames.append(name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int r = m_ServerConfig.autoAddScreen(name);
|
int r = m_ServerConfig.autoAddScreen(name);
|
||||||
if (r != kAutoAddScreenOk) {
|
if (r != kAutoAddScreenOk) {
|
||||||
|
@ -1244,7 +1279,9 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
|
||||||
|
|
||||||
void MainWindow::on_m_pActivate_triggered()
|
void MainWindow::on_m_pActivate_triggered()
|
||||||
{
|
{
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
raiseActivationDialog();
|
raiseActivationDialog();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_m_pButtonApply_clicked()
|
void MainWindow::on_m_pButtonApply_clicked()
|
||||||
|
@ -1456,6 +1493,7 @@ void MainWindow::bonjourInstallFinished()
|
||||||
m_pCheckBoxAutoConfig->setChecked(true);
|
m_pCheckBoxAutoConfig->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
int MainWindow::raiseActivationDialog()
|
int MainWindow::raiseActivationDialog()
|
||||||
{
|
{
|
||||||
if (m_ActivationDialogRunning) {
|
if (m_ActivationDialogRunning) {
|
||||||
|
@ -1479,15 +1517,18 @@ int MainWindow::raiseActivationDialog()
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::on_windowShown()
|
void MainWindow::on_windowShown()
|
||||||
{
|
{
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
time_t currentTime = ::time(0);
|
time_t currentTime = ::time(0);
|
||||||
if (!m_AppConfig->activationHasRun()
|
if (!m_AppConfig->activationHasRun()
|
||||||
&& ((m_AppConfig->edition() == kUnregistered) ||
|
&& ((m_AppConfig->edition() == kUnregistered) ||
|
||||||
(m_LicenseManager->serialKey().isExpired(currentTime)))) {
|
(m_LicenseManager->serialKey().isExpired(currentTime)))) {
|
||||||
raiseActivationDialog();
|
raiseActivationDialog();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MainWindow::getProfileRootForArg()
|
QString MainWindow::getProfileRootForArg()
|
||||||
|
|
|
@ -95,8 +95,12 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#ifdef SYNERGY_ENTERPRISE
|
||||||
|
MainWindow(QSettings& settings, AppConfig& appConfig);
|
||||||
|
#else
|
||||||
MainWindow(QSettings& settings, AppConfig& appConfig,
|
MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
LicenseManager& licenseManager);
|
LicenseManager& licenseManager);
|
||||||
|
#endif
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -118,14 +122,17 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void updateZeroconfService();
|
void updateZeroconfService();
|
||||||
void serverDetected(const QString name);
|
void serverDetected(const QString name);
|
||||||
void updateLocalFingerprint();
|
void updateLocalFingerprint();
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
LicenseManager& licenseManager() const;
|
LicenseManager& licenseManager() const;
|
||||||
|
|
||||||
int raiseActivationDialog();
|
int raiseActivationDialog();
|
||||||
|
#endif
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setEdition(Edition edition);
|
void setEdition(Edition edition);
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
void beginTrial(bool isExpiring);
|
void beginTrial(bool isExpiring);
|
||||||
void endTrial(bool isExpired);
|
void endTrial(bool isExpired);
|
||||||
|
#endif
|
||||||
void appendLogRaw(const QString& text);
|
void appendLogRaw(const QString& text);
|
||||||
void appendLogInfo(const QString& text);
|
void appendLogInfo(const QString& text);
|
||||||
void appendLogDebug(const QString& text);
|
void appendLogDebug(const QString& text);
|
||||||
|
@ -149,7 +156,7 @@ public slots:
|
||||||
void logError();
|
void logError();
|
||||||
void updateFound(const QString& version);
|
void updateFound(const QString& version);
|
||||||
void bonjourInstallFinished();
|
void bonjourInstallFinished();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSettings& settings() { return m_Settings; }
|
QSettings& settings() { return m_Settings; }
|
||||||
|
@ -185,7 +192,9 @@ public slots:
|
||||||
void promptAutoConfig();
|
void promptAutoConfig();
|
||||||
QString getProfileRootForArg();
|
QString getProfileRootForArg();
|
||||||
void checkConnected(const QString& line);
|
void checkConnected(const QString& line);
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
void checkLicense(const QString& line);
|
void checkLicense(const QString& line);
|
||||||
|
#endif
|
||||||
void checkFingerprint(const QString& line);
|
void checkFingerprint(const QString& line);
|
||||||
bool autoHide();
|
bool autoHide();
|
||||||
QString getTimeStamp();
|
QString getTimeStamp();
|
||||||
|
@ -223,8 +232,10 @@ public slots:
|
||||||
qRuningState m_ExpectedRunningState;
|
qRuningState m_ExpectedRunningState;
|
||||||
QMutex m_StopDesktopMutex;
|
QMutex m_StopDesktopMutex;
|
||||||
SslCertificate* m_pSslCertificate;
|
SslCertificate* m_pSslCertificate;
|
||||||
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
bool m_ActivationDialogRunning;
|
bool m_ActivationDialogRunning;
|
||||||
QStringList m_PendingClientNames;
|
QStringList m_PendingClientNames;
|
||||||
|
#endif
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||||
|
|
|
@ -63,7 +63,11 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||||
|
#ifdef SYNERGY_ENTERPRISE
|
||||||
|
m_pCheckBoxEnableCrypto->setEnabled(true);
|
||||||
|
#else
|
||||||
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.edition() == kPro);
|
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.edition() == kPro);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::accept()
|
void SettingsDialog::accept()
|
||||||
|
|
|
@ -41,10 +41,10 @@
|
||||||
class QThreadImpl : public QThread
|
class QThreadImpl : public QThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void msleep(unsigned long msecs)
|
static void msleep(unsigned long msecs)
|
||||||
{
|
{
|
||||||
QThread::msleep(msecs);
|
QThread::msleep(msecs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int waitForTray();
|
int waitForTray();
|
||||||
|
@ -59,84 +59,90 @@ int main(int argc, char* argv[])
|
||||||
/* Workaround for QTBUG-40332 - "High ping when QNetworkAccessManager is instantiated" */
|
/* Workaround for QTBUG-40332 - "High ping when QNetworkAccessManager is instantiated" */
|
||||||
::setenv ("QT_BEARER_POLL_TIMEOUT", "-1", 1);
|
::setenv ("QT_BEARER_POLL_TIMEOUT", "-1", 1);
|
||||||
#endif
|
#endif
|
||||||
QCoreApplication::setOrganizationName("Synergy");
|
QCoreApplication::setOrganizationName("Synergy");
|
||||||
QCoreApplication::setOrganizationDomain("http://symless.com/");
|
QCoreApplication::setOrganizationDomain("http://symless.com/");
|
||||||
QCoreApplication::setApplicationName("Synergy");
|
QCoreApplication::setApplicationName("Synergy");
|
||||||
|
|
||||||
QSynergyApplication app(argc, argv);
|
QSynergyApplication app(argc, argv);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
|
||||||
if (app.applicationDirPath().startsWith("/Volumes/")) {
|
if (app.applicationDirPath().startsWith("/Volumes/")) {
|
||||||
QMessageBox::information(
|
QMessageBox::information(
|
||||||
NULL, "Synergy",
|
NULL, "Synergy",
|
||||||
"Please drag Synergy to the Applications folder, and open it from there.");
|
"Please drag Synergy to the Applications folder, and open it from there.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkMacAssistiveDevices())
|
if (!checkMacAssistiveDevices())
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!waitForTray())
|
if (!waitForTray())
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
AppConfig appConfig (&settings);
|
AppConfig appConfig (&settings);
|
||||||
qRegisterMetaType<Edition>("Edition");
|
qRegisterMetaType<Edition>("Edition");
|
||||||
LicenseManager licenseManager (&appConfig);
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
|
LicenseManager licenseManager (&appConfig);
|
||||||
|
#endif
|
||||||
|
|
||||||
app.switchTranslator(appConfig.language());
|
app.switchTranslator(appConfig.language());
|
||||||
|
|
||||||
MainWindow mainWindow(settings, appConfig, licenseManager);
|
#ifdef SYNERGY_ENTERPRISE
|
||||||
|
MainWindow mainWindow(settings, appConfig);
|
||||||
|
#else
|
||||||
|
MainWindow mainWindow(settings, appConfig, licenseManager);
|
||||||
|
#endif
|
||||||
|
|
||||||
QObject::connect(dynamic_cast<QObject*>(&app), SIGNAL(aboutToQuit()),
|
QObject::connect(dynamic_cast<QObject*>(&app), SIGNAL(aboutToQuit()),
|
||||||
&mainWindow, SLOT(saveSettings()));
|
&mainWindow, SLOT(saveSettings()));
|
||||||
|
|
||||||
SetupWizard setupWizard(mainWindow, true);
|
SetupWizard setupWizard(mainWindow, true);
|
||||||
|
|
||||||
if (appConfig.wizardShouldRun())
|
if (appConfig.wizardShouldRun())
|
||||||
{
|
{
|
||||||
setupWizard.show();
|
setupWizard.show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWindow.open();
|
mainWindow.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
int waitForTray()
|
int waitForTray()
|
||||||
{
|
{
|
||||||
// on linux, the system tray may not be available immediately after logging in,
|
// on linux, the system tray may not be available immediately after logging in,
|
||||||
// so keep retrying but give up after a short time.
|
// so keep retrying but give up after a short time.
|
||||||
int trayAttempts = 0;
|
int trayAttempts = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (QSystemTrayIcon::isSystemTrayAvailable())
|
if (QSystemTrayIcon::isSystemTrayAvailable())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++trayAttempts > TRAY_RETRY_COUNT)
|
if (++trayAttempts > TRAY_RETRY_COUNT)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(NULL, "Synergy",
|
QMessageBox::critical(NULL, "Synergy",
|
||||||
QObject::tr("System tray is unavailable, don't close your window."));
|
QObject::tr("System tray is unavailable, don't close your window."));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QThreadImpl::msleep(TRAY_RETRY_WAIT);
|
QThreadImpl::msleep(TRAY_RETRY_WAIT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
@ -144,36 +150,36 @@ bool checkMacAssistiveDevices()
|
||||||
{
|
{
|
||||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 // mavericks
|
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 // mavericks
|
||||||
|
|
||||||
// new in mavericks, applications are trusted individually
|
// new in mavericks, applications are trusted individually
|
||||||
// with use of the accessibility api. this call will show a
|
// with use of the accessibility api. this call will show a
|
||||||
// prompt which can show the security/privacy/accessibility
|
// prompt which can show the security/privacy/accessibility
|
||||||
// tab, with a list of allowed applications. synergy should
|
// tab, with a list of allowed applications. synergy should
|
||||||
// show up there automatically, but will be unchecked.
|
// show up there automatically, but will be unchecked.
|
||||||
|
|
||||||
if (AXIsProcessTrusted()) {
|
if (AXIsProcessTrusted()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* keys[] = { kAXTrustedCheckOptionPrompt };
|
const void* keys[] = { kAXTrustedCheckOptionPrompt };
|
||||||
const void* trueValue[] = { kCFBooleanTrue };
|
const void* trueValue[] = { kCFBooleanTrue };
|
||||||
CFDictionaryRef options = CFDictionaryCreate(NULL, keys, trueValue, 1, NULL, NULL);
|
CFDictionaryRef options = CFDictionaryCreate(NULL, keys, trueValue, 1, NULL, NULL);
|
||||||
|
|
||||||
bool result = AXIsProcessTrustedWithOptions(options);
|
bool result = AXIsProcessTrustedWithOptions(options);
|
||||||
CFRelease(options);
|
CFRelease(options);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// now deprecated in mavericks.
|
// now deprecated in mavericks.
|
||||||
bool result = AXAPIEnabled();
|
bool result = AXAPIEnabled();
|
||||||
if (!result) {
|
if (!result) {
|
||||||
QMessageBox::information(
|
QMessageBox::information(
|
||||||
NULL, "Synergy",
|
NULL, "Synergy",
|
||||||
"Please enable access to assistive devices "
|
"Please enable access to assistive devices "
|
||||||
"System Preferences -> Security & Privacy -> "
|
"System Preferences -> Security & Privacy -> "
|
||||||
"Privacy -> Accessibility, then re-open Synergy.");
|
"Privacy -> Accessibility, then re-open Synergy.");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue