From 760893427955122a011f6b70aad9c0f79359637c 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: Wed, 2 Oct 2019 22:25:16 +0800 Subject: TaskHistory list now uses real data --- controller.cxx | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'controller.cxx') diff --git a/controller.cxx b/controller.cxx index 133f2d8..14f6468 100644 --- a/controller.cxx +++ b/controller.cxx @@ -9,7 +9,6 @@ Controller::Controller(QObject* parent) : QObject{parent} - , m_ticketSubject{""} { #ifdef ANDROID QDir location{QStandardPaths::writableLocation(QStandardPaths @@ -45,6 +44,11 @@ Controller::Controller(QObject* parent) ticketList = new TicketList; engine->rootContext()->setContextProperty("ticketList", ticketList); + using RTClient::TicketHistoryList; + ticketHistoryList = new TicketHistoryList; + engine->rootContext()->setContextProperty("ticketHistoryList" + , ticketHistoryList); + connect(appWindow, SIGNAL(logIn(QString, QString)) , client, SLOT(logIn(QString, QString))); @@ -71,26 +75,11 @@ Controller::Controller(QObject* parent) }); }); - connect(appWindow, SIGNAL(ticketId(int)) + connect(appWindow, SIGNAL(ticketHistory(int)) , client, SLOT(ticketHistory(int))); - connect(appWindow, SIGNAL(ticketSubject(QString)) - , this, SLOT(setTicketSubject(QString))); - connect(client, &Client::gotTicketHistory - , [appWindow,this](rtclient_ticket_history_list* list) { - auto history = list->histories[0]; - QMetaObject::invokeMethod(appWindow, "ticketHistory" - , Q_ARG(QVariant, m_ticketSubject) - , Q_ARG(QVariant - , QString{history->content}) - , Q_ARG(QVariant - , QString{history->creator}) - , Q_ARG(QVariant - , QString{asctime(history - ->created)})); - rtclient_ticket_history_list_free(list); - }); + , ticketHistoryList, &TicketHistoryList::update); connect(appWindow, SIGNAL(ticketNew(QString, QString)) , client, SLOT(ticketNew(QString, QString))); @@ -98,11 +87,6 @@ Controller::Controller(QObject* parent) thread.start(); } -void Controller::setTicketSubject(QString const& subject) -{ - if (m_ticketSubject != subject) m_ticketSubject = subject; -} - Controller::~Controller() { thread.quit(); -- cgit v1.2.3