Update libqmatrixclient && improve setting page(Rather a hack, needs

improvement).
This commit is contained in:
Black Hat 2018-07-22 20:31:52 +08:00
parent d6a7f8ad8b
commit f9e41f7e9f
6 changed files with 110 additions and 71 deletions

@ -1 +1 @@
Subproject commit f004c32ae4291fd8eca7f4106af7582e6fc86f5a
Subproject commit 716aa2a97d6654cc45ed6a9c8b08cad6d833e301

View File

@ -4,85 +4,62 @@ import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import "component"
import "form"
Page {
property alias darkTheme: themeSwitch.checked
property alias miniMode: miniModeSwitch.checked
property alias darkTheme: appearanceForm.darkTheme
property alias miniMode: appearanceForm.miniMode
property var connection
header: TabBar {
id: tabBar
width: parent.width
currentIndex: settingView.currentIndex
SettingAccountForm {
id: accountForm
parent: null
}
TabButton {
text: "Account"
SettingAppearancePage {
id: appearanceForm
parent: null
}
RowLayout {
ColumnLayout {
Material.elevation: 10
Layout.preferredWidth: 240
Layout.fillHeight: true
spacing: 0
ItemDelegate {
Layout.fillWidth: true
text: "Account"
onClicked: pushToStack(accountForm)
}
ItemDelegate {
Layout.fillWidth: true
text: "Appearance"
onClicked: pushToStack(appearanceForm)
}
ItemDelegate {
Layout.fillWidth: true
text: "About"
}
}
TabButton {
text: "Appearance"
}
TabButton {
text: "About"
StackView {
Layout.fillWidth: true
Layout.fillHeight: true
id: settingStackView
}
}
SwipeView {
id: settingView
currentIndex: tabBar.currentIndex
anchors.fill: parent
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 {
id: appearancePage
Column {
Switch {
id: themeSwitch
text: "Dark theme"
}
Switch {
id: miniModeSwitch
text: "Mini Room List"
}
}
}
Item {
id: thirdPage
}
function pushToStack(item) {
settingStackView.clear()
settingStackView.push(item)
}
}

View File

@ -0,0 +1,35 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "qrc:/qml/component"
Page {
RowLayout {
height: 60
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: 18
text: connection ? connection.localUser.displayName : ""
}
Label {
font.pointSize: 12
text: "No text."
}
}
}
}

View File

@ -0,0 +1,19 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
Page {
property alias darkTheme: themeSwitch.checked
property alias miniMode: miniModeSwitch.checked
Column {
Switch {
id: themeSwitch
text: "Dark theme"
}
Switch {
id: miniModeSwitch
text: "Mini Room List"
}
}
}

View File

@ -120,11 +120,17 @@ ApplicationWindow {
Room {
id: roomPage
parent: null
connection: window.connection
}
Setting {
id: settingPage
parent: null
connection: window.connection
}

View File

@ -27,5 +27,7 @@
<file>qml/component/AudioBubble.qml</file>
<file>qml/form/SettingForm.qml</file>
<file>qml/Setting.qml</file>
<file>qml/form/SettingAccountForm.qml</file>
<file>qml/form/SettingAppearancePage.qml</file>
</qresource>
</RCC>