From 41bfcb06c9c0ff97ab69f323e96117b46529828b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Sun, 15 Sep 2019 20:05:18 +0800 Subject: qrtclient as submodule instead while librtclient has become qrtclient's submodule --- controller.cxx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'controller.cxx') diff --git a/controller.cxx b/controller.cxx index 2e562bf..47656e4 100644 --- a/controller.cxx +++ b/controller.cxx @@ -1,15 +1,13 @@ #include #include -#include "worker.hxx" -#include "user.hxx" -#include "tasklist.hxx" +#include #include "controller.hxx" Controller::Controller(QObject* parent) : QObject{parent} { - auto worker = new Worker; - worker->moveToThread(&thread); - connect(&thread, &QThread::finished, worker, &QObject::deleteLater); + auto client = new RTClient::Client{"https://darapsa.co.id/rt"}; + client->moveToThread(&thread); + connect(&thread, &QThread::finished, client, &QObject::deleteLater); auto engine = static_cast(parent); auto rootObjects = engine->rootObjects(); @@ -17,10 +15,11 @@ Controller::Controller(QObject* parent) : QObject{parent} auto loginView = appWindow->findChild("login"); connect(loginView, SIGNAL(logIn(QString, QString)), - worker, SLOT(logIn(QString, QString))); - connect(worker, SIGNAL(logged(rt_user*)), loginView, SLOT(pushProfile())); - connect(loginView, SIGNAL(search(QString)), worker, SLOT(search(QString))); + client, SLOT(logIn(QString, QString))); + connect(client, SIGNAL(logged(rt_user*)), loginView, SLOT(pushProfile())); + connect(loginView, SIGNAL(search(QString)), client, SLOT(search(QString))); + using RTClient::User; auto typeId = qmlRegisterSingletonType("KelakonUser", 0, 1, "User" , [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* { @@ -29,11 +28,11 @@ Controller::Controller(QObject* parent) : QObject{parent} return new User; }); auto user = engine->singletonInstance(typeId); - connect(worker, SIGNAL(logged(rt_user*)), user, SLOT(update(rt_user*))); + connect(client, SIGNAL(logged(rt_user*)), user, SLOT(update(rt_user*))); - taskList = new TaskList; + taskList = new RTClient::TicketList; engine->rootContext()->setContextProperty("taskList", taskList); - connect(worker, SIGNAL(foundTasks(rt_ticketlist*)) + connect(client, SIGNAL(foundTasks(rt_ticketlist*)) , taskList, SLOT(addTasks(rt_ticketlist*))); thread.start(); -- cgit v1.2.3