diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-02 22:25:16 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-02 22:25:16 +0800 |
commit | 760893427955122a011f6b70aad9c0f79359637c (patch) | |
tree | a1732d3a83c36ea570331ccbf95782fec6d0c7ff | |
parent | 95fe18a60e62d9761f522ccb659c1d1fe4ea30f9 (diff) |
TaskHistory list now uses real data
-rw-r--r-- | TicketHistory.qml | 49 | ||||
-rw-r--r-- | TicketList.qml | 5 | ||||
-rw-r--r-- | controller.cxx | 30 | ||||
-rw-r--r-- | controller.hxx | 9 | ||||
m--------- | larva | 0 | ||||
-rw-r--r-- | main.qml | 11 | ||||
m--------- | qrtclient | 0 |
7 files changed, 21 insertions, 83 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 <QThread> #include <qrtclient/ticket.hxx> - -struct rtclient_ticket_history_list; +#include <qrtclient/tickethistory.hxx> 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 -Subproject 51d7238597fb8fd754c36249261db4a36c8bf1a +Subproject 019e19f51c85ca6c2e787740b93487dcde7d4de @@ -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 -Subproject c0ec7d794a69116e01b51fc46f37b1af01e4066 +Subproject 6e3ee14209963c9a7190cc76925cc736fea8321 |