Small UI improvement.

This commit is contained in:
Black Hat 2018-07-20 22:36:19 +08:00
parent c330bb4ff5
commit 7837c2d75e
6 changed files with 53 additions and 11 deletions

View File

@ -13,7 +13,7 @@ Page {
RoomListModel { RoomListModel {
id: roomListModel id: roomListModel
connection: matriqueController.isLogin ? page.connection : undefined connection: page.connection
onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName) onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
} }

View File

@ -1,10 +1,14 @@
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2 import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import "component"
Page { Page {
property alias darkTheme: themeSwitch.checked property alias darkTheme: themeSwitch.checked
property alias miniMode: miniModeSwitch.checked property alias miniMode: miniModeSwitch.checked
property var connection
header: TabBar { header: TabBar {
id: tabBar id: tabBar
@ -12,13 +16,14 @@ Page {
currentIndex: settingView.currentIndex currentIndex: settingView.currentIndex
TabButton { TabButton {
text: qsTr("Account") text: "Account"
} }
TabButton { TabButton {
text: qsTr("Appearance") text: "Appearance"
} }
TabButton { TabButton {
text: qsTr("About") text: "About"
} }
} }
@ -30,6 +35,34 @@ Page {
Item { Item {
id: accountPage 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 { Item {

View File

@ -27,6 +27,7 @@ AvatarContainer {
linkColor: isNotice || sentByMe ? Material.accent : "white" linkColor: isNotice || sentByMe ? Material.accent : "white"
// textFormat: contentType === "text/html" ? Text.RichText : Text.StyledText // textFormat: contentType === "text/html" ? Text.RichText : Text.StyledText
textFormat: Text.StyledText textFormat: Text.StyledText
onLinkActivated: Qt.openUrlExternally(link)
} }
} }
} }

View File

@ -21,5 +21,6 @@ Rectangle {
anchors.margins: 12 anchors.margins: 12
wrapMode: Label.Wrap wrapMode: Label.Wrap
textFormat: Text.StyledText textFormat: Text.StyledText
onLinkActivated: Qt.openUrlExternally(link)
} }
} }

View File

@ -182,6 +182,7 @@ Item {
background: Item { background: Item {
Rectangle { Rectangle {
z: 5
width: inputField.width * inputField.progress width: inputField.width * inputField.progress
height: parent.height height: parent.height
color: Material.accent color: Material.accent
@ -190,12 +191,15 @@ Item {
Rectangle { anchors.fill: parent; color: Material.theme == Material.Light ? "#eaeaea" : "#242424" } Rectangle { anchors.fill: parent; color: Material.theme == Material.Light ? "#eaeaea" : "#242424" }
} }
Keys.onReturnPressed: { Shortcut {
sequence: "Ctrl+Return"
onActivated: {
if (inputField.text) { if (inputField.text) {
postMessage(inputField.text) inputField.postMessage(inputField.text)
inputField.text = "" inputField.text = ""
} }
} }
}
function postMessage(text) { function postMessage(text) {
if (text.trim().length === 0) { return } if (text.trim().length === 0) { return }

View File

@ -11,6 +11,8 @@ import "component"
import "form" import "form"
ApplicationWindow { ApplicationWindow {
readonly property var connection: matriqueController.isLogin ? matriqueController.connection : undefined
id: window id: window
visible: true visible: true
width: 960 width: 960
@ -121,11 +123,12 @@ ApplicationWindow {
Room { Room {
id: roomPage id: roomPage
connection: matriqueController.connection connection: window.connection
} }
Setting { Setting {
id: settingPage id: settingPage
connection: window.connection
} }
RowLayout { RowLayout {
@ -147,8 +150,8 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
anchors.margins: 15 anchors.margins: 15
source: matriqueController.isLogin ? matriqueController.connection.localUser && matriqueController.connection.localUser.avatarUrl ? "image://mxc/" + matriqueController.connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png" source: connection ? connection.localUser && connection.localUser.avatarUrl ? "image://mxc/" + connection.localUser.avatarUrl : "" : "qrc:/asset/img/avatar.png"
displayText: matriqueController.connection.localUser && matriqueController.connection.localUser.displayText ? matriqueController.connection.localUser.displayText : "N" displayText: connection && connection.localUser.displayName ? connection.localUser.displayName : "N"
opaqueBackground: false opaqueBackground: false
} }