From 53da54bab9b2d5c80ea8267a9542a89d38511b2d 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: Mon, 30 Sep 2019 19:17:59 +0800 Subject: Attempt to show real ticket history data Not working yet --- controller.cxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'controller.cxx') diff --git a/controller.cxx b/controller.cxx index b27896c..5a1d786 100644 --- a/controller.cxx +++ b/controller.cxx @@ -63,13 +63,34 @@ Controller::Controller(QObject* parent) : QObject{parent} connect(client, &Client::searchedTicket, ticketList, &TicketList::update); - connect(client, &Client::loggedIn, [appWindow,this]() { + auto ticketHistory = [appWindow,this,&client]() { + auto homeView = appWindow->findChild("home"); + connect(client, &Client::gotTicketHistory, [homeView] + (rtclient_ticket_history_list* list) { + auto history = list->histories[list->length - 1]; + QMetaObject::invokeMethod(homeView + , "ticketHistory" + , Q_ARG(QString + , QString{history + ->description}) + , Q_ARG(QString + , QString{history + ->content}) + , Q_ARG(QString + , QString{history + ->creator})); + }); + }; + + connect(client, &Client::loggedIn, [appWindow,this,ticketHistory]() { auto loginView = appWindow->findChild("login"); - connect(ticketList, &TicketList::updated, [loginView]() { + connect(ticketList, &TicketList::updated + , [loginView,this,ticketHistory]() { QMetaObject::invokeMethod(loginView , "pushHome"); + ticketHistory(); }); - }); + }); connect(appWindow, SIGNAL(ticketHistory(int)) , client, SLOT(ticketHistory(int))); -- cgit v1.2.3