modify:change the trigger method of thread
This commit is contained in:
parent
d85185b635
commit
1e845d537d
|
@ -29,8 +29,6 @@
|
||||||
#include "xatom-helper.h"
|
#include "xatom-helper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "threaddriver.h"
|
|
||||||
|
|
||||||
#define LOG_IDENT "ukui_kylin_nm"
|
#define LOG_IDENT "ukui_kylin_nm"
|
||||||
|
|
||||||
void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
|
@ -99,13 +97,11 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
ThreadDriver networkManagerDiver;
|
|
||||||
QThread thread;
|
QThread thread;
|
||||||
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
|
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
|
||||||
p_networkResource->moveToThread(&thread);
|
p_networkResource->moveToThread(&thread);
|
||||||
QObject::connect(&networkManagerDiver, SIGNAL(initSignal()), p_networkResource, SLOT(onInitNetwork()));
|
QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork()));
|
||||||
thread.start();
|
thread.start();
|
||||||
networkManagerDiver.emitSignal();
|
|
||||||
|
|
||||||
// Internationalization
|
// Internationalization
|
||||||
QString locale = QLocale::system().name();
|
QString locale = QLocale::system().name();
|
||||||
|
|
|
@ -66,6 +66,3 @@ unix {
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
org.ukui.kylin-nm.switch.gschema.xml
|
org.ukui.kylin-nm.switch.gschema.xml
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
threaddriver.h
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#ifndef THREADDRIVER_H
|
|
||||||
#define THREADDRIVER_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QThread>
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
|
|
||||||
class ThreadDriver:public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ThreadDriver(QObject* parent=0):QObject(parent){}
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void emitSignal() {
|
|
||||||
emit initSignal();
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void initSignal();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // THREADDRIVER_H
|
|
Loading…
Reference in New Issue