Move notify into thread #4932
This commit is contained in:
parent
e1e38bd3a2
commit
4be852c2f2
|
@ -62,7 +62,8 @@ SOURCES += src/main.cpp \
|
||||||
src/Plugin.cpp \
|
src/Plugin.cpp \
|
||||||
src/WebClient.cpp \
|
src/WebClient.cpp \
|
||||||
../lib/common/PluginVersion.cpp \
|
../lib/common/PluginVersion.cpp \
|
||||||
src/SubscriptionManager.cpp
|
src/SubscriptionManager.cpp \
|
||||||
|
src/ActivationNotifier.cpp
|
||||||
HEADERS += src/MainWindow.h \
|
HEADERS += src/MainWindow.h \
|
||||||
src/AboutDialog.h \
|
src/AboutDialog.h \
|
||||||
src/ServerConfig.h \
|
src/ServerConfig.h \
|
||||||
|
@ -109,7 +110,8 @@ HEADERS += src/MainWindow.h \
|
||||||
src/Plugin.h \
|
src/Plugin.h \
|
||||||
src/WebClient.h \
|
src/WebClient.h \
|
||||||
../lib/common/PluginVersion.h \
|
../lib/common/PluginVersion.h \
|
||||||
src/SubscriptionManager.h
|
src/SubscriptionManager.h \
|
||||||
|
src/ActivationNotifier.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,36 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2015 Synergy Seamless 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 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ActivationNotifier.h"
|
||||||
|
|
||||||
|
#include "CoreInterface.h"
|
||||||
|
|
||||||
|
ActivationNotifier::ActivationNotifier(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActivationNotifier::setIdentity(QString identity)
|
||||||
|
{
|
||||||
|
m_Identity = identity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActivationNotifier::notify()
|
||||||
|
{
|
||||||
|
CoreInterface coreInterface;
|
||||||
|
coreInterface.notifyActivation(m_Identity);
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2015 Synergy Seamless 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 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ACTIVATIONNOTIFIER_H
|
||||||
|
#define ACTIVATIONNOTIFIER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class ActivationNotifier : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ActivationNotifier(QObject *parent = 0);
|
||||||
|
|
||||||
|
void setIdentity(QString identity);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void notify();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void finished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_Identity;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ACTIVATIONNOTIFIER_H
|
|
@ -18,6 +18,7 @@
|
||||||
#include "SetupWizard.h"
|
#include "SetupWizard.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "WebClient.h"
|
#include "WebClient.h"
|
||||||
|
#include "ActivationNotifier.h"
|
||||||
#include "SubscriptionManager.h"
|
#include "SubscriptionManager.h"
|
||||||
#include "EditionType.h"
|
#include "EditionType.h"
|
||||||
#include "QSynergyApplication.h"
|
#include "QSynergyApplication.h"
|
||||||
|
@ -200,22 +201,19 @@ void SetupWizard::accept()
|
||||||
if (m_pRadioButtonActivate->isChecked()) {
|
if (m_pRadioButtonActivate->isChecked()) {
|
||||||
appConfig.setActivateEmail(m_pLineEditEmail->text());
|
appConfig.setActivateEmail(m_pLineEditEmail->text());
|
||||||
|
|
||||||
CoreInterface coreInterface;
|
notifyActivation("login:" + m_pLineEditEmail->text());
|
||||||
coreInterface.notifyActivation("login:" + m_pLineEditEmail->text());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pRadioButtonSubscription->isChecked())
|
if (m_pRadioButtonSubscription->isChecked())
|
||||||
{
|
{
|
||||||
appConfig.setSerialKey(m_pLineEditSerialKey->text());
|
appConfig.setSerialKey(m_pLineEditSerialKey->text());
|
||||||
|
|
||||||
CoreInterface coreInterface;
|
notifyActivation("serial:" + m_pLineEditSerialKey->text());
|
||||||
coreInterface.notifyActivation("serial:" + m_pLineEditSerialKey->text());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pRadioButtonSkip->isChecked())
|
if (m_pRadioButtonSkip->isChecked())
|
||||||
{
|
{
|
||||||
CoreInterface coreInterface;
|
notifyActivation("skip:unknown");
|
||||||
coreInterface.notifyActivation("skip:unknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appConfig.setEdition(m_Edition);
|
appConfig.setEdition(m_Edition);
|
||||||
|
@ -251,6 +249,21 @@ void SetupWizard::reject()
|
||||||
QWizard::reject();
|
QWizard::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupWizard::notifyActivation(QString identity)
|
||||||
|
{
|
||||||
|
ActivationNotifier* notifier = new ActivationNotifier();
|
||||||
|
notifier->setIdentity(identity);
|
||||||
|
QThread* thread = new QThread;
|
||||||
|
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||||
|
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||||
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
notifier->moveToThread(thread);
|
||||||
|
thread->start();
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index)
|
void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
QString ietfCode = m_pComboLanguage->itemData(index).toString();
|
QString ietfCode = m_pComboLanguage->itemData(index).toString();
|
||||||
|
|
|
@ -43,6 +43,7 @@ protected:
|
||||||
void changeEvent(QEvent* event);
|
void changeEvent(QEvent* event);
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
|
void notifyActivation(QString identity);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow& m_MainWindow;
|
MainWindow& m_MainWindow;
|
||||||
|
|
Loading…
Reference in New Issue