Made Bonjour install in another thread #4235
This commit is contained in:
parent
af4817d075
commit
a0cc3d6e7f
|
@ -49,7 +49,8 @@ SOURCES += src/main.cpp \
|
||||||
src/ZeroconfBrowser.cpp \
|
src/ZeroconfBrowser.cpp \
|
||||||
src/ZeroconfService.cpp \
|
src/ZeroconfService.cpp \
|
||||||
src/DataDownloader.cpp \
|
src/DataDownloader.cpp \
|
||||||
src/AddClientDialog.cpp
|
src/AddClientDialog.cpp \
|
||||||
|
src/CommandProcess.cpp
|
||||||
HEADERS += src/MainWindow.h \
|
HEADERS += src/MainWindow.h \
|
||||||
src/AboutDialog.h \
|
src/AboutDialog.h \
|
||||||
src/ServerConfig.h \
|
src/ServerConfig.h \
|
||||||
|
@ -84,7 +85,8 @@ HEADERS += src/MainWindow.h \
|
||||||
src/ZeroconfBrowser.h \
|
src/ZeroconfBrowser.h \
|
||||||
src/ZeroconfService.h \
|
src/ZeroconfService.h \
|
||||||
src/DataDownloader.h \
|
src/DataDownloader.h \
|
||||||
src/AddClientDialog.h
|
src/AddClientDialog.h \
|
||||||
|
src/CommandProcess.h
|
||||||
RESOURCES += res/Synergy.qrc
|
RESOURCES += res/Synergy.qrc
|
||||||
RC_FILE = res/win/Synergy.rc
|
RC_FILE = res/win/Synergy.rc
|
||||||
macx {
|
macx {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2014 Synergy Si, Inc.
|
||||||
|
*
|
||||||
|
* 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 "CommandProcess.h"
|
||||||
|
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
CommandProcess::CommandProcess(QString cmd, QStringList arguments) :
|
||||||
|
m_Command(cmd),
|
||||||
|
m_Arguments(arguments)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandProcess::run()
|
||||||
|
{
|
||||||
|
QProcess process;
|
||||||
|
process.start(m_Command, m_Arguments);
|
||||||
|
process.waitForFinished();
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2014 Synergy Si, Inc.
|
||||||
|
*
|
||||||
|
* 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 COMMANDTHREAD_H
|
||||||
|
#define COMMANDTHREAD_H
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
class CommandProcess : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CommandProcess(QString cmd, QStringList arguments);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_Command;
|
||||||
|
QStringList m_Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMMANDTHREAD_H
|
|
@ -27,6 +27,7 @@
|
||||||
#include "SetupWizard.h"
|
#include "SetupWizard.h"
|
||||||
#include "ZeroconfService.h"
|
#include "ZeroconfService.h"
|
||||||
#include "DataDownloader.h"
|
#include "DataDownloader.h"
|
||||||
|
#include "CommandProcess.h"
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
@ -973,7 +974,8 @@ void MainWindow::on_m_pButtonApply_clicked()
|
||||||
|
|
||||||
void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
|
void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (!isBonjourRunning() && checked && !m_SuppressAutoConnectWarning) {
|
if (!isBonjourRunning() && checked) {
|
||||||
|
if (!m_SuppressAutoConnectWarning) {
|
||||||
int r = QMessageBox::information(
|
int r = QMessageBox::information(
|
||||||
this, tr("Synergy"),
|
this, tr("Synergy"),
|
||||||
tr("Auto connect feature requires Bonjour.\n\n"
|
tr("Auto connect feature requires Bonjour.\n\n"
|
||||||
|
@ -983,6 +985,7 @@ void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
|
||||||
if (r == QMessageBox::Yes) {
|
if (r == QMessageBox::Yes) {
|
||||||
downloadBonjour();
|
downloadBonjour();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_pCheckBoxAutoConnect->setChecked(false);
|
m_pCheckBoxAutoConnect->setChecked(false);
|
||||||
return;
|
return;
|
||||||
|
@ -1117,14 +1120,17 @@ void MainWindow::installBonjour()
|
||||||
file.write(m_pDataDownloader->downloadedData());
|
file.write(m_pDataDownloader->downloadedData());
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
QProcess process;
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments.append("/i");
|
arguments.append("/i");
|
||||||
QString winFilename = QDir::toNativeSeparators(filename);
|
QString winFilename = QDir::toNativeSeparators(filename);
|
||||||
arguments.append(winFilename);
|
arguments.append(winFilename);
|
||||||
arguments.append("/passive");
|
arguments.append("/passive");
|
||||||
process.start("msiexec", arguments);
|
CommandProcess* cp = new CommandProcess("msiexec", arguments);
|
||||||
process.waitForFinished();
|
QThread* thread = new QThread;
|
||||||
|
cp->moveToThread(thread);
|
||||||
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
thread->start();
|
||||||
|
QMetaObject::invokeMethod(cp, "run", Qt::QueuedConnection);
|
||||||
|
|
||||||
m_DownloadMessageBox->hide();
|
m_DownloadMessageBox->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue