Skip to content
Snippets Groups Projects
Commit 72f7b375 authored by Franck Laurent's avatar Franck Laurent
Browse files

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
parent acd4b306
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 107 deletions
......@@ -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 {}
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
}
ManageAccountPage {
isSIP: settingsViewRect.isSIP
onNavigateToMainView: dismiss()
onNavigateToNewWizardView: dismiss()
}
CustomizeProfilePage {}
LinkedDevicesPage {}
CallSettingsPage {}
AdvancedSettingsPage {}
SystemSettingsPage {}
AppearenceSettingsPage {}
LocationSharingSettingsPage {}
FileTransferSettingsPage{}
CallRecordingSettingsPage {}
TroubleshootSettingsPage {}
UpdatesSettingsPage {}
AudioSettingsPage {}
VideoSettingsPage {}
ScreenSharingSettingsPage {}
PluginSettingsPage {}
}
}
......@@ -33,9 +33,6 @@ SettingsPageBase {
property int itemWidth
signal showAdvancedSettingsRequest
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.advancedSettingsTitle
flickableContent: ColumnLayout {
......
......@@ -36,9 +36,6 @@ SettingsPageBase {
property int itemWidth: 188
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.appearence
flickableContent: ColumnLayout {
......
......@@ -30,9 +30,6 @@ SettingsPageBase {
id: root
property int itemWidth: 188
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.audio
flickableContent: ColumnLayout {
......
......@@ -38,9 +38,6 @@ SettingsPageBase {
property string screenshotPathBestName: UtilsAdapter.dirName(UtilsAdapter.getDirScreenshot())
property int itemWidth: 188
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.callRecording
onRecordPathChanged: {
......
......@@ -37,9 +37,6 @@ SettingsPageBase {
property bool isSIP
property int itemWidth: 132
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.callSettingsTitle
function updateAndShowModeratorsSlot() {
......
......@@ -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()
......
......@@ -32,9 +32,6 @@ SettingsPageBase {
id: root
property int itemWidth: 164
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.fileTransfer
......
......@@ -32,11 +32,8 @@ import "../../commoncomponents"
SettingsPageBase {
id: root
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.linkedDevicesSettingsTitle
flickableContent: ColumnLayout {
id: currentAccountEnableColumnLayout
......
......@@ -36,9 +36,6 @@ SettingsPageBase {
id: root
property int itemWidth: 578
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.locationSharingLabel
......
......@@ -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 {
......
......@@ -34,8 +34,6 @@ SettingsPageBase {
property int itemWidth: 150
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.screenSharing
flickableContent: ColumnLayout {
......
......@@ -62,5 +62,6 @@ Page {
contentItem.children: [flickableContent]
topMargin: JamiTheme.preferredSettingsBottomMarginSize
bottomMargin: JamiTheme.preferredSettingsBottomMarginSize
ScrollBar.horizontal.visible: false
}
}
......@@ -37,8 +37,6 @@ SettingsPageBase {
property bool isSIP
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.system
......
......@@ -35,8 +35,6 @@ SettingsPageBase {
property int itemWidth
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.troubleshootTitle
......
......@@ -34,8 +34,6 @@ import "../../commoncomponents"
SettingsPageBase {
id: root
signal navigateToMainView
signal navigateToNewWizardView
title: JamiStrings.updatesTitle
function presentInfoDialog(infoText) {
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment