mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
our current experimental Neutrino branch
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@27 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
104
src/gui/rc_lock.cpp
Normal file
104
src/gui/rc_lock.cpp
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
Neutrino-GUI - DBoxII-Project
|
||||
|
||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
||||
|
||||
|
||||
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 <gui/rc_lock.h>
|
||||
|
||||
#include <gui/widget/hintbox.h>
|
||||
#include <gui/widget/messagebox.h>
|
||||
#include <gui/widget/stringinput.h>
|
||||
|
||||
const std::string CRCLock::NO_USER_INPUT = "noUserInput";
|
||||
|
||||
// -- Menue Handler Interface
|
||||
// -- Infinite Loop to lock remote control (until release lock key pressed)
|
||||
// -- 2003-12-01 rasc
|
||||
|
||||
int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
{
|
||||
if (parent)
|
||||
parent->hide();
|
||||
|
||||
bool no_input = (actionKey == NO_USER_INPUT);
|
||||
if (ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_LOCKMSG,
|
||||
CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel,
|
||||
NEUTRINO_ICON_INFO,450,no_input ? 5 : -1,no_input) == CMessageBox::mbrCancel)
|
||||
return menu_return::RETURN_EXIT_ALL;
|
||||
|
||||
// -- Lockup Box
|
||||
lockBox();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void CRCLock::lockBox()
|
||||
{
|
||||
neutrino_msg_t msg;
|
||||
neutrino_msg_data_t data;
|
||||
|
||||
unsigned long long timeoutEnd;
|
||||
|
||||
// -- Loop until release key pressed
|
||||
// -- Key sequence: <RED> <DBOX> within 5 secs
|
||||
while (1) {
|
||||
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(9999999);
|
||||
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
|
||||
|
||||
if (msg == NeutrinoMessages::UNLOCK_RC)
|
||||
break;
|
||||
|
||||
if (msg == CRCInput::RC_red) {
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(5);
|
||||
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
|
||||
|
||||
//if (msg == CRCInput::RC_setup) break;
|
||||
if (msg == (neutrino_msg_t) g_settings.key_unlock) break;
|
||||
}
|
||||
|
||||
if (msg == CRCInput::RC_timeout) continue;
|
||||
|
||||
// -- Zwen told me: Eating only RC events would be nice
|
||||
// -- so be it...
|
||||
|
||||
if (msg > CRCInput::RC_MaxRC) {
|
||||
CNeutrinoApp::getInstance()->handleMsg(msg, data);
|
||||
} else {
|
||||
CVFD::getInstance()->showRCLock();
|
||||
// Since showRCLock blocks 2secs for each key we eat all
|
||||
// messages created during this time. Hopefully this ok...
|
||||
g_RCInput->clearRCMsg();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
Reference in New Issue
Block a user