summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-07-09 09:36:33 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-07-09 11:36:34 +0200
commit2f08f5181c682f212d69852ce5b519033c9fbf70 (patch)
treec913f941f5e93cb2ca6addde05bac9636b42f114 /resources
parentMerge branch 'nheko_loading_spinner' into 'master' (diff)
downloadnheko-2f08f5181c682f212d69852ce5b519033c9fbf70.tar.xz
Redesign invites and room preview joins
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/ChatPage.qml1
-rw-r--r--resources/qml/RoomList.qml60
-rw-r--r--resources/qml/RoomSettings.qml6
-rw-r--r--resources/qml/TimelineView.qml55
-rw-r--r--resources/qml/TopBar.qml24
-rw-r--r--resources/qml/components/FlatButton.qml47
-rw-r--r--resources/res.qrc1
7 files changed, 120 insertions, 74 deletions
diff --git a/resources/qml/ChatPage.qml b/resources/qml/ChatPage.qml

index 7f6758df..ae37187b 100644 --- a/resources/qml/ChatPage.qml +++ b/resources/qml/ChatPage.qml
@@ -79,6 +79,7 @@ Rectangle { showBackButton: adaptiveView.singlePageMode room: Rooms.currentRoom + roomPreview: Rooms.currentRoomPreview.roomid ? Rooms.currentRoomPreview : null } } diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index c4a8bcfb..a92beb38 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml
@@ -121,7 +121,7 @@ Page { states: [ State { name: "highlight" - when: hovered.hovered && !(Rooms.currentRoom && model.roomId == Rooms.currentRoom.roomId()) + when: hovered.hovered && !((Rooms.currentRoom && model.roomId == Rooms.currentRoom.roomId()) || Rooms.currentRoomPreview.roomid == model.roomId) PropertyChanges { target: roomItem @@ -135,7 +135,7 @@ Page { }, State { name: "selected" - when: Rooms.currentRoom && model.roomId == Rooms.currentRoom.roomId() + when: (Rooms.currentRoom && model.roomId == Rooms.currentRoom.roomId()) || Rooms.currentRoomPreview.roomid == model.roomId PropertyChanges { target: roomItem @@ -268,7 +268,7 @@ Page { RowLayout { Layout.fillWidth: true spacing: 0 - visible: !model.isInvite && !model.isSpace + visible: !model.isSpace height: visible ? 0 : undefined ElidedLabel { @@ -310,60 +310,6 @@ Page { } - RowLayout { - Layout.fillWidth: true - spacing: Nheko.paddingMedium - visible: model.isInvite - enabled: visible - height: visible ? 0 : undefined - - ElidedLabel { - elideWidth: textContent.width / 2 - 2 * Nheko.paddingMedium - fullText: qsTr("Accept") - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - leftPadding: Nheko.paddingMedium - rightPadding: Nheko.paddingMedium - color: Nheko.colors.brightText - - TapHandler { - onSingleTapped: Rooms.acceptInvite(model.roomId) - } - - background: Rectangle { - color: Nheko.theme.alternateButton - radius: height / 2 - } - - } - - ElidedLabel { - Layout.alignment: Qt.AlignRight - elideWidth: textContent.width / 2 - 2 * Nheko.paddingMedium - fullText: qsTr("Decline") - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - leftPadding: Nheko.paddingMedium - rightPadding: Nheko.paddingMedium - color: Nheko.colors.brightText - - TapHandler { - onSingleTapped: Rooms.declineInvite(model.roomId) - } - - background: Rectangle { - color: Nheko.theme.alternateButton - radius: height / 2 - } - - } - - Item { - Layout.fillWidth: true - } - - } - } } diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml
index d6e6c6a5..c852b837 100644 --- a/resources/qml/RoomSettings.qml +++ b/resources/qml/RoomSettings.qml
@@ -117,9 +117,11 @@ ApplicationWindow { } ScrollView { - Layout.maximumHeight: 75 + Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter - width: parent.width + Layout.fillWidth: true + Layout.leftMargin: Nheko.paddingLarge + Layout.rightMargin: Nheko.paddingLarge TextArea { text: TimelineManager.escapeEmoji(roomSettings.roomTopic) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 0209054d..46317b2c 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -2,6 +2,7 @@ // // SPDX-License-Identifier: GPL-3.0-or-later +import "./components" import "./delegates" import "./device-verification" import "./emoji" @@ -21,10 +22,11 @@ Item { id: timelineView property var room: null + property var roomPreview: null property bool showBackButton: false Label { - visible: !room && !TimelineManager.isInitialSync + visible: !room && !TimelineManager.isInitialSync && !roomPreview anchors.centerIn: parent text: qsTr("No room open") font.pointSize: 24 @@ -132,15 +134,25 @@ Item { } ColumnLayout { - visible: room != null && room.isSpace + id: preview + + property string roomName: room ? room.roomName : (roomPreview ? roomPreview.roomName : "") + property string roomTopic: room ? room.roomTopic : (roomPreview ? roomPreview.roomTopic : "") + property string avatarUrl: room ? room.roomAvatarUrl : (roomPreview ? roomPreview.roomAvatarUrl : "") + + visible: room != null && room.isSpace || roomPreview != null enabled: visible anchors.fill: parent anchors.margins: Nheko.paddingLarge spacing: Nheko.paddingLarge + Item { + Layout.fillHeight: true + } + Avatar { - url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" - displayName: room ? room.roomName : "" + url: parent.avatarUrl.replace("mxc://", "image://MxcImage/") + displayName: parent.roomName height: 130 width: 130 Layout.alignment: Qt.AlignHCenter @@ -148,22 +160,25 @@ Item { } MatrixText { - text: room ? room.roomName : "" + text: parent.roomName font.pixelSize: 24 Layout.alignment: Qt.AlignHCenter } MatrixText { + visible: !!room text: qsTr("%1 member(s)").arg(room ? room.roomMemberCount : 0) Layout.alignment: Qt.AlignHCenter } ScrollView { Layout.alignment: Qt.AlignHCenter - width: timelineView.width - Nheko.paddingLarge * 2 + Layout.fillWidth: true + Layout.leftMargin: Nheko.paddingLarge + Layout.rightMargin: Nheko.paddingLarge TextArea { - text: TimelineManager.escapeEmoji(room ? room.roomTopic : "") + text: TimelineManager.escapeEmoji(preview.roomTopic) wrapMode: TextEdit.WordWrap textFormat: TextEdit.RichText readOnly: true @@ -182,6 +197,32 @@ Item { } + FlatButton { + visible: roomPreview && !roomPreview.isInvite + Layout.alignment: Qt.AlignHCenter + text: qsTr("join the conversation") + onClicked: Rooms.joinPreview(roomPreview.roomid) + } + + FlatButton { + visible: roomPreview && roomPreview.isInvite + Layout.alignment: Qt.AlignHCenter + text: qsTr("accept invite") + onClicked: Rooms.acceptInvite(roomPreview.roomid) + } + + FlatButton { + visible: roomPreview && roomPreview.isInvite + Layout.alignment: Qt.AlignHCenter + text: qsTr("decline invite") + onClicked: Rooms.declineInvite(roomPreview.roomid) + } + + Item { + visible: room != null + Layout.preferredHeight: Math.ceil(fontMetrics.lineSpacing * 2) + } + Item { Layout.fillHeight: true } diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml
index 30ab2e7c..82373023 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml
@@ -12,6 +12,9 @@ Rectangle { id: topBar property bool showBackButton: false + property string roomName: room ? room.roomName : qsTr("No room selected") + property string avatarUrl: room ? room.roomAvatarUrl : "" + property string roomTopic: room ? room.roomTopic : "" Layout.fillWidth: true implicitHeight: topLayout.height + Nheko.paddingMedium * 2 @@ -20,15 +23,15 @@ Rectangle { TapHandler { onSingleTapped: { - room.openRoomSettings(); + if (room) + room.openRoomSettings(); + eventPoint.accepted = true; } gesturePolicy: TapHandler.ReleaseWithinBounds } GridLayout { - //Layout.margins: 8 - id: topLayout anchors.left: parent.left @@ -59,9 +62,13 @@ Rectangle { Layout.alignment: Qt.AlignVCenter width: Nheko.avatarSize height: Nheko.avatarSize - url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" - displayName: room ? room.roomName : qsTr("No room selected") - onClicked: room.openRoomSettings() + url: avatarUrl.replace("mxc://", "image://MxcImage/") + displayName: roomName + onClicked: { + if (room) { + room.openRoomSettings(); + } + } } Label { @@ -70,7 +77,7 @@ Rectangle { Layout.row: 0 color: Nheko.colors.text font.pointSize: fontMetrics.font.pointSize * 1.1 - text: room ? room.roomName : qsTr("No room selected") + text: roomName maximumLineCount: 1 elide: Text.ElideRight textFormat: Text.RichText @@ -82,12 +89,13 @@ Rectangle { Layout.row: 1 Layout.maximumHeight: fontMetrics.lineSpacing * 2 // show 2 lines clip: true - text: room ? room.roomTopic : "" + text: roomTopic } ImageButton { id: roomOptionsButton + visible: !!room Layout.column: 3 Layout.row: 0 Layout.rowSpan: 2 diff --git a/resources/qml/components/FlatButton.qml b/resources/qml/components/FlatButton.qml new file mode 100644
index 00000000..77d97976 --- /dev/null +++ b/resources/qml/components/FlatButton.qml
@@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtGraphicalEffects 1.12 +import QtQuick 2.9 +import QtQuick.Controls 2.5 +import im.nheko 1.0 + +Button { + id: control + + implicitHeight: Math.ceil(control.contentItem.implicitHeight * 1.5) + implicitWidth: Math.ceil(control.contentItem.implicitWidth + control.contentItem.implicitHeight) + hoverEnabled: true + + DropShadow { + anchors.fill: control.background + horizontalOffset: 3 + verticalOffset: 3 + radius: 8 + samples: 17 + cached: true + color: "#80000000" + source: control.background + } + + contentItem: Text { + text: control.text + //font: control.font + font.capitalization: Font.AllUppercase + font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5) + //font.capitalization: Font.AllUppercase + color: Nheko.colors.light + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + //height: control.contentItem.implicitHeight * 2 + //width: control.contentItem.implicitWidth * 2 + radius: height / 6 + color: Qt.lighter(Nheko.colors.dark, control.down ? 1.4 : (control.hovered ? 1.2 : 1)) + } + +} diff --git a/resources/res.qrc b/resources/res.qrc
index 9bb8ae2e..f41835f9 100644 --- a/resources/res.qrc +++ b/resources/res.qrc
@@ -183,6 +183,7 @@ <file>qml/voip/VideoCall.qml</file> <file>qml/components/AdaptiveLayout.qml</file> <file>qml/components/AdaptiveLayoutElement.qml</file> + <file>qml/components/FlatButton.qml</file> </qresource> <qresource prefix="/media"> <file>media/ring.ogg</file>