Merge branch '4696' of github.com:synergy/synergy into 4696
This commit is contained in:
commit
d215c49966
|
@ -39,6 +39,12 @@ QString CoreInterface::getProfileDir()
|
||||||
return run(args);
|
return run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CoreInterface::getInstalledDir()
|
||||||
|
{
|
||||||
|
QStringList args("--get-installed-dir");
|
||||||
|
return run(args);
|
||||||
|
}
|
||||||
|
|
||||||
QString CoreInterface::getArch()
|
QString CoreInterface::getArch()
|
||||||
{
|
{
|
||||||
QStringList args("--get-arch");
|
QStringList args("--get-arch");
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
|
|
||||||
QString getPluginDir();
|
QString getPluginDir();
|
||||||
QString getProfileDir();
|
QString getProfileDir();
|
||||||
|
QString getInstalledDir();
|
||||||
QString getArch();
|
QString getArch();
|
||||||
QString run(const QStringList& args, const QString& input = "");
|
QString run(const QStringList& args, const QString& input = "");
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,11 @@ void FileSysClient::queryPluginList()
|
||||||
QString extension = "*" + Plugin::getOsSpecificExt();
|
QString extension = "*" + Plugin::getOsSpecificExt();
|
||||||
QStringList nameFilter(extension);
|
QStringList nameFilter(extension);
|
||||||
|
|
||||||
QString searchDirectory(Plugin::getOsSpecificInstallerLocation());
|
QString installDir(m_CoreInterface.getInstalledDir()
|
||||||
|
.append(QDir::separator())
|
||||||
|
.append(Plugin::getOsSpecificInstallerLocation()));
|
||||||
|
|
||||||
|
QString searchDirectory(installDir);
|
||||||
|
|
||||||
QDir directory(searchDirectory);
|
QDir directory(searchDirectory);
|
||||||
|
|
||||||
|
|
|
@ -18,16 +18,6 @@
|
||||||
#include "Plugin.h"
|
#include "Plugin.h"
|
||||||
|
|
||||||
#include "CoreInterface.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 kBaseUrl[] = "http://synergy-project.org/files";
|
||||||
static const char kDefaultVersion[] = "1.1";
|
static const char kDefaultVersion[] = "1.1";
|
||||||
|
@ -41,18 +31,15 @@ static const char kLinuxPackagePlatformRpm64[] = "Linux-x86_64-rpm";
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
static const char kWinPluginExt[] = ".dll";
|
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";
|
||||||
static const char kUserPluginLocation[] = "C:/Users/speaker/AppData/Local/Synergy/Plugins";//TODO: needs proper windows %X% notation
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
static const char kMacPluginPrefix[] = "lib";
|
static const char kMacPluginPrefix[] = "lib";
|
||||||
static const char kMacPluginExt[] = ".dylib";
|
static const char kMacPluginExt[] = ".dylib";
|
||||||
static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins";
|
static const char kInstallerPluginLocation[] = "plugins";
|
||||||
static const char kUserPluginLocation[] = "/home/speaker/.synergy/plugins";//TODO: needs proper unix notation
|
|
||||||
#else
|
#else
|
||||||
static const char kLinuxPluginPrefix[] = "lib";
|
static const char kLinuxPluginPrefix[] = "lib";
|
||||||
static const char kLinuxPluginExt[] = ".so";
|
static const char kLinuxPluginExt[] = ".so";
|
||||||
static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins";
|
static const char kInstallerPluginLocation[] = "plugins";
|
||||||
static const char kUserPluginLocation[] = "/home/speaker/.synergy/plugins";//TODO: needs proper MacOS X notation
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString Plugin::getOsSpecificExt()
|
QString Plugin::getOsSpecificExt()
|
||||||
|
@ -83,8 +70,3 @@ QString Plugin::getOsSpecificName(const QString& pluginName)
|
||||||
QString Plugin::getOsSpecificInstallerLocation() {
|
QString Plugin::getOsSpecificInstallerLocation() {
|
||||||
return kInstallerPluginLocation;
|
return kInstallerPluginLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Plugin::getOsSpecificUserLocation() {
|
|
||||||
return kUserPluginLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,11 @@ void PluginManager::initFromFileSys(QStringList pluginList)
|
||||||
if (m_ProfileDir.isEmpty()) {
|
if (m_ProfileDir.isEmpty()) {
|
||||||
emit error(tr("Failed to get profile directory."));
|
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()
|
PluginManager::~PluginManager()
|
||||||
|
@ -77,7 +82,8 @@ void PluginManager::copyPlugins()
|
||||||
try {
|
try {
|
||||||
// Get the Directory where plugins are put on installation
|
// Get the Directory where plugins are put on installation
|
||||||
// If it doesn't exist, there is nothing to do
|
// 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);
|
QDir srcDir(srcDirName);
|
||||||
if (!srcDir.exists()) {
|
if (!srcDir.exists()) {
|
||||||
emit info(
|
emit info(
|
||||||
|
@ -96,10 +102,10 @@ void PluginManager::copyPlugins()
|
||||||
// Run through the list of plugins and copy them
|
// Run through the list of plugins and copy them
|
||||||
for ( int i = 0 ; i < m_FileSysPluginList.size() ; i++ ) {
|
for ( int i = 0 ; i < m_FileSysPluginList.size() ; i++ ) {
|
||||||
// Get a file entry for the plugin using the full path
|
// 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
|
// construct the destination file name
|
||||||
QString newName = destDirName;
|
QString newName(destDirName + QDir::separator() + m_FileSysPluginList.at(i));
|
||||||
newName.append(QDir::separator()).append(m_FileSysPluginList.at(i));
|
|
||||||
|
|
||||||
// Check to see if the plugin already exists
|
// Check to see if the plugin already exists
|
||||||
QFile newFile(newName);
|
QFile newFile(newName);
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
QStringList m_FileSysPluginList;
|
QStringList m_FileSysPluginList;
|
||||||
QString m_PluginDir;
|
QString m_PluginDir;
|
||||||
QString m_ProfileDir;
|
QString m_ProfileDir;
|
||||||
|
QString m_InstalledDir;
|
||||||
CoreInterface m_CoreInterface;
|
CoreInterface m_CoreInterface;
|
||||||
SslCertificate m_SslCertificate;
|
SslCertificate m_SslCertificate;
|
||||||
};
|
};
|
||||||
|
|
|
@ -180,6 +180,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
|
||||||
args.m_getPluginList = true;
|
args.m_getPluginList = true;
|
||||||
return 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)) {
|
else if (isArg(i, argc, argv, NULL, "--get-plugin-dir", 0)) {
|
||||||
args.m_getPluginDir = true;
|
args.m_getPluginDir = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -74,6 +74,9 @@ ToolApp::run(int argc, char** argv)
|
||||||
else if (m_args.m_getPluginList) {
|
else if (m_args.m_getPluginList) {
|
||||||
getPluginList();
|
getPluginList();
|
||||||
}
|
}
|
||||||
|
else if (m_args.m_getInstalledDir) {
|
||||||
|
std::cout << ARCH->getInstalledDirectory() << std::endl;
|
||||||
|
}
|
||||||
else if (m_args.m_getPluginDir) {
|
else if (m_args.m_getPluginDir) {
|
||||||
std::cout << ARCH->getPluginDirectory() << std::endl;
|
std::cout << ARCH->getPluginDirectory() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ ToolArgs::ToolArgs() :
|
||||||
m_loginAuthenticate(false),
|
m_loginAuthenticate(false),
|
||||||
m_getPluginList(false),
|
m_getPluginList(false),
|
||||||
m_getPluginDir(false),
|
m_getPluginDir(false),
|
||||||
|
m_getInstalledDir(false),
|
||||||
m_getProfileDir(false)
|
m_getProfileDir(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
bool m_loginAuthenticate;
|
bool m_loginAuthenticate;
|
||||||
bool m_getPluginList;
|
bool m_getPluginList;
|
||||||
bool m_getPluginDir;
|
bool m_getPluginDir;
|
||||||
|
bool m_getInstalledDir;
|
||||||
bool m_getProfileDir;
|
bool m_getProfileDir;
|
||||||
bool m_getArch;
|
bool m_getArch;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue