1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 06:45:45 +02:00

SettingsPage: dynamically load the individual pages of the settings view

Replace StackLayout with StackView. The StackView manages the lifetime of the view.

GitLab: #897

Change-Id: I25892310eb83ad70f4b06f91e94ec5ea8b87ef86
This commit is contained in:
Franck LAURENT 2023-04-04 15:44:38 -04:00
parent acd4b3065c
commit 72f7b37503
17 changed files with 94 additions and 107 deletions

View file

@ -36,23 +36,24 @@ ListSelectionView {
id: viewNode
objectName: "SettingsView"
enum SettingsMenu {
ManageAccount,
CustomizeProfile,
LinkedDevices,
AdvancedSettings,
System,
CallSettings,
Appearence,
LocationSharing,
FileTransfer,
CallRecording,
Troubleshoot,
Update,
Audio,
Video,
Screensharing,
Plugin
// A map of view names to file paths for QML files that define each view.
property variant resources: {
"ManageAccountPage": Qt.resolvedUrl("components/ManageAccountPage.qml"),
"CustomizeProfilePage": Qt.resolvedUrl("components/CustomizeProfilePage.qml"),
"LinkedDevicesPage": Qt.resolvedUrl("components/LinkedDevicesPage.qml"),
"CallSettingsPage": Qt.resolvedUrl("components/CallSettingsPage.qml"),
"AdvancedSettingsPage": Qt.resolvedUrl("components/AdvancedSettingsPage.qml"),
"SystemSettingsPage": Qt.resolvedUrl("components/SystemSettingsPage.qml"),
"AppearenceSettingsPage": Qt.resolvedUrl("components/AppearenceSettingsPage.qml"),
"LocationSharingSettingsPage": Qt.resolvedUrl("components/LocationSharingSettingsPage.qml"),
"FileTransferSettingsPage": Qt.resolvedUrl("components/FileTransferSettingsPage.qml"),
"CallRecordingSettingsPage": Qt.resolvedUrl("components/CallRecordingSettingsPage.qml"),
"TroubleshootSettingsPage": Qt.resolvedUrl("components/TroubleshootSettingsPage.qml"),
"UpdatesSettingsPage": Qt.resolvedUrl("components/UpdatesSettingsPage.qml"),
"AudioSettingsPage": Qt.resolvedUrl("components/AudioSettingsPage.qml"),
"VideoSettingsPage": Qt.resolvedUrl("components/VideoSettingsPage.qml"),
"ScreenSharingSettingsPage": Qt.resolvedUrl("components/ScreenSharingSettingsPage.qml"),
"PluginSettingsPage": Qt.resolvedUrl("components/PluginSettingsPage.qml"),
}
splitViewStateKey: "Main"
@ -83,50 +84,71 @@ ListSelectionView {
}
}
rightPaneItem: StackLayout {
id: settingsViewRect
rightPaneItem: StackView {
id: settingsView
objectName: "settingsView"
currentIndex: selectedMenu !== -1 ? selectedMenu : 0
property var currentIndex: selectedMenu !== -1 ? selectedMenu : 0
anchors.fill: parent
signal stopBooth
property bool isSIP: CurrentAccount.type === Profile.Type.SIP
initialItem: ManageAccountPage {}
ManageAccountPage {
isSIP: settingsViewRect.isSIP
onNavigateToMainView: dismiss()
onNavigateToNewWizardView: dismiss()
onCurrentIndexChanged: {
switch(currentIndex) {
default:
case 0:
replace(currentItem, viewNode.resources["ManageAccountPage"], StackView.Immediate)
break
case 1:
replace(currentItem, viewNode.resources["CustomizeProfilePage"], StackView.Immediate)
break
case 2:
replace(currentItem, viewNode.resources["LinkedDevicesPage"], StackView.Immediate)
break
case 3:
replace(currentItem, viewNode.resources["CallSettingsPage"], StackView.Immediate)
break
case 4:
replace(currentItem, viewNode.resources["AdvancedSettingsPage"], StackView.Immediate)
break
case 5:
replace(currentItem, viewNode.resources["SystemSettingsPage"], StackView.Immediate)
break
case 6:
replace(currentItem, viewNode.resources["AppearenceSettingsPage"], StackView.Immediate)
break
case 7:
replace(currentItem, viewNode.resources["LocationSharingSettingsPage"], StackView.Immediate)
break
case 8:
replace(currentItem, viewNode.resources["FileTransferSettingsPage"], StackView.Immediate)
break
case 9:
replace(currentItem, viewNode.resources["CallRecordingSettingsPage"], StackView.Immediate)
break
case 10:
replace(currentItem, viewNode.resources["TroubleshootSettingsPage"], StackView.Immediate)
break
case 11:
replace(currentItem, viewNode.resources["UpdatesSettingsPage"], StackView.Immediate)
break
case 12:
replace(currentItem, viewNode.resources["AudioSettingsPage"], StackView.Immediate)
break
case 13:
replace(currentItem, viewNode.resources["VideoSettingsPage"], StackView.Immediate)
break
case 14:
replace(currentItem, viewNode.resources["ScreenSharingSettingsPage"], StackView.Immediate)
break
case 15:
replace(currentItem, viewNode.resources["PluginSettingsPage"], StackView.Immediate)
break
}
CustomizeProfilePage {}
LinkedDevicesPage {}
CallSettingsPage {}
AdvancedSettingsPage {}
SystemSettingsPage {}
AppearenceSettingsPage {}
LocationSharingSettingsPage {}
FileTransferSettingsPage{}
CallRecordingSettingsPage {}
TroubleshootSettingsPage {}
UpdatesSettingsPage {}
AudioSettingsPage {}
VideoSettingsPage {}
ScreenSharingSettingsPage {}
PluginSettingsPage {}
}
}
}

View file

@ -33,9 +33,6 @@ SettingsPageBase {
property int itemWidth
signal showAdvancedSettingsRequest
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.advancedSettingsTitle
flickableContent: ColumnLayout {

View file

@ -36,9 +36,6 @@ SettingsPageBase {
property int itemWidth: 188
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.appearence
flickableContent: ColumnLayout {

View file

@ -30,9 +30,6 @@ SettingsPageBase {
id: root
property int itemWidth: 188
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.audio
flickableContent: ColumnLayout {

View file

@ -38,9 +38,6 @@ SettingsPageBase {
property string screenshotPathBestName: UtilsAdapter.dirName(UtilsAdapter.getDirScreenshot())
property int itemWidth: 188
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.callRecording
onRecordPathChanged: {

View file

@ -37,9 +37,6 @@ SettingsPageBase {
property bool isSIP
property int itemWidth: 132
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.callSettingsTitle
function updateAndShowModeratorsSlot() {

View file

@ -30,8 +30,6 @@ import "../../commoncomponents"
SettingsPageBase {
id: root
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.customizeProfile
function stopBooth() {
@ -53,7 +51,7 @@ SettingsPageBase {
Layout.preferredWidth: parent.width
Connections {
target: settingsViewRect
target: settingsView
function onStopBooth() {
stopBooth()

View file

@ -32,9 +32,6 @@ SettingsPageBase {
id: root
property int itemWidth: 164
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.fileTransfer

View file

@ -32,11 +32,8 @@ import "../../commoncomponents"
SettingsPageBase {
id: root
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.linkedDevicesSettingsTitle
flickableContent: ColumnLayout {
id: currentAccountEnableColumnLayout

View file

@ -36,9 +36,6 @@ SettingsPageBase {
id: root
property int itemWidth: 578
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.locationSharingLabel

View file

@ -31,11 +31,12 @@ import "../../commoncomponents"
SettingsPageBase {
id: root
property bool isSIP
property bool isSIP: CurrentAccount.type === Profile.Type.SIP
property int itemWidth: 250
signal navigateToMainView
signal navigateToNewWizardView
onNavigateToMainView: viewNode.dismiss()
title: JamiStrings.manageAccountSettingsTitle
flickableContent: ColumnLayout {

View file

@ -34,8 +34,6 @@ SettingsPageBase {
property int itemWidth: 150
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.screenSharing
flickableContent: ColumnLayout {

View file

@ -62,5 +62,6 @@ Page {
contentItem.children: [flickableContent]
topMargin: JamiTheme.preferredSettingsBottomMarginSize
bottomMargin: JamiTheme.preferredSettingsBottomMarginSize
ScrollBar.horizontal.visible: false
}
}

View file

@ -37,8 +37,6 @@ SettingsPageBase {
property bool isSIP
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.system

View file

@ -35,8 +35,6 @@ SettingsPageBase {
property int itemWidth
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.troubleshootTitle

View file

@ -34,8 +34,6 @@ import "../../commoncomponents"
SettingsPageBase {
id: root
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.updatesTitle
function presentInfoDialog(infoText) {

View file

@ -36,9 +36,6 @@ SettingsPageBase {
property int itemWidth: 266
property real aspectRatio: 0.75
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.video
flickableContent: ColumnLayout {
@ -63,17 +60,6 @@ SettingsPageBase {
previewWidget.startWithId(VideoDevices.getDefaultDevice(), force)
}
onVisibleChanged: {
flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf)
if (visible) {
hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration()
if (previewWidget.visible)
generalSettings.startPreviewing(true)
} else {
previewWidget.startWithId("")
}
}
Connections {
target: VideoDevices
@ -114,6 +100,17 @@ SettingsPageBase {
}
}
Component.onCompleted: {
flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf)
hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration()
if (previewWidget.visible)
startPreviewing(true)
}
Component.onDestruction: {
previewWidget.startWithId("")
}
// video Preview
Rectangle {
visible: VideoDevices.listSize !== 0