From c34a4a5a3cbd2a261e3ad72577a4f0187d49b1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= Date: Tue, 10 Mar 2020 21:40:13 +0100 Subject: [PATCH 01/11] Decrease minimumWidth Fixes #191 --- qml/main.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/main.qml b/qml/main.qml index 11a55e4e0..eb14caa80 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -21,7 +21,7 @@ ApplicationWindow { width: 960 height: 640 - minimumWidth: 480 + minimumWidth: 400 minimumHeight: 360 id: window From 517de81ac43a30c49d552f8627b3da88c3c88888 Mon Sep 17 00:00:00 2001 From: Black Date: Sat, 21 Mar 2020 13:39:05 -0700 Subject: [PATCH 02/11] Update libQuotient. --- include/libQuotient | 2 +- src/spectralroom.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/libQuotient b/include/libQuotient index 9bcf0cbc3..d06bbd663 160000 --- a/include/libQuotient +++ b/include/libQuotient @@ -1 +1 @@ -Subproject commit 9bcf0cbc3d690663d37d1737173ab5088fed152f +Subproject commit d06bbd6633eea048e35421b1785e96468c3cf5c0 diff --git a/src/spectralroom.cpp b/src/spectralroom.cpp index c21d92c58..3c4e58d9b 100644 --- a/src/spectralroom.cpp +++ b/src/spectralroom.cpp @@ -22,6 +22,7 @@ #include "events/roommessageevent.h" #include "events/typingevent.h" #include "events/roompowerlevelsevent.h" +#include "events/roomcanonicalaliasevent.h" #include "jobs/downloadfilejob.h" #include "user.h" #include "utils.h" @@ -351,10 +352,6 @@ QString SpectralRoom::eventToString(const RoomEvent& evt, } return tr("made something unknown"); }, - [](const RoomAliasesEvent& e) { - return tr("has set room aliases on server %1 to: %2") - .arg(e.stateKey(), QLocale().createSeparatedList(e.aliases())); - }, [](const RoomCanonicalAliasEvent& e) { return (e.alias().isEmpty()) ? tr("cleared the room main alias") From a798a1f83085271f22f1af3b69be90030dba5af3 Mon Sep 17 00:00:00 2001 From: Black Date: Mon, 23 Mar 2020 22:59:39 -0700 Subject: [PATCH 03/11] Fix on new canonical alias events. --- .../Spectral/Dialog/RoomSettingsDialog.qml | 52 ++++--------------- include/libQuotient | 2 +- 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/imports/Spectral/Dialog/RoomSettingsDialog.qml b/imports/Spectral/Dialog/RoomSettingsDialog.qml index 10e4889d8..db8cda7da 100644 --- a/imports/Spectral/Dialog/RoomSettingsDialog.qml +++ b/imports/Spectral/Dialog/RoomSettingsDialog.qml @@ -232,7 +232,7 @@ Dialog { Layout.preferredWidth: 100 wrapMode: Label.Wrap - text: "Main Alias" + text: "Canonical Alias" color: MPalette.lighter } @@ -243,12 +243,12 @@ Dialog { enabled: canChangeCanonicalAlias - model: room.remoteAliases + model: room.aliases - currentIndex: room.remoteAliases.indexOf(room.canonicalAlias) + currentIndex: room.aliases.indexOf(room.canonicalAlias) onCurrentIndexChanged: { - if (room.canonicalAlias != room.remoteAliases[currentIndex]) { - room.setCanonicalAlias(room.remoteAliases[currentIndex]) + if (room.canonicalAlias != room.aliases[currentIndex]) { + room.setCanonicalAlias(room.aliases[currentIndex]) } } } @@ -257,12 +257,14 @@ Dialog { RowLayout { Layout.fillWidth: true + visible: room.altAliases && room.altAliases.length + Label { Layout.preferredWidth: 100 Layout.alignment: Qt.AlignTop wrapMode: Label.Wrap - text: "Local Aliases" + text: "Alt Aliases" color: MPalette.lighter } @@ -272,7 +274,7 @@ Dialog { spacing: 0 Repeater { - model: room.localAliases + model: room.altAliases delegate: RowLayout { Layout.maximumWidth: parent.width @@ -302,42 +304,6 @@ Dialog { } } } - - RowLayout { - Layout.fillWidth: true - - Label { - Layout.preferredWidth: 100 - Layout.alignment: Qt.AlignTop - - wrapMode: Label.Wrap - text: "Remote Aliases" - color: MPalette.lighter - } - - ColumnLayout { - Layout.fillWidth: true - - spacing: 0 - - Repeater { - model: { - var localAliases = room.localAliases - var remoteAliases = room.remoteAliases - return remoteAliases.filter(n => !localAliases.includes(n)) - } - - delegate: Label { - width: parent.width - - text: modelData - - font.pixelSize: 12 - color: MPalette.lighter - } - } - } - } } } } diff --git a/include/libQuotient b/include/libQuotient index d06bbd663..79a3e9e2a 160000 --- a/include/libQuotient +++ b/include/libQuotient @@ -1 +1 @@ -Subproject commit d06bbd6633eea048e35421b1785e96468c3cf5c0 +Subproject commit 79a3e9e2accd0de0ac8bf35d8b77f36ca211899f From 26f539d7f17595d5eb1b95b5a8ad333dfa7a4650 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Fri, 27 Mar 2020 16:34:28 +0100 Subject: [PATCH 04/11] Add desktop-entry hint to notifications --- src/notifications/managerlinux.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notifications/managerlinux.cpp b/src/notifications/managerlinux.cpp index af9f8b94c..dd0c57901 100644 --- a/src/notifications/managerlinux.cpp +++ b/src/notifications/managerlinux.cpp @@ -56,6 +56,7 @@ uint NotificationsManager::showNotification(const QString summary, QVariantMap hints; hints["image-data"] = croppedImage; + hints["desktop-entry"] = "org.eu.encom.spectral"; QList argumentList; argumentList << "Spectral"; // app_name argumentList << uint(0); // replace_id From 6935bd9c4d2c43b195aa6bc20fcbb5ec91572569 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Fri, 27 Mar 2020 17:54:30 +0100 Subject: [PATCH 05/11] Escape HTML in notifications when server supports HTML --- src/notifications/manager.h | 1 + src/notifications/managerlinux.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/notifications/manager.h b/src/notifications/manager.h index 5e7888fc6..62219e465 100644 --- a/src/notifications/manager.h +++ b/src/notifications/manager.h @@ -27,6 +27,7 @@ class NotificationsManager : public QObject { private: #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) QDBusInterface dbus; + bool serverSupportsHtml = false; uint showNotification(const QString summary, const QString text, const QImage image); diff --git a/src/notifications/managerlinux.cpp b/src/notifications/managerlinux.cpp index af9f8b94c..68c219231 100644 --- a/src/notifications/managerlinux.cpp +++ b/src/notifications/managerlinux.cpp @@ -5,6 +5,7 @@ #include #include #include +#include NotificationsManager::NotificationsManager(QObject *parent) : QObject(parent), @@ -13,6 +14,15 @@ NotificationsManager::NotificationsManager(QObject *parent) this) { qDBusRegisterMetaType(); + const QDBusReply capabilitiesReply = dbus.call("GetCapabilities"); + + if (capabilitiesReply.isValid()) { + const QStringList capabilities = capabilitiesReply.value(); + serverSupportsHtml = capabilities.contains("body-markup"); + } else { + qWarning() << "Could not get notification server capabilities" << capabilitiesReply.error(); + } + QDBusConnection::sessionBus().connect( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "ActionInvoked", this, @@ -54,6 +64,8 @@ uint NotificationsManager::showNotification(const QString summary, croppedImage = image; } + const QString body = serverSupportsHtml ? text.toHtmlEscaped() : text; + QVariantMap hints; hints["image-data"] = croppedImage; QList argumentList; @@ -61,7 +73,7 @@ uint NotificationsManager::showNotification(const QString summary, argumentList << uint(0); // replace_id argumentList << ""; // app_icon argumentList << summary; // summary - argumentList << text; // body + argumentList << body; // body argumentList << (QStringList("default") << "reply"); // actions argumentList << hints; // hints argumentList << int(-1); // timeout in ms From 8d77ae33353e1a20bc66aa2222447d425216b10e Mon Sep 17 00:00:00 2001 From: Black Date: Wed, 15 Apr 2020 19:44:45 -0700 Subject: [PATCH 06/11] Update deps. --- include/libQuotient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libQuotient b/include/libQuotient index 79a3e9e2a..58dfe7439 160000 --- a/include/libQuotient +++ b/include/libQuotient @@ -1 +1 @@ -Subproject commit 79a3e9e2accd0de0ac8bf35d8b77f36ca211899f +Subproject commit 58dfe74390ebdd8ec6611d3b8fecfe7d051ff955 From 9fc316757ec4cbb2ec4d1223c4aa8f89b3bbeb26 Mon Sep 17 00:00:00 2001 From: Black Date: Wed, 3 Jun 2020 22:02:46 -0700 Subject: [PATCH 07/11] Use null coalescing. --- imports/Spectral/Component/AutoTextField.qml | 2 +- imports/Spectral/Component/Timeline/AudioDelegate.qml | 8 +++----- imports/Spectral/Component/Timeline/ImageDelegate.qml | 2 +- imports/Spectral/Component/Timeline/MessageDelegate.qml | 6 +++--- imports/Spectral/Component/Timeline/ReactionDelegate.qml | 2 +- imports/Spectral/Component/Timeline/VideoDelegate.qml | 2 +- imports/Spectral/Dialog/AccountDetailDialog.qml | 2 +- imports/Spectral/Effect/ElevationEffect.qml | 2 +- imports/Spectral/Panel/RoomListPanel.qml | 4 ++-- imports/Spectral/Panel/RoomPanelInput.qml | 8 ++++---- 10 files changed, 18 insertions(+), 20 deletions(-) diff --git a/imports/Spectral/Component/AutoTextField.qml b/imports/Spectral/Component/AutoTextField.qml index 134470942..ebcd037d3 100644 --- a/imports/Spectral/Component/AutoTextField.qml +++ b/imports/Spectral/Component/AutoTextField.qml @@ -26,7 +26,7 @@ TextField { states: [ State { name: "shown" - when: textField.text.length !== 0 || textField.activeFocus + when: textField.text.length != 0 || textField.activeFocus PropertyChanges { target: floatingPlaceholder; scale: 0.8 } PropertyChanges { target: floatingPlaceholder; anchors.topMargin: -floatingPlaceholder.height * 0.4 } } diff --git a/imports/Spectral/Component/Timeline/AudioDelegate.qml b/imports/Spectral/Component/Timeline/AudioDelegate.qml index 2a7d563b5..87d2a9119 100644 --- a/imports/Spectral/Component/Timeline/AudioDelegate.qml +++ b/imports/Spectral/Component/Timeline/AudioDelegate.qml @@ -96,7 +96,7 @@ RowLayout { } Label { - readonly property int duration: content.info.duration || audio.duration || 0 + readonly property int duration: content.info.duration ?? audio.duration ?? 0 Layout.fillWidth: true @@ -193,14 +193,12 @@ RowLayout { } } - function openSavedFile() - { + function openSavedFile() { if (Qt.openUrlExternally(progressInfo.localPath)) return; if (Qt.openUrlExternally(progressInfo.localDir)) return; } - function humanSize(duration) - { + function humanSize(duration) { if (!duration) return qsTr("Unknown", "Unknown duration") if (duration < 1000) diff --git a/imports/Spectral/Component/Timeline/ImageDelegate.qml b/imports/Spectral/Component/Timeline/ImageDelegate.qml index 445c18cfb..4a1fe926d 100644 --- a/imports/Spectral/Component/Timeline/ImageDelegate.qml +++ b/imports/Spectral/Component/Timeline/ImageDelegate.qml @@ -68,7 +68,7 @@ RowLayout { } Image { - readonly property bool isThumbnail: !(content.info.thumbnail_info == null || content.thumbnailMediaId == null) + readonly property bool isThumbnail: content.info.thumbnail_info && content.thumbnailMediaId readonly property var info: isThumbnail ? content.info.thumbnail_info : content.info readonly property string mediaId: isThumbnail ? content.thumbnailMediaId : content.mediaId readonly property int maxWidth: messageListView.width - (!sentByMe ? 36 + root.spacing : 0) - 48 diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml index a17a312f3..b1cedfdd7 100644 --- a/imports/Spectral/Component/Timeline/MessageDelegate.qml +++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml @@ -15,9 +15,9 @@ ColumnLayout { readonly property bool avatarVisible: !sentByMe && showAuthor readonly property bool sentByMe: author.isLocalUser readonly property bool darkBackground: !sentByMe - readonly property bool replyVisible: reply || false - readonly property bool failed: marks === EventStatus.SendingFailed - readonly property color authorColor: eventType === "notice" ? MPalette.primary : author.color + readonly property bool replyVisible: reply ?? false + readonly property bool failed: marks == EventStatus.SendingFailed + readonly property color authorColor: eventType == "notice" ? MPalette.primary : author.color readonly property color replyAuthorColor: replyVisible ? reply.author.color : MPalette.accent signal saveFileAs() diff --git a/imports/Spectral/Component/Timeline/ReactionDelegate.qml b/imports/Spectral/Component/Timeline/ReactionDelegate.qml index 38a393fda..1a9f85117 100644 --- a/imports/Spectral/Component/Timeline/ReactionDelegate.qml +++ b/imports/Spectral/Component/Timeline/ReactionDelegate.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts 1.12 import Spectral.Setting 0.1 Flow { - visible: (reaction && reaction.length > 0) || false + visible: (reaction && reaction.length > 0) ?? false spacing: 8 diff --git a/imports/Spectral/Component/Timeline/VideoDelegate.qml b/imports/Spectral/Component/Timeline/VideoDelegate.qml index abc8f7717..bd22120c6 100644 --- a/imports/Spectral/Component/Timeline/VideoDelegate.qml +++ b/imports/Spectral/Component/Timeline/VideoDelegate.qml @@ -120,7 +120,7 @@ RowLayout { } Image { - readonly property bool isThumbnail: !(content.info.thumbnail_info == null || content.thumbnailMediaId == null) + readonly property bool isThumbnail: content.info.thumbnail_info && content.thumbnailMediaId readonly property var info: isThumbnail ? content.info.thumbnail_info : content.info anchors.fill: parent diff --git a/imports/Spectral/Dialog/AccountDetailDialog.qml b/imports/Spectral/Dialog/AccountDetailDialog.qml index 75b598b8a..a72d31da5 100644 --- a/imports/Spectral/Dialog/AccountDetailDialog.qml +++ b/imports/Spectral/Dialog/AccountDetailDialog.qml @@ -39,7 +39,7 @@ Dialog { height: 48 source: user.avatarMediaId - hint: user.displayName || "No Name" + hint: user.displayName ?? "" Menu { id: contextMenu diff --git a/imports/Spectral/Effect/ElevationEffect.qml b/imports/Spectral/Effect/ElevationEffect.qml index 0299fd5c2..d5aa66505 100644 --- a/imports/Spectral/Effect/ElevationEffect.qml +++ b/imports/Spectral/Effect/ElevationEffect.qml @@ -135,7 +135,7 @@ Item { glowRadius: modelData.blur/2 spread: 0.05 color: _shadowColors[index] - cornerRadius: modelData.blur + (effect.sourceItem.radius || 0) + cornerRadius: modelData.blur + (effect.sourceItem.radius ?? 0) } } diff --git a/imports/Spectral/Panel/RoomListPanel.qml b/imports/Spectral/Panel/RoomListPanel.qml index cbd64b636..d3ab40e4c 100644 --- a/imports/Spectral/Panel/RoomListPanel.qml +++ b/imports/Spectral/Panel/RoomListPanel.qml @@ -224,7 +224,7 @@ Item { Layout.fillHeight: true source: avatar - hint: name || "No Name" + hint: name ?? "" } ColumnLayout { @@ -236,7 +236,7 @@ Item { Layout.fillWidth: true Layout.fillHeight: true - text: name || "No Name" + text: name ?? "" color: MPalette.foreground font.pixelSize: 16 font.bold: unreadCount >= 0 diff --git a/imports/Spectral/Panel/RoomPanelInput.qml b/imports/Spectral/Panel/RoomPanelInput.qml index 256f9dd46..a3ffa1ebe 100644 --- a/imports/Spectral/Panel/RoomPanelInput.qml +++ b/imports/Spectral/Panel/RoomPanelInput.qml @@ -130,9 +130,9 @@ Control { keyNavigationWraps: true delegate: Control { - property string autoCompleteText: modelData.displayName || modelData.unicode + property string autoCompleteText: modelData.displayName ?? modelData.unicode property bool isEmoji: modelData.unicode != null - readonly property bool highlighted: autoCompleteListView.currentIndex === index + readonly property bool highlighted: autoCompleteListView.currentIndex == index height: 36 padding: 6 @@ -140,7 +140,7 @@ Control { background: Rectangle { visible: !isEmoji color: highlighted ? border.color : "transparent" - border.color: isEmoji ? Material.accent : modelData.color + border.color: isEmoji ? MPalette.accent : modelData.color border.width: 2 radius: height / 2 } @@ -164,7 +164,7 @@ Control { Layout.preferredHeight: 24 visible: !isEmoji - source: modelData.avatarMediaId || null + source: modelData.avatarMediaId ?? null color: modelData.color ? Qt.darker(modelData.color, 1.1) : MPalette.accent } From 679bb4c01b1a86ab0eead4ea3d61a272d203aa08 Mon Sep 17 00:00:00 2001 From: Zr22 Date: Fri, 10 Jul 2020 07:31:28 +0000 Subject: [PATCH 08/11] Add support for OpenBSD --- src/notifications/manager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notifications/manager.h b/src/notifications/manager.h index 62219e465..8b6973bd5 100644 --- a/src/notifications/manager.h +++ b/src/notifications/manager.h @@ -6,7 +6,7 @@ #include #include -#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) #include #include #endif @@ -25,7 +25,7 @@ class NotificationsManager : public QObject { void notificationClicked(const QString roomId, const QString eventId); private: -#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) QDBusInterface dbus; bool serverSupportsHtml = false; uint showNotification(const QString summary, @@ -50,7 +50,7 @@ class NotificationsManager : public QObject { const QImage& icon); }; -#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image); const QDBusArgument& operator>>(const QDBusArgument& arg, QImage&); #endif From e2841e5430bb0a69214a405422402d6f3600323a Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 15 Jul 2020 16:13:02 -0700 Subject: [PATCH 09/11] appveyor.yml: Update to Qt 5.15 and VS 2019 Signed-off-by: Alistair Francis --- .appveyor.yml | 6 +++--- .gitlab-ci.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5d28a9f51..f5a1a70c0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,10 +1,10 @@ -image: Visual Studio 2017 +image: Visual Studio 2019 environment: DEPLOY_DIR: Spectral-%APPVEYOR_BUILD_VERSION% matrix: - - QTDIR: C:\Qt\5.12\msvc2017_64 - VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" + - QTDIR: C:\Qt\5.15\msvc2019_64 + VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" PLATFORM: init: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9637c84f3..6759aab3b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ build-appimage: - sudo cmake --build build --target install - cd .. - git clone https://github.com/commonmark/cmark.git && cd cmark - - git checkout tags/0.29.0 + - git reset --hard tags/0.29.0 - cmake . -Bbuild -LA -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install -DCMARK_SHARED=ON -DCMARK_STATIC=ON -DCMARK_TESTS=OFF - cmake --build build --target install --parallel $(nproc) - cd .. From 675ec40a63d24cd427fed71bdcc6fdfe8448c16e Mon Sep 17 00:00:00 2001 From: Black Date: Sat, 25 Jul 2020 16:45:48 -0700 Subject: [PATCH 10/11] Update to libQuotient 0.6. --- include/libQuotient | 2 +- src/publicroomlistmodel.cpp | 9 ++++----- src/spectralroom.cpp | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/libQuotient b/include/libQuotient index 58dfe7439..55d8d9c07 160000 --- a/include/libQuotient +++ b/include/libQuotient @@ -1 +1 @@ -Subproject commit 58dfe74390ebdd8ec6611d3b8fecfe7d051ff955 +Subproject commit 55d8d9c073b732e296c72bc8a747bbd691931209 diff --git a/src/publicroomlistmodel.cpp b/src/publicroomlistmodel.cpp index e8bc0d317..29ff97d4d 100644 --- a/src/publicroomlistmodel.cpp +++ b/src/publicroomlistmodel.cpp @@ -110,15 +110,14 @@ void PublicRoomListModel::next(int count) { attempted = true; if (job->status() == BaseJob::Success) { - auto resp = job->data(); - nextBatch = resp.nextBatch; + nextBatch = job->nextBatch(); this->beginInsertRows({}, rooms.count(), - rooms.count() + resp.chunk.count() - 1); - rooms.append(resp.chunk); + rooms.count() + job->chunk().count() - 1); + rooms.append(job->chunk()); this->endInsertRows(); - if (resp.nextBatch.isEmpty()) { + if (job->nextBatch().isEmpty()) { emit hasMoreChanged(); } } diff --git a/src/spectralroom.cpp b/src/spectralroom.cpp index 3c4e58d9b..5ee909a9e 100644 --- a/src/spectralroom.cpp +++ b/src/spectralroom.cpp @@ -397,30 +397,30 @@ void SpectralRoom::changeAvatar(QUrl localFile) { const auto job = connection()->uploadFile(localFile.toLocalFile()); if (isJobRunning(job)) { connect(job, &BaseJob::success, this, [this, job] { - connection()->callApi( - id(), "m.room.avatar", QJsonObject{{"url", job->contentUri()}}); + connection()->callApi( + id(), "m.room.avatar", localUser()->id(), QJsonObject{{"url", job->contentUri()}}); }); } } void SpectralRoom::addLocalAlias(const QString& alias) { - auto aliases = localAliases(); - if (aliases.contains(alias)) + auto a = aliases(); + if (a.contains(alias)) return; - aliases += alias; + a += alias; - setLocalAliases(aliases); + setLocalAliases(a); } void SpectralRoom::removeLocalAlias(const QString& alias) { - auto aliases = localAliases(); - if (!aliases.contains(alias)) + auto a = aliases(); + if (!a.contains(alias)) return; - aliases.removeAll(alias); + a.removeAll(alias); - setLocalAliases(aliases); + setLocalAliases(a); } QString SpectralRoom::markdownToHTML(const QString& markdown) { From d6009479a5cea4a9b5abcfacaa205eb9c8bf851c Mon Sep 17 00:00:00 2001 From: Black Date: Tue, 28 Jul 2020 20:33:32 -0700 Subject: [PATCH 11/11] Fix some deprecation. --- src/matriximageprovider.h | 2 +- src/messageeventmodel.cpp | 11 ++++++----- src/spectralroom.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/matriximageprovider.h b/src/matriximageprovider.h index 030ea41ad..70f911e85 100644 --- a/src/matriximageprovider.h +++ b/src/matriximageprovider.h @@ -56,7 +56,7 @@ class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider { Quotient::Connection* connection() { return m_connection; } void setConnection(Quotient::Connection* connection) { - m_connection.store(connection); + m_connection.storeRelaxed(connection); emit connectionChanged(); } diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index b023f44fc..48862e165 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -207,13 +207,13 @@ int MessageEventModel::refreshEventRoles(const QString& id, } inline bool hasValidTimestamp(const Quotient::TimelineItem& ti) { - return ti->timestamp().isValid(); + return ti->originTimestamp().isValid(); } QDateTime MessageEventModel::makeMessageTimestamp( const Quotient::Room::rev_iter_t& baseIt) const { const auto& timeline = m_currentRoom->messageEvents(); - auto ts = baseIt->event()->timestamp(); + auto ts = baseIt->event()->originTimestamp(); if (ts.isValid()) return ts; @@ -222,10 +222,10 @@ QDateTime MessageEventModel::makeMessageTimestamp( using Quotient::TimelineItem; auto rit = std::find_if(baseIt, timeline.rend(), hasValidTimestamp); if (rit != timeline.rend()) - return {rit->event()->timestamp().date(), {0, 0}, Qt::LocalTime}; + return {rit->event()->originTimestamp().date(), {0, 0}, Qt::LocalTime}; auto it = std::find_if(baseIt.base(), timeline.end(), hasValidTimestamp); if (it != timeline.end()) - return {it->event()->timestamp().date(), {0, 0}, Qt::LocalTime}; + return {it->event()->originTimestamp().date(), {0, 0}, Qt::LocalTime}; // What kind of room is that?.. qCritical() << "No valid timestamps in the room timeline!"; @@ -242,7 +242,8 @@ QString MessageEventModel::renderDate(QDateTime timestamp) const { return tr("The day before yesterday"); if (date > QDate::currentDate().addDays(-7)) return date.toString("dddd"); - return date.toString(Qt::DefaultLocaleShortDate); + + return QLocale::system().toString(date, QLocale::ShortFormat); } void MessageEventModel::refreshLastUserEvents(int baseTimelineRow) { diff --git a/src/spectralroom.cpp b/src/spectralroom.cpp index 5ee909a9e..c279166bc 100644 --- a/src/spectralroom.cpp +++ b/src/spectralroom.cpp @@ -167,7 +167,7 @@ void SpectralRoom::countChanged() { QDateTime SpectralRoom::lastActiveTime() const { if (timelineSize() == 0) return QDateTime(); - return messageEvents().rbegin()->get()->timestamp(); + return messageEvents().rbegin()->get()->originTimestamp(); } int SpectralRoom::savedTopVisibleIndex() const {