Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
svenhoefer
2012-11-07 13:04:52 +01:00
7 changed files with 44 additions and 23 deletions

View File

@@ -121,30 +121,38 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str
return false;
}
bool CExtUpdate::writemtdExt(const std::string & filename)
bool CExtUpdate::applySettings(const std::string & filename, int mode)
{
if(!FileHelpers)
FileHelpers = new CFileHelpers();
imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
if (mode == MODE_EXPERT)
imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
else
imgFilename = FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
DBG_TIMER_START()
bool ret = writemtdExt();
bool ret = applySettings();
DBG_TIMER_STOP("Image editing")
if (!ret) {
if (mtdRamError != "")
DisplayErrorMessage(mtdRamError.c_str());
}
else {
if ((mtdNumber < 3) || (mtdNumber > 4)) {
const char *err = "invalid mtdNumber\n";
printf(err);
DisplayErrorMessage(err);
WRITE_UPDATE_LOG("ERROR: %s", err);
return false;
if (mode == MODE_EXPERT) {
if ((mtdNumber < 3) || (mtdNumber > 4)) {
const char *err = "invalid mtdNumber\n";
printf(err);
DisplayErrorMessage(err);
WRITE_UPDATE_LOG("ERROR: %s", err);
return false;
}
}
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO);
WRITE_UPDATE_LOG("\n");
WRITE_UPDATE_LOG("##### Settings taken. #####\n");
CFlashExpert::getInstance()->writemtd(filename, mtdNumber);
if (mode == MODE_EXPERT)
CFlashExpert::getInstance()->writemtd(filename, mtdNumber);
}
return ret;
}
@@ -166,7 +174,7 @@ bool CExtUpdate::isMtdramLoad()
return ret;
}
bool CExtUpdate::writemtdExt()
bool CExtUpdate::applySettings()
{
if(!hintBox)
hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED));

View File

@@ -55,7 +55,7 @@ class CExtUpdate
std::string mountPkt;
CFileHelpers* FileHelpers;
bool writemtdExt(void);
bool applySettings(void);
bool readBackupList(const std::string & dstPath);
bool copyFileList(const std::string & fileList, const std::string & dstPath);
bool readConfig(const std::string & Config);
@@ -69,11 +69,16 @@ class CExtUpdate
void updateLog(const char *buf);
public:
enum
{
MODE_EXPERT = 0,
MODE_SOFTUPDATE = 1
};
CExtUpdate();
~CExtUpdate();
static CExtUpdate* getInstance();
bool writemtdExt(const std::string & filename);
bool applySettings(const std::string & filename, int mode);
bool ErrorReset(bool modus, const std::string & msg1="", const std::string & msg2="");
};

View File

@@ -451,16 +451,20 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
sleep(2);
//flash it...
#ifdef DEBUG1
if(1)
#else
if(!ft.program(filename, 80, 100))
#endif
{
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes)
if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE))
return menu_return::RETURN_REPAINT;
}
#ifdef DEBUG1
if(1) {
#else
if(!ft.program(filename, 80, 100)) {
#endif
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
return menu_return::RETURN_REPAINT;
}
//status anzeigen
showGlobalStatus(100);
@@ -690,7 +694,7 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
showFileSelector("");
} else {
if(selectedMTD == 10) {
CExtUpdate::getInstance()->writemtdExt(actionKey);
CExtUpdate::getInstance()->applySettings(actionKey, CExtUpdate::MODE_EXPERT);
}
else if(selectedMTD==-1) {
writemtd(actionKey, MTD_OF_WHOLE_IMAGE);