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/ZeroconfService.cpp \
|
||||
src/DataDownloader.cpp \
|
||||
src/AddClientDialog.cpp
|
||||
src/AddClientDialog.cpp \
|
||||
src/CommandProcess.cpp
|
||||
HEADERS += src/MainWindow.h \
|
||||
src/AboutDialog.h \
|
||||
src/ServerConfig.h \
|
||||
|
@ -84,7 +85,8 @@ HEADERS += src/MainWindow.h \
|
|||
src/ZeroconfBrowser.h \
|
||||
src/ZeroconfService.h \
|
||||
src/DataDownloader.h \
|
||||
src/AddClientDialog.h
|
||||
src/AddClientDialog.h \
|
||||
src/CommandProcess.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
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 "ZeroconfService.h"
|
||||
#include "DataDownloader.h"
|
||||
#include "CommandProcess.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
@ -973,15 +974,17 @@ void MainWindow::on_m_pButtonApply_clicked()
|
|||
|
||||
void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
|
||||
{
|
||||
if (!isBonjourRunning() && checked && !m_SuppressAutoConnectWarning) {
|
||||
int r = QMessageBox::information(
|
||||
this, tr("Synergy"),
|
||||
tr("Auto connect feature requires Bonjour.\n\n"
|
||||
"Do you want to install Bonjour?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (!isBonjourRunning() && checked) {
|
||||
if (!m_SuppressAutoConnectWarning) {
|
||||
int r = QMessageBox::information(
|
||||
this, tr("Synergy"),
|
||||
tr("Auto connect feature requires Bonjour.\n\n"
|
||||
"Do you want to install Bonjour?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (r == QMessageBox::Yes) {
|
||||
downloadBonjour();
|
||||
if (r == QMessageBox::Yes) {
|
||||
downloadBonjour();
|
||||
}
|
||||
}
|
||||
|
||||
m_pCheckBoxAutoConnect->setChecked(false);
|
||||
|
@ -1117,14 +1120,17 @@ void MainWindow::installBonjour()
|
|||
file.write(m_pDataDownloader->downloadedData());
|
||||
file.close();
|
||||
|
||||
QProcess process;
|
||||
QStringList arguments;
|
||||
arguments.append("/i");
|
||||
QString winFilename = QDir::toNativeSeparators(filename);
|
||||
arguments.append(winFilename);
|
||||
arguments.append("/passive");
|
||||
process.start("msiexec", arguments);
|
||||
process.waitForFinished();
|
||||
CommandProcess* cp = new CommandProcess("msiexec", arguments);
|
||||
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();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue