Linkify topic in room settings and use non-deprecated MessageDialog

This commit is contained in:
Nicolas Werner 2021-02-22 21:35:11 +01:00
parent 8351cc4180
commit af9b66dd3e
3 changed files with 19 additions and 13 deletions

View File

@ -191,7 +191,7 @@ sudo emerge -a ">=dev-qt/qtgui-5.10.0" media-libs/fontconfig dev-libs/qtkeychain
```bash ```bash
# Build requirements + qml modules needed at runtime (you may not need all of them, but the following seem to work according to reports): # 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) This will install all dependencies, except for tweeny (use bundled tweeny)
and mtxclient (needs to be build separately). 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 \ sudo apt install cmake gcc make automake liblmdb-dev \
qt5-default libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-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-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 qt5keychain-dev
``` ```

View File

@ -1,6 +1,6 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.3 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.Layouts 1.2
import QtQuick.Window 2.3 import QtQuick.Window 2.3
import im.nheko 1.0 import im.nheko 1.0
@ -110,18 +110,25 @@ ApplicationWindow {
ScrollView { ScrollView {
Layout.maximumHeight: 75 Layout.maximumHeight: 75
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true width: parent.width
TextArea { TextArea {
text: roomSettings.roomTopic text: TimelineManager.escapeEmoji(roomSettings.roomTopic)
wrapMode: TextEdit.WordWrap wrapMode: TextEdit.WordWrap
textFormat: TextEdit.RichText
readOnly: true readOnly: true
background: null background: null
selectByMouse: true selectByMouse: true
color: colors.text 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 Layout.alignment: Qt.AlignRight
} }
MessageDialog { Platform.MessageDialog {
id: confirmEncryptionDialog id: confirmEncryptionDialog
title: qsTr("End-to-End Encryption") title: qsTr("End-to-End Encryption")
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br> text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
Please take note that it can't be disabled afterwards.") Please take note that it can't be disabled afterwards.")
modality: Qt.WindowModal modality: Qt.WindowModal
icon: StandardIcon.Question
onAccepted: { onAccepted: {
if (roomSettings.isEncryptionEnabled) if (roomSettings.isEncryptionEnabled)
return ; return ;
@ -203,7 +209,7 @@ ApplicationWindow {
onRejected: { onRejected: {
encryptionToggle.checked = false; encryptionToggle.checked = false;
} }
standardButtons: Dialog.Ok | Dialog.Cancel buttons: Dialog.Ok | Dialog.Cancel
} }
MatrixText { MatrixText {

View File

@ -229,7 +229,7 @@ RoomSettings::roomName() const
QString QString
RoomSettings::roomTopic() const RoomSettings::roomTopic() const
{ {
return QString::fromStdString(info_.topic); return utils::linkifyMessage(QString::fromStdString(info_.topic).toHtmlEscaped());
} }
QString QString
@ -622,4 +622,4 @@ RoomSettings::updateAvatar()
emit proxy->stopLoading(); emit proxy->stopLoading();
}); });
}); });
} }