update: reworked update menu

-moved software_update.cpp/h to update_menue.cpp/h
-add new class CUpdateSettings into files update_settings.cpp/h
-using update settings in sub menus, so we've got only hotkeys
 and less menu items in update menu
-reworked some locales
This commit is contained in:
2012-06-08 22:04:11 +02:00
committed by thilo
parent 05c030049e
commit 643b9f485f
12 changed files with 330 additions and 160 deletions

View File

@@ -389,7 +389,7 @@ extra.tp_pol_h H
extra.tp_pol_l L
extra.tp_pol_r R
extra.tp_rate Symbolrate
extra.update_dir Update-Verzeichnis
extra.update_dir Lokales Update-Verzeichnis
extra.use_gotoxx Benutze gotoXX
extra.volume_pos Lautstärkeanzeige
extra.west Westen
@@ -434,7 +434,7 @@ filesystem.is.utf8.option.utf8 UTF-8
flashupdate.actionreadflash lese Flash
flashupdate.cantopenfile kann Datei nicht öffnen
flashupdate.cantopenmtd kann das MTD-Device nicht öffnen
flashupdate.checkupdate nach neuer Version suchen
flashupdate.checkupdate Nach Updates suchen
flashupdate.currentversion_sep Installierte Version
flashupdate.currentversiondate Datum
flashupdate.currentversiontime Uhrzeit
@@ -475,13 +475,14 @@ flashupdate.ready fertig
flashupdate.reallyflashmtd Wollen Sie den Flashvorgang wirklich durchführen?\n\nFalls ein Fehler auftritt oder das Image nicht\nfunktionfähig ist, wird Ihre Box nicht mehr booten.\n\nImagename: %s\nZiel: %s
flashupdate.savesuccess Das Image wurde erfolgreich unter dem\nDateinamen %s gespeichert.
flashupdate.selectimage Verfügbare Images/Files
flashupdate.settings Update-Einstellungen
flashupdate.squashfs.noversion Bei Updates werden Versionsüberprüfungen derzeit nur über Web-Updates unterstützt.\nWollen Sie das ausgewählte Image wirklich installieren?
flashupdate.titlereadflash Flash auslesen
flashupdate.titlewriteflash Flash schreiben
flashupdate.updatemode Updatemodus
flashupdate.updatemode_internet Internet
flashupdate.updatemode_manual manuell (ftp)
flashupdate.url_file Konfigfile
flashupdate.updatemode_manual von lokalem Update-Verzeichnis
flashupdate.url_file Internet Konfigurations-Datei
flashupdate.versioncheck Versionsüberprüfung
flashupdate.writeflash ganzes Flashimage einspielen
flashupdate.writeflashmtd einzelne Partition einspielen

View File

@@ -389,7 +389,7 @@ extra.tp_pol_h H
extra.tp_pol_l L
extra.tp_pol_r R
extra.tp_rate Symbol rate
extra.update_dir Directory for updates
extra.update_dir Local update directory
extra.use_gotoxx Use gotoXX
extra.volume_pos Volumebar
extra.west West
@@ -434,7 +434,7 @@ filesystem.is.utf8.option.utf8 UTF-8
flashupdate.actionreadflash reading
flashupdate.cantopenfile can't open file
flashupdate.cantopenmtd can't open mtd-device
flashupdate.checkupdate search for new version
flashupdate.checkupdate Check for updates
flashupdate.currentversion_sep Current version
flashupdate.currentversiondate Date
flashupdate.currentversiontime Time
@@ -475,12 +475,13 @@ flashupdate.ready ready
flashupdate.reallyflashmtd Do you really want to flash?\n\nIf a error occurs or the image is not\nvalid, the box will not boot after flashing.\n\nImagename: %s\nTarget: %s
flashupdate.savesuccess The image was successfully saved \nunder %s.
flashupdate.selectimage Available Images/Files
flashupdate.settings Update settings
flashupdate.squashfs.noversion SquashFS version checks are currently only supported when updating over the web.\nAre you sure that you wish to install this image?
flashupdate.titlereadflash Reading Flash
flashupdate.titlewriteflash Writing Flash
flashupdate.updatemode Updatemode
flashupdate.updatemode_internet internet
flashupdate.updatemode_manual manual (ftp)
flashupdate.updatemode_manual from local update directory
flashupdate.url_file config file
flashupdate.versioncheck checking version
flashupdate.writeflash Write whole image

View File

