From 4c2ce1bac23a9f128447c237e2ea79183de3a135 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 6 Jan 2018 14:46:09 +0100 Subject: [PATCH] - flashtool: add posibilty to get localized and non-localized type Conflicts: src/gui/update.cpp Signed-off-by: Thilo Graf --- data/locale/deutsch.locale | 2 +- data/locale/english.locale | 2 +- src/gui/update.cpp | 8 ++++++-- src/system/flashtool.cpp | 20 ++++++++++---------- src/system/flashtool.h | 2 +- src/system/locals.h | 2 +- src/system/locals_intern.h | 2 +- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index dd534b92f..6baf3668d 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -689,8 +689,8 @@ flashupdate.titlereadflash Flash auslesen flashupdate.titlewriteflash Flash schreiben flashupdate.type_addon Erweiterung flashupdate.type_beta Beta -flashupdate.type_internal Intern flashupdate.type_locale Sprachdatei +flashupdate.type_nightly Nightly flashupdate.type_release Release flashupdate.type_settings Einstellungen flashupdate.type_text Text diff --git a/data/locale/english.locale b/data/locale/english.locale index 82c4a6899..49cbe0a51 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -689,8 +689,8 @@ flashupdate.titlereadflash Reading Flash flashupdate.titlewriteflash Writing Flash flashupdate.type_addon Addon flashupdate.type_beta Beta -flashupdate.type_internal Internal flashupdate.type_locale Locale +flashupdate.type_nightly Nightly flashupdate.type_release Release flashupdate.type_settings Settings flashupdate.type_text Text diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 29dbc56eb..bac2eaec5 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -215,9 +215,13 @@ bool CFlashUpdate::selectHttpImage(void) showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILE)); char current[200]; +#if 0 snprintf(current, 200, "%s: %s %s %s %s %s", g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSION_SEP), curInfo.getReleaseCycle(), g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSIONDATE), curInfo.getDate(), g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSIONTIME), curInfo.getTime()); +#endif + + snprintf(current, 200, "%s %s %s %s", curInfo.getReleaseCycle(), curInfo.getType(true), curInfo.getDate(), curInfo.getTime()); CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE, listWidth, MN_WIDGET_ID_IMAGESELECTOR); @@ -274,7 +278,7 @@ bool CFlashUpdate::selectHttpImage(void) fileTypes[i] = versionInfo.snapshot; std::string description = versionInfo.getReleaseCycle(); description += ' '; - description += versionInfo.getType(); + description += versionInfo.getType(true); description += ' '; description += versionInfo.getDate(); description += ' '; @@ -379,7 +383,7 @@ bool CFlashUpdate::checkVersion4Update() msg_body = LOCALE_FLASHUPDATE_MSGBOX; #ifdef SQUASHFS versionInfo = new CFlashVersionInfo(newVersion);//Memory leak: versionInfo - sprintf(msg, g_Locale->getText(msg_body), versionInfo->getDate(), versionInfo->getTime(), versionInfo->getReleaseCycle(), versionInfo->getType()); + sprintf(msg, g_Locale->getText(msg_body), versionInfo->getDate(), versionInfo->getTime(), versionInfo->getReleaseCycle(), versionInfo->getType(true)); if (fileType <= '2') { diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index c09412182..3c3cf49bd 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -524,28 +524,28 @@ const char *CFlashVersionInfo::getReleaseCycle(void) const return releaseCycle; } -const char *CFlashVersionInfo::getType(void) const +const char *CFlashVersionInfo::getType(bool localized) const { switch (snapshot) { case '0': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_RELEASE); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_RELEASE) : "Release"); case '1': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_BETA); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_BETA) : "Beta"); case '2': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_INTERNAL); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_NIGHTLY) : "Nightly"); case 'L': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_LOCALE); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_LOCALE) : "Locale"); case 'S': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_SETTINGS); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_SETTINGS) : "Settings"); case 'A': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_ADDON); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_ADDON) : "Addon"); case 'U': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_UPDATE); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_UPDATE) : "Update"); case 'T': - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_TEXT); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_TEXT) : "Text"); default: - return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_UNKNOWN); + return (localized ? g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_UNKNOWN) : "Unknown"); } } diff --git a/src/system/flashtool.h b/src/system/flashtool.h index d54693ee7..86a1a3b97 100644 --- a/src/system/flashtool.h +++ b/src/system/flashtool.h @@ -91,7 +91,7 @@ class CFlashVersionInfo const char *getDate(void) const; const char *getTime(void) const; const char *getReleaseCycle(void) const; - const char *getType(void) const; + const char *getType(bool localized = false) const; int getVersion(void) const; time_t getDateTime(void) const { return datetime; }; }; diff --git a/src/system/locals.h b/src/system/locals.h index fbb3ca23a..d7926147b 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -715,8 +715,8 @@ typedef enum LOCALE_FLASHUPDATE_TITLEWRITEFLASH, LOCALE_FLASHUPDATE_TYPE_ADDON, LOCALE_FLASHUPDATE_TYPE_BETA, - LOCALE_FLASHUPDATE_TYPE_INTERNAL, LOCALE_FLASHUPDATE_TYPE_LOCALE, + LOCALE_FLASHUPDATE_TYPE_NIGHTLY, LOCALE_FLASHUPDATE_TYPE_RELEASE, LOCALE_FLASHUPDATE_TYPE_SETTINGS, LOCALE_FLASHUPDATE_TYPE_TEXT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 6cbcdbb20..0882affd5 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -715,8 +715,8 @@ const char * locale_real_names[] = "flashupdate.titlewriteflash", "flashupdate.type_addon", "flashupdate.type_beta", - "flashupdate.type_internal", "flashupdate.type_locale", + "flashupdate.type_nightly", "flashupdate.type_release", "flashupdate.type_settings", "flashupdate.type_text",