From af9b66dd3ece30e3870acc19e3e34cc70a9eaf68 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 22 Feb 2021 21:35:11 +0100 Subject: [PATCH] Linkify topic in room settings and use non-deprecated MessageDialog --- README.md | 4 ++-- resources/qml/RoomSettings.qml | 24 +++++++++++++++--------- src/ui/RoomSettings.cpp | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4f8aa111..15d4f416 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ sudo emerge -a ">=dev-qt/qtgui-5.10.0" media-libs/fontconfig dev-libs/qtkeychain ```bash # Build requirements + qml modules needed at runtime (you may not need all of them, but the following seem to work according to reports): -sudo apt install g++ cmake zlib1g-dev libssl-dev qt{base,declarative,tools,multimedia,quickcontrols2-}5-dev libqt5svg5-dev libboost-system-dev libboost-thread-dev libboost-iostreams-dev libolm-dev liblmdb++-dev libcmark-dev nlohmann-json3-dev libspdlog-dev libgtest-dev qml-module-qt{gstreamer,multimedia,quick-extras,-labs-settings,graphicaleffects,quick-controls2} qt5keychain-dev +sudo apt install g++ cmake zlib1g-dev libssl-dev qt{base,declarative,tools,multimedia,quickcontrols2-}5-dev libqt5svg5-dev libboost-system-dev libboost-thread-dev libboost-iostreams-dev libolm-dev liblmdb++-dev libcmark-dev nlohmann-json3-dev libspdlog-dev libgtest-dev qml-module-qt{gstreamer,multimedia,quick-extras,-labs-settings,-labs-platform,graphicaleffects,quick-controls2} qt5keychain-dev ``` This will install all dependencies, except for tweeny (use bundled tweeny) and mtxclient (needs to be build separately). @@ -204,7 +204,7 @@ and mtxclient (needs to be build separately). sudo apt install cmake gcc make automake liblmdb-dev \ qt5-default libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev \ qml-module-qtgstreamer qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev \ - qml-module-qtgraphicaleffects qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts \ + qml-module-qtgraphicaleffects qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform\ qt5keychain-dev ``` diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml index b37dab76..58e34a8f 100644 --- a/resources/qml/RoomSettings.qml +++ b/resources/qml/RoomSettings.qml @@ -1,6 +1,6 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.2 +import Qt.labs.platform 1.1 as Platform import QtQuick.Layouts 1.2 import QtQuick.Window 2.3 import im.nheko 1.0 @@ -110,18 +110,25 @@ ApplicationWindow { ScrollView { Layout.maximumHeight: 75 - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true + width: parent.width TextArea { - text: roomSettings.roomTopic - wrapMode: TextEdit.WordWrap + text: TimelineManager.escapeEmoji(roomSettings.roomTopic) + wrapMode: TextEdit.WordWrap + textFormat: TextEdit.RichText readOnly: true background: null selectByMouse: true color: colors.text - horizontalAlignment: TextEdit.AlignHCenter + horizontalAlignment: TextEdit.AlignHCenter + + onLinkActivated: TimelineManager.openLink(link); + + CursorShape { + anchors.fill: parent + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } } } @@ -186,14 +193,13 @@ ApplicationWindow { Layout.alignment: Qt.AlignRight } - MessageDialog { + Platform.MessageDialog { id: confirmEncryptionDialog title: qsTr("End-to-End Encryption") text: qsTr("Encryption is currently experimental and things might break unexpectedly.
Please take note that it can't be disabled afterwards.") modality: Qt.WindowModal - icon: StandardIcon.Question onAccepted: { if (roomSettings.isEncryptionEnabled) return ; @@ -203,7 +209,7 @@ ApplicationWindow { onRejected: { encryptionToggle.checked = false; } - standardButtons: Dialog.Ok | Dialog.Cancel + buttons: Dialog.Ok | Dialog.Cancel } MatrixText { diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp index aa6f60a0..a264c78b 100644 --- a/src/ui/RoomSettings.cpp +++ b/src/ui/RoomSettings.cpp @@ -229,7 +229,7 @@ RoomSettings::roomName() const QString RoomSettings::roomTopic() const { - return QString::fromStdString(info_.topic); + return utils::linkifyMessage(QString::fromStdString(info_.topic).toHtmlEscaped()); } QString @@ -622,4 +622,4 @@ RoomSettings::updateAvatar() emit proxy->stopLoading(); }); }); -} \ No newline at end of file +}