@@ -81,7 +81,6 @@ libneutrino_gui_a_SOURCES = \
screensetup.cpp \
settings_manager.cpp \
sleeptimer.cpp \
software_update.cpp \
start_wizard.cpp \
streaminfo2.cpp \
subchannel_select.cpp \
@@ -89,6 +88,8 @@ libneutrino_gui_a_SOURCES = \
themes.cpp \
timeosd.cpp \
update.cpp \
update_menue.cpp \
update_settings.cpp \
user_menue.cpp \
user_menue_setup.cpp \
vfd_setup.cpp \

View File

@@ -1,132 +0,0 @@
/*
$Id: port of software_update.cpp,v 1.8 2011/04/03 21:56:13 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project
Software update implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
rework Copyright (C) 2011 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
License: GPL
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <neutrino_menue.h>
#include "software_update.h"
#include "gui/filebrowser.h"
#include <gui/widget/icons.h>
#include <driver/screen_max.h>
#include <driver/screen_max.h>
#include <system/debug.h>
#include <system/flashtool.h>
CSoftwareUpdate::CSoftwareUpdate()
{
width = w_max (40, 10);
fe = new CFlashExpert();
input_url_file = new CStringInputSMS(LOCALE_FLASHUPDATE_URL_FILE, g_settings.softupdate_url_file, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789!""<EFBFBD>$%&/()=?-. ");
}
CSoftwareUpdate::~CSoftwareUpdate()
{
delete fe;
delete input_url_file;
}
#define FLASHUPDATE_UPDATEMODE_OPTION_COUNT 2
const CMenuOptionChooser::keyval FLASHUPDATE_UPDATEMODE_OPTIONS[FLASHUPDATE_UPDATEMODE_OPTION_COUNT] =
{
{ 0, LOCALE_FLASHUPDATE_UPDATEMODE_MANUAL },
{ 1, LOCALE_FLASHUPDATE_UPDATEMODE_INTERNET }
};
int CSoftwareUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init software-update\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
if(actionKey == "update_dir") {
const char *action_str = "update";
if(chooserDir(g_settings.update_dir, true, action_str, sizeof(g_settings.update_dir)-1))
printf("[neutrino] new %s dir %s\n", action_str, g_settings.update_dir);
return res;
}
res = showSoftwareUpdate();
return res;
}
int CSoftwareUpdate::showSoftwareUpdate()
/* shows the menue and options for software update */
{
CMenuWidget* softUpdate = new CMenuWidget(LOCALE_MAINMENU_SERVICE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_SOFTWAREUPDATE);
softUpdate->addIntroItems(LOCALE_SERVICEMENU_UPDATE);
//expert-functions
CMenuWidget mtdexpert(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_MTDEXPERT);
showSoftwareUpdateExpert(&mtdexpert);
softUpdate->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, true, NULL, &mtdexpert, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
softUpdate->addItem(GenericMenuSeparatorLine);
CMenuOptionChooser *oj = new CMenuOptionChooser(LOCALE_FLASHUPDATE_UPDATEMODE, &g_settings.softupdate_mode, FLASHUPDATE_UPDATEMODE_OPTIONS, FLASHUPDATE_UPDATEMODE_OPTION_COUNT, true, NULL);
softUpdate->addItem( oj );
softUpdate->addItem( new CMenuForwarder(LOCALE_EXTRA_UPDATE_DIR, true, g_settings.update_dir , this, "update_dir", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
softUpdate->addItem(GenericMenuSeparatorLine);
CFlashUpdate flash;
softUpdate->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_CHECKUPDATE, true, NULL, &flash, "", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW ));
int res = softUpdate->exec (NULL, "");
delete softUpdate;
return res;
}
/* shows experts-functions to read/write to the mtd */
void CSoftwareUpdate::showSoftwareUpdateExpert(CMenuWidget *mtd_expert)
{
mtd_expert->addIntroItems();
mtd_expert->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_READFLASHMTD , true, NULL, fe, "readflashmtd" ));
mtd_expert->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_WRITEFLASHMTD, true, NULL, fe, "writeflashmtd"));
mtd_expert->addItem(GenericMenuSeparatorLine);
mtd_expert->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_URL_FILE, true, g_settings.softupdate_url_file, input_url_file));
}

106
src/gui/update_menue.cpp Normal file
View File

