Small UI tweaks && bug fixes.

This commit is contained in:
Black Hat 2018-07-20 12:14:02 +08:00
parent 80fca26092
commit 6f6a7da414
11 changed files with 65 additions and 47 deletions

View File

@ -26,13 +26,8 @@ Page {
id: roomListForm id: roomListForm
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: { Layout.preferredWidth: settingPage.miniMode ? 80 : page.width * 0.4
if (page.width > 560) { Layout.minimumWidth: 80
return page.width * 0.4;
} else {
return 80;
}
}
Layout.maximumWidth: 360 Layout.maximumWidth: 360
listModel: roomListModel listModel: roomListModel

View File

@ -3,23 +3,8 @@ import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2 import QtQuick.Controls.Material 2.2
Page { Page {
SwipeView { property alias darkTheme: themeSwitch.checked
id: settingView property alias miniMode: miniModeSwitch.checked
currentIndex: 1
anchors.fill: parent
Item {
id: accountPage
}
Item {
id: secondPage
}
Item {
id: thirdPage
}
}
header: TabBar { header: TabBar {
id: tabBar id: tabBar
@ -30,10 +15,41 @@ Page {
text: qsTr("Account") text: qsTr("Account")
} }
TabButton { TabButton {
text: qsTr("Call History") text: qsTr("Appearance")
} }
TabButton { TabButton {
text: qsTr("Dail Pad") text: qsTr("About")
}
}
SwipeView {
id: settingView
currentIndex: tabBar.currentIndex
anchors.fill: parent
Item {
id: accountPage
}
Item {
id: appearancePage
Column {
Switch {
id: themeSwitch
text: "Dark theme"
}
Switch {
id: miniModeSwitch
text: "Mini Room List"
}
}
}
Item {
id: thirdPage
} }
} }
} }

View File

