From 7c0dde29d39b670ff864e7417596d1bef4e58843 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 1 Mar 2017 15:04:10 +0100 Subject: [PATCH 01/20] src/neutrino.cpp init struct timer_remotebox_item, avoid segfault without InfoClock Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d12ea80c5b6607657ffc8fdd74e9c0345f3c4d2b Author: Jacek Jendrzej Date: 2017-03-01 (Wed, 01 Mar 2017) --- 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 900748ae27728a30cbbc1a3413e1b87ec99f48ac Mon Sep 17 00:00:00 2001 From: TangoCash Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 02/20] fix blinking clock in some modes (thx dbo) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/16537620a6cb6d4f7f7885066a4d9b9338a81c0d Author: TangoCash Date: 2017-03-01 (Wed, 01 Mar 2017) --- 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 66b44f2a0f7e3a002bb69d2078ce714af753af35 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 03/20] flashtool: localize getType() function Origin commit data ------------------ 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 --- 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 9591b9a0fcc95b5fdee6c15094fd4ba711b4bff9 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 04/20] update: prepare for menu hints Origin commit data ------------------ 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 --- 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 49a00625888f0cea1cf2e49944d54179e548fb81 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 05/20] update: change filetype comparsion; "< '3'" to "<= '2'" Origin commit data ------------------ 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'" --- 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 b95f60030e9990db22c4ca332c499cf7e5e1b475 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 06/20] update: small cleanup; ... remove obsolete g_Locale->getText() from ShowHint calls Origin commit data ------------------ 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 --- 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 9d0dd14108c4417a08cc05c717564f134bccacac Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 1 Mar 2017 18:16:09 +0100 Subject: [PATCH 07/20] update: rename DEBUG1 to DRYRUN Origin commit data ------------------ 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 --- 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); From b6164c20b70d00f7b33edf4edd37d30843224818 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 2 Mar 2017 22:23:32 +0100 Subject: [PATCH 08/20] fix segfault at startup Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/0e2a405fa5a5b5e18f74a85db191b20bb7e39431 Author: vanhofen Date: 2017-03-02 (Thu, 02 Mar 2017) Origin message was: ------------------ - fix segfault at startup --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 9d75f1d7c..5560a7381 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -511,7 +511,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)); + //NI 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, ""); From 55b63d5299ffcf1dd7cd5b8e4289b1ff97cd5547 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 2 Mar 2017 23:00:49 +0100 Subject: [PATCH 09/20] luainstance: add offsets to lua; set Lua api version to 1.70 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6eb1bb1ea4c6d807771a60948b716f3d20a376c6 Author: vanhofen Date: 2017-03-02 (Thu, 02 Mar 2017) Origin message was: ------------------ - luainstance: add offsets to lua; set Lua api version to 1.70 --- src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/luainstance.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 6c8b8bc22..55b19f4e0 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 69 +#define LUA_API_VERSION_MINOR 70 diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index b3aaea15b..8df8c00ec 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -273,6 +273,19 @@ static void set_lua_variables(lua_State *L) { NULL, 0 } }; + /* offsets, exported as e.g. OFFSET['SHADOW'] */ + table_key offsets[] = + { + { "SHADOW", OFFSET_SHADOW }, + { "INTER", OFFSET_INTER }, + { "INNER_LARGE", OFFSET_INNER_LARGE }, + { "INNER_MID", OFFSET_INNER_MID }, + { "INNER_SMALL", OFFSET_INNER_SMALL }, + { "INNER_MIN", OFFSET_INNER_MIN }, + { "INNER_NONE", OFFSET_INNER_NONE }, + { NULL, 0 } + }; + /* screen offsets, exported as e.g. SCREEN['END_Y'] */ lua_Integer xRes = (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth(true); lua_Integer yRes = (lua_Integer)CFrameBuffer::getInstance()->getScreenHeight(true); @@ -375,6 +388,7 @@ static void set_lua_variables(lua_State *L) { "SCREEN", screenopts }, { "FONT", fontlist }, { "CORNER", corners }, + { "OFFSET", offsets }, { "MENU_RETURN", menureturn }, { "APIVERSION", apiversion }, { "PLAYSTATE", playstate }, From 0cdafc7a1ed51bd33a869df06e1ece82ce26a65a Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Thu, 2 Mar 2017 23:32:01 +0100 Subject: [PATCH 10/20] CNeutrinoApp::loadSetup: Fix Segfault when an remote timer is defined Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9fe20399c4f8ed47f129eb20901eaf27f8ee9853 Author: Michael Liebmann Date: 2017-03-02 (Thu, 02 Mar 2017) --- src/neutrino.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index fe94460d2..0a15d9969 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -468,7 +468,8 @@ 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)); + timer_rb.online = false; + timer_rb.port = 0; std::string k; k = "timer_remotebox_ip_" + to_string(i); timer_rb.rbaddress = configfile.getString(k, ""); From f7bffbff098054d41118e64ae8d163aa1f3d503b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 3 Mar 2017 00:07:10 +0100 Subject: [PATCH 11/20] Revert "- fix segfault at startup" This reverts commit b6164c20b70d00f7b33edf4edd37d30843224818. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/8bd88c94af4b614aa7ce5e760fee32566d00959c Author: vanhofen Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 5560a7381..9d75f1d7c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -511,7 +511,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; - //NI memset(&timer_rb, 0, sizeof(struct timer_remotebox_item)); + 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, ""); From 42131fe3515276d4f67ca7f68c9b5485661c2752 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 3 Mar 2017 08:55:35 +0100 Subject: [PATCH 12/20] luainstance: add missing RADIUS_NONE; fix typo in dynfont handling Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6afe247bc3f37f220795a72d90fe165e8f00d26f Author: vanhofen Date: 2017-03-03 (Fri, 03 Mar 2017) Origin message was: ------------------ - luainstance: add missing RADIUS_NONE; fix typo in dynfont handling --- src/gui/lua/luainstance.cpp | 5 +++-- src/gui/lua/luainstance.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index 8df8c00ec..2b8a2ac76 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -270,6 +270,7 @@ static void set_lua_variables(lua_State *L) { "RADIUS_MID", RADIUS_MID }, { "RADIUS_SMALL", RADIUS_SMALL }, { "RADIUS_MIN", RADIUS_MIN }, + { "RADIUS_NONE", RADIUS_NONE }, { NULL, 0 } }; @@ -343,7 +344,7 @@ static void set_lua_variables(lua_State *L) { "STYLE_ITALIC", (lua_Integer)CNeutrinoFonts::FONT_STYLE_ITALIC }, { "MAX", (lua_Integer)CNeutrinoFonts::DYNFONTEXT_MAX }, { "MAXIMUM_FONTS", (lua_Integer)CLuaInstance::DYNFONT_MAXIMUM_FONTS }, - { "TO_WIDE", (lua_Integer)CLuaInstance::DYNFONT_TO_WIDE }, + { "TOO_WIDE", (lua_Integer)CLuaInstance::DYNFONT_TOO_WIDE }, { "TOO_HIGH", (lua_Integer)CLuaInstance::DYNFONT_TOO_HIGH }, { NULL, 0 } }; @@ -1050,7 +1051,7 @@ int CLuaInstance::getDynFont(lua_State *L) dx = luaL_checkint(L, 2); if (dx > (lua_Integer)CFrameBuffer::getInstance()->getScreenWidth(true)) { lua_pushnil(L); - lua_pushinteger(L, DYNFONT_TO_WIDE); + lua_pushinteger(L, DYNFONT_TOO_WIDE); return 2; } dy = luaL_checkint(L, 3); diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index 21ebb625b..fe0ad3bff 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -46,7 +46,7 @@ public: enum { DYNFONT_NO_ERROR = 0, DYNFONT_MAXIMUM_FONTS = 1, - DYNFONT_TO_WIDE = 2, + DYNFONT_TOO_WIDE = 2, DYNFONT_TOO_HIGH = 3 }; From 00d53e03c9ddd1b9761c8c17b99f4c33fa51e056 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 3 Mar 2017 08:57:42 +0100 Subject: [PATCH 13/20] luainstance: re-add typo TO_WIDE to stay backward compatible Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/75ff8687dd2cdc445977501e8201cd95e6bb9e17 Author: vanhofen Date: 2017-03-03 (Fri, 03 Mar 2017) Origin message was: ------------------ - luainstance: re-add typo TO_WIDE to stay backward compatible --- src/gui/lua/luainstance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index 2b8a2ac76..9adfa1d4e 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -344,6 +344,7 @@ static void set_lua_variables(lua_State *L) { "STYLE_ITALIC", (lua_Integer)CNeutrinoFonts::FONT_STYLE_ITALIC }, { "MAX", (lua_Integer)CNeutrinoFonts::DYNFONTEXT_MAX }, { "MAXIMUM_FONTS", (lua_Integer)CLuaInstance::DYNFONT_MAXIMUM_FONTS }, + { "TO_WIDE", (lua_Integer)CLuaInstance::DYNFONT_TOO_WIDE }, // just here to stay backward compatible { "TOO_WIDE", (lua_Integer)CLuaInstance::DYNFONT_TOO_WIDE }, { "TOO_HIGH", (lua_Integer)CLuaInstance::DYNFONT_TOO_HIGH }, { NULL, 0 } From 8effbfe1cf67e54178b05238b2f6e20a4f224569 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Mar 2017 09:01:58 +0100 Subject: [PATCH 14/20] CComponentsWindow: use negative values for discret percental dimensions Also add possibility to use placeholder for better readability and better compatibilty with previous implementations. See doc in source files for more details Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cf9a953b59f1cfe15d1d234c4f00c58ba0d0029f Author: Thilo Graf Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/gui/components/cc_frm_window.cpp | 8 ++++---- src/gui/components/cc_frm_window.h | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index ab0663a2d..73a6e23a5 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -169,13 +169,13 @@ void CComponentsWindow::initWindowSize() if (cc_parent) return; - if (width > 0 && width <= 100) //percentage conversion TODO: behavior inside parent - width = frameBuffer->getScreenWidth()*width/100; + if (width < 0 && width >= -100) //percentage conversion TODO: behavior inside parent + width = frameBuffer->getScreenWidth()*abs(width)/100; if (width == 0 || (unsigned)width > frameBuffer->getScreenWidth()) width = frameBuffer->getScreenWidth(); - if (height > 0 && height <= 100) //percentage conversion TODO: behavior inside parent - height = frameBuffer->getScreenHeight()*height/100; + if (height < 0 && height >= -100) //percentage conversion TODO: behavior inside parent + height = frameBuffer->getScreenHeight()*abs(height)/100; if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight()) height = frameBuffer->getScreenHeight(); } diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index cb1b5288e..2c2b0ae64 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -29,6 +29,8 @@ #include "cc_frm_header.h" #include "cc_frm_footer.h" +#define CCW_PERCENATL - //placeholder for negative sign '-', used for discret dimensions parameters + //! Sub class of CComponentsForm. Shows a window with prepared items. /*! CComponentsWindow provides prepared items like header, footer and a container for @@ -135,6 +137,7 @@ class CComponentsWindow : public CComponentsForm CC_WINDOW_RIGHT_SIDEBAR = 2 }; + /**simple constructor for CComponentsWindow, this shows a window over full screen * @param[in] parent * @li optional: expects type CComponentsForm * as possible parent object, default = NULL @@ -148,9 +151,9 @@ class CComponentsWindow : public CComponentsForm * @param[in] y_pos * @li expects type const &int, defines y position on screen * @param[in] w - * @li expects type const &int, width of window, Note: value = 0 uses full screen, value > 0 to 100 interpreted as percent value of screen, value > 100 use native lines count on screen + * @li expects type const &int, width of window, Note: value = 0 uses full screen * @param[in] h - * @li expects type const &int, height of window, Note: value = 0 uses full screen, value > 0 to 100 interpreted as percent value of screen, value > 100 use native lines count on screen + * @li expects type const &int, height of window, Note: value = 0 uses full screen * @param[in] caption * @li optional: expects type const std::string&, defines title of window header * @param[in] iconname @@ -158,16 +161,24 @@ class CComponentsWindow : public CComponentsForm * @param[in] parent * @li optional: expects type CComponentsForm * as possible parent object, default = NULL * @param[in] shadow_mode - * @li optional: expects type int as mode, default = CC_SHADOW_OFF - * possible values are - * CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT) - * @see cc_types.h + * @li optional: expects type int as mode, default = CC_SHADOW_OFF \n + * possible values are \n + * CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT) \n + * Take a look into cc_types.h * @param[in] color_frame * @li optional: expects type fb_pixel_t, defines frame color, default = COL_FRAME_PLUS_0 * @param[in] color_body * @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0 * @param[in] color_shadow * @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0 + * + * @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen. + * For better readability please use placeholder 'CCW_PERCENATL' as negative sign '-' \n + * Example: \n + * this inits a window with position x100 y100 on screen with dimensions 700px x 800px \n + * CComponentsWindow win(100, 100, 700, 800, "Test window");\n + * this inits a window with position x100 y100 on screen with 50% of screen size assigned with discret percental screen dimensions \n + * CComponentsWindow win(100, 100, CCW_PERCENATL 50, CCW_PERCENATL 50, "Test window"); */ CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", From 3cdfcf3cba6038da1920fd4e342a59492ef10b61 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Mar 2017 09:03:46 +0100 Subject: [PATCH 15/20] CBuildInfo: adaopt for discret percental window dimensions Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/449901f1d8b0423f5cf289e0b582219e9a201182 Author: Thilo Graf Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/gui/buildinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 50b480964..fabc41b1a 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -35,7 +35,7 @@ using namespace std; -CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 90/*%*/, 90/*%*/, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) +CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENATL 90, CCW_PERCENATL 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) { initVarBuildInfo(); if (show) From 263bd0e3fcf9d97cb5bbb77510cef3005bac0831 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Mar 2017 09:04:47 +0100 Subject: [PATCH 16/20] CMovieBrowser: adaopt for discret percental window dimensions Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/21b700879e86a4f9b0da1d05657bbd3b2f417021 Author: Thilo Graf Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/gui/moviebrowser/mb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 72268adc4..faad7a41c 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -3126,7 +3126,7 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, 50/*%*/, 25/*%*/, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir); + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENATL 50, CCW_PERCENATL 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir); loadBox.enableShadow(); loadBox.paint(); From e64a61b8b4e340553bb6ad3a8076f928e83f2862 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Mar 2017 09:06:04 +0100 Subject: [PATCH 17/20] CProgressWindow: adaopt for discret percental window dimensions Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/88f80053d24358bec745e5b145833166c9b7c3c0 Author: Thilo Graf Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/gui/widget/progresswindow.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 10624dea8..dfb269df0 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -28,8 +28,8 @@ #include #include "menue.h" -#define PW_MIN_WIDTH 50 //% -#define PW_MIN_HEIGHT 25 //% +#define PW_MIN_WIDTH CCW_PERCENATL 50 //% +#define PW_MIN_HEIGHT CCW_PERCENATL 20 //% class CProgressWindow : public CComponentsWindow, public CMenuTarget { From ff4dae4c439f9fe17a47c66b2a2137759cb5b17c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Mar 2017 09:07:15 +0100 Subject: [PATCH 18/20] CTestMenu: adaopt progress sample with discret percental window dimensions Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4d50172fbdb0d73c0f9243200d5500570c2b89b8 Author: Thilo Graf Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/gui/test_menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 2572883ab..78aa1a9b4 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -861,7 +861,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) //with signals sigc::signal OnProgress0, OnProgress1; - CProgressWindow pw2("Progress Single Test -> single Signal", 700, 200, &OnProgress0); + CProgressWindow pw2("Progress Single Test -> single Signal", CCW_PERCENATL 50, CCW_PERCENATL 30, &OnProgress0); pw2.paint(); for(size_t i = 0; i< max; i++){ @@ -870,7 +870,9 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } pw2.hide(); - CProgressWindow pw3("Progress Single Test -> dub Signal", 700, 200, NULL, &OnProgress0, &OnProgress1); + OnProgress0.clear(); + OnProgress1.clear(); + CProgressWindow pw3("Progress Single Test -> dub Signal", CCW_PERCENATL 50, CCW_PERCENATL 20, NULL, &OnProgress0, &OnProgress1); pw3.paint(); for(size_t i = 0; i< max; i++){ From 1481a5e2bc0ef85dbbfe9370fc26aeed0bb337ff Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Mar 2017 09:10:40 +0100 Subject: [PATCH 19/20] CProgressWindow: small optimize of size handling Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a9a09541e09a36acb9fe0362f7a5285dd48b5533 Author: Thilo Graf Date: 2017-03-03 (Fri, 03 Mar 2017) --- src/gui/widget/progresswindow.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index f8262f972..539094345 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -99,8 +99,7 @@ void CProgressWindow::Init( signal *statusSignal, //set window height h_height = ccw_head->getHeight(); - ccw_body->setHeight((OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight())*ccw_body->size()); - + ccw_body->setHeight(ccw_body->back()->getYPos()+ ccw_body->back()->getHeight()+ OFFSET_INNER_MID); height = max(height, ccw_body->getHeight() + h_height); //set position on screen @@ -112,8 +111,8 @@ CProgressBar* CProgressWindow::getProgressItem() CProgressBar *pBar = new CProgressBar(); pBar->allowPaint(false); int y_tmp = 0; - for(size_t i = 0; i< ccw_body->size(); i++){ - y_tmp += ccw_body->getCCItem(i)->getHeight(); + for(size_t i = ccw_body->size()-1; i< ccw_body->size(); i++){ + y_tmp += ccw_body->getCCItem(i)->getYPos() + ccw_body->getCCItem(i)->getHeight(); y_tmp += OFFSET_INNER_MID; } pBar->setDimensionsAll(OFFSET_INNER_MID, y_tmp, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); From 1bf92d5fdd9267535f481d73f76e62511368b701 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 3 Mar 2017 09:52:57 +0100 Subject: [PATCH 20/20] fix funny typo Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/8862ef621b77d71b1974c4abff43b569e12b2002 Author: vanhofen Date: 2017-03-03 (Fri, 03 Mar 2017) Origin message was: ------------------ - fix funny typo --- src/gui/buildinfo.cpp | 2 +- src/gui/components/cc_frm_window.h | 6 +++--- src/gui/moviebrowser/mb.cpp | 2 +- src/gui/test_menu.cpp | 4 ++-- src/gui/widget/progresswindow.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index fabc41b1a..6cd1241b8 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -35,7 +35,7 @@ using namespace std; -CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENATL 90, CCW_PERCENATL 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) +CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENT 90, CCW_PERCENT 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) { initVarBuildInfo(); if (show) diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index 2c2b0ae64..52b4e0012 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -29,7 +29,7 @@ #include "cc_frm_header.h" #include "cc_frm_footer.h" -#define CCW_PERCENATL - //placeholder for negative sign '-', used for discret dimensions parameters +#define CCW_PERCENT - //placeholder for negative sign '-', used for discret dimensions parameters //! Sub class of CComponentsForm. Shows a window with prepared items. /*! @@ -173,12 +173,12 @@ class CComponentsWindow : public CComponentsForm * @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0 * * @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen. - * For better readability please use placeholder 'CCW_PERCENATL' as negative sign '-' \n + * For better readability please use placeholder 'CCW_PERCENT' as negative sign '-' \n * Example: \n * this inits a window with position x100 y100 on screen with dimensions 700px x 800px \n * CComponentsWindow win(100, 100, 700, 800, "Test window");\n * this inits a window with position x100 y100 on screen with 50% of screen size assigned with discret percental screen dimensions \n - * CComponentsWindow win(100, 100, CCW_PERCENATL 50, CCW_PERCENATL 50, "Test window"); + * CComponentsWindow win(100, 100, CCW_PERCENT 50, CCW_PERCENT 50, "Test window"); */ CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index faad7a41c..724048fa9 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -3126,7 +3126,7 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENATL 50, CCW_PERCENATL 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir); + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENT 50, CCW_PERCENT 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir); loadBox.enableShadow(); loadBox.paint(); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 78aa1a9b4..5bc587c4a 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -861,7 +861,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) //with signals sigc::signal OnProgress0, OnProgress1; - CProgressWindow pw2("Progress Single Test -> single Signal", CCW_PERCENATL 50, CCW_PERCENATL 30, &OnProgress0); + CProgressWindow pw2("Progress Single Test -> single Signal", CCW_PERCENT 50, CCW_PERCENT 30, &OnProgress0); pw2.paint(); for(size_t i = 0; i< max; i++){ @@ -872,7 +872,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) OnProgress0.clear(); OnProgress1.clear(); - CProgressWindow pw3("Progress Single Test -> dub Signal", CCW_PERCENATL 50, CCW_PERCENATL 20, NULL, &OnProgress0, &OnProgress1); + CProgressWindow pw3("Progress Single Test -> dub Signal", CCW_PERCENT 50, CCW_PERCENT 20, NULL, &OnProgress0, &OnProgress1); pw3.paint(); for(size_t i = 0; i< max; i++){ diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index dfb269df0..e94d08755 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -28,8 +28,8 @@ #include #include "menue.h" -#define PW_MIN_WIDTH CCW_PERCENATL 50 //% -#define PW_MIN_HEIGHT CCW_PERCENATL 20 //% +#define PW_MIN_WIDTH CCW_PERCENT 50 +#define PW_MIN_HEIGHT CCW_PERCENT 20 class CProgressWindow : public CComponentsWindow, public CMenuTarget {