@@ -0,0 +1,106 @@
/*
$Id: port of software_update.cpp,v 1.8 2011/04/03 21:56:13 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project
Software update implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Rework Copyright (C) 2011 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
License: GPL
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <neutrino_menue.h>
#include "update_menue.h"
#include "update_settings.h"
#include <gui/widget/icons.h>
#include <driver/screen_max.h>
#include <system/debug.h>
#include <system/flashtool.h>
CSoftwareUpdate::CSoftwareUpdate()
{
width = w_max (40, 10);
fe = new CFlashExpert();
}
CSoftwareUpdate::~CSoftwareUpdate()
{
delete fe;
}
int CSoftwareUpdate::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{
dprintf(DEBUG_DEBUG, "init software-update\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
parent->hide();
res = showSoftwareUpdate();
return res;
}
int CSoftwareUpdate::showSoftwareUpdate()
/* shows the menue and options for software update */
{
CMenuWidget softUpdate(LOCALE_MAINMENU_SERVICE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_SOFTWAREUPDATE);
softUpdate.addIntroItems(LOCALE_SERVICEMENU_UPDATE);
//flashing
CFlashUpdate flash;
softUpdate.addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_CHECKUPDATE, true, NULL, &flash, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
//expert-functions
CMenuWidget mtdexpert(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_MTDEXPERT);
showSoftwareUpdateExpert(&mtdexpert);
softUpdate.addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_EXPERTFUNCTIONS, true, NULL, &mtdexpert, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
softUpdate.addItem(GenericMenuSeparatorLine);
//settings
CUpdateSettings update_settings;
softUpdate.addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_SETTINGS, true, NULL, &update_settings, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW ));
int res = softUpdate.exec (NULL, "");
return res;
}
/* shows experts-functions to read/write to the mtd */
void CSoftwareUpdate::showSoftwareUpdateExpert(CMenuWidget *w_mtd_expert)
{
w_mtd_expert->addIntroItems();
w_mtd_expert->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_READFLASHMTD , true, NULL, fe, "readflashmtd" ));
w_mtd_expert->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_WRITEFLASHMTD, true, NULL, fe, "writeflashmtd"));
}

View File

