Update menu changes; setup wizard banner

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@634 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2010-06-19 09:55:21 +00:00
parent ce612cd800
commit c3897d3231
14 changed files with 112 additions and 54 deletions

View File

@@ -68,7 +68,8 @@
extern int allow_flash;
#define gTmpPath "/var/update/"
//#define gTmpPath "/var/update/"
#define gTmpPath "/tmp/"
#define gUserAgent "neutrino/softupdater 1.0"
#define LIST_OF_UPDATES_LOCAL_FILENAME "coolstream.list"
@@ -135,17 +136,33 @@ bool CFlashUpdate::selectHttpImage(void)
std::vector<std::string> updates_lists, urls, names, versions, descriptions, md5s;
char fileTypes[128];
int selected = -1;
int curVer, newVer, newfound = 0;
CConfigFile _configfile('\t');
const char * versionString = (_configfile.loadConfig("/.version")) ? (_configfile.getString( "version", "????????????????").c_str()) : "????????????????";
installedVersion = versionString;
CFlashVersionInfo curInfo(versionString);
printf("current flash-version: %s (%d)\n", installedVersion.c_str(), curInfo.getVersion());
curVer = curInfo.getVersion();
httpTool.setStatusViewer(this);
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILE)); // UTF-8
char current[200];
snprintf(current, 200, "%s: %s %s %s %s %s", g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSION_SEP), curInfo.getReleaseCycle(),
g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSIONDATE), curInfo.getDate(),
g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSIONTIME), curInfo.getTime());
CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE);
SelectionWidget.addItem(GenericMenuSeparator);
SelectionWidget.addItem(GenericMenuBack);
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::LINE));
SelectionWidget.addItem(new CMenuForwarderNonLocalized(current, false));
std::ifstream urlFile(g_settings.softupdate_url_file);
#ifdef DEBUG
printf("[update] file %s\n", g_settings.softupdate_url_file);
printf("[update] file %s\n", g_settings.softupdate_url_file);
#endif
unsigned int i = 0;
@@ -153,7 +170,7 @@ printf("[update] file %s\n", g_settings.softupdate_url_file);
{
std::string::size_type startpos, endpos;
#ifdef DEBUG
printf("[update] url %s\n", url.c_str());
printf("[update] url %s\n", url.c_str());
#endif
/* extract domain name */
@@ -188,16 +205,21 @@ printf("[update] url %s\n", url.c_str());
//std::getline(in, md5);
md5s.push_back(md5);
enabled = true;
#ifdef DEBUG
printf("[update] url %s version %s md5 %s name %s\n", url.c_str(), version.c_str(), md5.c_str(), name.c_str());
#endif
CFlashVersionInfo versionInfo(versions[i]);
newVer = versionInfo.getVersion();
#ifdef DEBUG
printf("[update] url %s version %s (%d) md5 %s name %s\n", url.c_str(), version.c_str(), newVer, md5.c_str(), name.c_str());
#endif
if(newVer > curVer)
newfound = 1;
if(!allow_flash && (versionInfo.snapshot < '3'))
enabled = false;
fileTypes[i] = versionInfo.snapshot;
std::string description = versionInfo.getType();
//std::string description = versionInfo.getType();
std::string description = versionInfo.getReleaseCycle();
description += ' ';
description += versionInfo.getType();
description += ' ';
description += versionInfo.getDate();
description += ' ';
@@ -205,7 +227,8 @@ printf("[update] url %s version %s md5 %s name %s\n", url.c_str(), version.c_str
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
SelectionWidget.addItem(new CMenuForwarderNonLocalized(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected)));
//SelectionWidget.addItem(new CMenuForwarderNonLocalized(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected)));
SelectionWidget.addItem(new CMenuForwarderNonLocalized(descriptions[i].c_str(), enabled, names[i].c_str(), new CUpdateMenuTarget(i, &selected)));
i++;
}
}
@@ -218,6 +241,10 @@ printf("[update] url %s version %s md5 %s name %s\n", url.c_str(), version.c_str
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_GETINFOFILEERROR)); // UTF-8
return false;
}
if(newfound)
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_NEW_FOUND), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO);
else
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_NEW_NOTFOUND), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO);
SelectionWidget.exec(NULL, "");
@@ -229,7 +256,7 @@ printf("[update] url %s version %s md5 %s name %s\n", url.c_str(), version.c_str
file_md5 = md5s[selected];
fileType = fileTypes[selected];
#ifdef DEBUG
printf("[update] filename %s type %c newVersion %s md5 %s\n", filename.c_str(), fileType, newVersion.c_str(), file_md5.c_str());
printf("[update] filename %s type %c newVersion %s md5 %s\n", filename.c_str(), fileType, newVersion.c_str(), file_md5.c_str());
#endif
return true;

View File

@@ -57,7 +57,7 @@ CMessageBox::CMessageBox(const neutrino_locale_t Caption, const char * const Tex
num++;
if (showbuttons & mbNo)
num++;
if (showbuttons & (mbCancel | mbBack))
if (showbuttons & (mbCancel | mbBack | mbOk))
num++;
int new_width = 15 + num*ButtonWidth;
if(new_width > m_width)
@@ -80,7 +80,7 @@ CMessageBox::CMessageBox(const neutrino_locale_t Caption, ContentLines& Lines, c
num++;
if (showbuttons & mbNo)
num++;
if (showbuttons & (mbCancel | mbBack))
if (showbuttons & (mbCancel | mbBack | mbOk))
num++;
int new_width = 15 + num*ButtonWidth;
if(new_width > m_width)
@@ -152,7 +152,7 @@ void CMessageBox::paintButtons()
}
if (showbuttons & (mbCancel | mbBack))
if (showbuttons & (mbCancel | mbBack | mbOk))
{
if (result >= mbrCancel)
{
@@ -168,7 +168,9 @@ void CMessageBox::paintButtons()
m_window->paintBoxRel(xpos, m_height-m_fheight-20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor, RADIUS_LARGE);//round
//m_window->paintIcon(NEUTRINO_ICON_BUTTON_HOME, xpos+10, m_height-m_fheight-19);
m_window->paintIcon(NEUTRINO_ICON_BUTTON_HOME, xpos+14, m_height-m_fheight - 20, m_fheight);
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + 43, m_height-m_fheight+4, ButtonWidth- 53, g_Locale->getText((showbuttons & mbCancel) ? LOCALE_MESSAGEBOX_CANCEL : LOCALE_MESSAGEBOX_BACK), (CFBWindow::color_t)color, 0, true); // UTF-8
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + 43, m_height-m_fheight+4, ButtonWidth- 53,
g_Locale->getText((showbuttons & mbCancel) ? LOCALE_MESSAGEBOX_CANCEL : (showbuttons & mbOk) ? LOCALE_MESSAGEBOX_OK : LOCALE_MESSAGEBOX_BACK),
(CFBWindow::color_t)color, 0, true); // UTF-8
}
}
@@ -205,9 +207,9 @@ int CMessageBox::exec(int timeout)
}
else if (((msg == CRCInput::RC_timeout) ||
(msg == (neutrino_msg_t)g_settings.key_channelList_cancel)) &&
(showbuttons & (mbCancel | mbBack)))
(showbuttons & (mbCancel | mbBack | mbOk)))
{
result = (showbuttons & mbCancel) ? mbrCancel : mbrBack;
result = (showbuttons & mbCancel) ? mbrCancel : (showbuttons & mbOk) ? mbrOk: mbrBack;
loop = false;
}
else if ((msg == CRCInput::RC_green) && (showbuttons & mbNo))

View File

@@ -54,7 +54,8 @@ class CMessageBox : public CHintBoxExt
mbrYes = 0,
mbrNo = 1,
mbrCancel = 2,
mbrBack = 3
mbrBack = 3,
mbrOk = 4
} result;
enum buttons_
@@ -63,7 +64,8 @@ class CMessageBox : public CHintBoxExt
mbNo = 0x02,
mbCancel = 0x04,
mbAll = 0x07,
mbBack = 0x08
mbBack = 0x08,
mbOk = 0x10
} buttons;
// Text & Caption are always UTF-8 encoded