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 --- TicketHistory.qml | 49 ++++++++----------------------------------------- TicketList.qml | 5 +++-- controller.cxx | 30 +++++++----------------------- controller.hxx | 9 ++------- larva | 2 +- main.qml | 11 +---------- qrtclient | 2 +- 7 files changed, 23 insertions(+), 85 deletions(-) diff --git a/TicketHistory.qml b/TicketHistory.qml index 8970da1..26408cf 100644 --- a/TicketHistory.qml +++ b/TicketHistory.qml @@ -5,54 +5,21 @@ import "larva/features" TaskDetailForm { property string subject - property string content - property string creator - property string created 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 - } - - 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 - } + ticketBriefForm { + ticketSubject.text: subject +// ticketCreator.text: creator + } - TaskHistoryForm { - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.top: separator.bottom - anchors.topMargin: 8 + listView { + model: ticketHistoryList + delegate: TaskHistoryForm { creatorText.text: creator ticketDescription.text: content ticketDate.text: created } } + } diff --git a/TicketList.qml b/TicketList.qml index cb095d9..6bfb54e 100644 --- a/TicketList.qml +++ b/TicketList.qml @@ -9,8 +9,9 @@ TaskListForm { height: task.height taskTitle.text: subject itemDelegate.onClicked: { - window.ticketId(id) - window.ticketSubject(subject) + window.ticketHistory(id) + pageView.push("TicketHistory.qml" + , {"subject": subject}) } } } 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(); diff --git a/controller.hxx b/controller.hxx index 1e9c7f8..f92527c 100644 --- a/controller.hxx +++ b/controller.hxx @@ -3,8 +3,7 @@ #include #include - -struct rtclient_ticket_history_list; +#include class Controller : public QObject { @@ -16,15 +15,11 @@ class Controller : public QObject signals: void checked(QString const& name); - void gotTicketHistory(rtclient_ticket_history_list* list); - - private slots: - void setTicketSubject(QString const& subject); private: QThread thread; RTClient::TicketList* ticketList; - QString m_ticketSubject; + RTClient::TicketHistoryList* ticketHistoryList; }; #endif // CONTROLLER_HXX diff --git a/larva b/larva index 51d7238..019e19f 160000 --- a/larva +++ b/larva @@ -1 +1 @@ -Subproject commit 51d7238597fb8fd754c36249261db4a36c8bf1a0 +Subproject commit 019e19f51c85ca6c2e787740b93487dcde7d4def diff --git a/main.qml b/main.qml index 9412cb4..83eb694 100644 --- a/main.qml +++ b/main.qml @@ -4,17 +4,8 @@ import "larva/features" ApplicationWindow { signal logIn(string name, string password) - signal ticketId(int id) - signal ticketSubject(string subject) + signal ticketHistory(int id) signal ticketNew(string queue, string requestor) - function ticketHistory(subject, content, creator, created) { - pageView.push("TicketHistory.qml", { - "subject": subject - , "content": content - , "creator": creator - , "created": created - }) - } id: window visible: true diff --git a/qrtclient b/qrtclient index c0ec7d7..6e3ee14 160000 --- a/qrtclient +++ b/qrtclient @@ -1 +1 @@ -Subproject commit c0ec7d794a69116e01b51fc46f37b1af01e4066f +Subproject commit 6e3ee14209963c9a7190cc76925cc736fea83218 -- cgit v1.2.3