diff --git a/include/libqmatrixclient b/include/libqmatrixclient
index f004c32ae..716aa2a97 160000
--- a/include/libqmatrixclient
+++ b/include/libqmatrixclient
@@ -1 +1 @@
-Subproject commit f004c32ae4291fd8eca7f4106af7582e6fc86f5a
+Subproject commit 716aa2a97d6654cc45ed6a9c8b08cad6d833e301
diff --git a/qml/Setting.qml b/qml/Setting.qml
index 7ddeff678..a71a3a254 100644
--- a/qml/Setting.qml
+++ b/qml/Setting.qml
@@ -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)
}
}
diff --git a/qml/form/SettingAccountForm.qml b/qml/form/SettingAccountForm.qml
new file mode 100644
index 000000000..4bdab361e
--- /dev/null
+++ b/qml/form/SettingAccountForm.qml
@@ -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."
+ }
+ }
+ }
+}
diff --git a/qml/form/SettingAppearancePage.qml b/qml/form/SettingAppearancePage.qml
new file mode 100644
index 000000000..55c4fd599
--- /dev/null
+++ b/qml/form/SettingAppearancePage.qml
@@ -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"
+ }
+ }
+}
diff --git a/qml/main.qml b/qml/main.qml
index 604d6ad78..565fc99eb 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -120,11 +120,17 @@ ApplicationWindow {
Room {
id: roomPage
+
+ parent: null
+
connection: window.connection
}
Setting {
id: settingPage
+
+ parent: null
+
connection: window.connection
}
diff --git a/res.qrc b/res.qrc
index ce9cec1ac..42cf6668f 100644
--- a/res.qrc
+++ b/res.qrc
@@ -27,5 +27,7 @@
qml/component/AudioBubble.qml
qml/form/SettingForm.qml
qml/Setting.qml
+ qml/form/SettingAccountForm.qml
+ qml/form/SettingAppearancePage.qml