From dda8738e8c35301a0b9c9cfdbec4bd8b591dd7f7 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Mon, 22 Apr 2019 09:28:33 +0800 Subject: [PATCH] Change black to primary. Improvements on ImageDelegate. Change reply style. --- imports/Spectral/Component/AutoTextField.qml | 2 + .../Component/Timeline/ImageDelegate.qml | 19 ++++-- .../Component/Timeline/MessageDelegate.qml | 25 ++++---- .../Component/Timeline/StateDelegate.qml | 1 + imports/Spectral/Panel/RoomDrawer.qml | 27 ++------ imports/Spectral/Panel/RoomPanel.qml | 61 +------------------ qml/main.qml | 10 +++ 7 files changed, 48 insertions(+), 97 deletions(-) diff --git a/imports/Spectral/Component/AutoTextField.qml b/imports/Spectral/Component/AutoTextField.qml index 274b236..a70d1e4 100644 --- a/imports/Spectral/Component/AutoTextField.qml +++ b/imports/Spectral/Component/AutoTextField.qml @@ -1,6 +1,8 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 +import Spectral.Setting 0.1 + TextField { selectByMouse: true } diff --git a/imports/Spectral/Component/Timeline/ImageDelegate.qml b/imports/Spectral/Component/Timeline/ImageDelegate.qml index c077842..9bb170f 100644 --- a/imports/Spectral/Component/Timeline/ImageDelegate.qml +++ b/imports/Spectral/Component/Timeline/ImageDelegate.qml @@ -9,6 +9,7 @@ import Spectral 0.1 import Spectral.Setting 0.1 import Spectral.Component 2.0 +import Spectral.Effect 2.0 import Spectral.Font 0.1 ColumnLayout { @@ -69,16 +70,23 @@ ColumnLayout { verticalAlignment: Label.AlignVCenter } + BusyIndicator { + Layout.preferredWidth: 64 + Layout.preferredHeight: 64 + + visible: img.status == Image.Loading + } + Image { Layout.maximumWidth: messageListView.width - (!sentByMe ? 32 + messageRow.spacing : 0) - 48 id: img - source: downloaded ? progressInfo.localPath : "image://mxc/" + + source: "image://mxc/" + (content.info && content.info.thumbnail_info ? content.thumbnailMediaId : content.mediaId) - sourceSize.width: 200 - sourceSize.height: 200 + sourceSize.width: messageListView.width * 0.6 + sourceSize.height: messageListView.height layer.enabled: true layer.effect: OpacityMask { @@ -94,12 +102,13 @@ ColumnLayout { color: "transparent" radius: 24 + antialiasing: true - border.width: 2 + border.width: 4 border.color: MPalette.banner } - AutoMouseArea { + RippleEffect { anchors.fill: parent id: messageMouseArea diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml index 3a2967e..100d062 100644 --- a/imports/Spectral/Component/Timeline/MessageDelegate.qml +++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml @@ -7,6 +7,7 @@ import Spectral 0.1 import Spectral.Setting 0.1 import Spectral.Component 2.0 +import Spectral.Effect 2.0 import Spectral.Font 0.1 ColumnLayout { @@ -74,6 +75,7 @@ ColumnLayout { background: Rectangle { color: sentByMe ? "#009DC2" : eventType === "notice" ? "#4285F4" : "#673AB7" radius: 18 + antialiasing: true AutoMouseArea { anchors.fill: parent @@ -123,19 +125,10 @@ ColumnLayout { padding: 8 - background: Item { - Rectangle { - anchors.leftMargin: 0 - width: 2 - height: parent.height + background: RippleEffect { + anchors.fill: parent - color: "white" - } - MouseArea { - anchors.fill: parent - - onClicked: goToEvent(replyEventId) - } + onPrimaryClicked: goToEvent(replyEventId) } contentItem: RowLayout { @@ -178,6 +171,14 @@ ColumnLayout { } } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 1 + + visible: replyEventId || "" + color: "white" + } + TextEdit { Layout.fillWidth: true diff --git a/imports/Spectral/Component/Timeline/StateDelegate.qml b/imports/Spectral/Component/Timeline/StateDelegate.qml index 9e6fef7..ca17279 100644 --- a/imports/Spectral/Component/Timeline/StateDelegate.qml +++ b/imports/Spectral/Component/Timeline/StateDelegate.qml @@ -23,5 +23,6 @@ Label { background: Rectangle { color: MPalette.banner radius: 4 + antialiasing: true } } diff --git a/imports/Spectral/Panel/RoomDrawer.qml b/imports/Spectral/Panel/RoomDrawer.qml index 7b8c887..b6b547e 100644 --- a/imports/Spectral/Panel/RoomDrawer.qml +++ b/imports/Spectral/Panel/RoomDrawer.qml @@ -4,6 +4,7 @@ import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.12 import Spectral.Component 2.0 +import Spectral.Effect 2.0 import Spectral.Setting 0.1 import Spectral 0.1 @@ -68,7 +69,7 @@ Drawer { Layout.preferredHeight: 32 Layout.alignment: Qt.AlignTop - icon: "\ue88e" + icon: "\ue88f" color: MPalette.lighter } @@ -96,7 +97,7 @@ Drawer { wrapMode: Label.Wrap text: room && room.topic ? room.topic : "No Topic" - color: MPalette.accent + color: MPalette.foreground } Label { @@ -161,7 +162,7 @@ Drawer { room: roomDrawer.room } - delegate: SwipeDelegate { + delegate: Item { width: userListView.width height: 48 @@ -185,25 +186,9 @@ Drawer { } } - swipe.right: Rectangle { - width: height - height: parent.height - anchors.right: parent.right - color: Material.accent - - MaterialIcon { - anchors.fill: parent - icon: "\ue879" - color: "white" - } - - SwipeDelegate.onClicked: { - room.kickMember(userId) - swipe.close() - } + RippleEffect { + anchors.fill: parent } - - onClicked: swipe.open(SwipeDelegate.Right) } ScrollBar.vertical: ScrollBar {} diff --git a/imports/Spectral/Panel/RoomPanel.qml b/imports/Spectral/Panel/RoomPanel.qml index e6ee257..b2826c8 100644 --- a/imports/Spectral/Panel/RoomPanel.qml +++ b/imports/Spectral/Panel/RoomPanel.qml @@ -83,7 +83,6 @@ Item { highlightMoveDuration: 500 boundsBehavior: Flickable.DragOverBounds - model: SortFilterProxyModel { id: sortedMessageEventModel @@ -173,8 +172,7 @@ Item { visible: section !== aboveSection || Math.abs(time - aboveTime) > 600000 } - MessageDelegate { - } + MessageDelegate {} } } @@ -191,8 +189,7 @@ Item { visible: section !== aboveSection || Math.abs(time - aboveTime) > 600000 } - MessageDelegate { - } + MessageDelegate {} } } @@ -300,60 +297,6 @@ Item { } } } - - Popup { - property alias listModel: readMarkerListView.model - - x: (window.width - width) / 2 - y: (window.height - height) / 2 - width: 320 - - id: readMarkerDialog - - parent: ApplicationWindow.overlay - - modal: true - padding: 16 - - closePolicy: Dialog.CloseOnEscape | Dialog.CloseOnPressOutside - - contentItem: AutoListView { - implicitHeight: Math.min(window.height - 64, - readMarkerListView.contentHeight) - - id: readMarkerListView - - clip: true - boundsBehavior: Flickable.DragOverBounds - - delegate: ItemDelegate { - width: parent.width - height: 48 - - RowLayout { - anchors.fill: parent - anchors.margins: 8 - spacing: 12 - - Avatar { - Layout.preferredWidth: height - Layout.fillHeight: true - - source: modelData.avatar - hint: modelData.displayName - } - - Label { - Layout.fillWidth: true - - text: modelData.displayName - } - } - } - - ScrollBar.vertical: ScrollBar {} - } - } } Control { diff --git a/qml/main.qml b/qml/main.qml index 5c40681..ba7e2bc 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -279,12 +279,14 @@ ApplicationWindow { Layout.preferredWidth: 48 Layout.preferredHeight: 48 + color: MPalette.foreground icon: "\ue7ff" } Label { Layout.fillWidth: true + color: MPalette.foreground text: "Start a Chat" } } @@ -304,12 +306,14 @@ ApplicationWindow { Layout.preferredWidth: 48 Layout.preferredHeight: 48 + color: MPalette.foreground icon: "\ue7fc" } Label { Layout.fillWidth: true + color: MPalette.foreground text: "Create a Room" } } @@ -333,12 +337,14 @@ ApplicationWindow { Layout.preferredWidth: 48 Layout.preferredHeight: 48 + color: MPalette.foreground icon: "\ue3a9" } Label { Layout.fillWidth: true + color: MPalette.foreground text: "Night Mode" } @@ -365,12 +371,14 @@ ApplicationWindow { Layout.preferredWidth: 48 Layout.preferredHeight: 48 + color: MPalette.foreground icon: "\ue5d2" } Label { Layout.fillWidth: true + color: MPalette.foreground text: "Enable System Tray" } @@ -397,12 +405,14 @@ ApplicationWindow { Layout.preferredWidth: 48 Layout.preferredHeight: 48 + color: MPalette.foreground icon: "\ue7f5" } Label { Layout.fillWidth: true + color: MPalette.foreground text: "Enable Notifications" }