- start-wizard: formatting code using astyle; some manual code nicenings

Conflicts:
	src/gui/start_wizard.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-12-06 05:18:19 +01:00
committed by Thilo Graf
parent b42885f423
commit 0125eb6e15
2 changed files with 56 additions and 42 deletions

View File

@@ -2,11 +2,11 @@
Neutrino-GUI - Tuxbox-Project Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
http://www.tuxbox.org http://www.tuxbox.org
Startup wizard Startup wizard
based upon an implementation created by based upon an implementation created by
Copyright (C) 2009 CoolStream International Ltd. Copyright (C) 2009 CoolStream International Ltd.
Reworked by dbt (Thilo Graf) Reworked by dbt (Thilo Graf)
Copyright (C) 2012 dbt Copyright (C) 2012 dbt
http://www.dbox2-tuning.net http://www.dbox2-tuning.net
@@ -27,15 +27,14 @@
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.
NOTE for ignorant distributors: NOTE for ignorant distributors:
It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL. It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL.
Please read it and understand it right! Please read it and understand it right!
This means for you: Hold it, if not, leave it! You could face legal action! This means for you: Hold it, if not, leave it! You could face legal action!
Otherwise ask the copyright owners, anything else would be theft! Otherwise ask the copyright owners, anything else would be theft!
*/ */
#include "start_wizard.h" #include "start_wizard.h"
#include <global.h> #include <global.h>
@@ -58,7 +57,7 @@
#include <hardware/video.h> #include <hardware/video.h>
extern cVideo * videoDecoder; extern cVideo *videoDecoder;
extern Zapit_config zapitCfg; extern Zapit_config zapitCfg;
using namespace std; using namespace std;
@@ -78,59 +77,64 @@ const CMenuOptionChooser::keyval WIZARD_SETUP_TYPE[] =
}; };
#endif #endif
int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/) int CStartUpWizard::exec(CMenuTarget *parent, const string &/*actionKey*/)
{ {
// remove menu-timeout during wizard
int default_timing_menu = g_settings.timing[SNeutrinoSettings::TIMING_MENU];
g_settings.timing[SNeutrinoSettings::TIMING_MENU] = 0;
//printf("[neutrino] Removing 'timing.menu' during wizard ...\n");
int res = menu_return::RETURN_REPAINT; int res = menu_return::RETURN_REPAINT;
showBackgroundLogo(); showBackgroundLogo();
if (parent) if (parent)
parent->hide(); parent->hide();
//language setup // language setup
COsdLangSetup languageSettings(SNeutrinoSettings::WIZARD_START); COsdLangSetup languageSettings(SNeutrinoSettings::WIZARD_START);
CMenuWidget osdl_setup(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE, 45, MN_WIDGET_ID_LANGUAGESETUP_LOCALE); CMenuWidget osdl_setup(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE, 45, MN_WIDGET_ID_LANGUAGESETUP_LOCALE);
osdl_setup.setWizardMode(true); osdl_setup.setWizardMode(true);
languageSettings.showLanguageSetup(&osdl_setup); languageSettings.showLanguageSetup(&osdl_setup);
osdl_setup.exec(NULL, ""); osdl_setup.exec(NULL, "");
/* hack to ensure system's view of timezone is the same as neutrino's */ // hack to ensure system's view of timezone is the same as neutrino's
CTZChangeNotifier tzn; CTZChangeNotifier tzn;
tzn.changeNotify(NONEXISTANT_LOCALE, (void *)"dummy"); tzn.changeNotify(NONEXISTANT_LOCALE, (void *)"dummy");
//restore backup // restore backup
CSettingsManager settingsManager(SNeutrinoSettings::WIZARD_START); CSettingsManager settingsManager(SNeutrinoSettings::WIZARD_START);
settingsManager.exec(NULL, ""); settingsManager.exec(NULL, "");
#if 0 //if (ShowMsg(LOCALE_WIZARD_WELCOME_HEAD, g_Locale->getText(LOCALE_WIZARD_WELCOME_TEXT), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbrCancel) == CMsgBox::mbrYes)
if(ShowMsg (LOCALE_WIZARD_WELCOME_HEAD, g_Locale->getText(LOCALE_WIZARD_WELCOME_TEXT), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbrCancel) == CMsgBox::mbrYes)
#endif
{ {
int advanced = 1; int advanced = 1;
#ifdef ENABLE_FASTSCAN #ifdef ENABLE_FASTSCAN
std::string lang = g_settings.language; std::string lang = g_settings.language;
if (lang == "nederlands") { if (lang == "nederlands")
{
advanced = 0; advanced = 0;
CMenuWidget wtype(LOCALE_WIZARD_SETUP); CMenuWidget wtype(LOCALE_WIZARD_SETUP);
wtype.setWizardMode(SNeutrinoSettings::WIZARD_ON); wtype.setWizardMode(SNeutrinoSettings::WIZARD_ON);
wtype.addIntroItems(); wtype.addIntroItems();
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_WIZARD_SETUP_TYPE, &advanced, WIZARD_SETUP_TYPE, 2, true, NULL); CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_WIZARD_SETUP_TYPE, &advanced, WIZARD_SETUP_TYPE, 2, true, NULL);
mc->setHint("", LOCALE_WIZARD_SETUP_TYPE_HINT); mc->setHint("", LOCALE_WIZARD_SETUP_TYPE_HINT);
wtype.addItem(mc); wtype.addItem(mc);
wtype.exec(NULL, ""); wtype.exec(NULL, "");
} }
#endif #endif
//open video settings in wizardmode // open video settings in wizardmode
if(advanced && res != menu_return::RETURN_EXIT_ALL) { if (advanced && res != menu_return::RETURN_EXIT_ALL)
{
g_videoSettings->setWizardMode(SNeutrinoSettings::WIZARD_ON); g_videoSettings->setWizardMode(SNeutrinoSettings::WIZARD_ON);
res = g_videoSettings->exec(NULL, ""); res = g_videoSettings->exec(NULL, "");
g_videoSettings->setWizardMode(SNeutrinoSettings::WIZARD_OFF); g_videoSettings->setWizardMode(SNeutrinoSettings::WIZARD_OFF);
} }
if(advanced && res != menu_return::RETURN_EXIT_ALL) if (advanced && res != menu_return::RETURN_EXIT_ALL)
{ {
COsdSetup osdSettings(SNeutrinoSettings::WIZARD_ON); COsdSetup osdSettings(SNeutrinoSettings::WIZARD_ON);
res = osdSettings.exec(NULL, ""); res = osdSettings.exec(NULL, "");
} }
if(advanced && res != menu_return::RETURN_EXIT_ALL) if (advanced && res != menu_return::RETURN_EXIT_ALL)
{ {
CNetworkSetup::getInstance()->setWizardMode(SNeutrinoSettings::WIZARD_ON); CNetworkSetup::getInstance()->setWizardMode(SNeutrinoSettings::WIZARD_ON);
res = CNetworkSetup::getInstance()->exec(NULL, ""); res = CNetworkSetup::getInstance()->exec(NULL, "");
@@ -138,8 +142,8 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/)
} }
#if ENABLE_PKG_MANAGEMENT #if ENABLE_PKG_MANAGEMENT
//package update check // package update check
if(advanced && res != menu_return::RETURN_EXIT_ALL) if (advanced && res != menu_return::RETURN_EXIT_ALL)
{ {
COPKGManager man(SNeutrinoSettings::WIZARD_START); COPKGManager man(SNeutrinoSettings::WIZARD_START);
if (man.hasOpkgSupport()) if (man.hasOpkgSupport())
@@ -158,34 +162,40 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/)
if (CFEManager::getInstance()->haveSat()) if (CFEManager::getInstance()->haveSat())
init_settings = file_exists(CONFIGDIR "/initial/"); init_settings = file_exists(CONFIGDIR "/initial/");
if(advanced && init_settings && (res != menu_return::RETURN_EXIT_ALL)) if (advanced && init_settings && (res != menu_return::RETURN_EXIT_ALL))
{ {
if (ShowMsg(LOCALE_WIZARD_INITIAL_SETTINGS, g_Locale->getText(LOCALE_WIZARD_INSTALL_SETTINGS), if (ShowMsg(LOCALE_WIZARD_INITIAL_SETTINGS, g_Locale->getText(LOCALE_WIZARD_INSTALL_SETTINGS),
CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, 30) == CMsgBox::mbrYes) { CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, 30) == CMsgBox::mbrYes)
{
system("/bin/cp " CONFIGDIR "/initial/* " ZAPITDIR); system("/bin/cp " CONFIGDIR "/initial/* " ZAPITDIR);
CFEManager::getInstance()->loadSettings(); CFEManager::getInstance()->loadSettings();
CFEManager::getInstance()->saveSettings(); CFEManager::getInstance()->saveSettings();
CZapit::getInstance()->PrepareChannels(); CZapit::getInstance()->PrepareChannels();
} }
} }
if(res != menu_return::RETURN_EXIT_ALL) if (res != menu_return::RETURN_EXIT_ALL)
{ {
CScanSetup::getInstance()->setWizardMode(SNeutrinoSettings::WIZARD_ON); CScanSetup::getInstance()->setWizardMode(SNeutrinoSettings::WIZARD_ON);
if (advanced) { if (advanced)
{
res = CScanSetup::getInstance()->exec(NULL, "setup_frontend"); res = CScanSetup::getInstance()->exec(NULL, "setup_frontend");
if(res != menu_return::RETURN_EXIT_ALL) if (res != menu_return::RETURN_EXIT_ALL)
res = CScanSetup::getInstance()->exec(NULL, ""); res = CScanSetup::getInstance()->exec(NULL, "");
} else { }
else
{
CZapit::getInstance()->GetConfig(zapitCfg); CZapit::getInstance()->GetConfig(zapitCfg);
#ifdef ENABLE_FASTSCAN #ifdef ENABLE_FASTSCAN
if (CFEManager::getInstance()->haveSat()) { if (CFEManager::getInstance()->haveSat())
{
CMenuWidget fastScanMenu(LOCALE_SATSETUP_FASTSCAN_HEAD, NEUTRINO_ICON_SETTINGS, 45, MN_WIDGET_ID_SCAN_FAST_SCAN); CMenuWidget fastScanMenu(LOCALE_SATSETUP_FASTSCAN_HEAD, NEUTRINO_ICON_SETTINGS, 45, MN_WIDGET_ID_SCAN_FAST_SCAN);
fastScanMenu.setWizardMode(SNeutrinoSettings::WIZARD_ON); fastScanMenu.setWizardMode(SNeutrinoSettings::WIZARD_ON);
CScanSetup::getInstance()->addScanMenuFastScan(&fastScanMenu); CScanSetup::getInstance()->addScanMenuFastScan(&fastScanMenu);
res = fastScanMenu.exec(NULL, ""); res = fastScanMenu.exec(NULL, "");
} }
#endif #endif
if (CFEManager::getInstance()->haveCable()) { if (CFEManager::getInstance()->haveCable())
{
CMenuWidget cableScan(LOCALE_SATSETUP_CABLE, NEUTRINO_ICON_SETTINGS, 45, MN_WIDGET_ID_SCAN_CABLE_SCAN); CMenuWidget cableScan(LOCALE_SATSETUP_CABLE, NEUTRINO_ICON_SETTINGS, 45, MN_WIDGET_ID_SCAN_CABLE_SCAN);
cableScan.setWizardMode(SNeutrinoSettings::WIZARD_ON); cableScan.setWizardMode(SNeutrinoSettings::WIZARD_ON);
CScanSetup::getInstance()->addScanMenuCable(&cableScan); CScanSetup::getInstance()->addScanMenuCable(&cableScan);
@@ -196,6 +206,13 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/)
} }
} }
// reset menu-timeout to our default if user doesn't change the value
if (g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0)
{
g_settings.timing[SNeutrinoSettings::TIMING_MENU] = default_timing_menu;
//printf("[neutrino] Set 'timing.menu' to default...\n");
}
killBackgroundLogo(); killBackgroundLogo();
return res; return res;
} }
@@ -209,4 +226,3 @@ inline void CStartUpWizard::killBackgroundLogo()
{ {
CFrameBuffer::getInstance()->stopFrame(); CFrameBuffer::getInstance()->stopFrame();
} }

View File

@@ -2,11 +2,11 @@
Neutrino-GUI - Tuxbox-Project Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
http://www.tuxbox.org http://www.tuxbox.org
Startup wizard Startup wizard
based upon an implementation created by based upon an implementation created by
Copyright (C) 2009 CoolStream International Ltd. Copyright (C) 2009 CoolStream International Ltd.
Reworked by dbt (Thilo Graf) Reworked by dbt (Thilo Graf)
Copyright (C) 2012 dbt Copyright (C) 2012 dbt
http://www.dbox2-tuning.net http://www.dbox2-tuning.net
@@ -27,11 +27,11 @@
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.
NOTE for ignorant distributors: NOTE for ignorant distributors:
It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL. It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL.
Please read it and understand it right! Please read it and understand it right!
This means for you: Hold it, if not, leave it! You could face legal action! This means for you: Hold it, if not, leave it! You could face legal action!
Otherwise ask the copyright owners, anything else would be theft! Otherwise ask the copyright owners, anything else would be theft!
*/ */
@@ -42,18 +42,16 @@
#include <neutrino.h> #include <neutrino.h>
#include <neutrino_menue.h> #include <neutrino_menue.h>
class CStartUpWizard : public CMenuTarget class CStartUpWizard : public CMenuTarget
{ {
private: private:
void showBackgroundLogo(); void showBackgroundLogo();
void killBackgroundLogo(); void killBackgroundLogo();
public: public:
CStartUpWizard(); CStartUpWizard();
~CStartUpWizard(); ~CStartUpWizard();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget *parent, const std::string &actionKey);
}; };
#endif #endif