Merge branch '4696' of github.com:synergy/synergy into 4696

This commit is contained in:
Adam Potolsky 2015-06-01 10:36:13 -07:00
commit b4c8e3c0eb
16 changed files with 388 additions and 277 deletions

View File

@ -17,7 +17,7 @@
# Version number for Synergy # Version number for Synergy
set(VERSION_MAJOR 1) set(VERSION_MAJOR 1)
set(VERSION_MINOR 7) set(VERSION_MINOR 7)
set(VERSION_REV 3) set(VERSION_REV 4)
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

@ -52,12 +52,14 @@ SOURCES += src/main.cpp \
src/DataDownloader.cpp \ src/DataDownloader.cpp \
src/AddClientDialog.cpp \ src/AddClientDialog.cpp \
src/CommandProcess.cpp \ src/CommandProcess.cpp \
src/WebClient.cpp \
src/PluginWizardPage.cpp \ src/PluginWizardPage.cpp \
src/PluginManager.cpp \ src/PluginManager.cpp \
src/CoreInterface.cpp \ src/CoreInterface.cpp \
src/Fingerprint.cpp \ src/Fingerprint.cpp \
src/SslCertificate.cpp src/SslCertificate.cpp \
src/FileSysClient.cpp \
src/Plugin.cpp \
src/WebClient.cpp
HEADERS += src/MainWindow.h \ HEADERS += src/MainWindow.h \
src/AboutDialog.h \ src/AboutDialog.h \
src/ServerConfig.h \ src/ServerConfig.h \
@ -94,14 +96,17 @@ HEADERS += src/MainWindow.h \
src/DataDownloader.h \ src/DataDownloader.h \
src/AddClientDialog.h \ src/AddClientDialog.h \
src/CommandProcess.h \ src/CommandProcess.h \
src/WebClient.h \
src/EditionType.h \ src/EditionType.h \
src/PluginWizardPage.h \ src/PluginWizardPage.h \
src/ProcessorArch.h \ src/ProcessorArch.h \
src/PluginManager.h \ src/PluginManager.h \
src/CoreInterface.h \ src/CoreInterface.h \
src/Fingerprint.h \ src/Fingerprint.h \
src/SslCertificate.h src/SslCertificate.h \
src/LocalFilesystemClient.h \
src/FileSysClient.h \
src/Plugin.h \
src/WebClient.h
RESOURCES += res/Synergy.qrc RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc RC_FILE = res/win/Synergy.rc
macx { macx {

View File

@ -0,0 +1,52 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si, Std.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "FileSysClient.h"
#include "EditionType.h"
#include "QUtility.h"
#include <QDir>
#include <QProcess>
#include <QMessageBox>
#include <QCoreApplication>
#include <stdexcept>
void FileSysClient::queryPluginList()
{
try {
isDone(false);
QString extension = "*" + Plugin::getOsSpecificExt();
QStringList nameFilter(extension);
QString searchDirectory(Plugin::getOsSpecificInstallerLocation());
QDir directory(searchDirectory);
m_PluginList = directory.entryList(nameFilter);
isDone(true);
}
catch (std::exception& e)
{
isDone(true);
emit error(tr("An error occurred while trying to load the "
"plugin list. Please contact the help desk, and "
"provide the following details.\n\n%1").arg(e.what()));
}
emit queryPluginDone();
return;
}

View File

@ -0,0 +1,63 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si, Std.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FileSysClient_H
#define FileSysClient_H
#include <QString>
#include <QStringList>
#include <QObject>
#include "Plugin.h"
#include "CoreInterface.h"
class QMessageBox;
class QWidget;
class QStringList;
class FileSysClient : public QObject
{
Q_OBJECT
public:
QStringList& getPluginList() { return m_PluginList; }
bool isDone() { return done; }
int count() { return copyCount; }
public slots:
void queryPluginList();
signals:
void error(QString e);
void queryPluginDone();
private:
void isDone(bool b) { done = b; }
QString request(const QString& email,
const QString& password,
QStringList& args);
Plugin plugin;
void count(int i) { copyCount = i; }
private:
int copyCount;
bool done;
QStringList m_PluginList;
CoreInterface m_CoreInterface;
};
#endif // FileSysClient_H

90
src/gui/src/Plugin.cpp Normal file
View File

@ -0,0 +1,90 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Plugin.h"
#include "CoreInterface.h"
//#include "CommandProcess.h"
//#include "DataDownloader.h"
//#include "QUtility.h"
//#include "ProcessorArch.h"
//#include "Fingerprint.h"
//#include <QFile>
//#include <QDir>
//#include <QProcess>
//#include <QCoreApplication>
static const char kBaseUrl[] = "http://synergy-project.org/files";
static const char kDefaultVersion[] = "1.1";
static const char kWinPackagePlatform32[] = "Windows-x86";
static const char kWinPackagePlatform64[] = "Windows-x64";
static const char kMacPackagePlatform[] = "MacOSX%1-i386";
static const char kLinuxPackagePlatformDeb32[] = "Linux-i686-deb";
static const char kLinuxPackagePlatformDeb64[] = "Linux-x86_64-deb";
static const char kLinuxPackagePlatformRpm32[] = "Linux-i686-rpm";
static const char kLinuxPackagePlatformRpm64[] = "Linux-x86_64-rpm";
#if defined(Q_OS_WIN)
static const char kWinPluginExt[] = ".dll";
static const char kInstallerPluginLocation[] = "C:/Program Files/Synergy/Plugins/"; //TODO: needs proper windows %X% notation
static const char kUserPluginLocation[] = "C:/Users/speaker/AppData/Local/Synergy/Plugins";//TODO: needs proper windows %X% notation
#elif defined(Q_OS_MAC)
static const char kMacPluginPrefix[] = "lib";
static const char kMacPluginExt[] = ".dylib";
static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins";
static const char kUserPluginLocation[] = "/home/speaker/.synergy/plugins";//TODO: needs proper unix notation
#else
static const char kLinuxPluginPrefix[] = "lib";
static const char kLinuxPluginExt[] = ".so";
static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins";
static const char kUserPluginLocation[] = "/home/speaker/.synergy/plugins";//TODO: needs proper MacOS X notation
#endif
QString Plugin::getOsSpecificExt()
{
#if defined(Q_OS_WIN)
return kWinPluginExt;
#elif defined(Q_OS_MAC)
return kMacPluginExt;
#else
return kLinuxPluginExt;
#endif
}
QString Plugin::getOsSpecificName(const QString& pluginName)
{
QString result = pluginName;
#if defined(Q_OS_WIN)
result.append(getOsSpecificExt());
#elif defined(Q_OS_MAC)
result = kMacPluginPrefix + pluginName + getOsSpecificExt();
#else
result = kLinuxPluginPrefix + pluginName + getOsSpecificExt();
#endif
return result;
}
QString Plugin::getOsSpecificInstallerLocation() {
return kInstallerPluginLocation;
}
QString Plugin::getOsSpecificUserLocation() {
return kUserPluginLocation;
}

53
src/gui/src/Plugin.h Normal file
View File

@ -0,0 +1,53 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLUGIN_H
#define PLUGIN_H
#include <QString>
#include <QStringList>
#include <QObject>
#include "SslCertificate.h"
#include "CoreInterface.h"
#include "DataDownloader.h"
class Plugin : public QObject
{
Q_OBJECT
public:
//Plugin();
//~PluginManager();
static QString getOsSpecificName(const QString& pluginName);
static QString getOsSpecificExt();
static QString getOsSpecificLocation();
static QString getOsSpecificInstallerLocation();
static QString getOsSpecificUserLocation();
public slots:
private:
// CoreInterface m_CoreInterface;
signals:
private:
};
#endif // PLUGIN_H

View File

@ -23,37 +23,23 @@
#include "QUtility.h" #include "QUtility.h"
#include "ProcessorArch.h" #include "ProcessorArch.h"
#include "Fingerprint.h" #include "Fingerprint.h"
#include "Plugin.h"
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
#include <QCoreApplication> #include <QCoreApplication>
static const char kBaseUrl[] = "http://synergy-project.org/files"; PluginManager::PluginManager() :
static const char kDefaultVersion[] = "1.1"; m_FileSysPluginList()
static const char kWinPackagePlatform32[] = "Windows-x86";
static const char kWinPackagePlatform64[] = "Windows-x64";
static const char kMacPackagePlatform[] = "MacOSX%1-i386";
static const char kLinuxPackagePlatformDeb32[] = "Linux-i686-deb";
static const char kLinuxPackagePlatformDeb64[] = "Linux-x86_64-deb";
static const char kLinuxPackagePlatformRpm32[] = "Linux-i686-rpm";
static const char kLinuxPackagePlatformRpm64[] = "Linux-x86_64-rpm";
#if defined(Q_OS_WIN)
static const char kWinPluginExt[] = ".dll";
#elif defined(Q_OS_MAC)
static const char kMacPluginPrefix[] = "lib";
static const char kMacPluginExt[] = ".dylib";
#else
static const char kLinuxPluginPrefix[] = "lib";
static const char kLinuxPluginExt[] = ".so";
#endif
PluginManager::PluginManager(QStringList pluginList) :
m_PluginList(pluginList),
m_DownloadIndex(-1)
{ {
}
void PluginManager::initFromFileSys(QStringList pluginList)
{
m_FileSysPluginList.clear();
m_FileSysPluginList.append(pluginList);
m_PluginDir = m_CoreInterface.getPluginDir(); m_PluginDir = m_CoreInterface.getPluginDir();
if (m_PluginDir.isEmpty()) { if (m_PluginDir.isEmpty()) {
emit error(tr("Failed to get plugin directory.")); emit error(tr("Failed to get plugin directory."));
@ -73,7 +59,7 @@ bool PluginManager::exist(QString name)
{ {
CoreInterface coreInterface; CoreInterface coreInterface;
QString PluginDir = coreInterface.getPluginDir(); QString PluginDir = coreInterface.getPluginDir();
QString pluginName = getPluginOsSpecificName(name); QString pluginName = Plugin::getOsSpecificName(name);
QString filename; QString filename;
filename.append(PluginDir); filename.append(PluginDir);
filename.append(QDir::separator()).append(pluginName); filename.append(QDir::separator()).append(pluginName);
@ -86,166 +72,65 @@ bool PluginManager::exist(QString name)
return exist; return exist;
} }
void PluginManager::downloadPlugins() void PluginManager::copyPlugins()
{ {
if (m_DataDownloader.isFinished()) {
if (!savePlugin()) {
return;
}
if (m_DownloadIndex != m_PluginList.size() - 1) {
emit downloadNext();
}
else {
emit downloadFinished();
return;
}
}
m_DownloadIndex++;
if (m_DownloadIndex < m_PluginList.size()) {
QUrl url;
QString pluginUrl = getPluginUrl(m_PluginList.at(m_DownloadIndex));
if (pluginUrl.isEmpty()) {
return;
}
url.setUrl(pluginUrl);
connect(&m_DataDownloader, SIGNAL(isComplete()), this, SLOT(downloadPlugins()));
m_DataDownloader.download(url);
}
}
bool PluginManager::savePlugin()
{
// create the path if not exist
QDir dir(m_PluginDir);
if (!dir.exists()) {
dir.mkpath(".");
}
QString filename = m_PluginDir;
QString pluginName = m_PluginList.at(m_DownloadIndex);
pluginName = getPluginOsSpecificName(pluginName);
filename.append(QDir::separator()).append(pluginName);
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
emit error(
tr("Failed to download plugin '%1' to: %2\n%3")
.arg(m_PluginList.at(m_DownloadIndex))
.arg(m_PluginDir)
.arg(file.errorString()));
file.close();
return false;
}
file.write(m_DataDownloader.data());
file.close();
return true;
}
QString PluginManager::getPluginUrl(const QString& pluginName)
{
QString archName;
#if defined(Q_OS_WIN)
try { try {
QString coreArch = m_CoreInterface.getArch(); // Get the Directory where plugins are put on installation
if (coreArch.startsWith("x86")) { // If it doesn't exist, there is nothing to do
archName = kWinPackagePlatform32; QString srcDirName = Plugin::getOsSpecificInstallerLocation();
} QDir srcDir(srcDirName);
else if (coreArch.startsWith("x64")) { if (!srcDir.exists()) {
archName = kWinPackagePlatform64; emit info(
} tr("No plugins found to copy from %1")
} .arg(srcDirName));
catch (...) { emit copyFinished();
emit error(tr("Could not get Windows architecture type."));
return "";
} }
#elif defined(Q_OS_MAC) // Get the directory where Plugins are installed into Synergy
// If it doesn't exist make it
QString destDirName = m_PluginDir;
QDir destDir(destDirName);
if (!destDir.exists()) {
destDir.mkpath(".");
}
// Run through the list of plugins and copy them
for ( int i = 0 ; i < m_FileSysPluginList.size() ; i++ ) {
// Get a file entry for the plugin using the full path
QFile file(srcDirName + m_FileSysPluginList.at(i));
// construct the destination file name
QString newName = destDirName;
newName.append(QDir::separator()).append(m_FileSysPluginList.at(i));
QString macVersion = "1010"; // Check to see if the plugin already exists
#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090 // 10.9 QFile newFile(newName);
macVersion = "109"; if(newFile.exists()) {
#elif __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080 // 10.8 // If it does, delete it. TODO: Check to see if same and leave
macVersion = "108"; newFile.remove();
#elif __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // 10.7 }
emit error(tr("Plugins not supported on this Mac OS X version.")); // make a copy of the plugin in the new location
return ""; bool result = file.copy(newName);
#endif if ( !result ) {
emit error(
archName = QString(kMacPackagePlatform).arg(macVersion); tr("Failed to copy plugin '%1' to: %2\n%3")
.arg(m_FileSysPluginList.at(i))
#else .arg(newName)
.arg(file.errorString()));
QString program("dpkg"); }
QStringList args; else {
args << "-s" << "synergy"; emit info(
tr("Copying '%1' plugin (%2/%3)...")
QProcess process; .arg(m_FileSysPluginList.at(i))
process.setReadChannel(QProcess::StandardOutput); .arg(i+1)
process.start(program, args); .arg(m_FileSysPluginList.size()));
bool success = process.waitForStarted(); }
}
if (!success || !process.waitForFinished()) }
catch (std::exception& e)
{ {
emit error(tr("Could not get Linux package type.")); emit error(tr("An error occurred while trying to copy the "
return ""; "plugin list. Please contact the help desk, and "
"provide the following details.\n\n%1").arg(e.what()));
} }
emit copyFinished();
bool isDeb = (process.exitCode() == 0); return;
int arch = getProcessorArch();
if (arch == kProcessorArchLinux32) {
if (isDeb) {
archName = kLinuxPackagePlatformDeb32;
}
else {
archName = kLinuxPackagePlatformRpm32;
}
}
else if (arch == kProcessorArchLinux64) {
if (isDeb) {
archName = kLinuxPackagePlatformDeb64;
}
else {
archName = kLinuxPackagePlatformRpm64;
}
}
else {
emit error(tr("Could not get Linux architecture type."));
return "";
}
#endif
QString result = QString("%1/plugins/%2/%3/%4/%5")
.arg(kBaseUrl)
.arg(pluginName)
.arg(kDefaultVersion)
.arg(archName)
.arg(getPluginOsSpecificName(pluginName));
qDebug() << result;
return result;
}
QString PluginManager::getPluginOsSpecificName(const QString& pluginName)
{
QString result = pluginName;
#if defined(Q_OS_WIN)
result.append(kWinPluginExt);
#elif defined(Q_OS_MAC)
result = kMacPluginPrefix + pluginName + kMacPluginExt;
#else
result = kLinuxPluginPrefix + pluginName + kLinuxPluginExt;
#endif
return result;
} }

View File

@ -25,44 +25,45 @@
#include "SslCertificate.h" #include "SslCertificate.h"
#include "CoreInterface.h" #include "CoreInterface.h"
#include "DataDownloader.h" #include "DataDownloader.h"
#include "Plugin.h"
class PluginManager : public QObject class PluginManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
PluginManager(QStringList pluginList); PluginManager();
~PluginManager(); ~PluginManager();
int downloadIndex() { return m_DownloadIndex; } void initFromWeb(QStringList pluginList);
void initFromFileSys(QStringList pluginList);
int pluginCount() { return m_FileSysPluginList.count(); }
static bool exist(QString name); static bool exist(QString name);
public slots: public slots:
void downloadPlugins(); void copyPlugins();
private: private:
bool savePlugin();
QString getPluginUrl(const QString& pluginName); QString getPluginUrl(const QString& pluginName);
bool runProgram( bool runProgram(
const QString& program, const QString& program,
const QStringList& args, const QStringList& args,
const QStringList& env); const QStringList& env);
static QString getPluginOsSpecificName(const QString& pluginName); //static QString getPluginOsSpecificName(const QString& pluginName);
signals: signals:
void error(QString e); void error(QString e);
void info(QString i); void info(QString i);
void downloadNext(); void updateCopyStatus(int);
void downloadFinished(); void copyFinished();
private: private:
QStringList m_PluginList; QStringList m_FileSysPluginList;
QString m_PluginDir; QString m_PluginDir;
QString m_ProfileDir; QString m_ProfileDir;
int m_DownloadIndex;
DataDownloader m_DataDownloader;
CoreInterface m_CoreInterface; CoreInterface m_CoreInterface;
SslCertificate m_SslCertificate; SslCertificate m_SslCertificate;
}; };

View File

@ -19,6 +19,7 @@
#include "ui_PluginWizardPageBase.h" #include "ui_PluginWizardPageBase.h"
#include "SslCertificate.h" #include "SslCertificate.h"
#include "FileSysClient.h"
#include "WebClient.h" #include "WebClient.h"
#include "PluginManager.h" #include "PluginManager.h"
@ -28,8 +29,7 @@
PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) : PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) :
QWizardPage(parent), QWizardPage(parent),
m_Finished(false), m_Finished(false),
m_pWebClient(NULL), m_pFileSysClient(NULL),
m_pPluginManager(NULL),
m_pSslCertificate(NULL), m_pSslCertificate(NULL),
m_AppConfig(appConfig) m_AppConfig(appConfig)
{ {
@ -44,12 +44,8 @@ PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) :
PluginWizardPage::~PluginWizardPage() PluginWizardPage::~PluginWizardPage()
{ {
if (m_pWebClient != NULL) { if (m_pFileSysClient != NULL) {
delete m_pWebClient; delete m_pFileSysClient;
}
if (m_pPluginManager != NULL) {
delete m_pPluginManager;
} }
delete m_pSslCertificate; delete m_pSslCertificate;
@ -75,27 +71,16 @@ void PluginWizardPage::showError(QString error)
void PluginWizardPage::queryPluginDone() void PluginWizardPage::queryPluginDone()
{ {
QStringList pluginList = m_pWebClient->getPluginList(); QStringList pluginList = m_pFileSysClient->getPluginList();
if (pluginList.isEmpty()) { if (pluginList.isEmpty()) {
updateStatus(tr("Setup complete.")); updateStatus(tr("Setup complete."));
showFinished(); showFinished();
} }
else { else {
downloadPlugins(); copyPlugins();
} }
} }
void PluginWizardPage::updateDownloadStatus()
{
QStringList pluginList = m_pWebClient->getPluginList();
int index = m_pPluginManager->downloadIndex();
updateStatus(
tr("Downloading '%1' plugin (%2/%3)...")
.arg(pluginList.at(index + 1))
.arg(index + 2)
.arg(pluginList.size()));
}
void PluginWizardPage::finished() void PluginWizardPage::finished()
{ {
// TODO: we should check if ns plugin exists // TODO: we should check if ns plugin exists
@ -130,33 +115,29 @@ void PluginWizardPage::updateStatus(QString info)
m_pLabelStatus->setText(info); m_pLabelStatus->setText(info);
} }
void PluginWizardPage::downloadPlugins() void PluginWizardPage::copyPlugins()
{ {
QStringList pluginList = m_pWebClient->getPluginList(); QStringList pluginList = m_pFileSysClient->getPluginList();
m_pPluginManager = new PluginManager(pluginList); m_PluginManager.initFromFileSys(pluginList);
m_pThread = new QThread; m_pThread = new QThread;
connect(m_pPluginManager, connect(&m_PluginManager,
SIGNAL(error(QString)), SIGNAL(error(QString)),
this, this,
SLOT(showError(QString))); SLOT(showError(QString)));
connect(m_pPluginManager, connect(&m_PluginManager,
SIGNAL(info(QString)), SIGNAL(info(QString)),
this, this,
SLOT(updateStatus(QString))); SLOT(updateStatus(QString)));
connect(m_pPluginManager, connect(&m_PluginManager,
SIGNAL(downloadNext()), SIGNAL(copyFinished()),
this,
SLOT(updateDownloadStatus()));
connect(m_pPluginManager,
SIGNAL(downloadFinished()),
this, this,
SLOT(generateCertificate())); SLOT(generateCertificate()));
connect(m_pPluginManager, connect(&m_PluginManager,
SIGNAL(error(QString)), SIGNAL(error(QString)),
m_pThread, m_pThread,
SLOT(quit())); SLOT(quit()));
@ -167,16 +148,14 @@ void PluginWizardPage::downloadPlugins()
SLOT(deleteLater())); SLOT(deleteLater()));
updateStatus( updateStatus(
tr("Downloading plugin: %1 (1/%2)") tr("Copying plugins..."));
.arg(pluginList.at(0))
.arg(pluginList.size()));
m_pPluginManager->moveToThread(m_pThread); m_PluginManager.moveToThread(m_pThread);
m_pThread->start(); m_pThread->start();
QMetaObject::invokeMethod( QMetaObject::invokeMethod(
m_pPluginManager, &m_PluginManager,
"downloadPlugins", "copyPlugins",
Qt::QueuedConnection); Qt::QueuedConnection);
} }
@ -195,7 +174,7 @@ bool PluginWizardPage::isComplete() const
void PluginWizardPage::initializePage() void PluginWizardPage::initializePage()
{ {
QWizardPage::initializePage(); QWizardPage::initializePage();
if (m_pWebClient == NULL) { if (m_pFileSysClient == NULL) {
if (m_Email.isEmpty() || if (m_Email.isEmpty() ||
m_Password.isEmpty()) { m_Password.isEmpty()) {
updateStatus(tr("Setup complete.")); updateStatus(tr("Setup complete."));
@ -205,38 +184,38 @@ void PluginWizardPage::initializePage()
m_pLabelSpinning->show(); m_pLabelSpinning->show();
m_pFileSysClient = new FileSysClient();
m_pWebClient = new WebClient(); m_pWebClient = new WebClient();
m_pWebClient->setEmail(m_Email); m_pWebClient->setEmail(m_Email);
m_pWebClient->setPassword(m_Password); m_pWebClient->setPassword(m_Password);
QThread* thread = new QThread; QThread* thread = new QThread;
connect(m_pWebClient, connect(m_pFileSysClient,
SIGNAL(error(QString)), SIGNAL(error(QString)),
this, this,
SLOT(showError(QString))); SLOT(showError(QString)));
connect(m_pWebClient, connect(m_pFileSysClient,
SIGNAL(queryPluginDone()), SIGNAL(queryPluginDone()),
this, this,
SLOT(queryPluginDone())); SLOT(queryPluginDone()));
connect(m_pWebClient, connect(m_pFileSysClient,
SIGNAL(queryPluginDone()), SIGNAL(queryPluginDone()),
thread, thread,
SLOT(quit())); SLOT(quit()));
connect(m_pWebClient, connect(m_pFileSysClient,
SIGNAL(error(QString)), SIGNAL(error(QString)),
thread, thread,
SLOT(quit())); SLOT(quit()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
m_pWebClient->moveToThread(thread); m_pFileSysClient->moveToThread(thread);
thread->start(); thread->start();
updateStatus(tr("Getting plugin list...")); QMetaObject::invokeMethod(m_pFileSysClient, "queryPluginList", Qt::QueuedConnection);
QMetaObject::invokeMethod(m_pWebClient, "queryPluginList", Qt::QueuedConnection);
} }
} }

View File

@ -21,10 +21,11 @@
#include "AppConfig.h" #include "AppConfig.h"
#include "ui_PluginWizardPageBase.h" #include "ui_PluginWizardPageBase.h"
#include "PluginManager.h"
#include <QWizardPage> #include <QWizardPage>
class FileSysClient;
class WebClient; class WebClient;
class PluginManager;
class SslCertificate; class SslCertificate;
class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage { class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage {
@ -49,12 +50,11 @@ protected slots:
void showError(QString error); void showError(QString error);
void updateStatus(QString info); void updateStatus(QString info);
void queryPluginDone(); void queryPluginDone();
void updateDownloadStatus();
void finished(); void finished();
void generateCertificate(); void generateCertificate();
private: private:
void downloadPlugins(); void copyPlugins();
void showFinished(); void showFinished();
private: private:
@ -62,7 +62,8 @@ private:
QString m_Email; QString m_Email;
QString m_Password; QString m_Password;
WebClient* m_pWebClient; WebClient* m_pWebClient;
PluginManager* m_pPluginManager; FileSysClient* m_pFileSysClient;
PluginManager m_PluginManager;
SslCertificate* m_pSslCertificate; SslCertificate* m_pSslCertificate;
QThread* m_pThread; QThread* m_pThread;
AppConfig& m_AppConfig; AppConfig& m_AppConfig;

View File

@ -37,6 +37,7 @@
#include <UserEnv.h> #include <UserEnv.h>
#include <Shellapi.h> #include <Shellapi.h>
#define MAXIMUM_WAIT_TIME 3
enum { enum {
kOutputBufferSize = 4096 kOutputBufferSize = 4096
}; };
@ -549,8 +550,14 @@ MSWindowsWatchdog::getActiveDesktop(LPSECURITY_ATTRIBUTES security)
} }
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
int waitTime = 0;
while (!m_ready) { while (!m_ready) {
if (waitTime >= MAXIMUM_WAIT_TIME) {
break;
}
ARCH->waitCondVar(m_condVar, m_mutex, 1.0); ARCH->waitCondVar(m_condVar, m_mutex, 1.0);
waitTime++;
} }
m_ready = false; m_ready = false;
ARCH->unlockMutex(m_mutex); ARCH->unlockMutex(m_mutex);
@ -565,7 +572,7 @@ MSWindowsWatchdog::testOutput(String buffer)
if (i != String::npos) { if (i != String::npos) {
size_t s = sizeof(g_activeDesktop); size_t s = sizeof(g_activeDesktop);
String defaultDesktop("Default"); String defaultDesktop("Default");
String sub = buffer.substr(s - 1, defaultDesktop.size()); String sub = buffer.substr(i + s - 1, defaultDesktop.size());
if (sub != defaultDesktop) { if (sub != defaultDesktop) {
m_autoElevated = true; m_autoElevated = true;
} }

View File

@ -64,9 +64,6 @@ public:
//! Get server which owns this listener //! Get server which owns this listener
Server* getServer() { return m_server; } Server* getServer() { return m_server; }
//! Return true if using secure network connection
bool isSecure() { return m_useSecureNetwork; }
//@} //@}
private: private:

View File

@ -29,11 +29,6 @@
// ClientProxy1_6 // ClientProxy1_6
// //
enum
{
kSslClipboardMaxSize = 1024
};
ClientProxy1_6::ClientProxy1_6(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) : ClientProxy1_6::ClientProxy1_6(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) :
ClientProxy1_5(name, stream, server, events), ClientProxy1_5(name, stream, server, events),
m_events(events) m_events(events)
@ -62,18 +57,10 @@ ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard* clipboard)
size_t size = data.size(); size_t size = data.size();
LOG((CLOG_DEBUG "sending clipboard %d to \"%s\"", id, getName().c_str())); LOG((CLOG_DEBUG "sending clipboard %d to \"%s\"", id, getName().c_str()));
// HACK: if using SSL, don't send large clipboards (#4601)
bool send = true;
if (getServer()->isSecure() && (size > kSslClipboardMaxSize)) {
send = false;
LOG((CLOG_WARN "large clipboards not supported with ssl, size=%d", size));
}
if (send) {
StreamChunker::sendClipboard(data, size, id, 0, m_events, this); StreamChunker::sendClipboard(data, size, id, 0, m_events, this);
LOG((CLOG_DEBUG "sent clipboard size=%d", size)); LOG((CLOG_DEBUG "sent clipboard size=%d", size));
} }
}
} }
void void

View File

@ -2389,9 +2389,3 @@ Server::dragInfoReceived(UInt32 fileNum, String content)
m_screen->startDraggingFiles(m_dragFileList); m_screen->startDraggingFiles(m_dragFileList);
} }
bool
Server::isSecure() const
{
return m_clientListener->isSecure();
}

View File

@ -175,9 +175,6 @@ public:
//! Return received file data //! Return received file data
String& getReceivedFileData() { return m_receivedFileData; } String& getReceivedFileData() { return m_receivedFileData; }
//! Return true if using secure network connection
bool isSecure() const;
//@} //@}
private: private:

View File

@ -63,8 +63,8 @@ ToolApp::run(int argc, char** argv)
return kExitFailed; return kExitFailed;
} }
else { else {
// HACK: send to standard out so watchdog can parse. String output = synergy::string::sprintf("activeDesktop:%s", name.c_str());
std::cout << "activeDesktop:" << name.c_str() << std::endl; LOG((CLOG_INFO "%s", output.c_str()));
} }
#endif #endif
} }