From 8107effd171ffb5285e4e6d79ff9a2b7e4669c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Feb 2022 11:51:44 +0800 Subject: Conform to updated librtclient commit 12cde42c929b63a1ef1b2ad7f3482336419980b2 --- ticket.cxx | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'ticket.cxx') diff --git a/ticket.cxx b/ticket.cxx index e42207b..05b57ad 100644 --- a/ticket.cxx +++ b/ticket.cxx @@ -3,6 +3,18 @@ namespace RTClient { +TicketList::TicketList(struct rtclient_ticket** list, + QObject* parent) + : QAbstractListModel{parent} +{ + size_t i = 0; + while (list[i]) { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + tickets << Ticket{list[i++]}; + endInsertRows(); + } +} + int TicketList::rowCount(QModelIndex const& parent) const { Q_UNUSED(parent) @@ -33,22 +45,4 @@ QHash TicketList::roleNames() const }; } - void TicketList::addTicket(Ticket const& ticket) - { - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - tickets << ticket; - endInsertRows(); - emit rowCountChanged(); - } - - void TicketList::update(rtclient_search_ticket_list* list) - { - if (list) { - for (size_t i = 0; i < list->length; i++) - addTicket(Ticket{list->tickets[i]}); - rtclient_search_ticket_free(list); - emit updated(); - } - } - } -- cgit v1.2.3