feat: enable saving app settings like the SplitView state

This commit is contained in:
Jonathan Rainville 2020-06-23 16:49:04 -04:00 committed by Iuri Matias
parent 02d915cb50
commit 9683b7a79e
5 changed files with 42 additions and 5 deletions

View File

@ -1,14 +1,19 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import Qt.labs.settings 1.0
import "../../../imports"
import "../../../shared"
import "."
SplitView {
id: chatView
property var appSettings
id: chatView
handle: SplitViewHandle {}
Component.onCompleted: this.restoreState(appSettings.chatSplitView)
Component.onDestruction: appSettings.chatSplitView = this.saveState()
ContactsColumn {
id: contactsColumn
SplitView.preferredWidth: Theme.leftTabPrefferedSize

View File

@ -6,14 +6,17 @@ import "../../../shared"
import "./Sections"
SplitView {
property var appSettings
id: profileView
x: 0
y: 0
Layout.fillHeight: true
Layout.fillWidth: true
handle: SplitViewHandle {}
Component.onCompleted: this.restoreState(appSettings.profileSplitView)
Component.onDestruction: appSettings.profileSplitView = this.saveState()
LeftTab {
id: leftTab
SplitView.preferredWidth: Theme.leftTabPrefferedSize

View File

@ -6,12 +6,17 @@ import "../../../shared"
import "."
SplitView {
property var appSettings
id: walletView
Layout.fillHeight: true
Layout.fillWidth: true
handle: SplitViewHandle {}
Component.onCompleted: this.restoreState(appSettings.walletSplitView)
Component.onDestruction: appSettings.walletSplitView = this.saveState()
LeftTab {
id: leftTab
SplitView.preferredWidth: Theme.leftTabPrefferedSize

View File

@ -6,6 +6,8 @@ import "../shared"
import "./AppLayouts"
RowLayout {
property var appSettings
id: rowLayout
Layout.fillHeight: true
Layout.fillWidth: true
@ -169,6 +171,7 @@ RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillHeight: true
appSettings: rowLayout.appSettings
}
WalletLayout {
@ -176,6 +179,7 @@ RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillHeight: true
appSettings: rowLayout.appSettings
}
BrowserLayout {
@ -190,6 +194,7 @@ RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillHeight: true
appSettings: rowLayout.appSettings
}
NodeLayout {

View File

@ -3,19 +3,36 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import Qt.labs.platform 1.1
import QtQml.StateMachine 1.14 as DSM
import Qt.labs.settings 1.0
import QtQml 2.13
import "./onboarding"
import "./app"
import "./imports"
ApplicationWindow {
property alias appSettings: settings
id: applicationWindow
width: 1232
height: 770
title: "Nim Status Client"
title: {
// Set application settings
Qt.application.name = qsTr("Nim Status Client")
Qt.application.organization = "Status"
Qt.application.domain = "status.im"
return Qt.application.name
}
visible: true
signal navigateTo(string path)
Settings {
id: settings
property var chatSplitView
property var walletSplitView
property var profileSplitView
}
SystemTrayIcon {
visible: true
icon.source: "shared/img/status-logo.png"
@ -138,7 +155,9 @@ ApplicationWindow {
Component {
id: app
AppMain {}
AppMain {
appSettings: applicationWindow.appSettings
}
}
Component {