diff --git a/qml/Room.qml b/qml/Room.qml index d389a14..de4dd96 100644 --- a/qml/Room.qml +++ b/qml/Room.qml @@ -13,7 +13,7 @@ Page { RoomListModel { id: roomListModel - connection: matriqueController.isLogin ? page.connection : undefined + connection: page.connection onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName) } diff --git a/qml/Setting.qml b/qml/Setting.qml index c7d1426..7ddeff6 100644 --- a/qml/Setting.qml +++ b/qml/Setting.qml @@ -1,10 +1,14 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 +import QtQuick.Layouts 1.3 + +import "component" Page { property alias darkTheme: themeSwitch.checked property alias miniMode: miniModeSwitch.checked + property var connection header: TabBar { id: tabBar @@ -12,13 +16,14 @@ Page { currentIndex: settingView.currentIndex TabButton { - text: qsTr("Account") + text: "Account" + } TabButton { - text: qsTr("Appearance") + text: "Appearance" } TabButton { - text: qsTr("About") + text: "About" } } @@ -30,6 +35,34 @@ Page { Item { id: accountPage + + RowLayout { + height: 80 + + ImageStatus { + Layout.preferredWidth: height + Layout.fillHeight: true + + source: connection ? connection.localUser && connection.localUser.avatarUrl ? "image://mxc/" + connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png" + displayText: connection && connection.localUser.displayName ? connection.localUser.displayName : "N" + opaqueBackground: false + } + + ColumnLayout { + Layout.fillWidth: true + Layout.fillHeight: true + + Label { + font.pointSize: 24 + text: connection ? connection.localUser.displayName : "" + } + + Label { + font.pointSize: 16 + text: "No text." + } + } + } } Item { diff --git a/qml/component/MessageBubble.qml b/qml/component/MessageBubble.qml index c8e997d..e14026e 100644 --- a/qml/component/MessageBubble.qml +++ b/qml/component/MessageBubble.qml @@ -27,6 +27,7 @@ AvatarContainer { linkColor: isNotice || sentByMe ? Material.accent : "white" // textFormat: contentType === "text/html" ? Text.RichText : Text.StyledText textFormat: Text.StyledText + onLinkActivated: Qt.openUrlExternally(link) } } } diff --git a/qml/component/StateBubble.qml b/qml/component/StateBubble.qml index dc1c3d1..77a52e5 100644 --- a/qml/component/StateBubble.qml +++ b/qml/component/StateBubble.qml @@ -21,5 +21,6 @@ Rectangle { anchors.margins: 12 wrapMode: Label.Wrap textFormat: Text.StyledText + onLinkActivated: Qt.openUrlExternally(link) } } diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml index fc18986..de35572 100644 --- a/qml/form/RoomForm.qml +++ b/qml/form/RoomForm.qml @@ -182,6 +182,7 @@ Item { background: Item { Rectangle { + z: 5 width: inputField.width * inputField.progress height: parent.height color: Material.accent @@ -190,10 +191,13 @@ Item { Rectangle { anchors.fill: parent; color: Material.theme == Material.Light ? "#eaeaea" : "#242424" } } - Keys.onReturnPressed: { - if (inputField.text) { - postMessage(inputField.text) - inputField.text = "" + Shortcut { + sequence: "Ctrl+Return" + onActivated: { + if (inputField.text) { + inputField.postMessage(inputField.text) + inputField.text = "" + } } } diff --git a/qml/main.qml b/qml/main.qml index 6811a6e..b11470e 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -11,6 +11,8 @@ import "component" import "form" ApplicationWindow { + readonly property var connection: matriqueController.isLogin ? matriqueController.connection : undefined + id: window visible: true width: 960 @@ -121,11 +123,12 @@ ApplicationWindow { Room { id: roomPage - connection: matriqueController.connection + connection: window.connection } Setting { id: settingPage + connection: window.connection } RowLayout { @@ -147,8 +150,8 @@ ApplicationWindow { anchors.fill: parent anchors.margins: 15 - source: matriqueController.isLogin ? matriqueController.connection.localUser && matriqueController.connection.localUser.avatarUrl ? "image://mxc/" + matriqueController.connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png" - displayText: matriqueController.connection.localUser && matriqueController.connection.localUser.displayText ? matriqueController.connection.localUser.displayText : "N" + source: connection ? connection.localUser && connection.localUser.avatarUrl ? "image://mxc/" + connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png" + displayText: connection && connection.localUser.displayName ? connection.localUser.displayName : "N" opaqueBackground: false }