From 56e611480abcd2e02701961a5a4772ddbad4666d Mon Sep 17 00:00:00 2001 From: xiphon Date: Thu, 12 Nov 2020 22:47:07 +0000 Subject: [PATCH] wizard: move language related settings to PersistentSettings --- components/LanguageSidebar.qml | 6 +++--- main.qml | 18 +++++------------- wizard/WizardController.qml | 12 ++---------- wizard/WizardSummary.qml | 2 +- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/components/LanguageSidebar.qml b/components/LanguageSidebar.qml index 59867df9..b6f732dd 100644 --- a/components/LanguageSidebar.qml +++ b/components/LanguageSidebar.qml @@ -131,9 +131,9 @@ Drawer { translationManager.setLanguage(locale_spl[0]); // set wizard language settings - wizard.language_locale = locale; - wizard.language_wallet = wallet_language; - wizard.language_language = display_name; + persistentSettings.locale = locale; + persistentSettings.language = display_name; + persistentSettings.language_wallet = wallet_language; appWindow.showStatusMessage(qsTr("Language changed."), 3); appWindow.toggleLanguageView(); diff --git a/main.qml b/main.qml index 30dfb91b..a858ad94 100644 --- a/main.qml +++ b/main.qml @@ -233,12 +233,6 @@ ApplicationWindow { else walletManager.setLogLevel(persistentSettings.logLevel) - // setup language - var locale = persistentSettings.locale - if (locale !== "") { - translationManager.setLanguage(locale.split("_")[0]); - } - // Reload transfer page with translations enabled middlePanel.transferView.onPageCompleted(); @@ -1291,6 +1285,8 @@ ApplicationWindow { x = (Screen.width - width) / 2 y = (Screen.height - maxWindowHeight) / 2 + translationManager.setLanguage(persistentSettings.locale.split("_")[0]); + applyWalletMode(persistentSettings.walletMode); // @@ -1346,8 +1342,9 @@ ApplicationWindow { return ""; } - property string language - property string locale + property string language: 'English (US)' + property string language_wallet: 'English' + property string locale: 'en_US' property string account_name property string wallet_path property bool allow_background_mining : false @@ -1845,11 +1842,6 @@ ApplicationWindow { function toggleLanguageView(){ languageSidebar.isOpened ? languageSidebar.close() : languageSidebar.open(); resetLanguageFields() - // update after changing language from settings page - if (persistentSettings.language != wizard.language_language) { - persistentSettings.language = wizard.language_language - persistentSettings.locale = wizard.language_locale - } } Timer { diff --git a/wizard/WizardController.qml b/wizard/WizardController.qml index 1c4f96b5..7467fb3d 100644 --- a/wizard/WizardController.qml +++ b/wizard/WizardController.qml @@ -107,11 +107,6 @@ Rectangle { property bool walletOptionsDeviceIsRestore: false property string tmpWalletFilename: '' - // language settings, updated via sidebar - property string language_locale: 'en_US' - property string language_wallet: 'English' - property string language_language: 'English (US)' - // recovery made (restore wallet) property string walletRestoreMode: 'seed' // seed, keys, qr @@ -333,7 +328,7 @@ Rectangle { console.log("Creating temporary wallet", tmp_wallet_filename) var nettype = appWindow.persistentSettings.nettype; var kdfRounds = appWindow.persistentSettings.kdfRounds; - var wallet = walletManager.createWallet(tmp_wallet_filename, "", wizardController.language_wallet, nettype, kdfRounds) + var wallet = walletManager.createWallet(tmp_wallet_filename, "", persistentSettings.language_wallet, nettype, kdfRounds) wizardController.walletOptionsSeed = wallet.seed @@ -364,9 +359,6 @@ Rectangle { wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword); // save to persistent settings - persistentSettings.language = wizardController.language_language - persistentSettings.locale = wizardController.language_locale - persistentSettings.account_name = wizardController.walletOptionsName persistentSettings.wallet_path = wizardController.m_wallet.path; persistentSettings.restore_height = (isNaN(walletOptionsRestoreHeight))? 0 : walletOptionsRestoreHeight @@ -404,7 +396,7 @@ Rectangle { if(wizardController.walletRestoreMode === 'seed') wallet = walletManager.recoveryWallet(tmp_wallet_filename, wizardController.walletOptionsSeed, wizardController.walletOptionsSeedOffset, nettype, restoreHeight, kdfRounds); else - wallet = walletManager.createWalletFromKeys(tmp_wallet_filename, wizardController.language_wallet, nettype, + wallet = walletManager.createWalletFromKeys(tmp_wallet_filename, persistentSettings.language_wallet, nettype, wizardController.walletOptionsRecoverAddress, wizardController.walletOptionsRecoverViewkey, wizardController.walletOptionsRecoverSpendkey, restoreHeight, kdfRounds) diff --git a/wizard/WizardSummary.qml b/wizard/WizardSummary.qml index a94d921d..840ee971 100644 --- a/wizard/WizardSummary.qml +++ b/wizard/WizardSummary.qml @@ -54,7 +54,7 @@ ColumnLayout { WizardSummaryItem { Layout.fillWidth: true header: qsTr("Language") + translationManager.emptyString - value: wizardController.language_language + value: persistentSettings.language } WizardSummaryItem {