mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
Main Menu: try to add dynamic possibility to disable items on runtime
The issue is that it's not really possible to disable/enable menu items on
runtime with an existant menu widget instance eg with personalized menu items.
Here we need a dynamic solution to disable items depends on stb-mode (mode_ts, mode_tv etc)
This should be solved here with an additional parameter for personalized items.
New paramter is named: disable_condition
Possible alvailable values at the moment are:
DCOND_MODE_NONE as default
DCOND_MODE_TV
DCOND_MODE_RADIO
DCOND_MODE_TS
includes some improvements by Sven
- menue: remove old_iconName handling
... icons should be painted on deactivated items too
- menue: try to fix position <-> selection missmatch
Origin commit data
------------------
Commit: 1f95f38d32
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-12-13 (Sun, 13 Dec 2015)
Origin message was:
------------------
Main Menu: try to add dynamic possibility to disable items on runtime
The issue is that it's not really possible to disable/enable menu items on
runtime with an existant menu widget instance eg with personalized menu items.
Here we need a dynamic solution to disable items depends on stb-mode (mode_ts, mode_tv etc)
This should be solved here with an additional parameter for personalized items.
New paramter is named: disable_condition
Possible alvailable values at the moment are:
DCOND_MODE_NONE as default
DCOND_MODE_TV
DCOND_MODE_RADIO
DCOND_MODE_TS
includes some improvements by Sven
- menue: remove old_iconName handling
... icons should be painted on deactivated items too
- menue: try to fix position <-> selection missmatch
This commit is contained in:
@@ -153,7 +153,7 @@
|
|||||||
#include <neutrino.h>
|
#include <neutrino.h>
|
||||||
#include <neutrino_menue.h>
|
#include <neutrino_menue.h>
|
||||||
#include <mymenu.h>
|
#include <mymenu.h>
|
||||||
|
#include <sigc++/bind.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -626,7 +626,7 @@ int CPersonalizeGui::ShowMenuOptions(const int& widget)
|
|||||||
//found observer item and if found, then define 'this' as observer for current option chooser and run changeNotify
|
//found observer item and if found, then define 'this' as observer for current option chooser and run changeNotify
|
||||||
bool is_observer = isObserver(v_item[i].widget, v_item[i].menuItem) ? true : false;
|
bool is_observer = isObserver(v_item[i].widget, v_item[i].menuItem) ? true : false;
|
||||||
CChangeObserver* observer = is_observer ? this : NULL;
|
CChangeObserver* observer = is_observer ? this : NULL;
|
||||||
CMenuOptionChooser * opt = new CMenuOptionChooser(name, p_mode, PERSONALIZE_MODE_OPTIONS, PERSONALIZE_MODE_MAX, v_item[i].menuItem->active, observer);
|
CMenuOptionChooser * opt = new CMenuOptionChooser(name, p_mode, PERSONALIZE_MODE_OPTIONS, PERSONALIZE_MODE_MAX, v_item[i].menuItem->current_active, observer);
|
||||||
if (is_observer)
|
if (is_observer)
|
||||||
changeNotify(name, (void*)p_mode);
|
changeNotify(name, (void*)p_mode);
|
||||||
|
|
||||||
@@ -830,20 +830,20 @@ void CPersonalizeGui::addIntroItems(CMenuWidget *widget)
|
|||||||
|
|
||||||
|
|
||||||
//overloaded version from 'addItem', first parameter is an id from widget collection 'v_widget'
|
//overloaded version from 'addItem', first parameter is an id from widget collection 'v_widget'
|
||||||
void CPersonalizeGui::addItem(const int& widget_id, CMenuItem *menu_Item, const int *personalize_mode, const bool defaultselected, const int& item_mode, CMenuItem *observer_Item)
|
void CPersonalizeGui::addItem(const int& widget_id, CMenuItem *menu_Item, const int *personalize_mode, const bool defaultselected, const int& item_mode, CMenuItem *observer_Item, const menu_item_disable_cond_t& disable_condition)
|
||||||
{
|
{
|
||||||
addItem(v_widget[widget_id], menu_Item, personalize_mode, defaultselected, item_mode, observer_Item);
|
addItem(v_widget[widget_id], menu_Item, personalize_mode, defaultselected, item_mode, observer_Item, disable_condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adds a personalized menu item object to menu with personalizing parameters
|
//adds a personalized menu item object to menu with personalizing parameters
|
||||||
void CPersonalizeGui::addItem(CMenuWidget *widget, CMenuItem *menu_Item, const int *personalize_mode, const bool defaultselected, const int& item_mode, CMenuItem *observer_Item)
|
void CPersonalizeGui::addItem(CMenuWidget *widget, CMenuItem *menu_Item, const int *personalize_mode, const bool defaultselected, const int& item_mode, CMenuItem *observer_Item, const menu_item_disable_cond_t& disable_condition)
|
||||||
{
|
{
|
||||||
if (observer_Item != NULL)
|
if (observer_Item != NULL)
|
||||||
addObservedItem(widget, observer_Item, menu_Item);
|
addObservedItem(widget, observer_Item, menu_Item);
|
||||||
|
|
||||||
CMenuForwarder *fw = static_cast <CMenuForwarder*> (menu_Item);
|
CMenuForwarder *fw = static_cast <CMenuForwarder*> (menu_Item);
|
||||||
|
|
||||||
menu_item_t item = {widget, menu_Item, defaultselected, fw->getTextLocale(), (int*)personalize_mode, item_mode, observer_Item};
|
menu_item_t item = {widget, menu_Item, defaultselected, fw->getTextLocale(), (int*)personalize_mode, item_mode, observer_Item, disable_condition};
|
||||||
|
|
||||||
if (item_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
|
if (item_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
|
||||||
{
|
{
|
||||||
@@ -871,10 +871,10 @@ void CPersonalizeGui::addSeparator(const int& widget_id, const neutrino_locale_t
|
|||||||
void CPersonalizeGui::addSeparator(CMenuWidget &widget, const neutrino_locale_t locale_text, const int& item_mode)
|
void CPersonalizeGui::addSeparator(CMenuWidget &widget, const neutrino_locale_t locale_text, const int& item_mode)
|
||||||
{
|
{
|
||||||
if (locale_text == NONEXISTANT_LOCALE) {
|
if (locale_text == NONEXISTANT_LOCALE) {
|
||||||
menu_item_t to_add_sep = {&widget, GenericMenuSeparatorLine, false, locale_text, NULL, item_mode, NULL};
|
menu_item_t to_add_sep = {&widget, GenericMenuSeparatorLine, false, locale_text, NULL, item_mode, NULL, DCOND_MODE_NONE };
|
||||||
v_item.push_back(to_add_sep);
|
v_item.push_back(to_add_sep);
|
||||||
} else {
|
} else {
|
||||||
menu_item_t to_add_sep = {&widget, new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, locale_text), false, locale_text, NULL, item_mode, NULL};
|
menu_item_t to_add_sep = {&widget, new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, locale_text), false, locale_text, NULL, item_mode, NULL, DCOND_MODE_NONE };
|
||||||
v_item.push_back(to_add_sep);
|
v_item.push_back(to_add_sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -939,6 +939,7 @@ void CPersonalizeGui::addPersonalizedItems()
|
|||||||
neutrino_msg_t d_key = fw->directKey;
|
neutrino_msg_t d_key = fw->directKey;
|
||||||
bool add_shortcut = false;
|
bool add_shortcut = false;
|
||||||
|
|
||||||
|
|
||||||
//get shortcut
|
//get shortcut
|
||||||
if (fw->active && (d_key == CRCInput::RC_nokey || CRCInput::isNumeric(d_key))) //if RC_nokey or RC_key is digi and item is active, allow to generate a shortcut,
|
if (fw->active && (d_key == CRCInput::RC_nokey || CRCInput::isNumeric(d_key))) //if RC_nokey or RC_key is digi and item is active, allow to generate a shortcut,
|
||||||
{
|
{
|
||||||
@@ -965,6 +966,14 @@ void CPersonalizeGui::addPersonalizedItems()
|
|||||||
use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, NULL, lock_icon);
|
use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, NULL, lock_icon);
|
||||||
v_item[i].menuItem->hintIcon = fw->hintIcon;
|
v_item[i].menuItem->hintIcon = fw->hintIcon;
|
||||||
v_item[i].menuItem->hint = fw->hint;
|
v_item[i].menuItem->hint = fw->hint;
|
||||||
|
|
||||||
|
//assign slot for items, causes disable/enable by condition eg: receiver mode
|
||||||
|
if (v_item[i].condition != DCOND_MODE_NONE ){
|
||||||
|
sigc::slot0<void> sl = sigc::bind<0>(sigc::mem_fun1(v_item[i].menuItem, &CMenuForwarder::disableByCondition), v_item[i].condition);
|
||||||
|
v_item[i].menuItem->OnPaintItem.connect(sl);
|
||||||
|
v_item[i].default_selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
//add item if it's set to visible or pin protected and allow to add an forwarder as next
|
//add item if it's set to visible or pin protected and allow to add an forwarder as next
|
||||||
if (p_mode != PERSONALIZE_MODE_NOTVISIBLE || i_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
|
if (p_mode != PERSONALIZE_MODE_NOTVISIBLE || i_mode == PERSONALIZE_SHOW_AS_ACCESS_OPTION)
|
||||||
{
|
{
|
||||||
|
@@ -111,6 +111,7 @@ typedef struct menu_item_t
|
|||||||
int* personalize_mode;
|
int* personalize_mode;
|
||||||
int item_mode;
|
int item_mode;
|
||||||
CMenuItem *observer_Item;
|
CMenuItem *observer_Item;
|
||||||
|
int condition;
|
||||||
}menu_item_struct_t;
|
}menu_item_struct_t;
|
||||||
|
|
||||||
typedef struct observ_menu_item_t
|
typedef struct observ_menu_item_t
|
||||||
@@ -242,8 +243,8 @@ class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINP
|
|||||||
int getItemsCount(CMenuWidget *widget);
|
int getItemsCount(CMenuWidget *widget);
|
||||||
int getItemsCount(const int& widget_id);
|
int getItemsCount(const int& widget_id);
|
||||||
void setShortcut(const int& short_cut = 1) {shortcut = short_cut;};
|
void setShortcut(const int& short_cut = 1) {shortcut = short_cut;};
|
||||||
void addItem(CMenuWidget *widget, CMenuItem *menu_Item, const int *personalize_mode = NULL, const bool defaultselected = false, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION, CMenuItem *observer_Item = NULL);
|
void addItem(CMenuWidget *widget, CMenuItem *menu_Item, const int *personalize_mode = NULL, const bool defaultselected = false, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION, CMenuItem *observer_Item = NULL, const menu_item_disable_cond_t& disable_condition = DCOND_MODE_NONE );
|
||||||
void addItem(const int& widget_id, CMenuItem *menu_Item, const int *personalize_mode = NULL, const bool defaultselected = false, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION, CMenuItem *observer_Item = NULL);
|
void addItem(const int& widget_id, CMenuItem *menu_Item, const int *personalize_mode = NULL, const bool defaultselected = false, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION, CMenuItem *observer_Item = NULL, const menu_item_disable_cond_t& disable_condition = DCOND_MODE_NONE );
|
||||||
void addIntroItems(CMenuWidget *widget);
|
void addIntroItems(CMenuWidget *widget);
|
||||||
void addIntroItems(const int& widget_id);
|
void addIntroItems(const int& widget_id);
|
||||||
void addSeparator(CMenuWidget &menu, const neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION);
|
void addSeparator(CMenuWidget &menu, const neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int& item_mode = PERSONALIZE_SHOW_AS_ITEM_OPTION);
|
||||||
|
@@ -59,7 +59,7 @@ CMenuForwarder * const GenericMenuNext = &CGenericMenuNext;
|
|||||||
|
|
||||||
CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic)
|
CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic)
|
||||||
{
|
{
|
||||||
active = Active;
|
active = current_active = Active;
|
||||||
directKey = DirectKey;
|
directKey = DirectKey;
|
||||||
isStatic = IsStatic;
|
isStatic = IsStatic;
|
||||||
|
|
||||||
@@ -89,6 +89,7 @@ CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const I
|
|||||||
selected_iconName = NULL;
|
selected_iconName = NULL;
|
||||||
height = 0;
|
height = 0;
|
||||||
actObserv = NULL;
|
actObserv = NULL;
|
||||||
|
parent_widget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenuItem::init(const int X, const int Y, const int DX, const int OFFX)
|
void CMenuItem::init(const int X, const int Y, const int DX, const int OFFX)
|
||||||
@@ -104,7 +105,7 @@ void CMenuItem::init(const int X, const int Y, const int DX, const int OFFX)
|
|||||||
|
|
||||||
void CMenuItem::setActive(const bool Active)
|
void CMenuItem::setActive(const bool Active)
|
||||||
{
|
{
|
||||||
active = Active;
|
active = current_active = Active;
|
||||||
/* used gets set by the addItem() function. This is for disabling
|
/* used gets set by the addItem() function. This is for disabling
|
||||||
machine-specific options by just not calling the addItem() function.
|
machine-specific options by just not calling the addItem() function.
|
||||||
Without this, the changeNotifiers would become machine-dependent. */
|
Without this, the changeNotifiers would become machine-dependent. */
|
||||||
@@ -112,6 +113,48 @@ void CMenuItem::setActive(const bool Active)
|
|||||||
paint();
|
paint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMenuItem::initModeCondition(const int& stb_mode)
|
||||||
|
{
|
||||||
|
if (CNeutrinoApp::getInstance()->getMode() == stb_mode){
|
||||||
|
active = false;
|
||||||
|
marked = false;
|
||||||
|
if (parent_widget)
|
||||||
|
if (!isSelectable())
|
||||||
|
parent_widget->initSelectable();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
printf("\033[33m[CMenuItem] [%s - %d] missmatching stb mode condition \033[0m\n", __func__, __LINE__, stb_mode);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMenuItem::disableByCondition(const menu_item_disable_cond_t& condition)
|
||||||
|
{
|
||||||
|
int stb_mode = CNeutrinoApp::getInstance()->getMode();
|
||||||
|
|
||||||
|
if (condition & DCOND_MODE_TS){
|
||||||
|
if (stb_mode == CNeutrinoApp::mode_ts)
|
||||||
|
if (initModeCondition(stb_mode))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (condition & DCOND_MODE_RADIO){
|
||||||
|
if (stb_mode == CNeutrinoApp::mode_radio)
|
||||||
|
if (initModeCondition(stb_mode))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (condition & DCOND_MODE_TV){
|
||||||
|
if (stb_mode == CNeutrinoApp::mode_tv)
|
||||||
|
if (initModeCondition(stb_mode))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
active = current_active;
|
||||||
|
|
||||||
|
if (parent_widget){
|
||||||
|
if (!isSelectable())
|
||||||
|
parent_widget->initSelectable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CMenuItem::setMarked(const bool Marked)
|
void CMenuItem::setMarked(const bool Marked)
|
||||||
{
|
{
|
||||||
marked = Marked;
|
marked = Marked;
|
||||||
@@ -605,6 +648,7 @@ void CMenuWidget::addItem(CMenuItem* menuItem, const bool defaultselected)
|
|||||||
|
|
||||||
menuItem->isUsed();
|
menuItem->isUsed();
|
||||||
items.push_back(menuItem);
|
items.push_back(menuItem);
|
||||||
|
menuItem->setParentWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenuWidget::resetWidget(bool delete_items)
|
void CMenuWidget::resetWidget(bool delete_items)
|
||||||
@@ -669,11 +713,6 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
bool bAllowRepeatLR = false;
|
bool bAllowRepeatLR = false;
|
||||||
CVFD::MODES oldLcdMode = CVFD::getInstance()->getMode();
|
CVFD::MODES oldLcdMode = CVFD::getInstance()->getMode();
|
||||||
|
|
||||||
int pos = 0;
|
|
||||||
if (selected > 0 && selected < (int)items.size())
|
|
||||||
pos = selected;
|
|
||||||
else
|
|
||||||
selected = -1;
|
|
||||||
exit_pressed = false;
|
exit_pressed = false;
|
||||||
|
|
||||||
frameBuffer->Lock();
|
frameBuffer->Lock();
|
||||||
@@ -693,21 +732,22 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* make sure we start with a selectable item... */
|
|
||||||
while (pos < (int)items.size()) {
|
|
||||||
if (items[pos]->isSelectable())
|
|
||||||
break;
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
checkHints();
|
checkHints();
|
||||||
|
|
||||||
if(savescreen) {
|
if(savescreen) {
|
||||||
calcSize();
|
calcSize();
|
||||||
saveScreen();
|
saveScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make sure we start with a selectable item... */
|
||||||
|
initSelectable();
|
||||||
|
|
||||||
paint();
|
paint();
|
||||||
frameBuffer->blit();
|
frameBuffer->blit();
|
||||||
|
|
||||||
|
int pos = selected;
|
||||||
|
|
||||||
int retval = menu_return::RETURN_REPAINT;
|
int retval = menu_return::RETURN_REPAINT;
|
||||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
|
|
||||||
@@ -1132,6 +1172,22 @@ void CMenuWidget::calcSize()
|
|||||||
setMenuPos(full_width);
|
setMenuPos(full_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMenuWidget::initSelectable()
|
||||||
|
{
|
||||||
|
int pos = 0;
|
||||||
|
if (selected > 0 && selected < (int)items.size())
|
||||||
|
pos = selected;
|
||||||
|
else
|
||||||
|
selected = -1;
|
||||||
|
|
||||||
|
while (pos < (int)items.size()) {
|
||||||
|
if (items[pos]->isSelectable())
|
||||||
|
break;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
selected = pos;
|
||||||
|
}
|
||||||
|
|
||||||
void CMenuWidget::paint()
|
void CMenuWidget::paint()
|
||||||
{
|
{
|
||||||
calcSize();
|
calcSize();
|
||||||
@@ -1218,16 +1274,16 @@ void CMenuWidget::paintItems()
|
|||||||
* different height and this might leave artifacts otherwise after changing pages */
|
* different height and this might leave artifacts otherwise after changing pages */
|
||||||
frameBuffer->paintBoxRel(x,item_start_y, width,item_height, COL_MENUCONTENT_PLUS_0);
|
frameBuffer->paintBoxRel(x,item_start_y, width,item_height, COL_MENUCONTENT_PLUS_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ypos=item_start_y;
|
int ypos=item_start_y;
|
||||||
for (int count = 0; count < (int)items.size(); count++)
|
for (int count = 0; count < (int)items.size(); count++)
|
||||||
{
|
{
|
||||||
CMenuItem* item = items[count];
|
CMenuItem* item = items[count];
|
||||||
|
item->OnPaintItem();
|
||||||
if ((count >= page_start[current_page]) &&
|
if ((count >= page_start[current_page]) &&
|
||||||
(count < page_start[current_page + 1]))
|
(count < page_start[current_page + 1]))
|
||||||
{
|
{
|
||||||
item->init(x, ypos, width, iconOffset);
|
item->init(x, ypos, width, iconOffset);
|
||||||
|
|
||||||
if (item->isSelectable() && selected == -1)
|
if (item->isSelectable() && selected == -1)
|
||||||
selected = count;
|
selected = count;
|
||||||
|
|
||||||
@@ -2125,6 +2181,7 @@ std::string CMenuForwarder::getOption(void)
|
|||||||
int CMenuForwarder::paint(bool selected)
|
int CMenuForwarder::paint(bool selected)
|
||||||
{
|
{
|
||||||
std::string option_name = getOption();
|
std::string option_name = getOption();
|
||||||
|
|
||||||
fb_pixel_t bgcol = 0;
|
fb_pixel_t bgcol = 0;
|
||||||
if (jumpTarget)
|
if (jumpTarget)
|
||||||
bgcol = jumpTarget->getColor();
|
bgcol = jumpTarget->getColor();
|
||||||
|
@@ -56,7 +56,8 @@ extern "C" {
|
|||||||
#define NO_WIDGET_ID -1
|
#define NO_WIDGET_ID -1
|
||||||
|
|
||||||
typedef int mn_widget_id_t;
|
typedef int mn_widget_id_t;
|
||||||
|
typedef int menu_item_disable_cond_t;
|
||||||
|
class CMenuWidget;
|
||||||
struct menu_return
|
struct menu_return
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
@@ -69,6 +70,15 @@ struct menu_return
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DCOND_MODE_NONE = 1,
|
||||||
|
|
||||||
|
DCOND_MODE_TV = 2,
|
||||||
|
DCOND_MODE_RADIO = 4,
|
||||||
|
DCOND_MODE_TS = 8
|
||||||
|
}/*menu_item_disable_cond_t*/;
|
||||||
|
|
||||||
class CChangeObserver
|
class CChangeObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -104,15 +114,16 @@ class CMenuTarget
|
|||||||
virtual fb_pixel_t getColor(void) { return 0; }
|
virtual fb_pixel_t getColor(void) { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMenuItem
|
class CMenuItem : public CComponentsSignals
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void setIconName();
|
void setIconName();
|
||||||
|
CMenuWidget* parent_widget;
|
||||||
protected:
|
protected:
|
||||||
int x, y, dx, offx, name_start_x, icon_frame_w;
|
int x, y, dx, offx, name_start_x, icon_frame_w;
|
||||||
bool used;
|
bool used;
|
||||||
fb_pixel_t item_color, item_bgcolor;
|
fb_pixel_t item_color, item_bgcolor;
|
||||||
|
bool initModeCondition(const int& stb_mode);
|
||||||
void initItemColors(const bool select_mode);
|
void initItemColors(const bool select_mode);
|
||||||
lua_State *luaState;
|
lua_State *luaState;
|
||||||
std::string luaAction;
|
std::string luaAction;
|
||||||
@@ -124,7 +135,7 @@ class CMenuItem
|
|||||||
CActivateObserver * actObserv;
|
CActivateObserver * actObserv;
|
||||||
public:
|
public:
|
||||||
int height;
|
int height;
|
||||||
bool active;
|
bool active, current_active;
|
||||||
bool marked;
|
bool marked;
|
||||||
bool inert;
|
bool inert;
|
||||||
bool isStatic;
|
bool isStatic;
|
||||||
@@ -157,7 +168,7 @@ class CMenuItem
|
|||||||
}
|
}
|
||||||
virtual int getYPosition(void) const { return y; }
|
virtual int getYPosition(void) const { return y; }
|
||||||
|
|
||||||
virtual bool isSelectable(void) const { return active; }
|
virtual bool isSelectable(void) const { return (active && current_active); }
|
||||||
|
|
||||||
virtual int exec(CMenuTarget* /*parent*/)
|
virtual int exec(CMenuTarget* /*parent*/)
|
||||||
{
|
{
|
||||||
@@ -180,17 +191,20 @@ class CMenuItem
|
|||||||
virtual int isMenueOptionChooser(void) const{return 0;}
|
virtual int isMenueOptionChooser(void) const{return 0;}
|
||||||
void setHint(const char * const icon, const neutrino_locale_t text) { hintIcon = (icon && *icon) ? icon : NULL; hint = text; }
|
void setHint(const char * const icon, const neutrino_locale_t text) { hintIcon = (icon && *icon) ? icon : NULL; hint = text; }
|
||||||
void setHint(const char * const icon, const std::string text) { hintIcon = (icon && *icon) ? icon : NULL; hintText = text; }
|
void setHint(const char * const icon, const std::string text) { hintIcon = (icon && *icon) ? icon : NULL; hintText = text; }
|
||||||
|
|
||||||
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
|
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
|
||||||
virtual const char *getName();
|
virtual const char *getName();
|
||||||
virtual void setName(const std::string& text);
|
virtual void setName(const std::string& text);
|
||||||
virtual void setName(const neutrino_locale_t text);
|
virtual void setName(const neutrino_locale_t text);
|
||||||
|
sigc::signal<void> OnPaintItem;
|
||||||
virtual const char *getDescription();
|
virtual const char *getDescription();
|
||||||
virtual void setDescription(const std::string& text);
|
virtual void setDescription(const std::string& text);
|
||||||
virtual void setDescription(const neutrino_locale_t text);
|
virtual void setDescription(const neutrino_locale_t text);
|
||||||
virtual int getDescriptionHeight(void);
|
virtual int getDescriptionHeight(void);
|
||||||
void setActivateObserver(CActivateObserver * Observ) { actObserv = Observ; }
|
void setActivateObserver(CActivateObserver * Observ) { actObserv = Observ; }
|
||||||
void activateNotify(void);
|
void activateNotify(void);
|
||||||
|
virtual void disableByCondition(const menu_item_disable_cond_t& condition);
|
||||||
|
void setParentWidget(CMenuWidget* parent){parent_widget = parent;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMenuSeparator : public CMenuItem
|
class CMenuSeparator : public CMenuItem
|
||||||
@@ -355,7 +369,7 @@ struct CMenuOptionChooserCompareItem: public std::binary_function <const CMenuOp
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMenuOptionChooser : public CAbstractMenuOptionChooser, public sigc::trackable
|
class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct keyval
|
struct keyval
|
||||||
@@ -577,6 +591,7 @@ class CMenuWidget : public CMenuTarget
|
|||||||
virtual const char *getName();
|
virtual const char *getName();
|
||||||
virtual void integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut=CRCInput::RC_nokey, bool enabled=true);
|
virtual void integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut=CRCInput::RC_nokey, bool enabled=true);
|
||||||
void setSelected(const int &Preselected){ selected = Preselected; };
|
void setSelected(const int &Preselected){ selected = Preselected; };
|
||||||
|
void initSelectable();
|
||||||
int getSelected()const { return selected; };
|
int getSelected()const { return selected; };
|
||||||
void move(int xoff, int yoff);
|
void move(int xoff, int yoff);
|
||||||
int getSelectedLine(void)const {return exit_pressed ? -1 : selected;};
|
int getSelectedLine(void)const {return exit_pressed ? -1 : selected;};
|
||||||
@@ -584,6 +599,7 @@ class CMenuWidget : public CMenuTarget
|
|||||||
void enableFade(bool _enable) { fade = _enable; };
|
void enableFade(bool _enable) { fade = _enable; };
|
||||||
void enableSaveScreen(bool enable);
|
void enableSaveScreen(bool enable);
|
||||||
void paintHint(int num);
|
void paintHint(int num);
|
||||||
|
void paintHint(){hint_painted = false;}
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MENU_POS_CENTER ,
|
MENU_POS_CENTER ,
|
||||||
|
@@ -57,7 +57,7 @@ class CFrameBuffer;
|
|||||||
class CConfigFile;
|
class CConfigFile;
|
||||||
class CScanSettings;
|
class CScanSettings;
|
||||||
|
|
||||||
class CNeutrinoApp : public CMenuTarget, CChangeObserver, sigc::trackable
|
class CNeutrinoApp : public CMenuTarget, CChangeObserver, public sigc::trackable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
|
@@ -181,12 +181,12 @@ void CNeutrinoApp::InitMenuMain()
|
|||||||
//tv-mode
|
//tv-mode
|
||||||
CMenuForwarder *tvswitch = new CMenuForwarder(LOCALE_MAINMENU_TVMODE, true, NULL, this, "tv", CRCInput::RC_red);
|
CMenuForwarder *tvswitch = new CMenuForwarder(LOCALE_MAINMENU_TVMODE, true, NULL, this, "tv", CRCInput::RC_red);
|
||||||
tvswitch->setHint(NEUTRINO_ICON_HINT_TVMODE, LOCALE_MENU_HINT_TVMODE);
|
tvswitch->setHint(NEUTRINO_ICON_HINT_TVMODE, LOCALE_MENU_HINT_TVMODE);
|
||||||
personalize.addItem(MENU_MAIN, tvswitch, &g_settings.personalize[SNeutrinoSettings::P_MAIN_TV_MODE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ITEM_OPTION, tvradio_switch); //observed
|
personalize.addItem(MENU_MAIN, tvswitch, &g_settings.personalize[SNeutrinoSettings::P_MAIN_TV_MODE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ITEM_OPTION, tvradio_switch, DCOND_MODE_TV | DCOND_MODE_TS); //observed
|
||||||
|
|
||||||
//radio-mode
|
//radio-mode
|
||||||
CMenuForwarder *radioswitch = new CMenuForwarder(LOCALE_MAINMENU_RADIOMODE, true, NULL, this, "radio", CRCInput::RC_green);
|
CMenuForwarder *radioswitch = new CMenuForwarder(LOCALE_MAINMENU_RADIOMODE, true, NULL, this, "radio", CRCInput::RC_green);
|
||||||
radioswitch->setHint(NEUTRINO_ICON_HINT_RADIOMODE, LOCALE_MENU_HINT_RADIOMODE);
|
radioswitch->setHint(NEUTRINO_ICON_HINT_RADIOMODE, LOCALE_MENU_HINT_RADIOMODE);
|
||||||
personalize.addItem(MENU_MAIN, radioswitch, &g_settings.personalize[SNeutrinoSettings::P_MAIN_RADIO_MODE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ITEM_OPTION, tvradio_switch); //observed
|
personalize.addItem(MENU_MAIN, radioswitch, &g_settings.personalize[SNeutrinoSettings::P_MAIN_RADIO_MODE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ITEM_OPTION, tvradio_switch, DCOND_MODE_RADIO | DCOND_MODE_TS); //observed
|
||||||
}
|
}
|
||||||
|
|
||||||
//timer
|
//timer
|
||||||
@@ -237,12 +237,12 @@ void CNeutrinoApp::InitMenuMain()
|
|||||||
// settings, also as pin protected option in personalize menu, as a result of parameter value CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION
|
// settings, also as pin protected option in personalize menu, as a result of parameter value CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION
|
||||||
mf = new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, &personalize.getWidget(MENU_SETTINGS)/**settings**/);
|
mf = new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, &personalize.getWidget(MENU_SETTINGS)/**settings**/);
|
||||||
mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_SETTINGS);
|
mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_SETTINGS);
|
||||||
personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SETTINGS], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION);
|
personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SETTINGS], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION, NULL, DCOND_MODE_TS);
|
||||||
|
|
||||||
// service, also as pin protected option in personalize menu, as a result of parameter value CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION
|
// service, also as pin protected option in personalize menu, as a result of parameter value CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION
|
||||||
mf = new CMenuForwarder(LOCALE_MAINMENU_SERVICE, true, NULL, &personalize.getWidget(MENU_SERVICE));
|
mf = new CMenuForwarder(LOCALE_MAINMENU_SERVICE, true, NULL, &personalize.getWidget(MENU_SERVICE));
|
||||||
mf->setHint(NEUTRINO_ICON_HINT_SERVICE, LOCALE_MENU_HINT_SERVICE);
|
mf->setHint(NEUTRINO_ICON_HINT_SERVICE, LOCALE_MENU_HINT_SERVICE);
|
||||||
personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SERVICE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION);
|
personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SERVICE], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION, NULL, DCOND_MODE_TS);
|
||||||
|
|
||||||
//separator
|
//separator
|
||||||
personalize.addSeparator(MENU_MAIN);
|
personalize.addSeparator(MENU_MAIN);
|
||||||
|
Reference in New Issue
Block a user