From 2dd636456c22a85751e3484776c45efc9458b9ba Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 1 Sep 2019 14:17:33 +0200 Subject: [PATCH] Add basic sections and button placeholders to qml timeline --- .gitignore | 3 + resources/qml/TimelineView.qml | 90 ++++++++++++++++++++++++++-- src/timeline/.TimelineItem.cpp.swp | Bin 114688 -> 0 bytes src/timeline2/TimelineModel.cpp | 43 ++++++++++++- src/timeline2/TimelineModel.h | 1 + src/timeline2/TimelineViewManager.h | 1 - 6 files changed, 132 insertions(+), 6 deletions(-) delete mode 100644 src/timeline/.TimelineItem.cpp.swp diff --git a/.gitignore b/.gitignore index 23b84039..0f61a911 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,9 @@ ui_*.h *.qmlproject.user *.qmlproject.user.* +# Vim +*.swp + #####=== CMake ===##### CMakeCache.txt diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 3d4c1147..7ff51362 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -1,4 +1,6 @@ -import QtQuick 2.1 +import QtQuick 2.5 +import QtQuick.Controls 2.5 +import QtQuick.Layouts 1.5 Rectangle { anchors.fill: parent @@ -17,9 +19,89 @@ Rectangle { id: chat model: timelineManager.timeline - delegate: Text { - height: contentHeight - text: model.userId + delegate: RowLayout { + width: chat.width + Text { + Layout.fillWidth: true + height: contentHeight + text: model.userName + } + + Button { + Layout.alignment: Qt.AlignRight + id: replyButton + flat: true + height: replyButtonImg.contentHeight + width: replyButtonImg.contentWidth + ToolTip.visible: hovered + ToolTip.text: qsTr("Reply") + Image { + id: replyButtonImg + // Workaround, can't get icon.source working for now... + anchors.fill: parent + source: "qrc:/icons/icons/ui/mail-reply.png" + } + } + Button { + Layout.alignment: Qt.AlignRight + id: optionsButton + flat: true + height: optionsButtonImg.contentHeight + width: optionsButtonImg.contentWidth + ToolTip.visible: hovered + ToolTip.text: qsTr("Options") + Image { + id: optionsButtonImg + // Workaround, can't get icon.source working for now... + anchors.fill: parent + source: "qrc:/icons/icons/ui/vertical-ellipsis.png" + } + + onClicked: contextMenu.open() + + Menu { + y: optionsButton.height + id: contextMenu + + MenuItem { + text: "Read receipts" + } + MenuItem { + text: "Mark as read" + } + MenuItem { + text: "View raw message" + } + MenuItem { + text: "Redact message" + } + } + } + + Text { + Layout.alignment: Qt.AlignRight + text: model.timestamp.toLocaleTimeString("HH:mm") + } + } + + section { + property: "section" + delegate: Column { + width: parent.width + Label { + anchors.horizontalCenter: parent.horizontalCenter + visible: section.includes(" ") + text: Qt.formatDate(new Date(Number(section.split(" ")[1]))) + height: contentHeight * 1.2 + width: contentWidth * 1.2 + horizontalAlignment: Text.AlignHCenter + background: Rectangle { + radius: parent.height / 2 + color: "black" + } + } + Text { text: section.split(" ")[0] } + } } } } diff --git a/src/timeline/.TimelineItem.cpp.swp b/src/timeline/.TimelineItem.cpp.swp deleted file mode 100644 index 75e03aebe8a2b20a05aec339ab9cab819ed7fe2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 114688 zcmeI537lkAb^ptKHz)ygt&R z#MJxDZ(i4ZcRhDK=bn4+-nAEv@9@sbt;_HnlgT{&_~K<}ZoDM3awwCjmW#DYp($T_ zKC^zcRjaM3`ul1<{XH#+aCCERUwfWF{%FbH?^i}^b-%i%S!*|n{%CcMXhxfj;%KWp z?^nuIe{?GNW4z_h=Zf`u&qM|v2NW1kppyda*36o-9+5fi)OBm+<4Hp&ddEI`Pp7|u z%YXs{3JfSPpum6v0}2c%FrdJI0s{*C)>5EV|AWk*Qo8#FB^(Xj_es1T75p~L1AiNN z0dMv9*x>tPf_EW!>-XOeem^L9A4q&ZHu!yB@P1n2`|k$7j|<*6CB8o-`2FzU{kg>V z2M52858hu-eAj%R6S)5*@m=%1F>qfS6imzaz`%V?@NOo)KP+(n!{Ggz#P>%A?phBw zCBFYb@O?aZe<<<&cLMj*g7-s$hyrgS+A)uo@7%=qM+Dy=8oU=0-+wP~Umv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mq`QYb1$!DRE3$RJLAWrWMqu*S<5pYsr|(#{Y_ze9ZAT)- z`f0PRkdo$d_07ZFi>98+e;E?ZqZt!HwwUFa4txjOed=9xe>3V|3nB{0NanfqJXGRL zqmu^X9s29BKa00uizd8v*WSVCq!MjVIg#t1LmuT|Us}#8g!XlNUqv0%MnfNsu_M=_ zcsbKTa$OH}*y9yUQl_UQYuuz8?-^tu^VD?yKls*;D z3LreApb3T)CEMurn{>lQK$5%lK!z>sj!D1RoGi2JyQN+$&e>FQHMSSaRa$2Q#n|aq zleA<~Q|_s> z+iF31!^~tfAuflTxVsO8bUQ8XS zi;9Nljf95d4+bZNgbCuhV|$)+y2XLc>8__?@_7^Apdr(G!l6co9OrEZ)L4sMy0XG{ zJekry-F}idx)fHiw`#v>RGFo=xMd!Y$343z-Bg~HAlW$_#figd>V1zL4H7*~ z-Mo)tQ#bLYH+A9v{{f1vhZh(AUoqS8?*jZ;7`Cd z@FV#CkASy<%YfVo@Obbk;(i@?0Wj&e+3JfT4mr+1j znqmPR@^l5~En=}HZ^T$hrDYbkM(iXz8?wU@u}n+FmzHjtTeT#Yfz=v;vbD*}Z;QWl znw|_5l|6%*Fprj4-%D>|wi?-?NrWo#)8E}IS^Rd-kIGDsG(Uc|-~3E)5aq7U&t{}l zNKgGz|CzEf$?h2w)pC))9vPuR{rP?~76#~^GnEV{bJk>+qd4bf +QDateTime +eventTimestamp(const T &event) +{ + return QDateTime::fromMSecsSinceEpoch(event.origin_server_ts); +} } TimelineModel::TimelineModel(QString room_id, QObject *parent) @@ -36,6 +43,7 @@ QHash TimelineModel::roleNames() const { return { + {Section, "section"}, {Type, "type"}, {Body, "body"}, {FormattedBody, "formattedBody"}, @@ -55,16 +63,49 @@ TimelineModel::rowCount(const QModelIndex &parent) const QVariant TimelineModel::data(const QModelIndex &index, int role) const { - nhlog::ui()->info("data"); if (index.row() < 0 && index.row() >= (int)eventOrder.size()) return QVariant(); QString id = eventOrder[index.row()]; switch (role) { + case Section: { + QDateTime date = boost::apply_visitor( + [](const auto &e) -> QDateTime { return eventTimestamp(e); }, events.value(id)); + date.setTime(QTime()); + + QString userId = boost::apply_visitor( + [](const auto &e) -> QString { return senderId(e); }, events.value(id)); + + for (int r = index.row() - 1; r > 0; r--) { + QDateTime prevDate = boost::apply_visitor( + [](const auto &e) -> QDateTime { return eventTimestamp(e); }, + events.value(eventOrder[r])); + prevDate.setTime(QTime()); + if (prevDate != date) + return QString("%2 %1").arg(date.toMSecsSinceEpoch()).arg(userId); + + QString prevUserId = + boost::apply_visitor([](const auto &e) -> QString { return senderId(e); }, + events.value(eventOrder[r])); + if (userId != prevUserId) + break; + } + + return QString("%1").arg(userId); + } case UserId: return QVariant(boost::apply_visitor( [](const auto &e) -> QString { return senderId(e); }, events.value(id))); + case UserName: + return QVariant(Cache::displayName( + room_id_, + boost::apply_visitor([](const auto &e) -> QString { return senderId(e); }, + events.value(id)))); + + case Timestamp: + return QVariant(boost::apply_visitor( + [](const auto &e) -> QDateTime { return eventTimestamp(e); }, events.value(id))); default: return QVariant(); } diff --git a/src/timeline2/TimelineModel.h b/src/timeline2/TimelineModel.h index a4224538..41a25f61 100644 --- a/src/timeline2/TimelineModel.h +++ b/src/timeline2/TimelineModel.h @@ -15,6 +15,7 @@ public: enum Roles { + Section, Type, Body, FormattedBody, diff --git a/src/timeline2/TimelineViewManager.h b/src/timeline2/TimelineViewManager.h index 7f760eac..ff976aad 100644 --- a/src/timeline2/TimelineViewManager.h +++ b/src/timeline2/TimelineViewManager.h @@ -34,7 +34,6 @@ public: Q_INVOKABLE TimelineModel *activeTimeline() const { - nhlog::ui()->info("aaaa"); return timeline_; }