1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-23 08:13:51 +02:00

wizardview: manage through MainView

Change-Id: I083d293784e07f4fcc099e60ada84e433a1b2fa0
GitLab: #1216
This commit is contained in:
Aline Gondim Santos 2023-07-05 09:48:38 -04:00
parent e71c1d1729
commit 8fd7c70d1f
5 changed files with 20 additions and 51 deletions

View file

@ -35,9 +35,6 @@ BaseView {
property bool successState: true property bool successState: true
// signal to redirect the page to main view
signal loaderSourceChangeRequested(int sourceToLoad)
function slotMigrationButtonClicked() { function slotMigrationButtonClicked() {
stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.Synching; stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.Synching;
AccountAdapter.setArchivePasswordAsync(CurrentAccountToMigrate.accountId, passwordInputLineEdit.text); AccountAdapter.setArchivePasswordAsync(CurrentAccountToMigrate.accountId, passwordInputLineEdit.text);

View file

@ -43,7 +43,6 @@ ApplicationWindow {
LayoutMirroring.childrenInherit: isRTL LayoutMirroring.childrenInherit: isRTL
enum LoadedSource { enum LoadedSource {
WizardView,
MainView, MainView,
AccountMigrationView, AccountMigrationView,
None None
@ -95,19 +94,13 @@ ApplicationWindow {
function checkLoadedSource() { function checkLoadedSource() {
var sourceString = mainApplicationLoader.source.toString(); var sourceString = mainApplicationLoader.source.toString();
if (sourceString === JamiQmlUtils.wizardViewLoadPath) if (sourceString === JamiQmlUtils.mainViewLoadPath)
return MainApplicationWindow.LoadedSource.WizardView;
else if (sourceString === JamiQmlUtils.mainViewLoadPath)
return MainApplicationWindow.LoadedSource.MainView; return MainApplicationWindow.LoadedSource.MainView;
return MainApplicationWindow.LoadedSource.None; return MainApplicationWindow.LoadedSource.None;
} }
function startClient() { function startClient() {
if (UtilsAdapter.getAccountListSize() !== 0) {
setMainLoaderSource(JamiQmlUtils.mainViewLoadPath); setMainLoaderSource(JamiQmlUtils.mainViewLoadPath);
} else {
setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath);
}
} }
function setMainLoaderSource(source) { function setMainLoaderSource(source) {
@ -159,14 +152,6 @@ ApplicationWindow {
asynchronous: true asynchronous: true
visible: status == Loader.Ready visible: status == Loader.Ready
Connections {
target: viewCoordinator
function onRequestAppWindowWizardView() {
setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath);
}
}
Connections { Connections {
id: connectionMigrationEnded id: connectionMigrationEnded
@ -182,32 +167,16 @@ ApplicationWindow {
} }
} }
Connections {
target: mainApplicationLoader.item
function onLoaderSourceChangeRequested(sourceToLoad) {
if (sourceToLoad === MainApplicationWindow.LoadedSource.WizardView)
setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath);
else if (sourceToLoad === MainApplicationWindow.LoadedSource.AccountMigrationView)
setMainLoaderSource(JamiQmlUtils.accountMigrationViewLoadPath);
else
setMainLoaderSource(JamiQmlUtils.mainViewLoadPath);
}
}
// Set `visible = false` when loading a new QML file. // Set `visible = false` when loading a new QML file.
onSourceChanged: windowSettingsLoaded = false onSourceChanged: windowSettingsLoaded = false
onLoaded: { onLoaded: {
if (checkLoadedSource() === MainApplicationWindow.LoadedSource.WizardView) { if (UtilsAdapter.getAccountListSize() === 0) {
// Onboarding wizard window, these settings are fixed. layoutManager.restoreWindowSettings();
// - window screen will default to the primary if (!viewCoordinator.rootView)
// - the window will showNormal once windowSettingsLoaded is // Set the viewCoordinator's root item.
// set to true(then forcing visible to true) viewCoordinator.init(item);
appWindow.width = JamiTheme.wizardViewMinWidth; viewCoordinator.present("WizardView");
appWindow.height = JamiTheme.wizardViewMinHeight;
appWindow.minimumWidth = JamiTheme.wizardViewMinWidth;
appWindow.minimumHeight = JamiTheme.wizardViewMinHeight;
} else { } else {
// Main window, load any valid app settings, and allow the // Main window, load any valid app settings, and allow the
// layoutManager to handle as much as possible. // layoutManager to handle as much as possible.
@ -220,6 +189,7 @@ ApplicationWindow {
viewCoordinator.present("WelcomePage"); viewCoordinator.present("WelcomePage");
viewCoordinator.preload("ConversationView"); viewCoordinator.preload("ConversationView");
}); });
if (!viewCoordinator.rootView)
// Set the viewCoordinator's root item. // Set the viewCoordinator's root item.
viewCoordinator.init(item); viewCoordinator.init(item);
if (CurrentAccountToMigrate.accountToMigrateListSize > 0) if (CurrentAccountToMigrate.accountToMigrateListSize > 0)

View file

@ -27,7 +27,10 @@ QtObject {
required property QtObject viewManager required property QtObject viewManager
signal initialized signal initialized
signal requestAppWindowWizardView
function requestAppWindowWizardView() {
viewCoordinator.present("WizardView");
}
// A map of view names to file paths for QML files that define each view. // A map of view names to file paths for QML files that define each view.
property variant resources: { property variant resources: {

View file

@ -43,8 +43,6 @@ Rectangle {
property int tabBarLeftMargin: 8 property int tabBarLeftMargin: 8
property int tabButtonShrinkSize: 8 property int tabButtonShrinkSize: 8
signal loaderSourceChangeRequested(int sourceToLoad)
property string currentConvId: CurrentConversation.id property string currentConvId: CurrentConversation.id
onCurrentConvIdChanged: { onCurrentConvIdChanged: {
if (currentConvId !== '') { if (currentConvId !== '') {

View file

@ -33,9 +33,6 @@ BaseView {
inhibits: ["ConversationView"] inhibits: ["ConversationView"]
// signal to redirect the page to main view
signal loaderSourceChangeRequested(int sourceToLoad)
color: JamiTheme.backgroundColor color: JamiTheme.backgroundColor
Connections { Connections {
@ -57,8 +54,11 @@ BaseView {
target: WizardViewStepModel target: WizardViewStepModel
function onCloseWizardView() { function onCloseWizardView() {
loaderSourceChangeRequested(MainApplicationWindow.LoadedSource.MainView);
root.dismiss(); root.dismiss();
viewCoordinator.preload("SidePanel");
viewCoordinator.preload("SettingsSidePanel");
viewCoordinator.present("WelcomePage");
viewCoordinator.preload("ConversationView");
} }
} }
@ -70,6 +70,7 @@ BaseView {
anchors.fill: parent anchors.fill: parent
contentHeight: controlPanelStackView.height contentHeight: controlPanelStackView.height
boundsBehavior: Flickable.StopAtBounds
StackLayout { StackLayout {
id: controlPanelStackView id: controlPanelStackView