2018-07-18 14:16:03 +00:00
|
|
|
import QtQuick 2.9
|
2018-07-19 13:02:06 +00:00
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Controls.Material 2.2
|
2018-07-20 14:36:19 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2018-09-09 13:13:43 +00:00
|
|
|
import Matrique 0.1
|
2018-08-24 05:25:41 +00:00
|
|
|
import Matrique.Settings 0.1
|
2018-07-20 14:36:19 +00:00
|
|
|
|
|
|
|
import "component"
|
2018-07-22 12:31:52 +00:00
|
|
|
import "form"
|
2018-09-10 03:56:32 +00:00
|
|
|
import "qrc:/js/util.js" as Util
|
2018-07-18 14:16:03 +00:00
|
|
|
|
2018-07-19 13:02:06 +00:00
|
|
|
Page {
|
2018-09-09 13:13:43 +00:00
|
|
|
property alias listModel: accountSettingsListView.model
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-09 13:13:43 +00:00
|
|
|
Page {
|
2018-07-22 12:31:52 +00:00
|
|
|
id: accountForm
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-09 02:12:45 +00:00
|
|
|
parent: null
|
2018-08-24 05:25:41 +00:00
|
|
|
|
2018-09-09 13:13:43 +00:00
|
|
|
padding: 64
|
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
ColumnLayout {
|
2018-09-09 13:13:43 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
ListView {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2018-08-24 05:25:41 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
id: accountSettingsListView
|
2018-09-09 13:13:43 +00:00
|
|
|
|
2018-09-10 08:22:45 +00:00
|
|
|
boundsBehavior: Flickable.DragOverBounds
|
|
|
|
|
|
|
|
clip: true
|
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
delegate: Column {
|
2018-09-10 08:22:45 +00:00
|
|
|
property bool expanded: false
|
|
|
|
|
2018-09-12 00:27:34 +00:00
|
|
|
spacing: 8
|
2018-09-10 07:01:01 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
SwipeDelegate {
|
|
|
|
width: accountSettingsListView.width
|
|
|
|
height: 64
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
clip: true
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
Row {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 8
|
|
|
|
|
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
ImageItem {
|
|
|
|
width: parent.height
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
hint: user.displayName
|
|
|
|
image: user.avatar
|
|
|
|
}
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
ColumnLayout {
|
|
|
|
Label {
|
|
|
|
text: user.displayName
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
text: user.id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
swipe.right: Rectangle {
|
2018-09-10 03:56:32 +00:00
|
|
|
width: parent.height
|
|
|
|
height: parent.height
|
2018-09-10 04:56:16 +00:00
|
|
|
anchors.right: parent.right
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
color: Material.accent
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
MaterialIcon {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
icon: "\ue879"
|
|
|
|
color: "white"
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
2018-09-10 04:56:16 +00:00
|
|
|
|
|
|
|
SwipeDelegate.onClicked: matriqueController.logout(connection)
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
2018-09-10 04:56:16 +00:00
|
|
|
|
2018-09-10 08:22:45 +00:00
|
|
|
onClicked: expanded = !expanded
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width - 32
|
2018-09-10 08:22:45 +00:00
|
|
|
height: expanded ? implicitHeight : 0
|
2018-09-10 04:56:16 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
2018-09-10 07:01:01 +00:00
|
|
|
spacing: 0
|
|
|
|
|
2018-09-10 08:22:45 +00:00
|
|
|
clip: true
|
|
|
|
|
2018-09-10 07:01:01 +00:00
|
|
|
ListView {
|
|
|
|
Layout.fillWidth: true
|
2018-09-12 00:27:34 +00:00
|
|
|
Layout.preferredHeight: 24
|
2018-09-10 07:01:01 +00:00
|
|
|
|
|
|
|
orientation: ListView.Horizontal
|
|
|
|
|
2018-09-12 00:27:34 +00:00
|
|
|
spacing: 8
|
|
|
|
|
2018-09-10 08:22:45 +00:00
|
|
|
model: ["#498882", "#42a5f5", "#5c6bc0", "#7e57c2", "#ab47bc", "#ff7043"]
|
2018-09-10 07:01:01 +00:00
|
|
|
|
|
|
|
delegate: Rectangle {
|
|
|
|
width: parent.height
|
|
|
|
height: parent.height
|
2018-09-12 00:27:34 +00:00
|
|
|
radius: width / 2
|
2018-09-10 07:01:01 +00:00
|
|
|
|
|
|
|
color: modelData
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
onClicked: matriqueController.setColor(connection.localUserId, modelData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
Label { text: "Homeserver:" }
|
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
text: connection.homeserver
|
|
|
|
selectByMouse: true
|
2018-09-10 04:59:35 +00:00
|
|
|
readOnly: true
|
2018-09-10 04:56:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
spacing: 16
|
|
|
|
|
|
|
|
Label { text: "Device ID:" }
|
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
text: connection.deviceId
|
|
|
|
selectByMouse: true
|
2018-09-10 04:59:35 +00:00
|
|
|
readOnly: true
|
2018-09-10 04:56:16 +00:00
|
|
|
}
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
|
|
|
|
2018-09-10 04:56:16 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
spacing: 16
|
|
|
|
|
|
|
|
Label { text: "Access Token:" }
|
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
text: connection.accessToken
|
|
|
|
selectByMouse: true
|
2018-09-10 04:59:35 +00:00
|
|
|
readOnly: true
|
2018-09-10 04:56:16 +00:00
|
|
|
}
|
|
|
|
}
|
2018-09-10 08:22:45 +00:00
|
|
|
|
|
|
|
Behavior on height {
|
|
|
|
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
|
|
|
}
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
2018-09-09 13:13:43 +00:00
|
|
|
}
|
|
|
|
}
|
2018-09-10 03:56:32 +00:00
|
|
|
|
|
|
|
Button {
|
2018-09-10 10:29:41 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
text: "Add Account"
|
|
|
|
flat: true
|
|
|
|
highlighted: true
|
|
|
|
|
2018-09-13 00:22:41 +00:00
|
|
|
onClicked: stackView.push(loginPage)
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
2018-09-09 13:13:43 +00:00
|
|
|
}
|
2018-07-20 04:14:02 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
Page {
|
2018-08-10 10:58:53 +00:00
|
|
|
id: generalForm
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-08-10 10:58:53 +00:00
|
|
|
parent: null
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
padding: 64
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
Column {
|
|
|
|
Switch {
|
|
|
|
text: "Lazy load at initial sync"
|
|
|
|
checked: MSettings.lazyLoad
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
onCheckedChanged: MSettings.lazyLoad = checked
|
|
|
|
}
|
2018-09-02 23:13:39 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
Switch {
|
|
|
|
text: "Use RichText instead of StyledText"
|
|
|
|
checked: MSettings.richText
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
onCheckedChanged: MSettings.richText = checked
|
|
|
|
}
|
2018-09-02 23:13:39 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
Switch {
|
|
|
|
text: "Use press and hold instead of right click"
|
|
|
|
checked: MSettings.pressAndHold
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
onCheckedChanged: MSettings.pressAndHold = checked
|
|
|
|
}
|
|
|
|
}
|
2018-08-10 10:58:53 +00:00
|
|
|
}
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
Page {
|
2018-07-22 12:31:52 +00:00
|
|
|
id: appearanceForm
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
parent: null
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
padding: 64
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
Column {
|
|
|
|
Switch {
|
|
|
|
text: "Dark theme"
|
|
|
|
checked: MSettings.darkTheme
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
onCheckedChanged: MSettings.darkTheme = checked
|
|
|
|
}
|
|
|
|
|
|
|
|
Switch {
|
|
|
|
text: "Mini Room List"
|
|
|
|
checked: MSettings.miniMode
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
onCheckedChanged: MSettings.miniMode = checked
|
|
|
|
}
|
2018-09-02 23:13:39 +00:00
|
|
|
|
|
|
|
Switch {
|
|
|
|
text: "Rearrange rooms by activity"
|
|
|
|
checked: MSettings.rearrangeByActivity
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-09-02 23:13:39 +00:00
|
|
|
onCheckedChanged: MSettings.rearrangeByActivity = checked
|
|
|
|
}
|
2018-08-24 05:25:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: aboutForm
|
2018-09-10 03:56:32 +00:00
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
parent: null
|
|
|
|
|
|
|
|
padding: 64
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 16
|
|
|
|
Image {
|
|
|
|
Layout.preferredWidth: 64
|
|
|
|
Layout.preferredHeight: 64
|
|
|
|
|
|
|
|
source: "qrc:/asset/img/icon.png"
|
|
|
|
}
|
2018-09-04 13:13:14 +00:00
|
|
|
Label { text: "Matrique, an IM client for the Matrix protocol." }
|
|
|
|
Label { text: "Released under GNU General Public License, version 3." }
|
2018-08-24 05:25:41 +00:00
|
|
|
}
|
2018-07-22 12:31:52 +00:00
|
|
|
}
|
2018-07-20 04:14:02 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
Rectangle {
|
|
|
|
width: 240
|
|
|
|
height: parent.height
|
2018-07-20 04:14:02 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
id: settingDrawer
|
|
|
|
|
|
|
|
color: MSettings.darkTheme ? "#323232" : "#f3f3f3"
|
|
|
|
|
|
|
|
Column {
|
|
|
|
anchors.fill: parent
|
2018-07-20 14:36:19 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
ItemDelegate {
|
2018-09-10 03:56:32 +00:00
|
|
|
width: parent.width
|
2018-07-20 14:36:19 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
text: "Account"
|
|
|
|
onClicked: pushToStack(accountForm)
|
|
|
|
}
|
2018-07-20 14:36:19 +00:00
|
|
|
|
2018-08-10 10:58:53 +00:00
|
|
|
ItemDelegate {
|
2018-09-10 03:56:32 +00:00
|
|
|
width: parent.width
|
2018-08-10 10:58:53 +00:00
|
|
|
|
|
|
|
text: "General"
|
|
|
|
onClicked: pushToStack(generalForm)
|
|
|
|
}
|
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
ItemDelegate {
|
2018-09-10 03:56:32 +00:00
|
|
|
width: parent.width
|
2018-07-20 14:36:19 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
text: "Appearance"
|
|
|
|
onClicked: pushToStack(appearanceForm)
|
|
|
|
}
|
2018-07-20 14:36:19 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
ItemDelegate {
|
2018-09-10 03:56:32 +00:00
|
|
|
width: parent.width
|
2018-07-20 14:36:19 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
text: "About"
|
2018-08-24 05:25:41 +00:00
|
|
|
onClicked: pushToStack(aboutForm)
|
2018-07-20 14:36:19 +00:00
|
|
|
}
|
2018-07-20 04:14:02 +00:00
|
|
|
}
|
2018-09-10 03:56:32 +00:00
|
|
|
}
|
2018-07-20 04:14:02 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
StackView {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: settingDrawer.width
|
2018-07-20 04:14:02 +00:00
|
|
|
|
2018-09-10 03:56:32 +00:00
|
|
|
id: settingStackView
|
2018-07-22 12:31:52 +00:00
|
|
|
}
|
2018-07-20 04:14:02 +00:00
|
|
|
|
2018-07-22 12:31:52 +00:00
|
|
|
function pushToStack(item) {
|
|
|
|
settingStackView.clear()
|
|
|
|
settingStackView.push(item)
|
2018-07-19 13:02:06 +00:00
|
|
|
}
|
2018-07-18 14:16:03 +00:00
|
|
|
}
|