@ -8,7 +8,7 @@ Item {
readonly property bool downloaded: progressInfo && progressInfo.completed readonly property bool downloaded: progressInfo && progressInfo.completed
Rectangle { Rectangle {
z: 5 z: -2
height: parent.height height: parent.height
width: progressInfo.active && !progressInfo.completed ? progressInfo.progress / progressInfo.total * parent.width : 0 width: progressInfo.active && !progressInfo.completed ? progressInfo.progress / progressInfo.total * parent.width : 0
color: Material.accent color: Material.accent
@ -25,9 +25,7 @@ Item {
} }
onDownloadedChanged: { onDownloadedChanged: downloaded && openOnFinished ? openSavedFile() : {}
if (downloaded && openOnFinished) openSavedFile()
}
function saveFileAs() { function saveFileAs() {
locationDialog.open() locationDialog.open()

View File

@ -9,7 +9,7 @@ AvatarContainer {
width: messageImage.implicitWidth + 24 width: messageImage.implicitWidth + 24
height: messageImage.implicitHeight + 24 height: messageImage.implicitHeight + 24
color: sentByMe ? "lightgrey" : Material.accent color: sentByMe ? background : Material.accent
DownloadableContent { DownloadableContent {
id: downloadable id: downloadable
@ -20,6 +20,7 @@ AvatarContainer {
Image { Image {
id: messageImage id: messageImage
z: -4
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url) source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)
MouseArea { MouseArea {

View File

@ -13,18 +13,18 @@ AvatarContainer {
width: Math.min(messageText.implicitWidth + 24, messageListView.width - (!sentByMe ? 40 + messageRow.spacing : 0)) width: Math.min(messageText.implicitWidth + 24, messageListView.width - (!sentByMe ? 40 + messageRow.spacing : 0))
height: messageText.implicitHeight + 24 height: messageText.implicitHeight + 24
color: isNotice ? "transparent" : sentByMe ? "lightgrey" : Material.accent color: isNotice ? "transparent" : !sentByMe ? Material.accent : background
border.color: Material.accent border.color: Material.accent
border.width: isNotice ? 2 : 0 border.width: isNotice ? 2 : 0
Label { Label {
id: messageText id: messageText
text: display text: display
color: isNotice ? "black" : sentByMe ? "black" : "white" color: isNotice || sentByMe ? Material.foreground : "white"
anchors.fill: parent anchors.fill: parent
anchors.margins: 12 anchors.margins: 12
wrapMode: Label.Wrap wrapMode: Label.Wrap
linkColor: isNotice ? Material.accent : 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
} }

View File

@ -6,7 +6,10 @@ Item {
id: messageDelegate id: messageDelegate
readonly property bool sentByMe: author === currentRoom.localUser readonly property bool sentByMe: author === currentRoom.localUser
readonly property bool darkTheme: Material.theme == Material.Dark
readonly property color background: darkTheme ? "#242424" : "lightgrey"
z: -5
width: delegateLoader.width width: delegateLoader.width
height: delegateLoader.height height: delegateLoader.height

View File

@ -10,13 +10,13 @@ Rectangle {
width: Math.min(stateText.implicitWidth + 24, messageListView.width) width: Math.min(stateText.implicitWidth + 24, messageListView.width)
height: stateText.implicitHeight + 24 height: stateText.implicitHeight + 24
color: isEmote ? Material.accent : "lightgrey" color: isEmote ? Material.accent : background
Label { Label {
id: stateText id: stateText
text: "<b>" + author.displayName + "</b> " + display text: "<b>" + author.displayName + "</b> " + display
color: isEmote ? "white" : "black" color: isEmote ? "white" : Material.foreground
linkColor: isEmote ? "white" : Material.accent linkColor: isEmote || darkTheme ? "white" : Material.accent
anchors.fill: parent anchors.fill: parent
anchors.margins: 12 anchors.margins: 12
wrapMode: Label.Wrap wrapMode: Label.Wrap

View File

@ -34,7 +34,6 @@ Item {
visible: currentRoom visible: currentRoom
Pane { Pane {
z: 10
padding: 16 padding: 16
Layout.fillWidth: true Layout.fillWidth: true
@ -78,6 +77,8 @@ Item {
ListView { ListView {
id: messageListView id: messageListView
z: -10
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.leftMargin: 16 Layout.leftMargin: 16
@ -127,7 +128,6 @@ Item {
} }
Pane { Pane {
z: 10
padding: 16 padding: 16
Layout.fillWidth: true Layout.fillWidth: true
@ -186,7 +186,6 @@ Item {
Rectangle { Rectangle {
width: inputField.width * inputField.progress width: inputField.width * inputField.progress
height: parent.height height: parent.height
z: 5
color: Material.accent color: Material.accent
opacity: 0.4 opacity: 0.4
} }

View File

@ -12,7 +12,7 @@ import "qrc:/qml/component"
Item { Item {
property alias listModel: roomListProxyModel.sourceModel property alias listModel: roomListProxyModel.sourceModel
property int currentIndex: roomListProxyModel.mapToSource(listView.currentIndex) property int currentIndex: roomListProxyModel.mapToSource(listView.currentIndex)
readonly property bool mini: width <= 80 // Used as an indicator of whether the listform should be displayed as "Mini mode". readonly property bool mini: settingPage.miniMode // Used as an indicator of whether the listform should be displayed as "Mini mode".
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@ -124,6 +124,7 @@ Item {
opacity: 0.2 opacity: 0.2
} }
highlightMoveDuration: 250 highlightMoveDuration: 250
maximumFlickVelocity: 1024
currentIndex: -1 currentIndex: -1
@ -161,7 +162,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
text: name ? name : alias ? alias : id text: name ? name : ""
font.pointSize: 16 font.pointSize: 16
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
@ -186,10 +187,14 @@ Item {
height: 24 height: 24
text: section text: section
color: "grey" color: "grey"
leftPadding: 16 leftPadding: mini ? undefined : 16
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
background: Rectangle { anchors.fill:parent; color: "#dbdbdb" } horizontalAlignment: mini ? Text.AlignHCenter : undefined
background: Rectangle {
anchors.fill:parent
color: Material.theme == Material.Light ? "#dbdbdb" : "#363636"
}
} }
} }
} }

View File

@ -15,10 +15,12 @@ ApplicationWindow {
visible: true visible: true
width: 960 width: 960
height: 640 height: 640
minimumWidth: 320 minimumWidth: 480
minimumHeight: 320 minimumHeight: 320
title: qsTr("Matrique") title: qsTr("Matrique")
Material.theme: settingPage.darkTheme ? Material.Dark : Material.Light
FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" } FontLoader { id: materialFont; source: "qrc:/asset/font/material.ttf" }
Settings.Settings { Settings.Settings {
@ -164,7 +166,6 @@ ApplicationWindow {
imageProvider.connection = matriqueController.connection imageProvider.connection = matriqueController.connection
if (matriqueController.userID && matriqueController.token) { if (matriqueController.userID && matriqueController.token) {
console.log("Perform auto-login.");
matriqueController.login(); matriqueController.login();
} else { } else {
stackView.replace(loginPage); stackView.replace(loginPage);

View File

@ -17,8 +17,8 @@ class ImageProviderConnection : public QObject {
QMatrixClient::Connection* getConnection() { return m_connection; } QMatrixClient::Connection* getConnection() { return m_connection; }
void setConnection(QMatrixClient::Connection* connection) { void setConnection(QMatrixClient::Connection* connection) {
emit connectionChanged();
m_connection = connection; m_connection = connection;
emit connectionChanged();
} }
private: private: