update: fix release cycle handling; add human readable version string

Origin commit data
------------------
Commit: 87d60639ae
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-11-29 (Thu, 29 Nov 2018)

Origin message was:
------------------
- update: fix release cycle handling; add human readable version string
This commit is contained in:
vanhofen
2018-11-29 22:47:42 +01:00
parent d946dcd2cb
commit 311f1857fa
7 changed files with 33 additions and 34 deletions

View File

@@ -731,7 +731,7 @@ flashupdate.menu_apply_settings Settingsübernahme erlauben
flashupdate.mkfs_create_image Backup erstellen
flashupdate.mkfs_preparing_files Dateien und Verzeichnisse vorbereiten
flashupdate.mkfs_using_sumtool Benutze Sumtool
flashupdate.msgbox Es wurde folgende neue Datei gefunden:\nDatum: %s, %s\nBasis-Image: %s\nTyp: %s\n\nWollen Sie diese Version jetzt herunterladen?
flashupdate.msgbox Es wurde folgendes Update gefunden:\n%s %s vom %s, %s\n\nWollen Sie diese Version jetzt herunterladen?
flashupdate.mtdselector Partitions-Auswahl
flashupdate.namemode1 Dateiname Settingsfile
flashupdate.namemode1_default <Org.Name>+settings.img

View File

@@ -731,7 +731,7 @@ flashupdate.menu_apply_settings Allow apply settings
flashupdate.mkfs_create_image Create backup
flashupdate.mkfs_preparing_files Preparing files and directories
flashupdate.mkfs_using_sumtool Using sumtool
flashupdate.msgbox Found the following new file:\nDate: %s, %s\nBaseImage: %s\nType: %s\n\nDo you want to download this version now?
flashupdate.msgbox Found the following update:\n%s %s of %s, %s\n\nDo you want to download this version now?
flashupdate.mtdselector Partition-Selector
flashupdate.namemode1 Filename settingsfile
flashupdate.namemode1_default <org.name>+settings.img

View File

@@ -299,7 +299,7 @@ void CImageInfo::InitInfoData()
}
if (is_version_code && version_string.size() == 16){
static CFlashVersionInfo versionInfo(version_string.c_str());
version_string = versionInfo.getReleaseCycle();
version_string = versionInfo.getVersionString();
version_string += " ";
version_string += versionInfo.getType();
version_string += " (";

View File

@@ -298,9 +298,9 @@ void CImageInfoNI::paint()
if (version.compare("n/a") != 0)
{
static CFlashVersionInfo versionInfo(version);
std::string releaseCycle = versionInfo.getReleaseCycle();
std::string v = versionInfo.getVersionString();
imageversion.str("");
imageversion << releaseCycle << " (" << versionInfo.getType(true) << ")";
imageversion << v << " (" << versionInfo.getType(true) << ")";
}
#endif

View File

@@ -238,13 +238,7 @@ 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
//NI
snprintf(current, 200, "%s %s %s %s", curInfo.getReleaseCycle(), curInfo.getType(true), curInfo.getDate(), curInfo.getTime());
snprintf(current, 200, "%s %s - %s, %s", curInfo.getType(true), curInfo.getVersionString(), curInfo.getDate(), curInfo.getTime());
CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE, listWidth, MN_WIDGET_ID_IMAGESELECTOR);
@@ -303,12 +297,12 @@ bool CFlashUpdate::selectHttpImage(void)
if(!allow_flash && (versionInfo.snapshot <= '2'))
enabled = false;
fileTypes[i] = versionInfo.snapshot;
std::string description = versionInfo.getReleaseCycle();
description += ' ';
description += versionInfo.getType(true);
description += ' ';
std::string description = versionInfo.getType(true);
description += " ";
description += versionInfo.getVersionString();
description += " - ";
description += versionInfo.getDate();
description += ' ';
description += ", ";
description += versionInfo.getTime();
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
@@ -417,7 +411,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(true));
sprintf(msg, g_Locale->getText(msg_body), versionInfo->getType(true), versionInfo->getVersionString(), versionInfo->getDate(), versionInfo->getTime());
if (fileType <= '2')
{

View File

@@ -481,23 +481,21 @@ CFlashVersionInfo::CFlashVersionInfo(const std::string & _versionString)
snapshot = versionString[0];
// recover release cycle version
// will be compared with RELEASE_CYCLE, which is defined in configure.ac as "x.0"
releaseCycle[0] = versionString[1];
releaseCycle[1] = '.';
/*
if (versionString[2] == '0')
{
releaseCycle[2] = versionString[3];
releaseCycle[3] = 0;
}
else
*/
{
releaseCycle[2] = versionString[2];
releaseCycle[3] = versionString[3];
releaseCycle[4] = 0;
}
releaseCycle[2] = '0';
releaseCycle[3] = 0;
// human readable version
vstring[0] = versionString[1];
vstring[1] = '.';
vstring[2] = versionString[2];
vstring[3] = versionString[3];
vstring[4] = 0;
version = atoi(&versionString[1])*100 + atoi(&versionString[2])*10 + atoi(&versionString[3]);
version = atoi(&releaseCycle[0]) * 100 + atoi(&releaseCycle[2]);
// recover date
struct tm tt;
memset(&tt, 0, sizeof(tt));
@@ -579,6 +577,11 @@ int CFlashVersionInfo::getVersion(void) const
return version;
}
const char *CFlashVersionInfo::getVersionString(void) const
{
return vstring;
}
//-----------------------------------------------------------------------------------------------------------------
CMTDInfo::CMTDInfo()

View File

@@ -80,7 +80,8 @@ class CFlashVersionInfo
char date[11];
char time[6];
char releaseCycle[5];
char releaseCycle[4];
char vstring[5]; // human readable version
int version;
time_t datetime;
@@ -93,7 +94,8 @@ class CFlashVersionInfo
const char *getTime(void) const;
const char *getReleaseCycle(void) const;
const char *getType(bool localized = false) const;
int getVersion(void) const;
int getVersion(void) const;
const char *getVersionString(void) const;
time_t getDateTime(void) const { return datetime; };
};