diff --git a/src/gui/src/FileSysClient.cpp b/src/gui/src/FileSysClient.cpp
deleted file mode 100644
index 61f09c57..00000000
--- a/src/gui/src/FileSysClient.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 installDir(m_CoreInterface.getInstalledDir()
- .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 queryPluginDone();
- return;
-}
diff --git a/src/gui/src/FileSysClient.h b/src/gui/src/FileSysClient.h
deleted file mode 100644
index dfe7ee95..00000000
--- a/src/gui/src/FileSysClient.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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/PluginManager.cpp b/src/gui/src/PluginManager.cpp
index 92b9f910..a39fef0b 100644
--- a/src/gui/src/PluginManager.cpp
+++ b/src/gui/src/PluginManager.cpp
@@ -35,15 +35,17 @@
PluginManager::PluginManager() :
- m_FileSysPluginList()
+ m_PluginList()
+{
+ init();
+}
+
+PluginManager::~PluginManager()
{
}
-void PluginManager::initFromFileSys(QStringList pluginList)
+void PluginManager::init()
{
- m_FileSysPluginList.clear();
- m_FileSysPluginList.append(pluginList);
-
m_PluginDir = m_CoreInterface.getPluginDir();
if (m_PluginDir.isEmpty()) {
emit error(tr("Failed to get plugin directory."));
@@ -60,10 +62,6 @@ void PluginManager::initFromFileSys(QStringList pluginList)
}
}
-PluginManager::~PluginManager()
-{
-}
-
bool PluginManager::exist(QString name)
{
CoreInterface coreInterface;
@@ -106,12 +104,12 @@ void PluginManager::copyPlugins()
destDir.mkpath(".");
}
// Run through the list of plugins and copy them
- for ( int i = 0 ; i < m_FileSysPluginList.size() ; i++ ) {
+ for ( int i = 0 ; i < m_PluginList.size() ; i++ ) {
// Get a file entry for the plugin using the full path
- QFile file(srcDirName + QDir::separator() + m_FileSysPluginList.at(i));
+ QFile file(srcDirName + QDir::separator() + m_PluginList.at(i));
// construct the destination file name
- QString newName(destDirName + QDir::separator() + m_FileSysPluginList.at(i));
+ QString newName(destDirName + QDir::separator() + m_PluginList.at(i));
// Check to see if the plugin already exists
QFile newFile(newName);
@@ -136,7 +134,7 @@ void PluginManager::copyPlugins()
emit error(
tr("Failed to copy plugin '%1' to: %2\n%3\n"
"Please stop synergy and run the wizard again.")
- .arg(m_FileSysPluginList.at(i))
+ .arg(m_PluginList.at(i))
.arg(newName)
.arg(file.errorString()));
return;
@@ -144,9 +142,9 @@ void PluginManager::copyPlugins()
else {
emit info(
tr("Copying '%1' plugin (%2/%3)...")
- .arg(m_FileSysPluginList.at(i))
+ .arg(m_PluginList.at(i))
.arg(i+1)
- .arg(m_FileSysPluginList.size()));
+ .arg(m_PluginList.size()));
}
}
}
@@ -160,3 +158,30 @@ void PluginManager::copyPlugins()
emit copyFinished();
return;
}
+
+void PluginManager::queryPluginList()
+{
+ try {
+ setDone(false);
+ QString extension = "*" + Plugin::getOsSpecificExt();
+ QStringList nameFilter(extension);
+
+ QString installDir(m_CoreInterface.getInstalledDir()
+ .append(QDir::separator())
+ .append(Plugin::getOsSpecificInstallerLocation()));
+
+ QString searchDirectory(installDir);
+ QDir directory(searchDirectory);
+ m_PluginList = directory.entryList(nameFilter);
+ setDone(true);
+ }
+ catch (std::exception& e)
+ {
+ setDone(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/PluginManager.h b/src/gui/src/PluginManager.h
index cb9ef4af..39715309 100644
--- a/src/gui/src/PluginManager.h
+++ b/src/gui/src/PluginManager.h
@@ -35,15 +35,18 @@ public:
PluginManager();
~PluginManager();
- void initFromWeb(QStringList pluginList);
- void initFromFileSys(QStringList pluginList);
+ void init();
- int pluginCount() { return m_FileSysPluginList.count(); }
+ int pluginCount() { return m_PluginList.count(); }
+ QStringList& getPluginList() { return m_PluginList; }
+ bool isDone() { return done; }
+ void setDone(bool b) { done = b; }
static bool exist(QString name);
public slots:
void copyPlugins();
+ void queryPluginList();
private:
QString getPluginUrl(const QString& pluginName);
@@ -59,14 +62,16 @@ signals:
void info(QString i);
void updateCopyStatus(int);
void copyFinished();
+ void queryPluginDone();
private:
- QStringList m_FileSysPluginList;
+ QStringList m_PluginList;
QString m_PluginDir;
QString m_ProfileDir;
QString m_InstalledDir;
CoreInterface m_CoreInterface;
SslCertificate m_SslCertificate;
+ bool done;
};
#endif // PLUGINMANAGER_H
diff --git a/src/gui/src/PluginWizardPage.cpp b/src/gui/src/PluginWizardPage.cpp
index 26da661f..22c2da25 100644
--- a/src/gui/src/PluginWizardPage.cpp
+++ b/src/gui/src/PluginWizardPage.cpp
@@ -64,15 +64,57 @@ void PluginWizardPage::changeEvent(QEvent *e)
}
}
-void PluginWizardPage::showError(QString error)
+void PluginWizardPage::initializePage()
{
- updateStatus(tr("Error: %1").arg(error));
- showFinished();
+ QWizardPage::initializePage();
+
+ if (m_Email.isEmpty() ||
+ m_Password.isEmpty()) {
+ updateStatus(tr("Setup complete."));
+ showFinished();
+ return;
+ }
+
+ m_pLabelSpinning->show();
+
+ QThread* thread = new QThread;
+
+ connect(&m_PluginManager,
+ SIGNAL(error(QString)),
+ this,
+ SLOT(showError(QString)));
+
+ connect(&m_PluginManager,
+ SIGNAL(info(QString)),
+ this,
+ SLOT(updateStatus(QString)));
+
+ connect(&m_PluginManager,
+ SIGNAL(queryPluginDone()),
+ this,
+ SLOT(queryPluginDone()));
+
+ connect(&m_PluginManager,
+ SIGNAL(queryPluginDone()),
+ thread,
+ SLOT(quit()));
+
+ connect(&m_PluginManager,
+ SIGNAL(error(QString)),
+ thread,
+ SLOT(quit()));
+
+ connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
+
+ m_PluginManager.moveToThread(thread);
+ thread->start();
+
+ QMetaObject::invokeMethod(&m_PluginManager, "queryPluginList", Qt::QueuedConnection);
}
void PluginWizardPage::queryPluginDone()
{
- QStringList pluginList = m_pFileSysClient->getPluginList();
+ QStringList pluginList = m_PluginManager.getPluginList();
if (pluginList.isEmpty()) {
updateStatus(tr("Setup complete."));
showFinished();
@@ -84,57 +126,10 @@ void PluginWizardPage::queryPluginDone()
}
}
-void PluginWizardPage::finished()
-{
- // TODO: we should check if ns plugin exists
- m_mainWindow.appConfig().setCryptoEnabled(true);
-
- updateStatus(tr("Plugins installed successfully."));
- showFinished();
-}
-
-void PluginWizardPage::generateCertificate()
-{
- connect(m_pSslCertificate,
- SIGNAL(generateFinished()),
- this,
- SLOT(finished()));
-
- connect(m_pSslCertificate,
- SIGNAL(generateFinished()),
- m_pThread,
- SLOT(quit()));
-
- updateStatus(tr("Generating SSL certificate..."));
-
- QMetaObject::invokeMethod(
- m_pSslCertificate,
- "generateCertificate",
- Qt::QueuedConnection);
-}
-
-void PluginWizardPage::updateStatus(QString info)
-{
- m_pLabelStatus->setText(info);
-}
-
void PluginWizardPage::copyPlugins()
{
- QStringList pluginList = m_pFileSysClient->getPluginList();
- m_PluginManager.initFromFileSys(pluginList);
-
m_pThread = new QThread;
- connect(&m_PluginManager,
- SIGNAL(error(QString)),
- this,
- SLOT(showError(QString)));
-
- connect(&m_PluginManager,
- SIGNAL(info(QString)),
- this,
- SLOT(updateStatus(QString)));
-
connect(&m_PluginManager,
SIGNAL(copyFinished()),
this,
@@ -162,6 +157,47 @@ void PluginWizardPage::copyPlugins()
Qt::QueuedConnection);
}
+void PluginWizardPage::generateCertificate()
+{
+ connect(m_pSslCertificate,
+ SIGNAL(generateFinished()),
+ this,
+ SLOT(finished()));
+
+ connect(m_pSslCertificate,
+ SIGNAL(generateFinished()),
+ m_pThread,
+ SLOT(quit()));
+
+ updateStatus(tr("Generating SSL certificate..."));
+
+ QMetaObject::invokeMethod(
+ m_pSslCertificate,
+ "generateCertificate",
+ Qt::QueuedConnection);
+}
+
+void PluginWizardPage::showError(QString error)
+{
+ updateStatus(tr("Error: %1").arg(error));
+ showFinished();
+}
+
+
+void PluginWizardPage::updateStatus(QString info)
+{
+ m_pLabelStatus->setText(info);
+}
+
+void PluginWizardPage::finished()
+{
+ // TODO: we should check if ns plugin exists
+ m_mainWindow.appConfig().setCryptoEnabled(true);
+
+ updateStatus(tr("Plugins installed successfully."));
+ showFinished();
+}
+
void PluginWizardPage::showFinished()
{
m_pLabelSpinning->hide();
@@ -173,50 +209,3 @@ bool PluginWizardPage::isComplete() const
{
return m_Finished;
}
-
-void PluginWizardPage::initializePage()
-{
- QWizardPage::initializePage();
-
- if (m_Email.isEmpty() ||
- m_Password.isEmpty()) {
- updateStatus(tr("Setup complete."));
- showFinished();
- return;
- }
-
- if (m_pFileSysClient == NULL) {
- m_pFileSysClient = new FileSysClient();
-
- m_pLabelSpinning->show();
-
- QThread* thread = new QThread;
-
- connect(m_pFileSysClient,
- SIGNAL(error(QString)),
- this,
- SLOT(showError(QString)));
-
- connect(m_pFileSysClient,
- SIGNAL(queryPluginDone()),
- this,
- SLOT(queryPluginDone()));
-
- connect(m_pFileSysClient,
- SIGNAL(queryPluginDone()),
- thread,
- SLOT(quit()));
-
- connect(m_pFileSysClient,
- SIGNAL(error(QString)),
- thread,
- SLOT(quit()));
-
- connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
-
- m_pFileSysClient->moveToThread(thread);
- thread->start();
-
- QMetaObject::invokeMethod(m_pFileSysClient, "queryPluginList", Qt::QueuedConnection);
- }
-}
diff --git a/src/gui/src/PluginWizardPage.h b/src/gui/src/PluginWizardPage.h
index d8cef4cc..140c8e6d 100644
--- a/src/gui/src/PluginWizardPage.h
+++ b/src/gui/src/PluginWizardPage.h
@@ -50,8 +50,8 @@ protected slots:
void showError(QString error);
void updateStatus(QString info);
void queryPluginDone();
- void finished();
void generateCertificate();
+ void finished();
private:
void copyPlugins();