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 --- Home.qml | 10 ++++++++++ TicketDetails.qml | 56 ----------------------------------------------------- TicketHistory.qml | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ TicketList.qml | 6 +----- controller.cxx | 27 +++++++++++++++++++++++--- kelakon.qrc | 2 +- larva | 2 +- qrtclient | 2 +- 8 files changed, 96 insertions(+), 67 deletions(-) delete mode 100644 TicketDetails.qml create mode 100644 TicketHistory.qml diff --git a/Home.qml b/Home.qml index 2a8d1a3..bf1db86 100644 --- a/Home.qml +++ b/Home.qml @@ -3,6 +3,16 @@ import QtQuick.Controls 2.12 import "larva/features" HomeForm { + objectName: "home" + function ticketHistory(description, content, creator) { + pageView.push("TicketHistory.qml", { + "subject": subject + , "description": description + , "content": content + , "creator": creator + }) + } + menuButton.onClicked: drawer.open() profileButton.onClicked: pageView.push("Profile.qml") diff --git a/TicketDetails.qml b/TicketDetails.qml deleted file mode 100644 index d5a2dc9..0000000 --- a/TicketDetails.qml +++ /dev/null @@ -1,56 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 -import "larva/features" - -TaskDetailForm { - property string subject - backButton.onClicked: pageView.pop() - - StackView { - id: contentView - anchors.fill: parent - background: Rectangle { - color: "#FFFFFF" - } - - TaskBriefForm { - id: ticketBriefForm - anchors.top: parent.top - anchors.topMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - ticketSubject.text: subject - } - Label { - id: separator - color: "#000000" - text: qsTr("Activities") - font.weight: Font.Medium - font.pixelSize: 16 - font.family: "Work Sans" - anchors.left: parent.left - anchors.leftMargin: 16 - anchors.top: ticketBriefForm.bottom - anchors.topMargin: 8 - } - - TaskHistoryForm { - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.top: separator.bottom - anchors.topMargin: 8 - } - } -} - -/*##^## -Designer { - D{i:0;autoSize:true;height:480;width:640} -} -##^##*/ diff --git a/TicketHistory.qml b/TicketHistory.qml new file mode 100644 index 0000000..991b643 --- /dev/null +++ b/TicketHistory.qml @@ -0,0 +1,58 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Controls.Material 2.12 +import "larva/features" + +TaskDetailForm { + property string subject + property string description + property string content + property string creator + + backButton.onClicked: pageView.pop() + + StackView { + id: contentView + anchors.fill: parent + background: Rectangle { + color: "#FFFFFF" + } + + TaskBriefForm { + id: ticketBriefForm + anchors.top: parent.top + anchors.topMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + ticketSubject.text: subject + ticketCreator.text: creator + ticketCreatedText.text: description + } + + Label { + id: separator + color: "#000000" + text: qsTr("Activities") + font.weight: Font.Medium + font.pixelSize: 16 + font.family: "Work Sans" + anchors.left: parent.left + anchors.leftMargin: 16 + anchors.top: ticketBriefForm.bottom + anchors.topMargin: 8 + } + + TaskHistoryForm { + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.top: separator.bottom + anchors.topMargin: 8 + creator.text: creator + ticketDescription.text: content + } + } +} diff --git a/TicketList.qml b/TicketList.qml index ba874b9..d253aa8 100644 --- a/TicketList.qml +++ b/TicketList.qml @@ -8,11 +8,7 @@ TaskListForm { width: parent.width height: task.height taskTitle.text: subject - itemDelegate.onClicked: { - window.ticketHistory(id) - pageView.push("TicketDetails.qml" - , {"subject": subject}) - } + itemDelegate.onClicked: window.ticketHistory(id) } } } 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))); diff --git a/kelakon.qrc b/kelakon.qrc index 670ff28..de92f96 100644 --- a/kelakon.qrc +++ b/kelakon.qrc @@ -5,7 +5,7 @@ LoginPassword.qml Home.qml TicketList.qml - TicketDetails.qml + TicketHistory.qml Profile.qml Email.qml Password.qml diff --git a/larva b/larva index 6c41f3d..ed24552 160000 --- a/larva +++ b/larva @@ -1 +1 @@ -Subproject commit 6c41f3de65255fd0286a6356a05fb8ed3edab6f1 +Subproject commit ed24552f650521b2a299c8340d97ae4df6a9948b diff --git a/qrtclient b/qrtclient index 3046c72..bd0e74d 160000 --- a/qrtclient +++ b/qrtclient @@ -1 +1 @@ -Subproject commit 3046c72a604df00cf54982a0985b3a70bdd6d994 +Subproject commit bd0e74d11e666126c97c34c5b508dbe811b128c3 -- cgit v1.2.3