From 64817a6044fc13fea13eaa8c4e74cf62ea3d42ee Mon Sep 17 00:00:00 2001 From: focus Date: Thu, 30 Sep 2010 15:55:16 +0000 Subject: [PATCH] Factory reset to delete all, with reboot git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@806 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/english.locale | 2 +- src/neutrino.cpp | 5 +++++ src/neutrinoMessages.h | 1 + src/neutrino_menue.cpp | 1 + src/system/setting_helpers.cpp | 6 +++++- src/zapit/src/getservices.cpp | 2 +- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index fb22a95d0..dfba1fe12 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1393,7 +1393,7 @@ scrambled_channel Scrambled channel neutrino_starting Neutrino starting... reset_channels Delete all channels reset_settings Reset settings to defaults -reset_all Factory reset +reset_all Factory reset and reboot reset_confirm Are you sure ? cam.settings CI Cam cam.empty No CAM in slot diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c44a08c53..3e0e4361c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3603,6 +3603,11 @@ printf("NeutrinoMessages::EVT_BOUQUETSCHANGED\n");fflush(stdout); } return messages_return::handled; } + else if( msg == NeutrinoMessages::REBOOT ) { + FILE *f = fopen("/tmp/.reboot", "w"); + fclose(f); + ExitRun(true); + } else if (msg == NeutrinoMessages::EVT_POPUP) { if (mode != mode_scart) ShowHintUTF(LOCALE_MESSAGEBOX_INFO, (const char *) data); // UTF-8 diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 2b636028e..42e18ac2a 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -71,6 +71,7 @@ struct NeutrinoMessages { REMIND = CRCInput::RC_Messages + 18, LOCK_RC = CRCInput::RC_Messages + 19, UNLOCK_RC = CRCInput::RC_Messages + 20, + REBOOT = CRCInput::RC_Messages + 21, EVT_VOLCHANGED = CRCInput::RC_Events + 1, EVT_MUTECHANGED = CRCInput::RC_Events + 2, diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 11a4d4bcf..3d937b4af 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -873,6 +873,7 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings mset->addItem(new CMenuForwarder(LOCALE_EXTRA_SAVECONFIG, true, NULL, this, "saveconfig")); mset->addItem(new CMenuForwarder(LOCALE_SETTINGS_BACKUP, true, NULL, this, "backup")); mset->addItem(new CMenuForwarder(LOCALE_SETTINGS_RESTORE, true, NULL, this, "restore")); + mset->addItem(new CMenuForwarder(LOCALE_RESET_ALL, true, NULL, resetNotifier, "all")); mainSettings.addItem(new CMenuForwarder(LOCALE_MAINSETTINGS_MANAGE, true, NULL, mset)); diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index c073f3440..65616999b 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -936,6 +936,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK bool delete_chan = (actionKey == "channels") || delete_all; bool delete_set = (actionKey == "settings") || delete_all; neutrino_locale_t msg = delete_all ? LOCALE_RESET_ALL : delete_chan ? LOCALE_RESET_CHANNELS : LOCALE_RESET_SETTINGS; + int ret = menu_return::RETURN_REPAINT; int result = ShowMsgUTF(msg, g_Locale->getText(LOCALE_RESET_CONFIRM), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo); if(result != CMessageBox::mbrYes) @@ -945,6 +946,8 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK system("rm -f /var/tuxbox/config/zapit/*.conf"); loadZapitSettings(); getZapitConfig(&zapitCfg); + g_RCInput->postMsg( NeutrinoMessages::REBOOT, 0); + ret = menu_return::RETURN_EXIT_ALL; } if(delete_set) { unlink(NEUTRINO_SETTINGS_FILE); @@ -959,8 +962,9 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK system("rm -f /var/tuxbox/config/zapit/*.xml"); g_Zapit->reinitChannels(); } - return true; + return ret; } + bool CLedControlNotifier::changeNotify(const neutrino_locale_t, void* /*data*/) { CVFD::getInstance()->setled(); diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 732669f35..b168f5903 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -387,7 +387,7 @@ void init_sat(t_satellite_position position) int LoadServices(fe_type_t frontendType, diseqc_t /*diseqcType*/, bool only_current) { xmlDocPtr parser; - bool satcleared = 0; + static bool satcleared = 0;//clear only once, because menu is static scnt = 0; printf("[zapit] Loading services, channel size %d ..\n", sizeof(CZapitChannel));