mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 02:41:12 +02:00
menu: add condition to enable/disable items in record mode (version 2)
Origin commit data
------------------
Commit: 5246233088
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-08-03 (Fri, 03 Aug 2018)
Origin message was:
------------------
- menu: add condition to enable/disable items in record mode (version 2)
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <driver/fade.h>
|
||||
#include <driver/display.h>
|
||||
#include <driver/record.h>
|
||||
#include <system/helpers.h>
|
||||
|
||||
#include <cctype>
|
||||
@@ -116,7 +117,7 @@ void CMenuItem::setActive(const bool Active)
|
||||
paint();
|
||||
}
|
||||
|
||||
bool CMenuItem::initModeCondition(const int& stb_mode)
|
||||
bool CMenuItem::initNeutrinoModeCondition(const int& stb_mode)
|
||||
{
|
||||
if (CNeutrinoApp::getInstance()->getMode() == stb_mode){
|
||||
active = false;
|
||||
@@ -130,23 +131,50 @@ bool CMenuItem::initModeCondition(const int& stb_mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMenuItem::initRecordModeCondition(const int& rec_mode)
|
||||
{
|
||||
if (CRecordManager::getInstance()->GetRecordMode() & rec_mode){
|
||||
active = false;
|
||||
marked = false;
|
||||
if (parent_widget)
|
||||
if (!isSelectable())
|
||||
parent_widget->initSelectable();
|
||||
return true;
|
||||
}
|
||||
printf("\033[33m[CMenuItem] [%s - %d] missmatching rec mode condition %d\033[0m\n", __func__, __LINE__, rec_mode);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMenuItem::disableByCondition(const menu_item_disable_cond_t& condition)
|
||||
{
|
||||
int stb_mode = CNeutrinoApp::getInstance()->getMode();
|
||||
int rec_mode = CRecordManager::getInstance()->GetRecordMode();
|
||||
|
||||
// Neutrino modes
|
||||
if (condition & DCOND_MODE_TS){
|
||||
if (stb_mode == NeutrinoModes::mode_ts)
|
||||
if (initModeCondition(stb_mode))
|
||||
if (initNeutrinoModeCondition(stb_mode))
|
||||
return;
|
||||
}
|
||||
if (condition & DCOND_MODE_RADIO){
|
||||
if (stb_mode == NeutrinoModes::mode_radio)
|
||||
if (initModeCondition(stb_mode))
|
||||
if (initNeutrinoModeCondition(stb_mode))
|
||||
return;
|
||||
}
|
||||
if (condition & DCOND_MODE_TV){
|
||||
if (stb_mode == NeutrinoModes::mode_tv)
|
||||
if (initModeCondition(stb_mode))
|
||||
if (initNeutrinoModeCondition(stb_mode))
|
||||
return;
|
||||
}
|
||||
// record modes
|
||||
if (condition & DCOND_MODE_REC){
|
||||
if (rec_mode & CRecordManager::RECMODE_REC)
|
||||
if (initRecordModeCondition(CRecordManager::RECMODE_REC))
|
||||
return;
|
||||
}
|
||||
if (condition & DCOND_MODE_TSHIFT){
|
||||
if (rec_mode & CRecordManager::RECMODE_TSHIFT)
|
||||
if (initRecordModeCondition(CRecordManager::RECMODE_TSHIFT))
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user