From dab51889cb563cae7d51989e9f5b50173c12b301 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 1 Mar 2017 15:04:10 +0100 Subject: [PATCH 1/7] src/neutrino.cpp init struct timer_remotebox_item, avoid segfault without InfoClock Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d12ea80c5b6607657ffc8fdd74e9c0345f3c4d2b Author: Jacek Jendrzej Date: 2017-03-01 (Wed, 01 Mar 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/neutrino.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 08b728cdd..fe94460d2 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -468,6 +468,7 @@ int CNeutrinoApp::loadSetup(const char * fname) if (timer_remotebox_itemcount) { for (int i = 0; i < timer_remotebox_itemcount; i++) { timer_remotebox_item timer_rb; + memset(&timer_rb, 0, sizeof(struct timer_remotebox_item)); std::string k; k = "timer_remotebox_ip_" + to_string(i); timer_rb.rbaddress = configfile.getString(k, ""); @@ -4237,9 +4238,10 @@ void stop_daemons(bool stopall, bool for_flash) if(!for_flash && !stopall && g_settings.hdmi_cec_mode && g_settings.hdmi_cec_standby){ videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)0); } - - delete InfoClock; - delete FileTimeOSD; + if(InfoClock) + delete InfoClock; + if(FileTimeOSD) + delete FileTimeOSD; delete &CMoviePlayerGui::getInstance(); CZapit::getInstance()->Stop(); From d10dda73e10bd7cb636e0c1ff08a7619dfe1e910 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 2/7] fix blinking clock in some modes (thx dbo) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/16537620a6cb6d4f7f7885066a4d9b9338a81c0d Author: TangoCash Date: 2017-03-01 (Wed, 01 Mar 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/infoviewer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index c32a4e9e2..367bca476 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -2168,9 +2168,13 @@ void CInfoViewer::killTitle() sigbox->kill(); #endif header->kill(); -#if 0 //not really required to kill clock, header does this +#if 1 //not really required to kill clock, header does this <--- really ???? if (clock) + { clock->kill(); + delete clock; + clock = NULL; + } #endif body->kill(); @@ -2380,7 +2384,10 @@ void CInfoViewer::ResetModules() delete header; header = NULL; delete body; body = NULL; delete infobar_txt; infobar_txt = NULL; - delete clock; clock = NULL; + if (clock) + { + delete clock; clock = NULL; + } delete txt_cur_start; txt_cur_start = NULL; delete txt_cur_event; txt_cur_event = NULL; delete txt_cur_event_rest; txt_cur_event_rest = NULL; From 780fa8a74dae8c688f38f63be738a161389e164a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 3/7] flashtool: localize getType() function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/950f74dd411f72dbaf78c0c2f4b78fbca9ce0ed4 Author: vanhofen Date: 2017-03-01 (Wed, 01 Mar 2017) Origin message was: ------------------ - flashtool: localize getType() function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 9 +++++++++ data/locale/english.locale | 9 +++++++++ src/system/flashtool.cpp | 20 +++++++++----------- src/system/locals.h | 9 +++++++++ src/system/locals_intern.h | 9 +++++++++ 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a1715b44f..05b8b5e58 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -682,6 +682,15 @@ flashupdate.selectimage Verfügbare Images/Files flashupdate.settings Update-Einstellungen 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_release Release +flashupdate.type_settings Einstellungen +flashupdate.type_text Text +flashupdate.type_unknown Unbekannt +flashupdate.type_update Aktualisierung flashupdate.update_with_settings_del_skipped Ordner [%s] kann nicht gelöscht werden. Eintrag wird übersprungen. flashupdate.update_with_settings_error Error Flashspeicher!\n \nIm neuen Image sind nur noch %ld KB (von %ld KB) frei,\ndas ist zu wenig, um einen sicheren Betrieb zu gewährleisten.\n \nDer Vorgang wird abgebrochen! flashupdate.update_with_settings_processed Image wird bearbeitet ... diff --git a/data/locale/english.locale b/data/locale/english.locale index 4feae3a1e..4f4430a68 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -682,6 +682,15 @@ flashupdate.selectimage Available Images/Files flashupdate.settings Update settings 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_release Release +flashupdate.type_settings Settings +flashupdate.type_text Text +flashupdate.type_unknown Unknown +flashupdate.type_update Update flashupdate.update_with_settings_del_skipped Folder [%s] can not be deleted. Entry is skipped. flashupdate.update_with_settings_error Flash Error!\n \nNew Image only has %ld KB (out of %ld KB) left. Not\nenough space to complete this operation.\n \nCanceling operation! flashupdate.update_with_settings_processed Image is being processed ... diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index aea8e5125..5c1eb4234 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -521,28 +521,26 @@ const char *CFlashVersionInfo::getReleaseCycle(void) const const char *CFlashVersionInfo::getType(void) const { - // TODO: localize it - switch (snapshot) { case '0': - return "Release"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_RELEASE); case '1': - return "Beta"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_BETA); case '2': - return "Internal"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_INTERNAL); case 'L': - return "Locale"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_LOCALE); case 'S': - return "Settings"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_SETTINGS); case 'A': - return "Addon"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_ADDON); case 'U': - return "Update"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_UPDATE); case 'T': - return "Text"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_TEXT); default: - return "Unknown"; + return g_Locale->getText(LOCALE_FLASHUPDATE_TYPE_UNKNOWN); } } diff --git a/src/system/locals.h b/src/system/locals.h index b74b90eb8..8aa833059 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -709,6 +709,15 @@ typedef enum LOCALE_FLASHUPDATE_SETTINGS, LOCALE_FLASHUPDATE_TITLEREADFLASH, LOCALE_FLASHUPDATE_TITLEWRITEFLASH, + LOCALE_FLASHUPDATE_TYPE_ADDON, + LOCALE_FLASHUPDATE_TYPE_BETA, + LOCALE_FLASHUPDATE_TYPE_INTERNAL, + LOCALE_FLASHUPDATE_TYPE_LOCALE, + LOCALE_FLASHUPDATE_TYPE_RELEASE, + LOCALE_FLASHUPDATE_TYPE_SETTINGS, + LOCALE_FLASHUPDATE_TYPE_TEXT, + LOCALE_FLASHUPDATE_TYPE_UNKNOWN, + LOCALE_FLASHUPDATE_TYPE_UPDATE, LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_DEL_SKIPPED, LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_ERROR, LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b3b18075b..f1134b99e 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -709,6 +709,15 @@ const char * locale_real_names[] = "flashupdate.settings", "flashupdate.titlereadflash", "flashupdate.titlewriteflash", + "flashupdate.type_addon", + "flashupdate.type_beta", + "flashupdate.type_internal", + "flashupdate.type_locale", + "flashupdate.type_release", + "flashupdate.type_settings", + "flashupdate.type_text", + "flashupdate.type_unknown", + "flashupdate.type_update", "flashupdate.update_with_settings_del_skipped", "flashupdate.update_with_settings_error", "flashupdate.update_with_settings_processed", From b648301aed2c80911704a057b2f4ccddd827a975 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 4/7] update: prepare for menu hints Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/943c03fc52b8c95d6a6ca066cc33a7a2e57055e6 Author: vanhofen Date: 2017-03-01 (Wed, 01 Mar 2017) Origin message was: ------------------ - update: prepare for menu hints ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/update.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index eeca7c65c..e31a2ff17 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -257,6 +257,7 @@ bool CFlashUpdate::selectHttpImage(void) { std::ifstream in(gTmpPath LIST_OF_UPDATES_LOCAL_FILENAME); bool enabled; + CMenuForwarder * mf; while (in >> url >> version >> md5 >> std::ws) { urls.push_back(url); @@ -290,7 +291,9 @@ bool CFlashUpdate::selectHttpImage(void) //SelectionWidget.addItem(new CMenuForwarder(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected))); CUpdateMenuTarget * up = new CUpdateMenuTarget(i, &selected); - SelectionWidget.addItem(new CMenuDForwarder(descriptions[i].c_str(), enabled, names[i].c_str(), up)); + mf = new CMenuDForwarder(descriptions[i].c_str(), enabled, names[i].c_str(), up); + //TODO mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, ""); + SelectionWidget.addItem(mf); i++; } } From 3fe63fdc6a9a2351ad8965eae4cfd90adc331453 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 5/7] update: change filetype comparsion; "< '3'" to "<= '2'" Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2a9b39f45fe8c3c6383e80bbaa3831473635e7da Author: vanhofen Date: 2017-03-01 (Wed, 01 Mar 2017) Origin message was: ------------------ - update: change filetype comparsion; "< '3'" to "<= '2'" ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/update.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index e31a2ff17..dc3fbdbf0 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -175,7 +175,7 @@ bool CFlashUpdate::checkOnlineVersion() #ifdef DEBUG printf("[update] url %s version %s (%d) timestamp %s (%ld) md5 %s name %s\n", url.c_str(), version.c_str(), newVer, versionInfo.getDate(), versionInfo.getDateTime(), md5.c_str(), name.c_str()); #endif - if(versionInfo.snapshot < '3' && (newVer > curVer || versionInfo.getDateTime() > curInfo.getDateTime())) { + if(versionInfo.snapshot <= '2' && (newVer > curVer || versionInfo.getDateTime() > curInfo.getDateTime())) { newfound = true; printf("[update] found new image\n"); break; @@ -273,9 +273,9 @@ bool CFlashUpdate::selectHttpImage(void) #ifdef DEBUG printf("[update] url %s version %s (%d) timestamp %s (%ld) md5 %s name %s\n", url.c_str(), version.c_str(), newVer, versionInfo.getDate(), versionInfo.getDateTime(), md5.c_str(), name.c_str()); #endif - if(versionInfo.snapshot < '3' && (newVer > curVer || versionInfo.getDateTime() > curInfo.getDateTime())) + if(versionInfo.snapshot <= '2' && (newVer > curVer || versionInfo.getDateTime() > curInfo.getDateTime())) newfound = 1; - if(!allow_flash && (versionInfo.snapshot < '3')) + if(!allow_flash && (versionInfo.snapshot <= '2')) enabled = false; fileTypes[i] = versionInfo.snapshot; //std::string description = versionInfo.getType(); @@ -325,7 +325,7 @@ bool CFlashUpdate::selectHttpImage(void) file_md5 = md5s[selected]; fileType = fileTypes[selected]; #ifdef BOXMODEL_CS_HD2 - if(fileType < '3') { + if(fileType <= '2') { int esize = CMTDInfo::getInstance()->getMTDEraseSize(sysfs); printf("[update] erase size is %x\n", esize); if (esize == 0x40000) { @@ -387,7 +387,7 @@ printf("[update] mode is %d\n", softupdate_mode); versionInfo = new CFlashVersionInfo(newVersion);//Memory leak: versionInfo sprintf(msg, g_Locale->getText(msg_body), versionInfo->getDate(), versionInfo->getTime(), versionInfo->getReleaseCycle(), versionInfo->getType()); - if(fileType < '3') + if(fileType <= '2') { if ((strncmp(RELEASE_CYCLE, versionInfo->getReleaseCycle(), 2) != 0) && (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_WRONGBASE), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) @@ -545,7 +545,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } if(softupdate_mode==1) { //internet-update - if ( ShowMsg(LOCALE_MESSAGEBOX_INFO, (fileType < '3') ? LOCALE_FLASHUPDATE_INSTALL_IMAGE : LOCALE_FLASHUPDATE_INSTALL_PACKAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes) // UTF-8 + if ( ShowMsg(LOCALE_MESSAGEBOX_INFO, (fileType <= '2') ? LOCALE_FLASHUPDATE_INSTALL_IMAGE : LOCALE_FLASHUPDATE_INSTALL_PACKAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes) // UTF-8 { hide(); return menu_return::RETURN_REPAINT; @@ -557,7 +557,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) #ifdef DEBUG printf("[update] flash/install filename %s type %c\n", filename.c_str(), fileType); #endif - if(fileType < '3') { + if(fileType <= '2') { //flash it... #ifndef BOXMODEL_CS_HD2 if (g_settings.apply_settings) { From 664e72dbd967f5c37a1e7e6310f5999521a10bb1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 6/7] update: small cleanup; ... remove obsolete g_Locale->getText() from ShowHint calls Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ea3ab21bb0633936f1bf05d43aa61ac481a435b7 Author: vanhofen Date: 2017-03-01 (Wed, 01 Mar 2017) Origin message was: ------------------ - update: small cleanup; ... remove obsolete g_Locale->getText() from ShowHint calls ------------------ This commit was generated by Migit --- src/gui/update.cpp | 79 +++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index dc3fbdbf0..3d78c5f69 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -207,7 +207,7 @@ bool CFlashUpdate::selectHttpImage(void) curVer = curInfo.getVersion(); httpTool.setStatusViewer(this); - showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILE)); // UTF-8 + showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILE)); char current[200]; snprintf(current, 200, "%s: %s %s %s %s %s", g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSION_SEP), curInfo.getReleaseCycle(), @@ -239,18 +239,13 @@ bool CFlashUpdate::selectHttpImage(void) if (startpos == std::string::npos) { startpos = 0; - endpos = std::string::npos; - updates_lists.push_back(url.substr(startpos, endpos - startpos)); } else { - //startpos += 2; - //endpos = url.find('/', startpos); startpos = url.find('/', startpos+2)+1; - endpos = std::string::npos; - updates_lists.push_back(url.substr(startpos, endpos - startpos)); } - //updates_lists.push_back(url.substr(startpos, endpos - startpos)); + endpos = std::string::npos; + updates_lists.push_back(url.substr(startpos, endpos - startpos)); SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::STRING | CMenuSeparator::LINE, updates_lists.rbegin()->c_str())); if (httpTool.downloadFile(url, gTmpPath LIST_OF_UPDATES_LOCAL_FILENAME, 20)) @@ -278,7 +273,6 @@ bool CFlashUpdate::selectHttpImage(void) if(!allow_flash && (versionInfo.snapshot <= '2')) enabled = false; fileTypes[i] = versionInfo.snapshot; - //std::string description = versionInfo.getType(); std::string description = versionInfo.getReleaseCycle(); description += ' '; description += versionInfo.getType(); @@ -289,7 +283,6 @@ bool CFlashUpdate::selectHttpImage(void) descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */ - //SelectionWidget.addItem(new CMenuForwarder(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected))); 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, ""); @@ -303,7 +296,7 @@ bool CFlashUpdate::selectHttpImage(void) if (urls.empty()) { - ShowMsg(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILEERROR), CMsgBox::mbrOk, CMsgBox::mbOk); // UTF-8 + ShowMsg(LOCALE_MESSAGEBOX_ERROR, LOCALE_FLASHUPDATE_GETINFOFILEERROR, CMsgBox::mbrOk, CMsgBox::mbOk); return false; } if (notify) { @@ -352,11 +345,10 @@ bool CFlashUpdate::getUpdateImage(const std::string & version) else return false; sprintf(dest_name, "%s/%s", g_settings.update_dir.c_str(), fname); - showStatusMessageUTF(std::string(g_Locale->getText(LOCALE_FLASHUPDATE_GETUPDATEFILE)) + ' ' + version); // UTF-8 + showStatusMessageUTF(std::string(g_Locale->getText(LOCALE_FLASHUPDATE_GETUPDATEFILE)) + ' ' + version); printf("get update (url): %s - %s\n", filename.c_str(), dest_name); return httpTool.downloadFile(filename, dest_name, 40 ); - //return httpTool.downloadFile(filename, gTmpPath UPDATE_LOCAL_FILENAME, 40 ); } bool CFlashUpdate::checkVersion4Update() @@ -365,7 +357,7 @@ bool CFlashUpdate::checkVersion4Update() CFlashVersionInfo * versionInfo; neutrino_locale_t msg_body; #ifdef DEBUG -printf("[update] mode is %d\n", softupdate_mode); + printf("[update] mode is %d\n", softupdate_mode); #endif if(softupdate_mode==1) //internet-update { @@ -374,7 +366,7 @@ printf("[update] mode is %d\n", softupdate_mode); showLocalStatus(100); showGlobalStatus(20); - showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_VERSIONCHECK)); // UTF-8 + showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_VERSIONCHECK)); printf("internet version: %s\n", newVersion.c_str()); @@ -390,15 +382,15 @@ printf("[update] mode is %d\n", softupdate_mode); if(fileType <= '2') { if ((strncmp(RELEASE_CYCLE, versionInfo->getReleaseCycle(), 2) != 0) && - (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_WRONGBASE), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) + (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_WRONGBASE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) { delete versionInfo; - //ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_WRONGBASE)); // UTF-8 + //ShowHint(LOCALE_MESSAGEBOX_ERROR, LOCALE_FLASHUPDATE_WRONGBASE); return false; } if ((strcmp("Release", versionInfo->getType()) != 0) && - //(ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_EXPERIMENTALIMAGE), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) // UTF-8 + //(ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_EXPERIMENTALIMAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_EXPERIMENTALIMAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) { delete versionInfo; @@ -414,7 +406,8 @@ printf("[update] mode is %d\n", softupdate_mode); CFileBrowser UpdatesBrowser; CFileFilter UpdatesFilter; - if(allow_flash) UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER); + if (allow_flash) + UpdatesFilter.addFilter(FILEBROWSER_UPDATE_FILTER); string filters[] = {"bin", "txt", "opk", "ipk"}; for(size_t i=0; igetType() == CFile::FILE_PKG_PACKAGE){ COPKGManager opkg; if (opkg.hasOpkgSupport()){ - int msgres = ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_OPKG_WARNING_3RDPARTY_PACKAGES, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE, 700); // UTF-8 + int msgres = ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_OPKG_WARNING_3RDPARTY_PACKAGES, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE, 700); if (msgres == CMsgBox::mbrYes){ if (!opkg.installPackage(UpdatesBrowser.getSelectedFile()->Name)) DisplayErrorMessage(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL)); @@ -479,9 +472,8 @@ printf("[update] mode is %d\n", softupdate_mode); } strcpy(msg, g_Locale->getText(LOCALE_FLASHUPDATE_NOVERSION)); -//never read msg_body = LOCALE_FLASHUPDATE_MSGBOX_MANUAL; } - return (ShowMsg(LOCALE_MESSAGEBOX_INFO, msg, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) == CMsgBox::mbrYes); // UTF-8 + return (ShowMsg(LOCALE_MESSAGEBOX_INFO, msg, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) == CMsgBox::mbrYes); } int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) @@ -499,13 +491,13 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) paint(); if(sysfs.size() < 8) { - ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENMTD)); + ShowHint(LOCALE_MESSAGEBOX_ERROR, LOCALE_FLASHUPDATE_CANTOPENMTD); hide(); return menu_return::RETURN_REPAINT; } if(!checkVersion4Update()) { hide(); - return menu_ret; //menu_return::RETURN_REPAINT; + return menu_ret; } #ifdef VFD_UPDATE @@ -524,7 +516,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) if(!getUpdateImage(newVersion)) { hide(); - ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_GETUPDATEFILEERROR)); // UTF-8 + ShowHint(LOCALE_MESSAGEBOX_ERROR, LOCALE_FLASHUPDATE_GETUPDATEFILEERROR); return menu_return::RETURN_REPAINT; } sprintf(fullname, "%s/%s", g_settings.update_dir.c_str(), fname); @@ -534,18 +526,17 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) showGlobalStatus(40); CFlashTool ft; - //ft.setMTDDevice(MTD_DEVICE_OF_UPDATE_PART); ft.setMTDDevice(sysfs); ft.setStatusViewer(this); - showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_MD5CHECK)); // UTF-8 + showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_MD5CHECK)); if((softupdate_mode==1) && !ft.check_md5(filename, file_md5)) { hide(); - ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_MD5SUMERROR)); // UTF-8 + ShowHint(LOCALE_MESSAGEBOX_ERROR, LOCALE_FLASHUPDATE_MD5SUMERROR); return menu_return::RETURN_REPAINT; } if(softupdate_mode==1) { //internet-update - if ( ShowMsg(LOCALE_MESSAGEBOX_INFO, (fileType <= '2') ? LOCALE_FLASHUPDATE_INSTALL_IMAGE : LOCALE_FLASHUPDATE_INSTALL_PACKAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes) // UTF-8 + if ( ShowMsg(LOCALE_MESSAGEBOX_INFO, (fileType <= '2') ? LOCALE_FLASHUPDATE_INSTALL_IMAGE : LOCALE_FLASHUPDATE_INSTALL_PACKAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes) { hide(); return menu_return::RETURN_REPAINT; @@ -561,7 +552,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) //flash it... #ifndef BOXMODEL_CS_HD2 if (g_settings.apply_settings) { - if (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) == CMsgBox::mbrYes) + if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_APPLY_SETTINGS, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) == CMsgBox::mbrYes) if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE)) { hide(); return menu_return::RETURN_REPAINT; @@ -575,15 +566,15 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) if(!ft.program(filename, 80, 100)) { #endif hide(); - ShowHint(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8 + ShowHint(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); return menu_return::RETURN_REPAINT; } //status anzeigen showGlobalStatus(100); - showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 + showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); hide(); - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8 + ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_FLASHREADYREBOOT); sleep(2); ft.reboot(); } @@ -598,7 +589,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) fread(buffer, (uint32_t)filesize, 1, fd); fclose(fd); buffer[filesize] = 0; - ShowMsg(LOCALE_MESSAGEBOX_INFO, buffer, CMsgBox::mbrBack, CMsgBox::mbBack); // UTF-8 + ShowMsg(LOCALE_MESSAGEBOX_INFO, buffer, CMsgBox::mbrBack, CMsgBox::mbBack); free(buffer); } } @@ -612,16 +603,12 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) my_system(3, install_sh, g_settings.update_dir.c_str(), filename.c_str()); #endif showGlobalStatus(100); - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 + ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_READY); } hide(); return menu_return::RETURN_REPAINT; } - -//-------------------------------------------------------------------------------------------------------------- - - CFlashExpert::CFlashExpert() :CProgressWindow() { @@ -833,17 +820,17 @@ void CFlashExpert::readmtd(int preadmtd) setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH); paint(); showGlobalStatus(0); - showStatusMessageUTF((std::string(g_Locale->getText(LOCALE_FLASHUPDATE_ACTIONREADFLASH)) + " (" + mtdInfo->getMTDName(preadmtd) + ')')); // UTF-8 + showStatusMessageUTF((std::string(g_Locale->getText(LOCALE_FLASHUPDATE_ACTIONREADFLASH)) + " (" + mtdInfo->getMTDName(preadmtd) + ')')); CFlashTool ft; ft.setStatusViewer( this ); ft.setMTDDevice(mtdInfo->getMTDFileName(preadmtd)); if(!ft.readFromMTD(filename, 100)) { - showStatusMessageUTF(ft.getErrorMessage()); // UTF-8 + showStatusMessageUTF(ft.getErrorMessage()); sleep(10); } else { showGlobalStatus(100); - showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 + showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); char message[500]; sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str()); sleep(1); @@ -866,7 +853,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) FILESYSTEM_ENCODING_TO_UTF8_STRING(filename).c_str(), CMTDInfo::getInstance()->getMTDName(mtdNumber).c_str()); - if (ShowMsg(LOCALE_MESSAGEBOX_INFO, message, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes) // UTF-8 + if (ShowMsg(LOCALE_MESSAGEBOX_INFO, message, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes) return; #ifdef VFD_UPDATE CVFD::getInstance()->showProgressBar2(0,"checking",0,"Update Neutrino"); @@ -880,14 +867,14 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) ft.setStatusViewer( this ); ft.setMTDDevice( CMTDInfo::getInstance()->getMTDFileName(mtdNumber) ); if(!ft.program( (std::string)g_settings.update_dir + "/" + filename, 50, 100)) { - showStatusMessageUTF(ft.getErrorMessage()); // UTF-8 + showStatusMessageUTF(ft.getErrorMessage()); sleep(10); } else { showGlobalStatus(100); - showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 + showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); sleep(2); hide(); - ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8 + ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_FLASHREADYREBOOT); ft.reboot(); } } From 9af8ad3e8a0ff187a2928e6d66948aa193cb472a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 7/7] update: rename DEBUG1 to DRYRUN Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/00d2d557c25ed931596de237f1945c7b401b0e2f Author: vanhofen Date: 2017-03-01 (Wed, 01 Mar 2017) Origin message was: ------------------ - update: rename DEBUG1 to DRYRUN ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/update.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 3d78c5f69..e0ce4cf0a 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -80,6 +80,8 @@ extern int allow_flash; +//#define DRYRUN + //#define gTmpPath "/var/update/" #define gTmpPath "/tmp/" #define gUserAgent "neutrino/softupdater 1.0" @@ -560,7 +562,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) } #endif -#ifdef DEBUG1 +#ifdef DRYRUN if(1) { #else if(!ft.program(filename, 80, 100)) { @@ -596,10 +598,8 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) else // not image, install { const char install_sh[] = "/bin/install.sh"; -#ifdef DEBUG1 - printf("[update] calling %s %s %s\n",install_sh, g_settings.update_dir.c_str(), filename.c_str() ); -#else printf("[update] calling %s %s %s\n",install_sh, g_settings.update_dir.c_str(), filename.c_str() ); +#ifndef DRYRUN my_system(3, install_sh, g_settings.update_dir.c_str(), filename.c_str()); #endif showGlobalStatus(100);