mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/settings] Reload the title bar when changing language
Before, the "Settings" title would not be immediately translated into the new language.
This commit is contained in:
@@ -300,6 +300,10 @@ void AppsContainer::refreshPreferences() {
|
||||
m_window.refreshPreferences();
|
||||
}
|
||||
|
||||
void AppsContainer::reloadTitleBarView() {
|
||||
m_window.reloadTitleBarView();
|
||||
}
|
||||
|
||||
void AppsContainer::displayExamModePopUp(bool activate) {
|
||||
m_examPopUpController.setActivatingExamMode(activate);
|
||||
activeApp()->displayModalViewController(&m_examPopUpController, 0.f, 0.f, Metric::ExamPopUpTopMargin, Metric::PopUpRightMargin, Metric::ExamPopUpBottomMargin, Metric::PopUpLeftMargin);
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
void run() override;
|
||||
bool updateBatteryState();
|
||||
void refreshPreferences();
|
||||
void reloadTitleBarView();
|
||||
void displayExamModePopUp(bool activate);
|
||||
void shutdownDueToLowBattery();
|
||||
void setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus);
|
||||
|
||||
@@ -31,6 +31,10 @@ void AppsWindow::refreshPreferences() {
|
||||
m_titleBarView.refreshPreferences();
|
||||
}
|
||||
|
||||
void AppsWindow::reloadTitleBarView() {
|
||||
m_titleBarView.reload();
|
||||
}
|
||||
|
||||
bool AppsWindow::updateAlphaLock() {
|
||||
return m_titleBarView.setShiftAlphaLockStatus(Ion::Events::shiftAlphaStatus());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
bool updateIsChargingState();
|
||||
bool updatePluggedState();
|
||||
void refreshPreferences();
|
||||
void reloadTitleBarView();
|
||||
bool updateAlphaLock();
|
||||
void hideTitleBarView(bool hide);
|
||||
private:
|
||||
|
||||
@@ -41,8 +41,10 @@ void LanguageController::viewWillAppear() {
|
||||
bool LanguageController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setLanguage((I18n::Language)(selectedRow()+1));
|
||||
/* We need to reload the whole title bar in order to translate both the
|
||||
* "Settings" title and the degree preference. */
|
||||
AppsContainer * myContainer = (AppsContainer * )app()->container();
|
||||
myContainer->refreshPreferences();
|
||||
myContainer->reloadTitleBarView();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -98,3 +98,8 @@ void TitleBarView::refreshPreferences() {
|
||||
// Layout the exam mode icon if needed
|
||||
layoutSubviews();
|
||||
}
|
||||
|
||||
void TitleBarView::reload() {
|
||||
refreshPreferences();
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
bool setIsPlugged(bool isPlugged);
|
||||
bool setShiftAlphaLockStatus(Ion::Events::ShiftAlphaStatus status);
|
||||
void refreshPreferences();
|
||||
void reload();
|
||||
private:
|
||||
constexpr static KDCoordinate k_alphaRightMargin = 5;
|
||||
constexpr static KDCoordinate k_examIconWidth = 18;
|
||||
|
||||
Reference in New Issue
Block a user