- adapt ShowHint handling from martii's neutrino-mp

This commit is contained in:
svenhoefer
2014-01-22 12:11:52 +01:00
parent cfe6facea4
commit 6995e1a765
11 changed files with 62 additions and 64 deletions

View File

@@ -332,7 +332,7 @@ printf("[update] mode is %d\n", softupdate_mode);
(ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_WRONGBASE), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) != CMessageBox::mbrYes))
{
delete versionInfo;
//ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_WRONGBASE)); // UTF-8
//ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_WRONGBASE)); // UTF-8
return false;
}
@@ -378,7 +378,7 @@ printf("[update] mode is %d\n", softupdate_mode);
else {
hide();
printf("flash-file not found: %s\n", filename.c_str());
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENFILE)); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENFILE)); // UTF-8
return false;
}
hide();
@@ -415,7 +415,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
paint();
if(sysfs.size() < 8) {
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENMTD));
ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENMTD));
hide();
return menu_return::RETURN_REPAINT;
}
@@ -440,7 +440,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
if(!getUpdateImage(newVersion)) {
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_GETUPDATEFILEERROR)); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_GETUPDATEFILEERROR)); // UTF-8
return menu_return::RETURN_REPAINT;
}
sprintf(fullname, "%s/%s", g_settings.update_dir.c_str(), fname);
@@ -457,7 +457,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_MD5CHECK)); // UTF-8
if((softupdate_mode==1) && !ft.check_md5(filename, file_md5)) {
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_MD5SUMERROR)); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_MD5SUMERROR)); // UTF-8
return menu_return::RETURN_REPAINT;
}
if(softupdate_mode==1) { //internet-update
@@ -491,7 +491,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
if(!ft.program(filename, 80, 100)) {
#endif
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
return menu_return::RETURN_REPAINT;
}
@@ -499,7 +499,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
showGlobalStatus(100);
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
sleep(2);
ft.reboot();
}
@@ -528,7 +528,7 @@ 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);
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
}
hide();
return menu_return::RETURN_REPAINT;
@@ -567,7 +567,7 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
std::string path = getPathName(backupFile);
if (!file_exists(path.c_str())) {
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_DIRECTORY_NOT_EXIST), path.c_str());
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
return false;
}
@@ -578,7 +578,7 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
if (mtd == -1) { // check disk space for image creation
if (!get_fs_usage("/", btotal, bused, &bsize)) {
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_VOLUME_ERROR), "root0");
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
return false;
}
backupRequiredSize = ((bused * bsize) / 1024ULL) * 2ULL; // twice disk space for summarized image
@@ -590,7 +590,7 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
btotal = 0; bused = 0; bsize = 0;
if (!get_fs_usage(path.c_str(), btotal, bused, &bsize)) {
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_VOLUME_ERROR), path.c_str());
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
return false;
}
uint64_t backupMaxSize = (btotal - bused) * (uint64_t)bsize;
@@ -601,7 +601,7 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile)
if (backupMaxSize < backupRequiredSize) {
snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_NO_AVAILABLE_SPACE), path.c_str(), backupMaxSize, backupRequiredSize);
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, errMsg);
ShowHint(LOCALE_MESSAGEBOX_ERROR, errMsg);
return false;
}
@@ -674,7 +674,7 @@ void CFlashExpert::readmtdJFFS2(std::string &filename)
char message[500];
sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str());
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message);
ShowHint(LOCALE_MESSAGEBOX_INFO, message);
}
#endif
@@ -746,9 +746,9 @@ void CFlashExpert::readmtd(int preadmtd)
hide();
#ifdef BOXMODEL_APOLLO
if (!forceOtherFilename)
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message);
ShowHint(LOCALE_MESSAGEBOX_INFO, message);
#else
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, message);
ShowHint(LOCALE_MESSAGEBOX_INFO, message);
#endif
}
}
@@ -783,7 +783,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber)
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
sleep(2);
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
ft.reboot();
}
}