Make UI responsive.

Some more UI changes in settings panel.
Fix link color in replies.
This commit is contained in:
Black Hat
2019-04-21 20:39:38 +08:00
parent aa3309a184
commit da155e07ca
6 changed files with 439 additions and 141 deletions

View File

@@ -169,7 +169,7 @@ ColumnLayout {
Layout.fillWidth: true
color: "white"
text: replyDisplay || ""
text: "<style>a{color: white;} .user-pill{}</style>" + (replyDisplay || "")
wrapMode: Label.Wrap
textFormat: Label.RichText

View File

@@ -16,7 +16,7 @@ Drawer {
ColumnLayout {
anchors.fill: parent
anchors.margins: 32
anchors.margins: 16
Avatar {
Layout.preferredWidth: 96

View File

@@ -80,134 +80,134 @@ Item {
]
}
Drawer {
width: Math.max(root.width, 400)
height: root.height
// Drawer {
// width: Math.max(root.width, 400)
// height: root.height
id: drawer
// id: drawer
edge: Qt.LeftEdge
// edge: Qt.LeftEdge
ColumnLayout {
anchors.fill: parent
// ColumnLayout {
// anchors.fill: parent
id: mainColumn
// id: mainColumn
spacing: 0
// spacing: 0
Control {
Layout.fillWidth: true
Layout.preferredHeight: 330
// Control {
// Layout.fillWidth: true
// Layout.preferredHeight: 330
padding: 24
// padding: 24
contentItem: ColumnLayout {
spacing: 4
// contentItem: ColumnLayout {
// spacing: 4
Avatar {
Layout.preferredWidth: 200
Layout.preferredHeight: 200
Layout.margins: 12
Layout.alignment: Qt.AlignHCenter
// Avatar {
// Layout.preferredWidth: 200
// Layout.preferredHeight: 200
// Layout.margins: 12
// Layout.alignment: Qt.AlignHCenter
source: root.user ? root.user.avatarMediaId : null
hint: root.user ? root.user.displayName : "?"
}
// source: root.user ? root.user.avatarMediaId : null
// hint: root.user ? root.user.displayName : "?"
// }
Label {
Layout.alignment: Qt.AlignHCenter
// Label {
// Layout.alignment: Qt.AlignHCenter
text: root.user ? root.user.displayName : "No Name"
color: "white"
font.pixelSize: 22
}
// text: root.user ? root.user.displayName : "No Name"
// color: "white"
// font.pixelSize: 22
// }
Label {
Layout.alignment: Qt.AlignHCenter
// Label {
// Layout.alignment: Qt.AlignHCenter
text: root.user ? root.user.id : "@example:matrix.org"
color: "white"
opacity: 0.7
font.pixelSize: 13
}
}
// text: root.user ? root.user.id : "@example:matrix.org"
// color: "white"
// opacity: 0.7
// font.pixelSize: 13
// }
// }
background: Rectangle { color: Material.primary }
// background: Rectangle { color: Material.primary }
RippleEffect {
anchors.fill: parent
}
}
// RippleEffect {
// anchors.fill: parent
// }
// }
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
// ScrollView {
// Layout.fillWidth: true
// Layout.fillHeight: true
clip: true
// clip: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ColumnLayout {
width: mainColumn.width
spacing: 0
// ColumnLayout {
// width: mainColumn.width
// spacing: 0
Repeater {
model: AccountListModel {
controller: spectralController
}
// Repeater {
// model: AccountListModel {
// controller: spectralController
// }
delegate: ItemDelegate {
Layout.fillWidth: true
// delegate: ItemDelegate {
// Layout.fillWidth: true
text: user.displayName
// text: user.displayName
onClicked: {
controller.connection = connection
drawer.close()
}
}
}
// onClicked: {
// controller.connection = connection
// drawer.close()
// }
// }
// }
ItemDelegate {
Layout.fillWidth: true
// ItemDelegate {
// Layout.fillWidth: true
text: "Add Account"
// text: "Add Account"
onClicked: loginDialog.open()
}
// onClicked: loginDialog.open()
// }
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
// Rectangle {
// Layout.fillWidth: true
// Layout.preferredHeight: 1
color: MSettings.darkTheme ? "#424242" : "#e7ebeb"
}
// color: MSettings.darkTheme ? "#424242" : "#e7ebeb"
// }
ItemDelegate {
Layout.fillWidth: true
// ItemDelegate {
// Layout.fillWidth: true
text: "Settings"
}
// text: "Settings"
// }
ItemDelegate {
Layout.fillWidth: true
// ItemDelegate {
// Layout.fillWidth: true
text: "Logout"
// text: "Logout"
onClicked: controller.logout(controller.connection)
}
// onClicked: controller.logout(controller.connection)
// }
ItemDelegate {
Layout.fillWidth: true
// ItemDelegate {
// Layout.fillWidth: true
text: "Exit"
// text: "Exit"
onClicked: Qt.quit()
}
}
}
}
}
// onClicked: Qt.quit()
// }
// }
// }
// }
// }
ColumnLayout {
anchors.fill: parent
@@ -288,8 +288,6 @@ Item {
AutoTextField {
readonly property bool active: text
readonly property bool isRoom: text.match(/#.*:.*\..*/g) || text.match(/!.*:.*\..*/g)
readonly property bool isUser: text.match(/@.*:.*\..*/g)
Layout.fillWidth: true
Layout.fillHeight: true
@@ -304,26 +302,6 @@ Item {
background: Item {}
}
ItemDelegate {
Layout.preferredWidth: height
Layout.fillHeight: true
visible: searchField.isRoom || searchField.isUser
contentItem: MaterialIcon { icon: "\ue145" }
onClicked: {
if (searchField.isRoom) {
controller.joinRoom(controller.connection, searchField.text)
return
}
if (searchField.isUser) {
controller.createDirectChat(controller.connection, searchField.text)
return
}
}
}
Avatar {
Layout.preferredWidth: height
Layout.fillHeight: true
@@ -336,7 +314,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: drawer.open()
onClicked: detailDialog.open()
}
}
}

View File

@@ -23,15 +23,6 @@ Item {
room: currentRoom
}
RoomDrawer {
width: Math.min(root.width * 0.7, 480)
height: root.height
id: roomDrawer
room: currentRoom
}
Label {
anchors.centerIn: parent
visible: !currentRoom
@@ -64,7 +55,7 @@ Item {
topic: currentRoom ? (currentRoom.topic).replace(/(\r\n\t|\n|\r\t)/gm,"") : ""
atTop: messageListView.atYBeginning
onClicked: roomDrawer.open()
onClicked: roomDrawer.visible ? roomDrawer.close() : roomDrawer.open()
}
ColumnLayout {

View File

@@ -1,3 +1,4 @@
module Spectral.Panel
RoomPanel 2.0 RoomPanel.qml
RoomListPanel 2.0 RoomListPanel.qml
RoomDrawer 2.0 RoomDrawer.qml