feat: enable saving app settings like the SplitView state
This commit is contained in:
parent
02d915cb50
commit
9683b7a79e
|
@ -1,14 +1,19 @@
|
||||||
import QtQuick 2.13
|
import QtQuick 2.13
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.13
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
import "../../../imports"
|
import "../../../imports"
|
||||||
import "../../../shared"
|
import "../../../shared"
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
id: chatView
|
property var appSettings
|
||||||
|
|
||||||
|
id: chatView
|
||||||
handle: SplitViewHandle {}
|
handle: SplitViewHandle {}
|
||||||
|
|
||||||
|
Component.onCompleted: this.restoreState(appSettings.chatSplitView)
|
||||||
|
Component.onDestruction: appSettings.chatSplitView = this.saveState()
|
||||||
|
|
||||||
ContactsColumn {
|
ContactsColumn {
|
||||||
id: contactsColumn
|
id: contactsColumn
|
||||||
SplitView.preferredWidth: Theme.leftTabPrefferedSize
|
SplitView.preferredWidth: Theme.leftTabPrefferedSize
|
||||||
|
|
|
@ -6,14 +6,17 @@ import "../../../shared"
|
||||||
import "./Sections"
|
import "./Sections"
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
|
property var appSettings
|
||||||
|
|
||||||
id: profileView
|
id: profileView
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
handle: SplitViewHandle {}
|
handle: SplitViewHandle {}
|
||||||
|
|
||||||
|
Component.onCompleted: this.restoreState(appSettings.profileSplitView)
|
||||||
|
Component.onDestruction: appSettings.profileSplitView = this.saveState()
|
||||||
|
|
||||||
LeftTab {
|
LeftTab {
|
||||||
id: leftTab
|
id: leftTab
|
||||||
SplitView.preferredWidth: Theme.leftTabPrefferedSize
|
SplitView.preferredWidth: Theme.leftTabPrefferedSize
|
||||||
|
|
|
@ -6,12 +6,17 @@ import "../../../shared"
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
|
property var appSettings
|
||||||
|
|
||||||
id: walletView
|
id: walletView
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
handle: SplitViewHandle {}
|
handle: SplitViewHandle {}
|
||||||
|
|
||||||
|
Component.onCompleted: this.restoreState(appSettings.walletSplitView)
|
||||||
|
Component.onDestruction: appSettings.walletSplitView = this.saveState()
|
||||||
|
|
||||||
LeftTab {
|
LeftTab {
|
||||||
id: leftTab
|
id: leftTab
|
||||||
SplitView.preferredWidth: Theme.leftTabPrefferedSize
|
SplitView.preferredWidth: Theme.leftTabPrefferedSize
|
||||||
|
|
|
@ -6,6 +6,8 @@ import "../shared"
|
||||||
import "./AppLayouts"
|
import "./AppLayouts"
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
property var appSettings
|
||||||
|
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -169,6 +171,7 @@ RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
appSettings: rowLayout.appSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletLayout {
|
WalletLayout {
|
||||||
|
@ -176,6 +179,7 @@ RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
appSettings: rowLayout.appSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserLayout {
|
BrowserLayout {
|
||||||
|
@ -190,6 +194,7 @@ RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
appSettings: rowLayout.appSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeLayout {
|
NodeLayout {
|
||||||
|
|
23
ui/main.qml
23
ui/main.qml
|
@ -3,19 +3,36 @@ import QtQuick.Controls 2.13
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.13
|
||||||
import Qt.labs.platform 1.1
|
import Qt.labs.platform 1.1
|
||||||
import QtQml.StateMachine 1.14 as DSM
|
import QtQml.StateMachine 1.14 as DSM
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
import QtQml 2.13
|
||||||
import "./onboarding"
|
import "./onboarding"
|
||||||
import "./app"
|
import "./app"
|
||||||
import "./imports"
|
import "./imports"
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
property alias appSettings: settings
|
||||||
|
|
||||||
id: applicationWindow
|
id: applicationWindow
|
||||||
width: 1232
|
width: 1232
|
||||||
height: 770
|
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
|
visible: true
|
||||||
|
|
||||||
signal navigateTo(string path)
|
signal navigateTo(string path)
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: settings
|
||||||
|
property var chatSplitView
|
||||||
|
property var walletSplitView
|
||||||
|
property var profileSplitView
|
||||||
|
}
|
||||||
|
|
||||||
SystemTrayIcon {
|
SystemTrayIcon {
|
||||||
visible: true
|
visible: true
|
||||||
icon.source: "shared/img/status-logo.png"
|
icon.source: "shared/img/status-logo.png"
|
||||||
|
@ -138,7 +155,9 @@ ApplicationWindow {
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: app
|
id: app
|
||||||
AppMain {}
|
AppMain {
|
||||||
|
appSettings: applicationWindow.appSettings
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|
Loading…
Reference in New Issue