Merge pull request #3231

56e61148 wizard: move language related settings to PersistentSettings (xiphon)
This commit is contained in:
Alexander Blair 2020-11-24 11:35:24 -08:00
commit 212fa083e2
No known key found for this signature in database
GPG key ID: C64552D877C32479
4 changed files with 11 additions and 27 deletions

View file

@ -131,9 +131,9 @@ Drawer {
translationManager.setLanguage(locale_spl[0]); translationManager.setLanguage(locale_spl[0]);
// set wizard language settings // set wizard language settings
wizard.language_locale = locale; persistentSettings.locale = locale;
wizard.language_wallet = wallet_language; persistentSettings.language = display_name;
wizard.language_language = display_name; persistentSettings.language_wallet = wallet_language;
appWindow.showStatusMessage(qsTr("Language changed."), 3); appWindow.showStatusMessage(qsTr("Language changed."), 3);
appWindow.toggleLanguageView(); appWindow.toggleLanguageView();

View file

@ -233,12 +233,6 @@ ApplicationWindow {
else else
walletManager.setLogLevel(persistentSettings.logLevel) walletManager.setLogLevel(persistentSettings.logLevel)
// setup language
var locale = persistentSettings.locale
if (locale !== "") {
translationManager.setLanguage(locale.split("_")[0]);
}
// Reload transfer page with translations enabled // Reload transfer page with translations enabled
middlePanel.transferView.onPageCompleted(); middlePanel.transferView.onPageCompleted();
@ -1291,6 +1285,8 @@ ApplicationWindow {
x = (Screen.width - width) / 2 x = (Screen.width - width) / 2
y = (Screen.height - maxWindowHeight) / 2 y = (Screen.height - maxWindowHeight) / 2
translationManager.setLanguage(persistentSettings.locale.split("_")[0]);
applyWalletMode(persistentSettings.walletMode); applyWalletMode(persistentSettings.walletMode);
// //
@ -1346,8 +1342,9 @@ ApplicationWindow {
return ""; return "";
} }
property string language property string language: 'English (US)'
property string locale property string language_wallet: 'English'
property string locale: 'en_US'
property string account_name property string account_name
property string wallet_path property string wallet_path
property bool allow_background_mining : false property bool allow_background_mining : false
@ -1845,11 +1842,6 @@ ApplicationWindow {
function toggleLanguageView(){ function toggleLanguageView(){
languageSidebar.isOpened ? languageSidebar.close() : languageSidebar.open(); languageSidebar.isOpened ? languageSidebar.close() : languageSidebar.open();
resetLanguageFields() 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 { Timer {

View file

@ -107,11 +107,6 @@ Rectangle {
property bool walletOptionsDeviceIsRestore: false property bool walletOptionsDeviceIsRestore: false
property string tmpWalletFilename: '' 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) // recovery made (restore wallet)
property string walletRestoreMode: 'seed' // seed, keys, qr property string walletRestoreMode: 'seed' // seed, keys, qr
@ -333,7 +328,7 @@ Rectangle {
console.log("Creating temporary wallet", tmp_wallet_filename) console.log("Creating temporary wallet", tmp_wallet_filename)
var nettype = appWindow.persistentSettings.nettype; var nettype = appWindow.persistentSettings.nettype;
var kdfRounds = appWindow.persistentSettings.kdfRounds; 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 wizardController.walletOptionsSeed = wallet.seed
@ -364,9 +359,6 @@ Rectangle {
wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword); wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword);
// save to persistent settings // save to persistent settings
persistentSettings.language = wizardController.language_language
persistentSettings.locale = wizardController.language_locale
persistentSettings.account_name = wizardController.walletOptionsName persistentSettings.account_name = wizardController.walletOptionsName
persistentSettings.wallet_path = wizardController.m_wallet.path; persistentSettings.wallet_path = wizardController.m_wallet.path;
persistentSettings.restore_height = (isNaN(walletOptionsRestoreHeight))? 0 : walletOptionsRestoreHeight persistentSettings.restore_height = (isNaN(walletOptionsRestoreHeight))? 0 : walletOptionsRestoreHeight
@ -404,7 +396,7 @@ Rectangle {
if(wizardController.walletRestoreMode === 'seed') if(wizardController.walletRestoreMode === 'seed')
wallet = walletManager.recoveryWallet(tmp_wallet_filename, wizardController.walletOptionsSeed, wizardController.walletOptionsSeedOffset, nettype, restoreHeight, kdfRounds); wallet = walletManager.recoveryWallet(tmp_wallet_filename, wizardController.walletOptionsSeed, wizardController.walletOptionsSeedOffset, nettype, restoreHeight, kdfRounds);
else 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.walletOptionsRecoverAddress, wizardController.walletOptionsRecoverViewkey,
wizardController.walletOptionsRecoverSpendkey, restoreHeight, kdfRounds) wizardController.walletOptionsRecoverSpendkey, restoreHeight, kdfRounds)

View file

@ -54,7 +54,7 @@ ColumnLayout {
WizardSummaryItem { WizardSummaryItem {
Layout.fillWidth: true Layout.fillWidth: true
header: qsTr("Language") + translationManager.emptyString header: qsTr("Language") + translationManager.emptyString
value: wizardController.language_language value: persistentSettings.language
} }
WizardSummaryItem { WizardSummaryItem {