update-menu: formatting code using astyle; some manual code nicenings

Origin commit data
------------------
Commit: 79eb6d0e34
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-12-04 (Sat, 04 Dec 2021)

Origin message was:
------------------
- update-menu: formatting code using astyle; some manual code nicenings
This commit is contained in:
vanhofen
2021-12-04 23:22:35 +01:00
parent 69e34bab75
commit 36cf1f8432
2 changed files with 37 additions and 37 deletions

View File

@@ -1,36 +1,35 @@
/* /*
$Id: port of software_update.cpp,v 1.8 2011/04/03 21:56:13 tuxbox-cvs Exp $ $Id: port of software_update.cpp,v 1.8 2011/04/03 21:56:13 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project Neutrino-GUI - DBoxII-Project
Software update implementation - Neutrino-GUI Software update implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys and some other guys
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
Rework Copyright (C) 2011 T. Graf 'dbt' Rework Copyright (C) 2011 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/ Homepage: http://www.dbox2-tuning.net/
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@@ -62,30 +61,31 @@ CSoftwareUpdate::~CSoftwareUpdate()
delete fe; delete fe;
} }
int CSoftwareUpdate::exec(CMenuTarget* parent, const std::string &/*actionKey*/) int CSoftwareUpdate::exec(CMenuTarget *parent, const std::string &/*actionKey*/)
{ {
dprintf(DEBUG_DEBUG, "init software-update\n"); dprintf(DEBUG_DEBUG, "init software-update\n");
int res = menu_return::RETURN_REPAINT; int res = menu_return::RETURN_REPAINT;
if (parent) if (parent)
parent->hide(); parent->hide();
res = showSoftwareUpdate(); res = showSoftwareUpdate();
return res; return res;
} }
// shows the menue and options for software update
int CSoftwareUpdate::showSoftwareUpdate() int CSoftwareUpdate::showSoftwareUpdate()
/* shows the menue and options for software update */
{ {
CMenuForwarder * mf, *update_item; CMenuForwarder *mf, *update_item;
CMenuWidget softUpdate(LOCALE_MAINMENU_SERVICE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_SOFTWAREUPDATE); CMenuWidget softUpdate(LOCALE_MAINMENU_SERVICE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_SOFTWAREUPDATE);
softUpdate.addIntroItems(LOCALE_SERVICEMENU_UPDATE); softUpdate.addIntroItems(LOCALE_SERVICEMENU_UPDATE);
unsigned int inetkey = CRCInput::RC_red; unsigned int inetkey = CRCInput::RC_red;
#if ENABLE_PKG_MANAGEMENT #if ENABLE_PKG_MANAGEMENT
if (COPKGManager::hasOpkgSupport()) { if (COPKGManager::hasOpkgSupport())
//firmware update via opkg {
// firmware update via opkg
mf = new CMenuDForwarder(LOCALE_OPKG_TITLE, true, NULL, new COPKGManager(), NULL, CRCInput::RC_red); mf = new CMenuDForwarder(LOCALE_OPKG_TITLE, true, NULL, new COPKGManager(), NULL, CRCInput::RC_red);
mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, LOCALE_MENU_HINT_OPKG); mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, LOCALE_MENU_HINT_OPKG);
softUpdate.addItem(mf); softUpdate.addItem(mf);
@@ -98,17 +98,17 @@ int CSoftwareUpdate::showSoftwareUpdate()
CFlashUpdate flash; CFlashUpdate flash;
flash.enableNotify(false); flash.enableNotify(false);
//online update // online update
update_item = new CMenuForwarder(LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET, allow_update && file_exists(g_settings.softupdate_url_file.c_str()), NULL, &flash, "inet", inetkey); update_item = new CMenuForwarder(LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET, allow_update && file_exists(g_settings.softupdate_url_file.c_str()), NULL, &flash, "inet", inetkey);
update_item->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CHECK); update_item->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CHECK);
softUpdate.addItem(update_item); softUpdate.addItem(update_item);
//local update // local update
update_item = new CMenuForwarder(LOCALE_FLASHUPDATE_CHECKUPDATE_LOCAL, allow_update, NULL, &flash, "local", CRCInput::RC_green); update_item = new CMenuForwarder(LOCALE_FLASHUPDATE_CHECKUPDATE_LOCAL, allow_update, NULL, &flash, "local", CRCInput::RC_green);
update_item->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CHECK_LOCAL); update_item->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CHECK_LOCAL);
softUpdate.addItem(update_item); softUpdate.addItem(update_item);
//settings // settings
CUpdateSettings update_settings; CUpdateSettings update_settings;
mf = new CMenuForwarder(LOCALE_FLASHUPDATE_SETTINGS, true, NULL, &update_settings, NULL, CRCInput::RC_yellow); mf = new CMenuForwarder(LOCALE_FLASHUPDATE_SETTINGS, true, NULL, &update_settings, NULL, CRCInput::RC_yellow);
mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_SETTINGS); mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_SETTINGS);
@@ -117,7 +117,7 @@ int CSoftwareUpdate::showSoftwareUpdate()
#if !HAVE_ARM_HARDWARE && !HAVE_MIPS_HARDWARE #if !HAVE_ARM_HARDWARE && !HAVE_MIPS_HARDWARE
softUpdate.addItem(GenericMenuSeparatorLine); softUpdate.addItem(GenericMenuSeparatorLine);
//expert-functions // expert-functions
CMenuWidget mtdexpert(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_MTDEXPERT); CMenuWidget mtdexpert(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_MTDEXPERT);
showSoftwareUpdateExpert(&mtdexpert); showSoftwareUpdateExpert(&mtdexpert);
mf = new CMenuForwarder(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, true, NULL, &mtdexpert, NULL, CRCInput::RC_blue); mf = new CMenuForwarder(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, true, NULL, &mtdexpert, NULL, CRCInput::RC_blue);
@@ -139,17 +139,17 @@ int CSoftwareUpdate::showSoftwareUpdate()
nextShortcut = (unsigned int)softUpdate.getNextShortcut(); nextShortcut = (unsigned int)softUpdate.getNextShortcut();
softUpdate.integratePlugins(PLUGIN_INTEGRATION_SOFTWARE_MANAGE, nextShortcut); softUpdate.integratePlugins(PLUGIN_INTEGRATION_SOFTWARE_MANAGE, nextShortcut);
int res = softUpdate.exec (NULL, ""); int res = softUpdate.exec(NULL, "");
return res; return res;
} }
/* shows experts-functions to read/write to the mtd */ // shows experts-functions to read/write to the mtd
void CSoftwareUpdate::showSoftwareUpdateExpert(CMenuWidget *w_mtd_expert) void CSoftwareUpdate::showSoftwareUpdateExpert(CMenuWidget *w_mtd_expert)
{ {
CMenuForwarder * mf; CMenuForwarder *mf;
w_mtd_expert->addIntroItems(); w_mtd_expert->addIntroItems();
mf = new CMenuForwarder(LOCALE_FLASHUPDATE_READFLASHMTD , true, NULL, fe, "readflashmtd" , CRCInput::RC_red); mf = new CMenuForwarder(LOCALE_FLASHUPDATE_READFLASHMTD, true, NULL, fe, "readflashmtd", CRCInput::RC_red);
mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_EXPERT_READ); mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_EXPERT_READ);
w_mtd_expert->addItem(mf); w_mtd_expert->addItem(mf);
mf = new CMenuForwarder(LOCALE_FLASHUPDATE_WRITEFLASHMTD, true, NULL, fe, "writeflashmtd", CRCInput::RC_green); mf = new CMenuForwarder(LOCALE_FLASHUPDATE_WRITEFLASHMTD, true, NULL, fe, "writeflashmtd", CRCInput::RC_green);

View File

@@ -1,28 +1,28 @@
/* /*
$Id: port of software_update.h,v 1.6 2011/04/03 21:56:13 tuxbox-cvs Exp $ $Id: port of software_update.h,v 1.6 2011/04/03 21:56:13 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project Neutrino-GUI - DBoxII-Project
Software update implementation - Neutrino-GUI Software update implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys and some other guys
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
Rework Copyright (C) 2011 T. Graf 'dbt' Rework Copyright (C) 2011 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/ Homepage: http://www.dbox2-tuning.net/
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU General Public
License along with this program; if not, write to the License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
@@ -42,13 +42,13 @@ class CSoftwareUpdate : public CMenuTarget
int width; int width;
int showSoftwareUpdate(); int showSoftwareUpdate();
void showSoftwareUpdateExpert(CMenuWidget *w_mtd_expert); void showSoftwareUpdateExpert(CMenuWidget *w_mtd_expert);
CFlashExpert *fe; CFlashExpert *fe;
public: public:
CSoftwareUpdate(); CSoftwareUpdate();
~CSoftwareUpdate(); ~CSoftwareUpdate();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget *parent, const std::string &actionKey);
}; };
#endif #endif