mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
- update: shorten updates lists in menu separators
Conflicts: src/gui/update.cpp src/gui/update.h Signed-off-by: Thilo Graf <dbt@novatux.de> Added update_php() to avoid conflicts
This commit is contained in:
@@ -138,6 +138,18 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void CFlashUpdate::update_php(std::string &url, const char* type)
|
||||||
|
{
|
||||||
|
if (url.find("update.php") != std::string::npos)
|
||||||
|
{
|
||||||
|
url += "?revision=" + to_string(cs_get_revision());
|
||||||
|
url += "&chip_type=" + to_string(cs_get_chip_type());
|
||||||
|
url += "&image_type=" + (std::string)type;
|
||||||
|
printf("[update_php] url %s\n", url.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
bool CFlashUpdate::checkOnlineVersion()
|
bool CFlashUpdate::checkOnlineVersion()
|
||||||
{
|
{
|
||||||
CHTTPTool httpTool;
|
CHTTPTool httpTool;
|
||||||
@@ -223,13 +235,14 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
|
|
||||||
snprintf(current, 200, "%s %s %s %s", curInfo.getReleaseCycle(), curInfo.getType(true), curInfo.getDate(), curInfo.getTime());
|
snprintf(current, 200, "%s %s %s %s", curInfo.getReleaseCycle(), curInfo.getType(true), curInfo.getDate(), curInfo.getTime());
|
||||||
|
|
||||||
|
|
||||||
CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE, listWidth, MN_WIDGET_ID_IMAGESELECTOR);
|
CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE, listWidth, MN_WIDGET_ID_IMAGESELECTOR);
|
||||||
|
|
||||||
SelectionWidget.addItem(GenericMenuSeparator);
|
SelectionWidget.addItem(GenericMenuSeparator);
|
||||||
SelectionWidget.addItem(GenericMenuBack);
|
SelectionWidget.addItem(GenericMenuBack);
|
||||||
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::LINE));
|
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::LINE));
|
||||||
|
|
||||||
SelectionWidget.addItem(new CMenuForwarder(current, false));
|
SelectionWidget.addItem(new CMenuForwarder(current, false, g_Locale->getText(LOCALE_FLASHUPDATE_CURRENTVERSION_SEP)));
|
||||||
std::ifstream urlFile(g_settings.softupdate_url_file.c_str());
|
std::ifstream urlFile(g_settings.softupdate_url_file.c_str());
|
||||||
dprintf(DEBUG_NORMAL, "[update] file %s\n", g_settings.softupdate_url_file.c_str());
|
dprintf(DEBUG_NORMAL, "[update] file %s\n", g_settings.softupdate_url_file.c_str());
|
||||||
|
|
||||||
@@ -247,12 +260,16 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// update_php(url, curInfo.getType());
|
||||||
startpos = url.find('/', startpos+2)+1;
|
startpos = url.find('/', startpos+2)+1;
|
||||||
}
|
}
|
||||||
endpos = std::string::npos;
|
endpos = std::string::npos;
|
||||||
updates_lists.push_back(url.substr(startpos, endpos - startpos));
|
updates_lists.push_back(url.substr(startpos, endpos - startpos));
|
||||||
|
|
||||||
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::STRING | CMenuSeparator::LINE, updates_lists.rbegin()->c_str()));
|
// don't paint separator for lists with no entry
|
||||||
|
// SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::STRING | CMenuSeparator::LINE, updates_lists.rbegin()->c_str()));
|
||||||
|
bool separator = false;
|
||||||
|
|
||||||
if (httpTool.downloadFile(url, gTmpPath LIST_OF_UPDATES_LOCAL_FILENAME, 20))
|
if (httpTool.downloadFile(url, gTmpPath LIST_OF_UPDATES_LOCAL_FILENAME, 20))
|
||||||
{
|
{
|
||||||
std::ifstream in(gTmpPath LIST_OF_UPDATES_LOCAL_FILENAME);
|
std::ifstream in(gTmpPath LIST_OF_UPDATES_LOCAL_FILENAME);
|
||||||
@@ -286,6 +303,14 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
|
|
||||||
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
|
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
|
||||||
|
|
||||||
|
|
||||||
|
if (!separator)
|
||||||
|
{
|
||||||
|
std::string updates_list = updates_lists.rbegin()->c_str();
|
||||||
|
updates_list = updates_list.substr(0, updates_list.find("?", 0)); // truncate updates list
|
||||||
|
SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::STRING | CMenuSeparator::LINE, updates_list));
|
||||||
|
separator = true;
|
||||||
|
}
|
||||||
CUpdateMenuTarget * up = new CUpdateMenuTarget(i, &selected);
|
CUpdateMenuTarget * up = new CUpdateMenuTarget(i, &selected);
|
||||||
mf = 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, "");
|
//TODO mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, "");
|
||||||
|
@@ -57,7 +57,8 @@ class CFlashUpdate : public CProgressWindow
|
|||||||
std::string newVersion;
|
std::string newVersion;
|
||||||
int menu_ret;
|
int menu_ret;
|
||||||
int softupdate_mode;
|
int softupdate_mode;
|
||||||
|
|
||||||
|
// void update_php(std::string &url, const char* type);
|
||||||
bool selectHttpImage(void);
|
bool selectHttpImage(void);
|
||||||
bool getUpdateImage(const std::string & version);
|
bool getUpdateImage(const std::string & version);
|
||||||
bool checkVersion4Update();
|
bool checkVersion4Update();
|
||||||
|
Reference in New Issue
Block a user