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 QtQuick.Layouts 1.3
import "component" import "component"
import "form"
Page { Page {
property alias darkTheme: themeSwitch.checked property alias darkTheme: appearanceForm.darkTheme
property alias miniMode: miniModeSwitch.checked property alias miniMode: appearanceForm.miniMode
property var connection property var connection
header: TabBar { SettingAccountForm {
id: tabBar id: accountForm
width: parent.width parent: null
currentIndex: settingView.currentIndex }
TabButton { SettingAppearancePage {
text: "Account" 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" StackView {
} Layout.fillWidth: true
TabButton { Layout.fillHeight: true
text: "About"
id: settingStackView
} }
} }
SwipeView { function pushToStack(item) {
id: settingView settingStackView.clear()
settingStackView.push(item)
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
}
} }
} }

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 { Room {
id: roomPage id: roomPage
parent: null
connection: window.connection connection: window.connection
} }
Setting { Setting {
id: settingPage id: settingPage
parent: null
connection: window.connection connection: window.connection
} }

View File

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