/*! * * Copyright (c) 2023-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file VLocalization.cpp * \author (last) Dara Navaei * \date (last) 10-May-2024 * \author (original) Behrouz NematiPour * \date (original) 03-Apr-2023 * */ #include "VLocalization.h" // Project #include "GuiController.h" #include "Settings.h" using namespace View; View::VLocalization::VLocalization(QObject *) { initConnections(); } /*! * \brief Connection Initializer * \details All the class signal/slot connections are defined here. */ void View::VLocalization::initConnections() { ACTION_VIEW_CONNECTION(SettingsData) } void View::VLocalization::doAdjustment(quint8 vLanguageIndex) { QString mLocale = _localeMap .value(vLanguageIndex); QString mLanguage = _languageMap.value(vLanguageIndex); if ( Storage::Settings::save("Localization", "Locale" , mLocale , Storage::Settings::Category_Enum::eConfigurationsLocale ) ) goto lErr; if ( Storage::Settings::save("Localization", "Language" , mLanguage , Storage::Settings::Category_Enum::eConfigurationsLocale ) ) goto lErr; notification("The changes will be applied on the next bootup."); //NOTE: We do not have other keyboards implemented for any language other than en_UK, en_US // keyboardLocale( _keyboardLocaleMap.value(vLanguageIndex) ); return; lErr: LOG_DEBUG("Unsuccessfull configuration value storage for Language"); notification("Failed to set language"); } /*! * \brief VLocalization::onSettingsDone * \details fills the items below, read from the settings file, when the reading is notified done by ApplicationController. * acidConcentrateOptions */ void View::VLocalization::onActionReceive(const SettingsData &) { QString mCategory = Storage::Settings_Category_Locale; QString mLanguage = ""; mLanguage = _Settings.value(mCategory, "Localization", "Language").toString(); if ( mLanguage.isEmpty() ) goto lErr; languageIndex(_languageMap.key(mLanguage)); return; lErr: LOG_DEBUG("incorrect configuration value for Language"); // FIXME: Notify UI with a message }