@@ -3,7 +3,7 @@
Neutrino-GUI - DBoxII-Project
Software update implementation - Neutrino-GUI
Software update implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
@@ -12,6 +12,7 @@
Rework Copyright (C) 2011 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
License: GPL
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
the Free Software Foundation; either version 2 of the License, or
@@ -22,32 +23,27 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __software_update__
#define __software_update__
#include <gui/widget/menue.h>
#include "gui/update.h"
#include "gui/widget/stringinput.h"
#include <string>
class CSoftwareUpdate : public CMenuTarget
{
private:
int width;
int showSoftwareUpdate();
void showSoftwareUpdateExpert(CMenuWidget *mtd_expert);
void showSoftwareUpdateExpert(CMenuWidget *w_mtd_expert);
CFlashExpert *fe;
CStringInputSMS *input_url_file;
public:
CSoftwareUpdate();

125
src/gui/update_settings.cpp Normal file
View File

@@ -0,0 +1,125 @@
/*
Neutrino-GUI - DBoxII-Project
Update settings implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2012 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
License: GPL
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <neutrino_menue.h>
#include "update_settings.h"
#include "gui/filebrowser.h"
#include <gui/widget/icons.h>
#include <driver/screen_max.h>
#include <system/debug.h>
CUpdateSettings::CUpdateSettings()
{
width = w_max (40, 10);
input_url_file = new CStringInputSMS(LOCALE_FLASHUPDATE_URL_FILE, g_settings.softupdate_url_file, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789!""<EFBFBD>$%&/()=?-. ");
}
CUpdateSettings::~CUpdateSettings()
{
delete input_url_file;
}
#define FLASHUPDATE_UPDATEMODE_OPTION_COUNT 2
const CMenuOptionChooser::keyval FLASHUPDATE_UPDATEMODE_OPTIONS[FLASHUPDATE_UPDATEMODE_OPTION_COUNT] =
{
{ 0, LOCALE_FLASHUPDATE_UPDATEMODE_MANUAL },
{ 1, LOCALE_FLASHUPDATE_UPDATEMODE_INTERNET }
};
int CUpdateSettings::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init software-update settings\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
parent->hide();
if(actionKey == "update_dir") {
const char *action_str = "update";
if(chooserDir(g_settings.update_dir, true, action_str, sizeof(g_settings.update_dir)-1))
printf("[neutrino] new %s dir %s\n", action_str, g_settings.update_dir);
return res;
}
res = initMenu();
return res;
}
/* init options for software update */
int CUpdateSettings::initMenu()
{
CMenuWidget w_upsettings(LOCALE_SERVICEMENU_UPDATE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_SOFTWAREUPDATE_SETTINGS);
w_upsettings.addIntroItems(LOCALE_FLASHUPDATE_SETTINGS);
CMenuForwarder * fw_url_input = new CMenuForwarder(LOCALE_FLASHUPDATE_URL_FILE, g_settings.softupdate_mode, g_settings.softupdate_url_file, input_url_file, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
CMenuForwarder * fw_update_dir = new CMenuForwarder(LOCALE_EXTRA_UPDATE_DIR, !g_settings.softupdate_mode, g_settings.update_dir , this, "update_dir", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
CUrlConfigSetupNotifier url_setup_notifier(fw_url_input, fw_update_dir);
CMenuOptionChooser *oj_mode = new CMenuOptionChooser(LOCALE_FLASHUPDATE_UPDATEMODE, &g_settings.softupdate_mode, FLASHUPDATE_UPDATEMODE_OPTIONS, FLASHUPDATE_UPDATEMODE_OPTION_COUNT, true, &url_setup_notifier);
w_upsettings.addItem(oj_mode);
w_upsettings.addItem(GenericMenuSeparatorLine);
w_upsettings.addItem(fw_update_dir);
w_upsettings.addItem(fw_url_input);
int res = w_upsettings.exec (NULL, "");
return res;
}
CUrlConfigSetupNotifier::CUrlConfigSetupNotifier( CMenuItem* i1, CMenuItem* i2)
{
toDisable[0] = i1;
toDisable[1] = i2;
}
bool CUrlConfigSetupNotifier::changeNotify(const neutrino_locale_t, void *)
{
if (g_settings.softupdate_mode){
toDisable[0]->setActive(true);
toDisable[1]->setActive(false);
}else{
toDisable[0]->setActive(false);
toDisable[1]->setActive(true);
}
return false;
}

67
src/gui/update_settings.h Normal file
View File

@@ -0,0 +1,67 @@
/*
$Id: port of software_update.h,v 1.6 2011/04/03 21:56:13 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project
Update settings implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2012 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __update_settings__
#define __update_settings__
#include <gui/widget/menue.h>
#include "gui/update.h"
#include "gui/widget/stringinput.h"
#include <string>
//helper class to enable/disable update config url item
class CUrlConfigSetupNotifier : public CChangeObserver
{
private:
CMenuItem* toDisable[2];
public:
CUrlConfigSetupNotifier( CMenuItem*, CMenuItem*);
bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL);
};
class CUpdateSettings : public CMenuTarget
{
private:
int width;
int initMenu();
CFlashExpert *fe;
CStringInputSMS *input_url_file;
public:
CUpdateSettings();
~CUpdateSettings();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

View File

@@ -70,7 +70,7 @@
#include "gui/scan_setup.h"
#include "gui/settings_manager.h"
#include "gui/sleeptimer.h"
#include "gui/software_update.h"
#include "gui/update_menue.h"
#include <gui/streaminfo2.h>
#include "gui/test_menu.h"
#include "gui/update.h"

View File

@@ -154,6 +154,9 @@ enum MN_WIDGET_ID
MN_WIDGET_ID_SOFTWAREUPDATE,
MN_WIDGET_ID_MTDEXPERT,
//software update settings
MN_WIDGET_ID_SOFTWAREUPDATE_SETTINGS,
MN_WIDGET_ID_SCAN_MAIN,
MN_WIDGET_ID_SCAN_FE_SETUP,
MN_WIDGET_ID_SCAN_AUTO_SCAN,

View File

@@ -502,6 +502,7 @@ typedef enum
LOCALE_FLASHUPDATE_REALLYFLASHMTD,
LOCALE_FLASHUPDATE_SAVESUCCESS,
LOCALE_FLASHUPDATE_SELECTIMAGE,
LOCALE_FLASHUPDATE_SETTINGS,
LOCALE_FLASHUPDATE_SQUASHFS_NOVERSION,
LOCALE_FLASHUPDATE_TITLEREADFLASH,
LOCALE_FLASHUPDATE_TITLEWRITEFLASH,

View File

@@ -502,6 +502,7 @@ const char * locale_real_names[] =
"flashupdate.reallyflashmtd",
"flashupdate.savesuccess",
"flashupdate.selectimage",
"flashupdate.settings",
"flashupdate.squashfs.noversion",
"flashupdate.titlereadflash",
"flashupdate.titlewriteflash",