#5657 Merge core fixes for trial support

This commit is contained in:
Andrew Nelless 2016-10-19 10:46:52 +01:00
commit 6a7d1dd43c
3 changed files with 37 additions and 7 deletions

View File

@ -17,8 +17,8 @@
# Version number for Synergy # Version number for Synergy
set(VERSION_MAJOR 1) set(VERSION_MAJOR 1)
set(VERSION_MINOR 8) set(VERSION_MINOR 8)
set(VERSION_REV 4) set(VERSION_REV 5)
set(VERSION_STAGE stable) set(VERSION_STAGE rc1)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}") set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)

View File

@ -101,7 +101,8 @@ 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)
{ {
setupUi(this); setupUi(this);
@ -555,10 +556,6 @@ void MainWindow::startSynergy()
args << "--name" << getScreenName(); args << "--name" << getScreenName();
if (!appConfig().serialKey().isEmpty()) {
args << "--serial-key" << appConfig().serialKey();
}
if (desktopMode) if (desktopMode)
{ {
setSynergyProcess(new QProcess(this)); setSynergyProcess(new QProcess(this));
@ -788,6 +785,10 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
#endif #endif
args << "-c" << configFilename << "--address" << address(); args << "-c" << configFilename << "--address" << address();
if (!appConfig().serialKey().isEmpty()) {
args << "--serial-key" << appConfig().serialKey();
}
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
// pass in physical resolution and primary screen center // pass in physical resolution and primary screen center
// TODO: get this information in the core binary even when // TODO: get this information in the core binary even when
@ -1187,6 +1188,14 @@ 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()) {
if (m_ActivationDialogRunning) {
// TODO: refactor this code
// add this screen to the pending list and check this list until
// users finish activation dialog
m_PendingClientNames.append(name);
return;
}
int r = m_ServerConfig.autoAddScreen(name); int r = m_ServerConfig.autoAddScreen(name);
if (r != kAutoAddScreenOk) { if (r != kAutoAddScreenOk) {
switch (r) { switch (r) {
@ -1225,6 +1234,9 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
void MainWindow::on_m_pActivate_triggered() void MainWindow::on_m_pActivate_triggered()
{ {
ActivationDialog activationDialog(this, appConfig(), licenseManager()); ActivationDialog activationDialog(this, appConfig(), licenseManager());
m_ActivationDialogRunning = true;
connect (&activationDialog, SIGNAL(finished(int)),
this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
activationDialog.exec(); activationDialog.exec();
} }
@ -1447,10 +1459,25 @@ void MainWindow::on_windowShown()
&& ((m_AppConfig->edition() == kUnregistered) || && ((m_AppConfig->edition() == kUnregistered) ||
(m_LicenseManager->serialKey().isExpired(currentTime)))) { (m_LicenseManager->serialKey().isExpired(currentTime)))) {
ActivationDialog activationDialog (this, appConfig(), licenseManager()); ActivationDialog activationDialog (this, appConfig(), licenseManager());
m_ActivationDialogRunning = true;
connect (&activationDialog, SIGNAL(finished(int)),
this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
activationDialog.exec(); activationDialog.exec();
} }
} }
void MainWindow::on_activationDialogFinish()
{
m_ActivationDialogRunning = false;
if (!m_PendingClientNames.empty()) {
foreach (const QString& name, m_PendingClientNames) {
autoAddScreen(name);
}
m_PendingClientNames.clear();
}
}
QString MainWindow::getProfileRootForArg() QString MainWindow::getProfileRootForArg()
{ {
CoreInterface coreInterface; CoreInterface coreInterface;

View File

@ -221,6 +221,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
qRuningState m_ExpectedRunningState; qRuningState m_ExpectedRunningState;
QMutex m_StopDesktopMutex; QMutex m_StopDesktopMutex;
SslCertificate* m_pSslCertificate; SslCertificate* m_pSslCertificate;
bool m_ActivationDialogRunning;
QStringList m_PendingClientNames;
private slots: private slots:
void on_m_pCheckBoxAutoConfig_toggled(bool checked); void on_m_pCheckBoxAutoConfig_toggled(bool checked);
@ -228,6 +230,7 @@ private slots:
void on_m_pButtonApply_clicked(); void on_m_pButtonApply_clicked();
void installBonjour(); void installBonjour();
void on_windowShown(); void on_windowShown();
void on_activationDialogFinish();
signals: signals:
void windowShown(); void windowShown();