greyed out network security group when no plugin available #4168
This commit is contained in:
parent
6cf40afcd7
commit
81bb74a24b
|
@ -54,7 +54,8 @@ SOURCES += src/main.cpp \
|
||||||
src/CommandProcess.cpp \
|
src/CommandProcess.cpp \
|
||||||
src/WebClient.cpp \
|
src/WebClient.cpp \
|
||||||
src/PluginWizardPage.cpp \
|
src/PluginWizardPage.cpp \
|
||||||
src/PluginManager.cpp
|
src/PluginManager.cpp \
|
||||||
|
src/DirectoryManager.cpp
|
||||||
HEADERS += src/MainWindow.h \
|
HEADERS += src/MainWindow.h \
|
||||||
src/AboutDialog.h \
|
src/AboutDialog.h \
|
||||||
src/ServerConfig.h \
|
src/ServerConfig.h \
|
||||||
|
@ -95,7 +96,8 @@ HEADERS += src/MainWindow.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/DirectoryManager.h
|
||||||
RESOURCES += res/Synergy.qrc
|
RESOURCES += res/Synergy.qrc
|
||||||
RC_FILE = res/win/Synergy.rc
|
RC_FILE = res/win/Synergy.rc
|
||||||
macx {
|
macx {
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="m_pGroupCrypto">
|
<widget class="QGroupBox" name="m_pGroupNetworkSecurity">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* 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 COPYING 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 "DirectoryManager.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
static const char kGetPluginDirArg[] = "--get-plugin-dir";
|
||||||
|
static const char kGetProfileDirArg[] = "--get-profile-dir";
|
||||||
|
|
||||||
|
DirectoryManager::DirectoryManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DirectoryManager::getPluginDir()
|
||||||
|
{
|
||||||
|
QStringList args(kGetPluginDirArg);
|
||||||
|
return getDirViaSyntool(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DirectoryManager::getProfileDir()
|
||||||
|
{
|
||||||
|
QStringList args(kGetProfileDirArg);
|
||||||
|
return getDirViaSyntool(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DirectoryManager::getDirViaSyntool(QStringList& args)
|
||||||
|
{
|
||||||
|
QString program(QCoreApplication::applicationDirPath() + "/syntool");
|
||||||
|
|
||||||
|
QProcess process;
|
||||||
|
process.setReadChannel(QProcess::StandardOutput);
|
||||||
|
process.start(program, args);
|
||||||
|
bool success = process.waitForStarted();
|
||||||
|
|
||||||
|
QString out, error;
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
if (process.waitForFinished()) {
|
||||||
|
out = process.readAllStandardOutput();
|
||||||
|
error = process.readAllStandardError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.trimmed();
|
||||||
|
error = error.trimmed();
|
||||||
|
|
||||||
|
if (out.isEmpty() ||
|
||||||
|
!error.isEmpty() ||
|
||||||
|
!success ||
|
||||||
|
process.exitCode() != 0)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(
|
||||||
|
NULL, QObject::tr("Synergy"),
|
||||||
|
QObject::tr("An error occured while calling syntool "
|
||||||
|
"with the first arg %1. Code: %2\nError: %3")
|
||||||
|
.arg(args.at(0))
|
||||||
|
.arg(process.exitCode())
|
||||||
|
.arg(error.isEmpty() ? "Unknown" : error));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* 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 COPYING 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 DIRECTORYMANAGER_H
|
||||||
|
#define DIRECTORYMANAGER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
class DirectoryManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DirectoryManager();
|
||||||
|
|
||||||
|
static QString getPluginDir();
|
||||||
|
static QString getProfileDir();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static QString getDirViaSyntool(QStringList& args);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIRECTORYMANAGER_H
|
|
@ -17,19 +17,14 @@
|
||||||
|
|
||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
|
|
||||||
|
#include "DirectoryManager.h"
|
||||||
#include "CommandProcess.h"
|
#include "CommandProcess.h"
|
||||||
#include "DataDownloader.h"
|
#include "DataDownloader.h"
|
||||||
#include "QUtility.h"
|
#include "QUtility.h"
|
||||||
#include "ProcessorArch.h"
|
#include "ProcessorArch.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
static const char kGetPluginDirArg[] = "--get-plugin-dir";
|
|
||||||
static const char kGetProfileDirArg[] = "--get-profile-dir";
|
|
||||||
|
|
||||||
static QString kPluginsBaseUrl = "http://synergy-project.org/files/plugins/";
|
static QString kPluginsBaseUrl = "http://synergy-project.org/files/plugins/";
|
||||||
static const char kWinProcessorArch32[] = "Windows-x86";
|
static const char kWinProcessorArch32[] = "Windows-x86";
|
||||||
|
@ -61,14 +56,12 @@ PluginManager::PluginManager(QStringList pluginList) :
|
||||||
m_DownloadIndex(-1),
|
m_DownloadIndex(-1),
|
||||||
m_pPluginDownloader(NULL)
|
m_pPluginDownloader(NULL)
|
||||||
{
|
{
|
||||||
QStringList args1(kGetPluginDirArg);
|
m_PluginDir = DirectoryManager::getPluginDir();
|
||||||
m_PluginDir = getDirViaSyntool(args1);
|
|
||||||
if (m_PluginDir.isEmpty()) {
|
if (m_PluginDir.isEmpty()) {
|
||||||
emit error(tr("Failed to get plugin directory."));
|
emit error(tr("Failed to get plugin directory."));
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList args2(kGetProfileDirArg);
|
m_ProfileDir = DirectoryManager::getProfileDir();
|
||||||
m_ProfileDir = getDirViaSyntool(args2);
|
|
||||||
if (m_ProfileDir.isEmpty()) {
|
if (m_ProfileDir.isEmpty()) {
|
||||||
emit error(tr("Failed to get profile directory."));
|
emit error(tr("Failed to get profile directory."));
|
||||||
}
|
}
|
||||||
|
@ -177,46 +170,6 @@ void PluginManager::savePlugin()
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString PluginManager::getDirViaSyntool(QStringList& args)
|
|
||||||
{
|
|
||||||
QString program(QCoreApplication::applicationDirPath() + "/syntool");
|
|
||||||
|
|
||||||
QProcess process;
|
|
||||||
process.setReadChannel(QProcess::StandardOutput);
|
|
||||||
process.start(program, args);
|
|
||||||
bool success = process.waitForStarted();
|
|
||||||
|
|
||||||
QString out, error;
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
if (process.waitForFinished()) {
|
|
||||||
out = process.readAllStandardOutput();
|
|
||||||
error = process.readAllStandardError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out = out.trimmed();
|
|
||||||
error = error.trimmed();
|
|
||||||
|
|
||||||
if (out.isEmpty() ||
|
|
||||||
!error.isEmpty() ||
|
|
||||||
!success ||
|
|
||||||
process.exitCode() != 0)
|
|
||||||
{
|
|
||||||
QMessageBox::critical(
|
|
||||||
(QWidget*)parent(), tr("Synergy"),
|
|
||||||
tr("An error occured while calling syntool "
|
|
||||||
"with the first arg %1. Code: %2\nError: %3")
|
|
||||||
.arg(args.at(0))
|
|
||||||
.arg(process.exitCode())
|
|
||||||
.arg(error.isEmpty() ? "Unknown" : error));
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PluginManager::getPluginUrl(const QString& pluginName)
|
QString PluginManager::getPluginUrl(const QString& pluginName)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
|
|
|
@ -42,7 +42,6 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void savePlugin();
|
void savePlugin();
|
||||||
QString getDirViaSyntool(QStringList& args);
|
|
||||||
QString getPluginUrl(const QString& pluginName);
|
QString getPluginUrl(const QString& pluginName);
|
||||||
QString getOpenSSLBinaryUrl();
|
QString getOpenSSLBinaryUrl();
|
||||||
QString getPluginOSSpecificName(const QString& pluginName);
|
QString getPluginOSSpecificName(const QString& pluginName);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SettingsDialog.h"
|
#include "SettingsDialog.h"
|
||||||
|
|
||||||
|
#include "DirectoryManager.h"
|
||||||
#include "SynergyLocale.h"
|
#include "SynergyLocale.h"
|
||||||
#include "QSynergyApplication.h"
|
#include "QSynergyApplication.h"
|
||||||
#include "QUtility.h"
|
#include "QUtility.h"
|
||||||
|
@ -26,6 +28,7 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||||
|
@ -54,7 +57,16 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
m_pCheckBoxElevateMode->hide();
|
m_pCheckBoxElevateMode->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QString pluginDir = DirectoryManager::getPluginDir();
|
||||||
|
QDir dir(pluginDir);
|
||||||
|
int fileNum = dir.entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries).count();
|
||||||
|
if (fileNum == 0) {
|
||||||
|
m_pGroupNetworkSecurity->setEnabled(false);
|
||||||
|
m_pCheckBoxEnableCrypto->setChecked(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
m_pCheckBoxEnableCrypto->setChecked(m_AppConfig.getCryptoEnabled());
|
m_pCheckBoxEnableCrypto->setChecked(m_AppConfig.getCryptoEnabled());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::accept()
|
void SettingsDialog::accept()
|
||||||
|
|
Loading…
Reference in New Issue