From 2d5ad45e0831e6211d764d2def20498a4358b092 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Tue, 26 May 2015 13:18:14 -0700 Subject: [PATCH 01/18] Adding plugin to install for deb builds. #4696 --- ext/toolchain/commands1.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index d06b29ee..cb14ae72 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -1135,12 +1135,14 @@ class InternalCommands: controlFile.close() targetBin = '%s/%s/usr/bin' % (debDir, package) + targetPlugin = '%s/%s/usr/lib/synergy-plugins' % (debDir, package) targetShare = '%s/%s/usr/share' % (debDir, package) targetApplications = "%s/applications" % targetShare targetIcons = "%s/icons" % targetShare targetDocs = "%s/doc/%s" % (targetShare, self.project) os.makedirs(targetBin) + os.makedirs(targetPlugin) os.makedirs(targetApplications) os.makedirs(targetIcons) os.makedirs(targetDocs) @@ -1158,6 +1160,17 @@ class InternalCommands: if err != 0: raise Exception('strip failed: ' + str(err)) + pluginDir = "%s/plugins" % binDir + + pluginFiles = [ 'libns.so'] + for f in pluginFiles: + shutil.copy("%s/%s" % (pluginDir, f), targetPlugin) + target = "%s/%s" % (targetPlugin, f) + os.chmod(target, 0o0644) + err = os.system("strip " + target) + if err != 0: + raise Exception('strip failed: ' + str(err)) + shutil.copy("%s/synergy.desktop" % resDir, targetApplications) shutil.copy("%s/synergy.ico" % resDir, targetIcons) From ee2ed0a31c3a52c88ffada3f0e0d619a97ee83cd Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Tue, 26 May 2015 16:41:26 -0700 Subject: [PATCH 02/18] changed synergy-plugins directory to synergy with the sub directory plugins #4696 --- ext/toolchain/commands1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index e1e80e69..5ef00d2d 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -1140,7 +1140,7 @@ class InternalCommands: controlFile.close() targetBin = '%s/%s/usr/bin' % (debDir, package) - targetPlugin = '%s/%s/usr/lib/synergy-plugins' % (debDir, package) + targetPlugin = '%s/%s/usr/lib/synergy/plugins' % (debDir, package) targetShare = '%s/%s/usr/share' % (debDir, package) targetApplications = "%s/applications" % targetShare targetIcons = "%s/icons" % targetShare From 8d70075171b9e4fd72493304ae84e110c5e278e6 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Fri, 29 May 2015 15:57:21 -0700 Subject: [PATCH 03/18] Replaces plugin download with install and copy functionality #4696 --- src/gui/gui.pro | 13 +- src/gui/src/FileSysClient.cpp | 52 +++++++ src/gui/src/FileSysClient.h | 63 ++++++++ src/gui/src/Plugin.cpp | 90 ++++++++++++ src/gui/src/Plugin.h | 53 +++++++ src/gui/src/PluginManager.cpp | 243 ++++++++----------------------- src/gui/src/PluginManager.h | 21 +-- src/gui/src/PluginWizardPage.cpp | 75 ++++------ src/gui/src/PluginWizardPage.h | 9 +- 9 files changed, 373 insertions(+), 246 deletions(-) create mode 100644 src/gui/src/FileSysClient.cpp create mode 100644 src/gui/src/FileSysClient.h create mode 100644 src/gui/src/Plugin.cpp create mode 100644 src/gui/src/Plugin.h diff --git a/src/gui/gui.pro b/src/gui/gui.pro index f519885e..2e441c67 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -52,12 +52,14 @@ SOURCES += src/main.cpp \ src/DataDownloader.cpp \ src/AddClientDialog.cpp \ src/CommandProcess.cpp \ - src/WebClient.cpp \ src/PluginWizardPage.cpp \ src/PluginManager.cpp \ src/CoreInterface.cpp \ src/Fingerprint.cpp \ - src/SslCertificate.cpp + src/SslCertificate.cpp \ + src/FileSysClient.cpp \ + src/Plugin.cpp \ + src/WebClient.cpp HEADERS += src/MainWindow.h \ src/AboutDialog.h \ src/ServerConfig.h \ @@ -94,14 +96,17 @@ HEADERS += src/MainWindow.h \ src/DataDownloader.h \ src/AddClientDialog.h \ src/CommandProcess.h \ - src/WebClient.h \ src/EditionType.h \ src/PluginWizardPage.h \ src/ProcessorArch.h \ src/PluginManager.h \ src/CoreInterface.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 RC_FILE = res/win/Synergy.rc macx { diff --git a/src/gui/src/FileSysClient.cpp b/src/gui/src/FileSysClient.cpp new file mode 100644 index 00000000..53b759b9 --- /dev/null +++ b/src/gui/src/FileSysClient.cpp @@ -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 . + */ + +#include "FileSysClient.h" + +#include "EditionType.h" +#include "QUtility.h" + +#include +#include +#include +#include +#include + +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; +} diff --git a/src/gui/src/FileSysClient.h b/src/gui/src/FileSysClient.h new file mode 100644 index 00000000..dfe7ee95 --- /dev/null +++ b/src/gui/src/FileSysClient.h @@ -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 . + */ + +#ifndef FileSysClient_H +#define FileSysClient_H + +#include +#include +#include + +#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 diff --git a/src/gui/src/Plugin.cpp b/src/gui/src/Plugin.cpp new file mode 100644 index 00000000..4759e4e2 --- /dev/null +++ b/src/gui/src/Plugin.cpp @@ -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 . + */ + +#include "Plugin.h" + +#include "CoreInterface.h" +//#include "CommandProcess.h" +//#include "DataDownloader.h" +//#include "QUtility.h" +//#include "ProcessorArch.h" +//#include "Fingerprint.h" + +//#include +//#include +//#include +//#include + +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 + getPluginOsSpecificExt(); +#else + result = kLinuxPluginPrefix + pluginName + getPluginOsSpecificExt(); +#endif + return result; +} + +QString Plugin::getOsSpecificInstallerLocation() { + return kInstallerPluginLocation; +} + +QString Plugin::getOsSpecificUserLocation() { + return kUserPluginLocation; +} + diff --git a/src/gui/src/Plugin.h b/src/gui/src/Plugin.h new file mode 100644 index 00000000..431e1a80 --- /dev/null +++ b/src/gui/src/Plugin.h @@ -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 . + */ +#ifndef PLUGIN_H +#define PLUGIN_H + +#include +#include +#include + +#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 diff --git a/src/gui/src/PluginManager.cpp b/src/gui/src/PluginManager.cpp index fd3a24e4..e73c93e6 100644 --- a/src/gui/src/PluginManager.cpp +++ b/src/gui/src/PluginManager.cpp @@ -23,37 +23,23 @@ #include "QUtility.h" #include "ProcessorArch.h" #include "Fingerprint.h" +#include "Plugin.h" #include #include #include #include -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"; - -#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) +PluginManager::PluginManager() : + m_FileSysPluginList() { +} + +void PluginManager::initFromFileSys(QStringList pluginList) +{ + m_FileSysPluginList.clear(); + m_FileSysPluginList.append(pluginList); + m_PluginDir = m_CoreInterface.getPluginDir(); if (m_PluginDir.isEmpty()) { emit error(tr("Failed to get plugin directory.")); @@ -73,7 +59,7 @@ bool PluginManager::exist(QString name) { CoreInterface coreInterface; QString PluginDir = coreInterface.getPluginDir(); - QString pluginName = getPluginOsSpecificName(name); + QString pluginName = Plugin::getOsSpecificName(name); QString filename; filename.append(PluginDir); filename.append(QDir::separator()).append(pluginName); @@ -86,166 +72,63 @@ bool PluginManager::exist(QString name) 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 { - QString coreArch = m_CoreInterface.getArch(); - if (coreArch.startsWith("x86")) { - archName = kWinPackagePlatform32; + // Get the Directory where plugins are put on installation + // If it doesn't exist, there is nothing to do + QString srcDirName = Plugin::getOsSpecificInstallerLocation(); + QDir srcDir(srcDirName); + if (!srcDir.exists()) { + emit info( + tr("No plugins found to copy from %1") + .arg(srcDirName)); + emit copyFinished(); } - else if (coreArch.startsWith("x64")) { - archName = kWinPackagePlatform64; + + // 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)); + + QFile newFile(newName); + if(newFile.exists()) { + newFile.remove(); + } + // make a copy of the plugin in the new location + bool result = file.copy(newName); + if ( !result ) { + emit error( + tr("Failed to copy plugin '%1' to: %2\n%3") + .arg(m_FileSysPluginList.at(i)) + .arg(newName) + .arg(file.errorString())); + } + else { + emit info( + tr("Copying '%1' plugin (%2/%3)...") + .arg(m_FileSysPluginList.at(i)) + .arg(i+1) + .arg(m_FileSysPluginList.size())); + } } } - catch (...) { - emit error(tr("Could not get Windows architecture type.")); - return ""; - } - -#elif defined(Q_OS_MAC) - - QString macVersion = "1010"; -#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090 // 10.9 - macVersion = "109"; -#elif __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080 // 10.8 - macVersion = "108"; -#elif __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // 10.7 - emit error(tr("Plugins not supported on this Mac OS X version.")); - return ""; -#endif - - archName = QString(kMacPackagePlatform).arg(macVersion); - -#else - - QString program("dpkg"); - QStringList args; - args << "-s" << "synergy"; - - QProcess process; - process.setReadChannel(QProcess::StandardOutput); - process.start(program, args); - bool success = process.waitForStarted(); - - if (!success || !process.waitForFinished()) + catch (std::exception& e) { - emit error(tr("Could not get Linux package type.")); - return ""; + emit error(tr("An error occurred while trying to copy the " + "plugin list. Please contact the help desk, and " + "provide the following details.\n\n%1").arg(e.what())); } - - bool isDeb = (process.exitCode() == 0); - - 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; + emit copyFinished(); + return; } diff --git a/src/gui/src/PluginManager.h b/src/gui/src/PluginManager.h index 279e5ff4..f6bdb5e4 100644 --- a/src/gui/src/PluginManager.h +++ b/src/gui/src/PluginManager.h @@ -25,44 +25,45 @@ #include "SslCertificate.h" #include "CoreInterface.h" #include "DataDownloader.h" +#include "Plugin.h" class PluginManager : public QObject { Q_OBJECT public: - PluginManager(QStringList pluginList); + 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); public slots: - void downloadPlugins(); + void copyPlugins(); private: - bool savePlugin(); QString getPluginUrl(const QString& pluginName); bool runProgram( const QString& program, const QStringList& args, const QStringList& env); - static QString getPluginOsSpecificName(const QString& pluginName); + //static QString getPluginOsSpecificName(const QString& pluginName); signals: void error(QString e); void info(QString i); - void downloadNext(); - void downloadFinished(); + void updateCopyStatus(int); + void copyFinished(); private: - QStringList m_PluginList; + QStringList m_FileSysPluginList; QString m_PluginDir; QString m_ProfileDir; - int m_DownloadIndex; - DataDownloader m_DataDownloader; CoreInterface m_CoreInterface; SslCertificate m_SslCertificate; }; diff --git a/src/gui/src/PluginWizardPage.cpp b/src/gui/src/PluginWizardPage.cpp index 2abdb178..9c2994a6 100644 --- a/src/gui/src/PluginWizardPage.cpp +++ b/src/gui/src/PluginWizardPage.cpp @@ -19,6 +19,7 @@ #include "ui_PluginWizardPageBase.h" #include "SslCertificate.h" +#include "FileSysClient.h" #include "WebClient.h" #include "PluginManager.h" @@ -28,8 +29,7 @@ PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) : QWizardPage(parent), m_Finished(false), - m_pWebClient(NULL), - m_pPluginManager(NULL), + m_pFileSysClient(NULL), m_pSslCertificate(NULL), m_AppConfig(appConfig) { @@ -44,12 +44,8 @@ PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) : PluginWizardPage::~PluginWizardPage() { - if (m_pWebClient != NULL) { - delete m_pWebClient; - } - - if (m_pPluginManager != NULL) { - delete m_pPluginManager; + if (m_pFileSysClient != NULL) { + delete m_pFileSysClient; } delete m_pSslCertificate; @@ -75,27 +71,16 @@ void PluginWizardPage::showError(QString error) void PluginWizardPage::queryPluginDone() { - QStringList pluginList = m_pWebClient->getPluginList(); + QStringList pluginList = m_pFileSysClient->getPluginList(); if (pluginList.isEmpty()) { updateStatus(tr("Setup complete.")); showFinished(); } 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() { // TODO: we should check if ns plugin exists @@ -130,33 +115,29 @@ void PluginWizardPage::updateStatus(QString info) m_pLabelStatus->setText(info); } -void PluginWizardPage::downloadPlugins() +void PluginWizardPage::copyPlugins() { - QStringList pluginList = m_pWebClient->getPluginList(); - m_pPluginManager = new PluginManager(pluginList); + QStringList pluginList = m_pFileSysClient->getPluginList(); + m_PluginManager.initFromFileSys(pluginList); + m_pThread = new QThread; - connect(m_pPluginManager, + connect(&m_PluginManager, SIGNAL(error(QString)), this, SLOT(showError(QString))); - connect(m_pPluginManager, + connect(&m_PluginManager, SIGNAL(info(QString)), this, SLOT(updateStatus(QString))); - connect(m_pPluginManager, - SIGNAL(downloadNext()), - this, - SLOT(updateDownloadStatus())); - - connect(m_pPluginManager, - SIGNAL(downloadFinished()), + connect(&m_PluginManager, + SIGNAL(copyFinished()), this, SLOT(generateCertificate())); - connect(m_pPluginManager, + connect(&m_PluginManager, SIGNAL(error(QString)), m_pThread, SLOT(quit())); @@ -167,16 +148,14 @@ void PluginWizardPage::downloadPlugins() SLOT(deleteLater())); updateStatus( - tr("Downloading plugin: %1 (1/%2)") - .arg(pluginList.at(0)) - .arg(pluginList.size())); + tr("Copying plugins...")); - m_pPluginManager->moveToThread(m_pThread); + m_PluginManager.moveToThread(m_pThread); m_pThread->start(); QMetaObject::invokeMethod( - m_pPluginManager, - "downloadPlugins", + &m_PluginManager, + "copyPlugins", Qt::QueuedConnection); } @@ -195,7 +174,7 @@ bool PluginWizardPage::isComplete() const void PluginWizardPage::initializePage() { QWizardPage::initializePage(); - if (m_pWebClient == NULL) { + if (m_pFileSysClient == NULL) { if (m_Email.isEmpty() || m_Password.isEmpty()) { updateStatus(tr("Setup complete.")); @@ -205,38 +184,38 @@ void PluginWizardPage::initializePage() m_pLabelSpinning->show(); + m_pFileSysClient = new FileSysClient(); m_pWebClient = new WebClient(); m_pWebClient->setEmail(m_Email); m_pWebClient->setPassword(m_Password); QThread* thread = new QThread; - connect(m_pWebClient, + connect(m_pFileSysClient, SIGNAL(error(QString)), this, SLOT(showError(QString))); - connect(m_pWebClient, + connect(m_pFileSysClient, SIGNAL(queryPluginDone()), this, SLOT(queryPluginDone())); - connect(m_pWebClient, + connect(m_pFileSysClient, SIGNAL(queryPluginDone()), thread, SLOT(quit())); - connect(m_pWebClient, + connect(m_pFileSysClient, SIGNAL(error(QString)), thread, SLOT(quit())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); - m_pWebClient->moveToThread(thread); + m_pFileSysClient->moveToThread(thread); thread->start(); - updateStatus(tr("Getting plugin list...")); - QMetaObject::invokeMethod(m_pWebClient, "queryPluginList", Qt::QueuedConnection); + QMetaObject::invokeMethod(m_pFileSysClient, "queryPluginList", Qt::QueuedConnection); } } diff --git a/src/gui/src/PluginWizardPage.h b/src/gui/src/PluginWizardPage.h index 95d4245a..65c7ea18 100644 --- a/src/gui/src/PluginWizardPage.h +++ b/src/gui/src/PluginWizardPage.h @@ -21,10 +21,11 @@ #include "AppConfig.h" #include "ui_PluginWizardPageBase.h" +#include "PluginManager.h" #include +class FileSysClient; class WebClient; -class PluginManager; class SslCertificate; class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage { @@ -49,12 +50,11 @@ protected slots: void showError(QString error); void updateStatus(QString info); void queryPluginDone(); - void updateDownloadStatus(); void finished(); void generateCertificate(); private: - void downloadPlugins(); + void copyPlugins(); void showFinished(); private: @@ -62,7 +62,8 @@ private: QString m_Email; QString m_Password; WebClient* m_pWebClient; - PluginManager* m_pPluginManager; + FileSysClient* m_pFileSysClient; + PluginManager m_PluginManager; SslCertificate* m_pSslCertificate; QThread* m_pThread; AppConfig& m_AppConfig; From e35fd80cef47fd7faf25030366d3326b4a31ac54 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Fri, 29 May 2015 16:20:47 -0700 Subject: [PATCH 04/18] Fixed name for Mac and Linux Build #4696 --- src/gui/src/Plugin.cpp | 4 ++-- src/gui/src/PluginManager.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/src/Plugin.cpp b/src/gui/src/Plugin.cpp index 4759e4e2..4c1729fb 100644 --- a/src/gui/src/Plugin.cpp +++ b/src/gui/src/Plugin.cpp @@ -73,9 +73,9 @@ QString Plugin::getOsSpecificName(const QString& pluginName) #if defined(Q_OS_WIN) result.append(getOsSpecificExt()); #elif defined(Q_OS_MAC) - result = kMacPluginPrefix + pluginName + getPluginOsSpecificExt(); + result = kMacPluginPrefix + pluginName + getOsSpecificExt(); #else - result = kLinuxPluginPrefix + pluginName + getPluginOsSpecificExt(); + result = kLinuxPluginPrefix + pluginName + getOsSpecificExt(); #endif return result; } diff --git a/src/gui/src/PluginManager.cpp b/src/gui/src/PluginManager.cpp index e73c93e6..371194a2 100644 --- a/src/gui/src/PluginManager.cpp +++ b/src/gui/src/PluginManager.cpp @@ -101,8 +101,10 @@ void PluginManager::copyPlugins() QString newName = destDirName; newName.append(QDir::separator()).append(m_FileSysPluginList.at(i)); + // Check to see if the plugin already exists QFile newFile(newName); if(newFile.exists()) { + // If it does, delete it. TODO: Check to see if same and leave newFile.remove(); } // make a copy of the plugin in the new location From 4bf1eeb0652df406b8469e88425db98f4270761f Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Fri, 29 May 2015 16:47:51 -0700 Subject: [PATCH 05/18] Removed unnecessary method and static data #4696 --- src/gui/src/Plugin.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/gui/src/Plugin.cpp b/src/gui/src/Plugin.cpp index 4c1729fb..d5ce909a 100644 --- a/src/gui/src/Plugin.cpp +++ b/src/gui/src/Plugin.cpp @@ -42,17 +42,14 @@ 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() @@ -83,8 +80,3 @@ QString Plugin::getOsSpecificName(const QString& pluginName) QString Plugin::getOsSpecificInstallerLocation() { return kInstallerPluginLocation; } - -QString Plugin::getOsSpecificUserLocation() { - return kUserPluginLocation; -} - From 98bb9b3fb3353b71e567ea50fb53090fa30b3b47 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Mon, 1 Jun 2015 16:43:27 -0700 Subject: [PATCH 06/18] Added getInstalledDir to ToolApp. #4696 --- src/lib/synergy/ArgParser.cpp | 4 ++++ src/lib/synergy/ToolApp.cpp | 5 ++++- src/lib/synergy/ToolArgs.cpp | 1 + src/lib/synergy/ToolArgs.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/synergy/ArgParser.cpp b/src/lib/synergy/ArgParser.cpp index a2021481..91a9c866 100644 --- a/src/lib/synergy/ArgParser.cpp +++ b/src/lib/synergy/ArgParser.cpp @@ -180,6 +180,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv) args.m_getPluginList = true; return true; } + else if (isArg(i, argc, argv, NULL, "--get-installed-dir", 0)) { + args.m_getInstalledDir = true; + return true; + } else if (isArg(i, argc, argv, NULL, "--get-plugin-dir", 0)) { args.m_getPluginDir = true; return true; diff --git a/src/lib/synergy/ToolApp.cpp b/src/lib/synergy/ToolApp.cpp index aa82fc88..ade16693 100644 --- a/src/lib/synergy/ToolApp.cpp +++ b/src/lib/synergy/ToolApp.cpp @@ -74,6 +74,9 @@ ToolApp::run(int argc, char** argv) else if (m_args.m_getPluginList) { getPluginList(); } + else if (m_args.m_getInstalledDir) { + std::cout << ARCH->getInstalledDirectory() << std::endl; + } else if (m_args.m_getPluginDir) { std::cout << ARCH->getPluginDirectory() << std::endl; } @@ -143,4 +146,4 @@ ToolApp::getPluginList() ss << "&password=" << password; std::cout << ARCH->internet().get(ss.str()) << std::endl; -} +} \ No newline at end of file diff --git a/src/lib/synergy/ToolArgs.cpp b/src/lib/synergy/ToolArgs.cpp index 5abd5476..8c3af4f1 100644 --- a/src/lib/synergy/ToolArgs.cpp +++ b/src/lib/synergy/ToolArgs.cpp @@ -22,6 +22,7 @@ ToolArgs::ToolArgs() : m_loginAuthenticate(false), m_getPluginList(false), m_getPluginDir(false), + m_getInstalledDir(false), m_getProfileDir(false) { } diff --git a/src/lib/synergy/ToolArgs.h b/src/lib/synergy/ToolArgs.h index c194c748..fe0d1bb9 100644 --- a/src/lib/synergy/ToolArgs.h +++ b/src/lib/synergy/ToolArgs.h @@ -28,6 +28,7 @@ public: bool m_loginAuthenticate; bool m_getPluginList; bool m_getPluginDir; + bool m_getInstalledDir; bool m_getProfileDir; bool m_getArch; }; From 5d770d420416bee66f40c21746891581449363a6 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Mon, 1 Jun 2015 16:43:57 -0700 Subject: [PATCH 07/18] Added getInstallDir to Core Interface #4696 --- src/gui/src/CoreInterface.cpp | 6 ++++++ src/gui/src/CoreInterface.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/gui/src/CoreInterface.cpp b/src/gui/src/CoreInterface.cpp index 0dea0ad6..3f1b666b 100644 --- a/src/gui/src/CoreInterface.cpp +++ b/src/gui/src/CoreInterface.cpp @@ -39,6 +39,12 @@ QString CoreInterface::getProfileDir() return run(args); } +QString CoreInterface::getInstalledDir() +{ + QStringList args("--get-installed-dir"); + return run(args); +} + QString CoreInterface::getArch() { QStringList args("--get-arch"); diff --git a/src/gui/src/CoreInterface.h b/src/gui/src/CoreInterface.h index 2c6a01ab..55d954c1 100644 --- a/src/gui/src/CoreInterface.h +++ b/src/gui/src/CoreInterface.h @@ -26,6 +26,7 @@ public: QString getPluginDir(); QString getProfileDir(); + QString getInstalledDir(); QString getArch(); QString run(const QStringList& args, const QString& input = ""); }; From 4a7fdabd658bb05b18601bef7e0bebed0684ae58 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Mon, 1 Jun 2015 16:46:33 -0700 Subject: [PATCH 08/18] Added Installed Dir to PluginManager #4696 --- src/gui/src/PluginManager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/src/PluginManager.h b/src/gui/src/PluginManager.h index f6bdb5e4..cb9ef4af 100644 --- a/src/gui/src/PluginManager.h +++ b/src/gui/src/PluginManager.h @@ -64,6 +64,7 @@ private: QStringList m_FileSysPluginList; QString m_PluginDir; QString m_ProfileDir; + QString m_InstalledDir; CoreInterface m_CoreInterface; SslCertificate m_SslCertificate; }; From c1158ea7f9c8a2c87eb58a67240da8859e5fb2f4 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Mon, 1 Jun 2015 16:48:12 -0700 Subject: [PATCH 09/18] Removed speaker and system hard coded locations from code #4696 Removed previously commended out code that is unnecessary #4696 --- src/gui/src/Plugin.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/gui/src/Plugin.cpp b/src/gui/src/Plugin.cpp index d5ce909a..e2555399 100644 --- a/src/gui/src/Plugin.cpp +++ b/src/gui/src/Plugin.cpp @@ -18,16 +18,6 @@ #include "Plugin.h" #include "CoreInterface.h" -//#include "CommandProcess.h" -//#include "DataDownloader.h" -//#include "QUtility.h" -//#include "ProcessorArch.h" -//#include "Fingerprint.h" - -//#include -//#include -//#include -//#include static const char kBaseUrl[] = "http://synergy-project.org/files"; static const char kDefaultVersion[] = "1.1"; @@ -41,15 +31,15 @@ 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 kInstallerPluginLocation[] = "Plugins"; #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 kInstallerPluginLocation[] = "plugins"; #else static const char kLinuxPluginPrefix[] = "lib"; static const char kLinuxPluginExt[] = ".so"; -static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins"; +static const char kInstallerPluginLocation[] = "plugins"; #endif QString Plugin::getOsSpecificExt() From e784b48711fc4185663749608b0197d43e470e1b Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Mon, 1 Jun 2015 16:50:05 -0700 Subject: [PATCH 10/18] Added use of Installed Dir for finding plugin install directory #4696 Fixed issues with file path creation #4696 --- src/gui/src/FileSysClient.cpp | 6 +++++- src/gui/src/PluginManager.cpp | 14 ++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/src/FileSysClient.cpp b/src/gui/src/FileSysClient.cpp index 53b759b9..439602cb 100644 --- a/src/gui/src/FileSysClient.cpp +++ b/src/gui/src/FileSysClient.cpp @@ -33,7 +33,11 @@ void FileSysClient::queryPluginList() QString extension = "*" + Plugin::getOsSpecificExt(); QStringList nameFilter(extension); - QString searchDirectory(Plugin::getOsSpecificInstallerLocation()); + QString installDir(m_CoreInterface.getInstalledDir() + .append(QDir::separator()) + .append(Plugin::getOsSpecificInstallerLocation())); + + QString searchDirectory(installDir); QDir directory(searchDirectory); diff --git a/src/gui/src/PluginManager.cpp b/src/gui/src/PluginManager.cpp index 371194a2..ee6e1011 100644 --- a/src/gui/src/PluginManager.cpp +++ b/src/gui/src/PluginManager.cpp @@ -49,6 +49,11 @@ void PluginManager::initFromFileSys(QStringList pluginList) if (m_ProfileDir.isEmpty()) { emit error(tr("Failed to get profile directory.")); } + + m_InstalledDir = m_CoreInterface.getInstalledDir(); + if (m_InstalledDir.isEmpty()) { + emit error(tr("Failed to get installed directory.")); + } } PluginManager::~PluginManager() @@ -77,7 +82,8 @@ void PluginManager::copyPlugins() try { // Get the Directory where plugins are put on installation // If it doesn't exist, there is nothing to do - QString srcDirName = Plugin::getOsSpecificInstallerLocation(); + QString srcDirName(m_InstalledDir.append(QDir::separator()) + .append(Plugin::getOsSpecificInstallerLocation())); QDir srcDir(srcDirName); if (!srcDir.exists()) { emit info( @@ -96,10 +102,10 @@ void PluginManager::copyPlugins() // 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)); + QFile file(srcDirName + QDir::separator() + m_FileSysPluginList.at(i)); + // construct the destination file name - QString newName = destDirName; - newName.append(QDir::separator()).append(m_FileSysPluginList.at(i)); + QString newName(destDirName + QDir::separator() + m_FileSysPluginList.at(i)); // Check to see if the plugin already exists QFile newFile(newName); From 0d237a07bc1dfa7fa41b77ba2c5ba237a056056b Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Mon, 1 Jun 2015 20:33:00 -0700 Subject: [PATCH 11/18] Updating installed dir for Linux and MacOS #4696 --- src/lib/arch/unix/ArchFileUnix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/arch/unix/ArchFileUnix.cpp b/src/lib/arch/unix/ArchFileUnix.cpp index e4f5afca..1e52ddd7 100644 --- a/src/lib/arch/unix/ArchFileUnix.cpp +++ b/src/lib/arch/unix/ArchFileUnix.cpp @@ -92,9 +92,9 @@ std::string ArchFileUnix::getInstalledDirectory() { #if WINAPI_XWINDOWS - return "/bin"; + return "/usr/bin"; #else - return ""; + return "/Applications/Synergy.app/Contents/MacOS/Synergy"; #endif } From 0061969cf249c1957c0b8e7114d763fbd1cdb3dd Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Tue, 2 Jun 2015 14:28:20 -0700 Subject: [PATCH 12/18] Updating installed dir for Linux and MacOS #4696 --- src/gui/src/Plugin.cpp | 5 +++-- src/lib/arch/unix/ArchFileUnix.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/src/Plugin.cpp b/src/gui/src/Plugin.cpp index e2555399..ebdc70ce 100644 --- a/src/gui/src/Plugin.cpp +++ b/src/gui/src/Plugin.cpp @@ -35,11 +35,12 @@ static const char kInstallerPluginLocation[] = "Plugins"; #elif defined(Q_OS_MAC) static const char kMacPluginPrefix[] = "lib"; static const char kMacPluginExt[] = ".dylib"; -static const char kInstallerPluginLocation[] = "plugins"; +static const char kInstallerPluginLocation[] = "plugins"; // TODO: Fix for mac #else static const char kLinuxPluginPrefix[] = "lib"; static const char kLinuxPluginExt[] = ".so"; -static const char kInstallerPluginLocation[] = "plugins"; +// /usr/bin becomes /usr/bin/../lib/syn... +static const char kInstallerPluginLocation[] = "../lib/synergy/plugins"; #endif QString Plugin::getOsSpecificExt() diff --git a/src/lib/arch/unix/ArchFileUnix.cpp b/src/lib/arch/unix/ArchFileUnix.cpp index e4f5afca..1e52ddd7 100644 --- a/src/lib/arch/unix/ArchFileUnix.cpp +++ b/src/lib/arch/unix/ArchFileUnix.cpp @@ -92,9 +92,9 @@ std::string ArchFileUnix::getInstalledDirectory() { #if WINAPI_XWINDOWS - return "/bin"; + return "/usr/bin"; #else - return ""; + return "/Applications/Synergy.app/Contents/MacOS/Synergy"; #endif } From ad9cfd64af4f8f15623069c3381f78d7db13a734 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Tue, 2 Jun 2015 14:29:01 -0700 Subject: [PATCH 13/18] Added symbolic link creation to linux and macos #4696 --- src/gui/src/PluginManager.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/src/PluginManager.cpp b/src/gui/src/PluginManager.cpp index ee6e1011..a30d0056 100644 --- a/src/gui/src/PluginManager.cpp +++ b/src/gui/src/PluginManager.cpp @@ -25,6 +25,8 @@ #include "Fingerprint.h" #include "Plugin.h" +#include + #include #include #include @@ -83,7 +85,8 @@ void PluginManager::copyPlugins() // Get the Directory where plugins are put on installation // If it doesn't exist, there is nothing to do QString srcDirName(m_InstalledDir.append(QDir::separator()) - .append(Plugin::getOsSpecificInstallerLocation())); + .append(Plugin::getOsSpecificInstallerLocation())); + QDir srcDir(srcDirName); if (!srcDir.exists()) { emit info( @@ -95,6 +98,7 @@ void PluginManager::copyPlugins() // 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("."); @@ -114,7 +118,11 @@ void PluginManager::copyPlugins() newFile.remove(); } // make a copy of the plugin in the new location + #if defined(Q_OS_WIN) bool result = file.copy(newName); + #else + bool result = file.link(newName); + #endif if ( !result ) { emit error( tr("Failed to copy plugin '%1' to: %2\n%3") @@ -133,9 +141,9 @@ void PluginManager::copyPlugins() } catch (std::exception& e) { - emit error(tr("An error occurred while trying to copy the " - "plugin list. Please contact the help desk, and " - "provide the following details.\n\n%1").arg(e.what())); + emit error(tr( "An error occurred while trying to copy the " + "plugin list. Please contact the help desk, and " + "provide the following details.\n\n%1").arg(e.what())); } emit copyFinished(); return; From 78f8fb45ba3d397109d255fb0ca1d8f159a54fa3 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Thu, 4 Jun 2015 09:58:22 -0700 Subject: [PATCH 14/18] Fixed Installed Directory in ARCH for MacOS #4696 --- src/lib/arch/unix/ArchFileUnix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/arch/unix/ArchFileUnix.cpp b/src/lib/arch/unix/ArchFileUnix.cpp index 1e52ddd7..71e9b5df 100644 --- a/src/lib/arch/unix/ArchFileUnix.cpp +++ b/src/lib/arch/unix/ArchFileUnix.cpp @@ -94,7 +94,7 @@ ArchFileUnix::getInstalledDirectory() #if WINAPI_XWINDOWS return "/usr/bin"; #else - return "/Applications/Synergy.app/Contents/MacOS/Synergy"; + return "/Applications/Synergy.app/Contents/MacOS"; #endif } From 88e5c6197d8679d190ccf29160527fad96c6c870 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Thu, 4 Jun 2015 14:06:17 -0700 Subject: [PATCH 15/18] Trivial whitespace fix cause by by editor settings --- src/gui/src/FileSysClient.cpp | 12 +++++------- src/gui/src/PluginWizardPage.h | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gui/src/FileSysClient.cpp b/src/gui/src/FileSysClient.cpp index 439602cb..61f09c57 100644 --- a/src/gui/src/FileSysClient.cpp +++ b/src/gui/src/FileSysClient.cpp @@ -34,22 +34,20 @@ void FileSysClient::queryPluginList() QStringList nameFilter(extension); QString installDir(m_CoreInterface.getInstalledDir() - .append(QDir::separator()) - .append(Plugin::getOsSpecificInstallerLocation())); + .append(QDir::separator()) + .append(Plugin::getOsSpecificInstallerLocation())); QString searchDirectory(installDir); - 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 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; diff --git a/src/gui/src/PluginWizardPage.h b/src/gui/src/PluginWizardPage.h index 65c7ea18..dbd834b7 100644 --- a/src/gui/src/PluginWizardPage.h +++ b/src/gui/src/PluginWizardPage.h @@ -30,11 +30,11 @@ class SslCertificate; class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage { - Q_OBJECT + Q_OBJECT public: PluginWizardPage(AppConfig& appConfig, QWidget *parent = 0); - ~PluginWizardPage(); + ~PluginWizardPage(); void setFinished(bool b) { m_Finished = b; } void setEmail(QString e) { m_Email = e; } @@ -44,7 +44,7 @@ public: void initializePage(); protected: - void changeEvent(QEvent *e); + void changeEvent(QEvent *e); protected slots: void showError(QString error); From f230ae734efdc07c2eeda5c5392a6d4eef685909 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Fri, 5 Jun 2015 11:20:31 -0700 Subject: [PATCH 16/18] Adding install of plugins for rpm based systems #4696 --- res/synergy.spec.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/res/synergy.spec.in b/res/synergy.spec.in index 3b35b6a1..b63daa6f 100644 --- a/res/synergy.spec.in +++ b/res/synergy.spec.in @@ -20,6 +20,7 @@ source=%{_topdir}/../.. mkdir -p %{buildroot}/%{_datarootdir}/applications mkdir -p %{buildroot}/%{_datarootdir}/icons mkdir -p %{buildroot}/%{_bindir} +mkdir -p %{buildroot}/%{_bindir}/../lib/synergy/plugins cp $source/bin/synergy %{buildroot}%{_bindir} cp $source/bin/synergyc %{buildroot}%{_bindir} @@ -28,6 +29,7 @@ cp $source/bin/synergyd %{buildroot}%{_bindir} cp $source/bin/syntool %{buildroot}%{_bindir} cp $source/res/synergy.desktop %{buildroot}%{_datarootdir}/applications cp $source/res/synergy.ico %{buildroot}%{_datarootdir}/icons +cp $source/bin/plugins/* %{buildroot}%{_bindir}/../lib/synergy/plugins %files %defattr(755,root,root,-) @@ -38,6 +40,7 @@ cp $source/res/synergy.ico %{buildroot}%{_datarootdir}/icons %{_bindir}/syntool %attr(644,-,-) %{_datarootdir}/applications/synergy.desktop %attr(644,-,-) %{_datarootdir}/icons/synergy.ico +%attr(644,-,-) %{_bindir}/../lib/synergy/plugins/* %changelog * Thu Mar 20 2014 Nick Bolton From 2db2ffac84cea46b8c279c80dad852c7ee631e72 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Fri, 5 Jun 2015 16:55:36 -0700 Subject: [PATCH 17/18] Adding Windows Plugins Directory to install #4696 --- src/setup/win32/Product.wxs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/setup/win32/Product.wxs b/src/setup/win32/Product.wxs index c93b4db6..6cdac1b2 100644 --- a/src/setup/win32/Product.wxs +++ b/src/setup/win32/Product.wxs @@ -27,6 +27,7 @@ + @@ -69,6 +70,7 @@ + @@ -130,5 +132,12 @@ + + + + + + + From 155a8b70c4a31154328d2f778eb407421b1c5f15 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Fri, 5 Jun 2015 17:07:47 -0700 Subject: [PATCH 18/18] Added version string to plugin and added to plugin loaded message --- src/lib/arch/win32/ArchPluginWindows.cpp | 7 ++++++- src/lib/plugin/ns/ns.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/arch/win32/ArchPluginWindows.cpp b/src/lib/arch/win32/ArchPluginWindows.cpp index ce814cf5..1f560e06 100644 --- a/src/lib/arch/win32/ArchPluginWindows.cpp +++ b/src/lib/arch/win32/ArchPluginWindows.cpp @@ -69,7 +69,12 @@ ArchPluginWindows::load() String filename = synergy::string::removeFileExt(*it); m_pluginTable.insert(std::make_pair(filename, lib)); - LOG((CLOG_DEBUG "loaded plugin: %s", (*it).c_str())); + char * version = (char*)invoke( filename.c_str(),"version",NULL); + if (version == NULL) { + version = "Pre-1.7.4"; + } + + LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(),version)); } } diff --git a/src/lib/plugin/ns/ns.cpp b/src/lib/plugin/ns/ns.cpp index f34e7faa..b2d8823d 100644 --- a/src/lib/plugin/ns/ns.cpp +++ b/src/lib/plugin/ns/ns.cpp @@ -24,6 +24,7 @@ #include +const char * kSynergyVers = VERSION; SecureSocket* g_secureSocket = NULL; SecureListenSocket* g_secureListenSocket = NULL; Arch* g_arch = NULL; @@ -86,6 +87,9 @@ invoke(const char* command, void** args) g_secureListenSocket = NULL; } } + else if(strcmp(command, "version") == 0) { + return (void*) kSynergyVers; + } return NULL; }