mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
- update: smoother view for current image
Conflicts: src/gui/update.cpp Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -84,6 +84,9 @@
|
||||
extern cVideo * videoDecoder;
|
||||
#endif
|
||||
|
||||
#if 0 //softupdate
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
extern int allow_flash;
|
||||
|
||||
//#define DRYRUN
|
||||
@@ -151,8 +154,12 @@ void CFlashUpdate::update_php(std::string &url, const char* type)
|
||||
if (url.find("update.php") != std::string::npos)
|
||||
{
|
||||
url += "?revision=" + to_string(cs_get_revision());
|
||||
url += "&boxname=";
|
||||
url += g_info.hw_caps->boxname;
|
||||
url += "&chip_type=" + to_string(cs_get_chip_type());
|
||||
url += "&image_type=" + (std::string)type;
|
||||
|
||||
url = str_replace(" ", "%20", url);
|
||||
printf("[update_php] url %s\n", url.c_str());
|
||||
}
|
||||
}
|
||||
@@ -186,6 +193,7 @@ bool CFlashUpdate::checkOnlineVersion()
|
||||
std::string host;
|
||||
startpos = url.find("//");
|
||||
if (startpos != std::string::npos) {
|
||||
//update_php(url, curInfo.getType()); //NI
|
||||
startpos += 2;
|
||||
endpos = url.find('/', startpos);
|
||||
host = url.substr(startpos, endpos - startpos);
|
||||
@@ -225,8 +233,14 @@ bool CFlashUpdate::selectHttpImage(void)
|
||||
|
||||
CConfigFile _configfile('\t');
|
||||
std::string versionString = "????????????????";
|
||||
if (_configfile.loadConfig("/.version"))
|
||||
std::string imagedescription = "";
|
||||
std::string imageversion = "n/a";
|
||||
if (_configfile.loadConfig(TARGET_PREFIX "/.version"))
|
||||
{
|
||||
versionString = _configfile.getString("version", "????????????????");
|
||||
imagedescription = _configfile.getString("imagedescription", "");
|
||||
imageversion = _configfile.getString("imageversion", "n/a");
|
||||
}
|
||||
|
||||
CFlashVersionInfo curInfo(versionString.c_str());
|
||||
dprintf(DEBUG_NORMAL, "[update] current flash-version: %s (%d) date %s (%ld)\n", versionString.c_str(), curInfo.getVersion(), curInfo.getDate(), curInfo.getDateTime());
|
||||
@@ -235,17 +249,18 @@ bool CFlashUpdate::selectHttpImage(void)
|
||||
httpTool.setStatusViewer(this);
|
||||
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILE));
|
||||
|
||||
char current[200];
|
||||
snprintf(current, 200, "%s %s %s %s", curInfo.getReleaseCycle(), curInfo.getType(true), curInfo.getDate(), curInfo.getTime());
|
||||
|
||||
char currentleft[200];
|
||||
char currentright[200];
|
||||
snprintf(currentleft, 200, "%s %d - %s, %s", curInfo.getType(true), curInfo.getVersion(), curInfo.getDate(), curInfo.getTime());
|
||||
snprintf(currentright, 200, "%s %s", imagedescription.c_str(), imageversion.c_str());
|
||||
|
||||
CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE, listWidth, MN_WIDGET_ID_IMAGESELECTOR);
|
||||
|
||||
SelectionWidget.addItem(GenericMenuSeparator);
|
||||
SelectionWidget.addItem(GenericMenuBack);
|
||||
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::LINE));
|
||||
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::STRING | CMenuSeparator::LINE, g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSION_SEP)));
|
||||
SelectionWidget.addItem(new CMenuForwarder(currentleft, false, currentright));
|
||||
|
||||
SelectionWidget.addItem(new CMenuForwarder(current, false, g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSION_SEP)));
|
||||
std::ifstream urlFile(g_settings.softupdate_url_file.c_str());
|
||||
dprintf(DEBUG_NORMAL, "[update] file %s\n", g_settings.softupdate_url_file.c_str());
|
||||
|
||||
@@ -296,12 +311,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.getVersion();
|
||||
description += " - ";
|
||||
description += versionInfo.getDate();
|
||||
description += ' ';
|
||||
description += ", ";
|
||||
description += versionInfo.getTime();
|
||||
|
||||
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
|
||||
@@ -316,7 +331,7 @@ bool CFlashUpdate::selectHttpImage(void)
|
||||
CUpdateMenuTarget * up = new CUpdateMenuTarget(i, &selected);
|
||||
mf = new CMenuDForwarder(descriptions[i].c_str(), enabled, names[i].c_str(), up);
|
||||
//TODO mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, "");
|
||||
SelectionWidget.addItem(mf);
|
||||
SelectionWidget.addItem(mf, i == 0); // first entry is preselected
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -349,7 +364,7 @@ bool CFlashUpdate::selectHttpImage(void)
|
||||
fileType = fileTypes[selected];
|
||||
gotImage = (fileType <= '9');
|
||||
|
||||
#ifdef BOXMODEL_CS_HD2
|
||||
#if 0 //#ifdef BOXMODEL_CS_HD2
|
||||
if (gotImage)
|
||||
{
|
||||
int esize = CMTDInfo::getInstance()->getMTDEraseSize(sysfs);
|
||||
@@ -359,7 +374,6 @@ bool CFlashUpdate::selectHttpImage(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE
|
||||
if (gotImage && (filename.substr(filename.find_last_of(".") + 1) == "tgz" || filename.substr(filename.find_last_of(".") + 1) == "zip"))
|
||||
{
|
||||
@@ -439,8 +453,8 @@ bool CFlashUpdate::checkVersion4Update()
|
||||
else
|
||||
{
|
||||
CFileBrowser UpdatesBrowser;
|
||||
|
||||
CFileFilter UpdatesFilter;
|
||||
|
||||
if (allow_flash)
|
||||
{
|
||||
UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER);
|
||||
@@ -724,7 +738,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
if (restart == CMsgBox::mbrYes)
|
||||
{
|
||||
if(g_settings.hdmi_cec_standby){
|
||||
videoDecoder->SetCECAutoStandby(false);
|
||||
videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)0);
|
||||
}
|
||||
std::string startup_new = "/boot/STARTUP_" + to_string(selected);
|
||||
dprintf(DEBUG_NORMAL, "[update] Start selected partition %d (%s)\n", selected, startup_new.c_str());
|
||||
|
Reference in New Issue
Block a user