From 9a2d6aea26e402b892808a58f799ef091c2ebd25 Mon Sep 17 00:00:00 2001 From: satbaby Date: Mon, 22 Oct 2012 15:52:07 +0200 Subject: [PATCH] rc_lock: lock for rc_lock, use only once, supplement to 9e3567dc09e4555003de68f01271c5ce6152d989 --- src/gui/rc_lock.cpp | 6 ++++++ src/gui/rc_lock.h | 5 +++-- src/neutrino.cpp | 5 +++-- src/nhttpd/tuxboxapi/coolstream/controlapi.cpp | 9 ++++----- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/gui/rc_lock.cpp b/src/gui/rc_lock.cpp index 51e12a12d..2b7177692 100644 --- a/src/gui/rc_lock.cpp +++ b/src/gui/rc_lock.cpp @@ -38,6 +38,7 @@ #include const std::string CRCLock::NO_USER_INPUT = "noUserInput"; +bool CRCLock::locked = false; // -- Menue Handler Interface // -- Infinite Loop to lock remote control (until release lock key pressed) @@ -45,6 +46,9 @@ const std::string CRCLock::NO_USER_INPUT = "noUserInput"; int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) { + if(locked) + return menu_return::RETURN_EXIT_ALL; + if (parent) parent->hide(); @@ -55,7 +59,9 @@ int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_EXIT_ALL; // -- Lockup Box + locked = true; lockBox(); + locked = false; ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO,450, no_input ? 5 : -1); return menu_return::RETURN_EXIT_ALL; diff --git a/src/gui/rc_lock.h b/src/gui/rc_lock.h index 4e6ea758c..bd32757d0 100644 --- a/src/gui/rc_lock.h +++ b/src/gui/rc_lock.h @@ -36,12 +36,13 @@ // class CRCLock: public CMenuTarget { +private: + void lockBox(); public: static const std::string NO_USER_INPUT; int exec(CMenuTarget* parent, const std::string & actionKey); - void lockBox(); + static bool locked; }; - #endif diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0e46f62ff..ec4cd0b2a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3197,6 +3197,9 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(mode == mode_radio && g_Radiotext) g_Radiotext->radiotext_stop(); + lastMode = mode; + mode = mode_standby; + if(!fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus()) { g_Zapit->setStandby(true); } else { @@ -3232,8 +3235,6 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(!CRecordManager::getInstance()->RecordingStatus()) cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); - lastMode = mode; - mode = mode_standby; //fan speed if (g_info.has_fan) { int fspeed = 1; diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index f3afbad54..109b00114 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -37,6 +37,8 @@ #include "gui/plugins.h"//for relodplugins #include #include +#include "gui/rc_lock.h" + // yhttpd #include "yhttpd.h" #include "ytypes_globals.h" @@ -456,20 +458,17 @@ void CControlAPI::RCCGI(CyhookHandler *hh) { if (!(hh->ParamList.empty())) { - static bool on_off = false; if (hh->ParamList["1"] == "lock"){ // lock remote control - if(!on_off){ + if(!CRCLock::locked){ NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); - on_off = true; }else{ hh->WriteLn("remote is already locked"); return; } } else if (hh->ParamList["1"] == "unlock"){// unlock remote control - if(on_off){ + if(CRCLock::locked){ NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); - on_off = false; }else{ hh->WriteLn("remote is already unlocked");