#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_SERVICE "Build the legacy service (synergyd)" 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_EXTENSIONS OFF)
|
||||
|
|
|
@ -15,7 +15,7 @@ if (NOT DEFINED SYNERGY_VERSION_MINOR)
|
|||
if (DEFINED ENV{SYNERGY_VERSION_MINOR})
|
||||
set (SYNERGY_VERSION_MINOR $ENV{SYNERGY_VERSION_MINOR})
|
||||
else()
|
||||
set (SYNERGY_VERSION_MINOR 9)
|
||||
set (SYNERGY_VERSION_MINOR 10)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -88,3 +88,6 @@ if (SYNERGY_DEVELOPER_MODE)
|
|||
add_definitions (-DSYNERGY_DEVELOPER_MODE=1)
|
||||
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_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)
|
||||
set (LEGACY_GUI_RC_FILES res/win/Synergy.rc)
|
||||
|
|
|
@ -188,6 +188,7 @@ void AppConfig::saveSettings()
|
|||
settings().sync();
|
||||
}
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
bool AppConfig::activationHasRun() const
|
||||
{
|
||||
return m_ActivationHasRun;
|
||||
|
@ -198,6 +199,7 @@ AppConfig& AppConfig::activationHasRun(bool value)
|
|||
m_ActivationHasRun = value;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString AppConfig::lastVersion() const
|
||||
{
|
||||
|
@ -242,6 +244,7 @@ void AppConfig::setAutoConfigPrompted(bool prompted)
|
|||
m_AutoConfigPrompted = prompted;
|
||||
}
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
void AppConfig::setEdition(Edition e) {
|
||||
m_Edition = e;
|
||||
}
|
||||
|
@ -264,6 +267,7 @@ QString AppConfig::serialKey() { return m_Serialkey; }
|
|||
int AppConfig::lastExpiringWarningTime() const { return m_LastExpiringWarningTime; }
|
||||
|
||||
void AppConfig::setLastExpiringWarningTime(int t) { m_LastExpiringWarningTime = t; }
|
||||
#endif
|
||||
|
||||
QString AppConfig::synergysName() const { return m_SynergysName; }
|
||||
|
||||
|
@ -280,7 +284,11 @@ void AppConfig::setCryptoEnabled(bool e) {
|
|||
}
|
||||
|
||||
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; }
|
||||
|
|
|
@ -79,6 +79,7 @@ class AppConfig: public QObject
|
|||
void setAutoConfig(bool autoConfig);
|
||||
bool autoConfigPrompted();
|
||||
void setAutoConfigPrompted(bool prompted);
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
void setEdition(Edition);
|
||||
Edition edition() const;
|
||||
QString setSerialKey(QString serial);
|
||||
|
@ -86,6 +87,7 @@ class AppConfig: public QObject
|
|||
QString serialKey();
|
||||
int lastExpiringWarningTime() const;
|
||||
void setLastExpiringWarningTime(int t);
|
||||
#endif
|
||||
|
||||
QString synergysName() const;
|
||||
QString synergycName() const;
|
||||
|
@ -101,9 +103,10 @@ class AppConfig: public QObject
|
|||
|
||||
void setAutoHide(bool b);
|
||||
bool getAutoHide();
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
bool activationHasRun() const;
|
||||
AppConfig& activationHasRun(bool value);
|
||||
#endif
|
||||
|
||||
QString lastVersion() const;
|
||||
|
||||
|
|
|
@ -76,11 +76,17 @@ static const char* synergyIconFiles[] =
|
|||
":/res/icons/16x16/synergy-transfering.png"
|
||||
};
|
||||
|
||||
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager) :
|
||||
m_Settings(settings),
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
MainWindow::MainWindow (QSettings& settings, AppConfig& appConfig)
|
||||
#else
|
||||
MainWindow::MainWindow (QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager)
|
||||
#endif
|
||||
: m_Settings(settings),
|
||||
m_AppConfig(&appConfig),
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
m_LicenseManager(&licenseManager),
|
||||
#endif
|
||||
m_pSynergy(NULL),
|
||||
m_SynergyState(synergyDisconnected),
|
||||
m_ServerConfig(&m_Settings, 5, 3, m_AppConfig->screenName(), this),
|
||||
|
@ -101,8 +107,10 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
|||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_ExpectedRunningState(kStopped),
|
||||
m_pSslCertificate(NULL),
|
||||
m_ActivationDialogRunning(false)
|
||||
m_pSslCertificate(NULL)
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
, m_ActivationDialogRunning(false)
|
||||
#endif
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
@ -142,7 +150,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
|||
|
||||
connect (this, SIGNAL(windowShown()),
|
||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
connect (m_LicenseManager, SIGNAL(editionChanged(Edition)),
|
||||
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||
|
||||
|
@ -151,20 +159,31 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
|||
|
||||
connect (m_LicenseManager, SIGNAL(endTrial(bool)),
|
||||
this, SLOT(endTrial(bool)), Qt::QueuedConnection);
|
||||
#endif
|
||||
|
||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
setWindowTitle ("Synergy Enterprise");
|
||||
#else
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
m_LicenseManager->refresh();
|
||||
#endif
|
||||
|
||||
QString lastVersion = m_AppConfig->lastVersion();
|
||||
QString currentVersion = m_VersionChecker.getVersion();
|
||||
if (lastVersion != currentVersion) {
|
||||
m_AppConfig->setLastVersion (currentVersion);
|
||||
m_AppConfig->saveSettings();
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
m_LicenseManager->notifyUpdate (lastVersion, currentVersion);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
m_pActivate->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -431,7 +450,9 @@ void MainWindow::updateFromLogLine(const QString &line)
|
|||
// TODO: this code makes Andrew cry
|
||||
checkConnected(line);
|
||||
checkFingerprint(line);
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
checkLicense(line);
|
||||
#endif
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (line.contains("trial has expired")) {
|
||||
|
@ -463,6 +485,7 @@ void MainWindow::checkLicense(const QString &line)
|
|||
raiseActivationDialog();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::checkFingerprint(const QString& line)
|
||||
{
|
||||
|
@ -532,8 +555,9 @@ void MainWindow::restartSynergy()
|
|||
|
||||
void MainWindow::proofreadInfo()
|
||||
{
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
setEdition(m_AppConfig->edition()); // Why is this here?
|
||||
|
||||
#endif
|
||||
int oldState = m_SynergyState;
|
||||
m_SynergyState = synergyDisconnected;
|
||||
setSynergyState((qSynergyState)oldState);
|
||||
|
@ -552,6 +576,7 @@ void MainWindow::clearLog()
|
|||
|
||||
void MainWindow::startSynergy()
|
||||
{
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
SerialKey serialKey = m_LicenseManager->serialKey();
|
||||
time_t currentTime = ::time(0);
|
||||
if (serialKey.isExpired(currentTime)) {
|
||||
|
@ -559,7 +584,7 @@ void MainWindow::startSynergy()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
bool desktopMode = appConfig().processMode() == Desktop;
|
||||
bool serviceMode = appConfig().processMode() == Service;
|
||||
|
||||
|
@ -804,9 +829,11 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
|
|||
#endif
|
||||
args << "-c" << configFilename << "--address" << address();
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
if (!appConfig().serialKey().isEmpty()) {
|
||||
args << "--serial-key" << appConfig().serialKey();
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1056,7 +1083,9 @@ void MainWindow::serverDetected(const QString name)
|
|||
|
||||
void MainWindow::setEdition(Edition edition)
|
||||
{
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
setWindowTitle(m_LicenseManager->getEditionName (edition));
|
||||
#endif
|
||||
if (m_AppConfig->getCryptoEnabled()) {
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
m_pSslCertificate->generateCertificate();
|
||||
|
@ -1065,6 +1094,7 @@ void MainWindow::setEdition(Edition edition)
|
|||
saveSettings();
|
||||
}
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
void MainWindow::beginTrial(bool isExpiring)
|
||||
{
|
||||
//Hack
|
||||
|
@ -1115,6 +1145,7 @@ void MainWindow::endTrial(bool isExpired)
|
|||
}
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::updateLocalFingerprint()
|
||||
{
|
||||
|
@ -1129,11 +1160,13 @@ void MainWindow::updateLocalFingerprint()
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
LicenseManager&
|
||||
MainWindow::licenseManager() const
|
||||
{
|
||||
return *m_LicenseManager;
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||
{
|
||||
|
@ -1199,6 +1232,7 @@ void MainWindow::on_m_pActionSettings_triggered()
|
|||
void MainWindow::autoAddScreen(const QString name)
|
||||
{
|
||||
if (!m_ServerConfig.ignoreAutoConfigClient()) {
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
if (m_ActivationDialogRunning) {
|
||||
// TODO: refactor this code
|
||||
// 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);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int r = m_ServerConfig.autoAddScreen(name);
|
||||
if (r != kAutoAddScreenOk) {
|
||||
|
@ -1244,7 +1279,9 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
|
|||
|
||||
void MainWindow::on_m_pActivate_triggered()
|
||||
{
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
raiseActivationDialog();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pButtonApply_clicked()
|
||||
|
@ -1456,6 +1493,7 @@ void MainWindow::bonjourInstallFinished()
|
|||
m_pCheckBoxAutoConfig->setChecked(true);
|
||||
}
|
||||
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
int MainWindow::raiseActivationDialog()
|
||||
{
|
||||
if (m_ActivationDialogRunning) {
|
||||
|
@ -1479,15 +1517,18 @@ int MainWindow::raiseActivationDialog()
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::on_windowShown()
|
||||
{
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
time_t currentTime = ::time(0);
|
||||
if (!m_AppConfig->activationHasRun()
|
||||
&& ((m_AppConfig->edition() == kUnregistered) ||
|
||||
(m_LicenseManager->serialKey().isExpired(currentTime)))) {
|
||||
raiseActivationDialog();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QString MainWindow::getProfileRootForArg()
|
||||
|
|
|
@ -95,8 +95,12 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
};
|
||||
|
||||
public:
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig);
|
||||
#else
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager);
|
||||
#endif
|
||||
~MainWindow();
|
||||
|
||||
public:
|
||||
|
@ -118,14 +122,17 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
void updateZeroconfService();
|
||||
void serverDetected(const QString name);
|
||||
void updateLocalFingerprint();
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
LicenseManager& licenseManager() const;
|
||||
|
||||
int raiseActivationDialog();
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void setEdition(Edition edition);
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
void beginTrial(bool isExpiring);
|
||||
void endTrial(bool isExpired);
|
||||
#endif
|
||||
void appendLogRaw(const QString& text);
|
||||
void appendLogInfo(const QString& text);
|
||||
void appendLogDebug(const QString& text);
|
||||
|
@ -185,7 +192,9 @@ public slots:
|
|||
void promptAutoConfig();
|
||||
QString getProfileRootForArg();
|
||||
void checkConnected(const QString& line);
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
void checkLicense(const QString& line);
|
||||
#endif
|
||||
void checkFingerprint(const QString& line);
|
||||
bool autoHide();
|
||||
QString getTimeStamp();
|
||||
|
@ -223,8 +232,10 @@ public slots:
|
|||
qRuningState m_ExpectedRunningState;
|
||||
QMutex m_StopDesktopMutex;
|
||||
SslCertificate* m_pSslCertificate;
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
bool m_ActivationDialogRunning;
|
||||
QStringList m_PendingClientNames;
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||
|
|
|
@ -63,7 +63,11 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
|||
#endif
|
||||
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
m_pCheckBoxEnableCrypto->setEnabled(true);
|
||||
#else
|
||||
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.edition() == kPro);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsDialog::accept()
|
||||
|
|
|
@ -92,11 +92,17 @@ int main(int argc, char* argv[])
|
|||
QSettings settings;
|
||||
AppConfig appConfig (&settings);
|
||||
qRegisterMetaType<Edition>("Edition");
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
LicenseManager licenseManager (&appConfig);
|
||||
#endif
|
||||
|
||||
app.switchTranslator(appConfig.language());
|
||||
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
MainWindow mainWindow(settings, appConfig);
|
||||
#else
|
||||
MainWindow mainWindow(settings, appConfig, licenseManager);
|
||||
#endif
|
||||
|
||||
QObject::connect(dynamic_cast<QObject*>(&app), SIGNAL(aboutToQuit()),
|
||||
&mainWindow, SLOT(saveSettings()));
|
||||
|
|
Loading…
Reference in New Issue