Merge branch 'master' into pu/mp

Origin commit data
------------------
Branch: ni/coolstream
Commit: 4b8cf23d70
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2017-10-16 (Mon, 16 Oct 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2017-10-16 13:17:17 +02:00
20 changed files with 360 additions and 423 deletions

View File

@@ -135,19 +135,9 @@ void CBEBouquetWidget::paintItems()
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page);
}
void CBEBouquetWidget::paintBody()
{
PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON);
}
void CBEBouquetWidget::paintHead()
{
header.setCaption(LOCALE_BOUQUETLIST_HEAD);
header.setIcon(NEUTRINO_ICON_SETTINGS);
header.setDimensionsAll(x, y, width, header_height);
header.setCorner(RADIUS_LARGE, CORNER_TOP);
header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true);
header.paint(CC_SAVE_SCREEN_NO);
CBEGlobals::paintHead(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), NEUTRINO_ICON_SETTINGS);
}
const struct button_label CBEBouquetWidgetButtons[] =
@@ -164,14 +154,7 @@ void CBEBouquetWidget::paintFoot()
{
size_t numbuttons = sizeof(CBEBouquetWidgetButtons)/sizeof(CBEBouquetWidgetButtons[0]);
footer.setCorner(RADIUS_LARGE, CORNER_BOTTOM);
footer.enableShadow(CC_SHADOW_ON, -1, true);
footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEBouquetWidgetButtons);
}
void CBEBouquetWidget::hide()
{
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
CBEGlobals::paintFoot(numbuttons, CBEBouquetWidgetButtons);
}
void CBEBouquetWidget::updateSelection(unsigned int newpos)
@@ -213,6 +196,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
parent->hide();
Bouquets = &g_bouquetManager->Bouquets;
init();
paintHead();
paintBody();
@@ -221,7 +205,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
bouquetsChanged = false;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
bool loop = true;
while (loop)
@@ -229,7 +213,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
if (msg <= CRCInput::RC_MaxRC)
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel))
{
@@ -364,7 +348,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
paintFoot();
paintItems();
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
}
}
else if (state == beMoving)
@@ -396,6 +380,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
}
}
hide();
ResetModules();
return res;
}

View File

@@ -64,11 +64,11 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp
bool bouquetsChanged;
void paintHead();
void paintBody();
void paintItem(int pos);
void paintItems();
void paintFoot();
void hide();
void updateSelection(unsigned int newpos);
void deleteBouquet();
@@ -85,6 +85,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp
void discardChanges();
std::string inputName(const char* const defaultName, const neutrino_locale_t caption);
std::string getInfoText(int /*index*/) { return ""; };
public:
CBEBouquetWidget();
@@ -92,6 +93,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp
//CZapitClient::BouquetList Bouquets;
BouquetList * Bouquets;
int exec(CMenuTarget* parent, const std::string & actionKey);
void hide(){CBEGlobals::hide();}
};
#endif

View File

@@ -55,8 +55,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
caption = Caption;
bouquet = Bouquet;
mode = CZapitClient::MODE_TV;
dline = NULL;
ibox = NULL;
Channels = NULL;
int iw, ih;
@@ -71,13 +70,10 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &iw, &ih);
status_icon_width = std::max(status_icon_width, iw);
header.addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT);
}
CBEChannelWidget::~CBEChannelWidget()
{
delete dline;
delete ibox;
}
void CBEChannelWidget::paintItem(int pos)
@@ -143,20 +139,12 @@ void CBEChannelWidget::paintItems()
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page);
}
void CBEChannelWidget::paintBody()
{
PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON);
}
void CBEChannelWidget::paintHead()
{
header.setCaption(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"));
header.setIcon(NULL); // trick the cc-header
header.setIcon(mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO);
header.setDimensionsAll(x, y, width, header_height);
header.setCorner(RADIUS_LARGE, CORNER_TOP);
header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true);
header.paint(CC_SAVE_SCREEN_NO);
if (!header->isPainted())
header->addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT);
CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"),
mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO);
}
const struct button_label CBEChannelWidgetButtons[] =
@@ -174,66 +162,7 @@ void CBEChannelWidget::paintFoot()
{
size_t numbuttons = sizeof(CBEChannelWidgetButtons)/sizeof(CBEChannelWidgetButtons[0]);
footer.enableShadow(CC_SHADOW_ON, -1, true);
footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelWidgetButtons);
}
void CBEChannelWidget::paintDetails(int pos, int current)
{
int xpos = x - DETAILSLINE_WIDTH;
int ypos1 = y + header_height + pos*item_height;
int ypos2 = y + height - info_height - OFFSET_SHADOW;
int ypos1a = ypos1 + (item_height/2);
int ypos2a = ypos2 + (info_height/2);
if (dline)
dline->kill();
if (pos >= 0)
{
if (dline == NULL)
dline = new CComponentsDetailsLine();
if (dline)
{
dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2);
dline->paint(CC_SAVE_SCREEN_NO);
}
if (ibox == NULL)
{
ibox = new CComponentsInfoBox();
if (ibox)
{
ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
ibox->setTextColor(COL_MENUCONTENTDARK_TEXT);
ibox->setFrameThickness(FRAME_WIDTH_MIN);
ibox->setCorner(RADIUS_LARGE);
ibox->enableShadow(CC_SHADOW_ON);
}
}
if (ibox)
{
if (ibox->isPainted())
ibox->hide();
ibox->setDimensionsAll(x, ypos2, width, info_height);
ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font);
ibox->paint(CC_SAVE_SCREEN_NO);
}
}
}
void CBEChannelWidget::hide()
{
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
if (dline)
dline->kill();
if (ibox)
ibox->kill();
CBEGlobals::paintFoot(numbuttons, CBEChannelWidgetButtons);
}
std::string CBEChannelWidget::getInfoText(int index)
@@ -317,7 +246,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
channelsChanged = false;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
bool loop = true;
while (loop)
@@ -325,7 +254,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
if (msg <= CRCInput::RC_MaxRC)
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel))
{
@@ -362,7 +291,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
if (state == beDefault)
addChannel();
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
}
else if (msg == CRCInput::RC_yellow)
{
@@ -485,7 +414,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey*
CNeutrinoApp::getInstance()->handleMsg(msg, data);
}
}
hide();
CBEGlobals::hide();
return res;
}

View File

@@ -38,9 +38,6 @@
class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelpers
{
private:
CComponentsDetailsLine *dline;
CComponentsInfoBox *ibox;
enum state_
{
beDefault,
@@ -60,12 +57,12 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp
unsigned int bouquet;
void paintHead();
void paintBody();
void paintItem(int pos);
void paintItems();
void paintFoot();
void paintDetails(int pos, int current);
void hide();
void updateSelection(unsigned int newpos);
void deleteChannel();
@@ -88,6 +85,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp
//CZapitClient::BouquetChannelList Channels;
ZapitChannelList * Channels;
int exec(CMenuTarget* parent, const std::string & actionKey);
void hide(){CBEGlobals::hide();}
bool hasChanged();
unsigned int getBouquet() { return bouquet; };
};

View File

@@ -48,8 +48,6 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap
liststart = 0;
channellist_sort_mode = SORT_ALPHA;
bouquetChannels = NULL;
dline = NULL;
ibox = NULL;
int iw, ih;
action_icon_width = 0;
@@ -64,8 +62,6 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap
CBEChannelSelectWidget::~CBEChannelSelectWidget()
{
delete dline;
delete ibox;
}
void CBEChannelSelectWidget::paintItem(int pos)
@@ -128,20 +124,10 @@ void CBEChannelSelectWidget::paintItems()
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page);
}
void CBEChannelSelectWidget::paintBody()
{
PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON);
}
void CBEChannelSelectWidget::paintHead()
{
header.setCaption(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"));
header.setIcon(NULL); // trick the cc-header
header.setIcon(mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO);
header.setDimensionsAll(x, y, width, header_height);
header.setCorner(RADIUS_LARGE, CORNER_TOP);
header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true);
header.paint(CC_SAVE_SCREEN_NO);
CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"),
mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO);
}
struct button_label CBEChannelSelectButtons[] =
@@ -180,66 +166,7 @@ void CBEChannelSelectWidget::paintFoot()
const short numbuttons = sizeof(CBEChannelSelectButtons)/sizeof(CBEChannelSelectButtons[0]);
footer.enableShadow(CC_SHADOW_ON, -1, true);
footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelSelectButtons);
}
void CBEChannelSelectWidget::paintDetails(int pos, int current)
{
int xpos = x - DETAILSLINE_WIDTH;
int ypos1 = y + header_height + pos*item_height;
int ypos2 = y + height - info_height - OFFSET_SHADOW;
int ypos1a = ypos1 + (item_height/2);
int ypos2a = ypos2 + (info_height/2);
if (dline)
dline->kill();
if (pos >= 0)
{
if (dline == NULL)
dline = new CComponentsDetailsLine();
if (dline)
{
dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2);
dline->paint(CC_SAVE_SCREEN_NO);
}
if (ibox == NULL)
{
ibox = new CComponentsInfoBox();
if (ibox)
{
ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
ibox->setTextColor(COL_MENUCONTENTDARK_TEXT);
ibox->setFrameThickness(FRAME_WIDTH_MIN);
ibox->setCorner(RADIUS_LARGE);
ibox->enableShadow(CC_SHADOW_ON);
}
}
if (ibox)
{
if (ibox->isPainted())
ibox->hide();
ibox->setDimensionsAll(x, ypos2, width, info_height);
ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font);
ibox->paint(CC_SAVE_SCREEN_NO);
}
}
}
void CBEChannelSelectWidget::hide()
{
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
if (dline)
dline->kill();
if (ibox)
ibox->kill();
CBEGlobals::paintFoot(numbuttons, CBEChannelSelectButtons);
}
std::string CBEChannelSelectWidget::getInfoText(int index)
@@ -318,7 +245,7 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & /*acti
paintFoot();
paintItems();
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
channelChanged = false;
bool loop = true;
@@ -327,7 +254,7 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & /*acti
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
if (msg <= CRCInput::RC_MaxRC)
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) || (msg == CRCInput::RC_home))
{

View File

@@ -37,9 +37,6 @@
class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CListHelpers
{
private:
CComponentsDetailsLine *dline;
CComponentsInfoBox *ibox;
enum {
SORT_ALPHA,
SORT_FREQ,
@@ -60,12 +57,12 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi
std::string caption;
void paintHead();
void paintBody();
void paintItem(int pos);
void paintItems();
void paintFoot();
void paintDetails(int pos, int current);
void hide();
void updateSelection(unsigned int newpos);
void sortChannels();
@@ -80,6 +77,7 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi
ZapitChannelList Channels;
ZapitChannelList * bouquetChannels;
int exec(CMenuTarget* parent, const std::string & actionKey);
void hide(){CBEGlobals::hide();}
bool hasChanged();
};

View File

@@ -30,21 +30,37 @@
#include "bouqueteditor_globals.h"
class CFrameBuffer;
CBEGlobals::CBEGlobals()
{
frameBuffer = CFrameBuffer::getInstance();
timeout_ptr = &g_settings.timing[SNeutrinoSettings::TIMING_MENU];
header = NULL;
footer = NULL;
dline = NULL;
ibox = NULL;
init();
}
void CBEGlobals::init()
{
item_font = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST];
info_font = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR];
width = frameBuffer->getScreenWidthRel();
height = frameBuffer->getScreenHeightRel();
header_height = header.getHeight();
if (!header)
header = new CComponentsHeader();
header_height = header->getHeight();
item_height = item_font->getHeight();
footer_height = footer.getHeight();
if (!footer)
footer = new CComponentsFooter();
footer_height = footer->getHeight();
info_height = 2*info_font->getHeight() + 2*OFFSET_INNER_SMALL;
items_count = (height - header_height - footer_height - OFFSET_INTER - info_height - 2*OFFSET_SHADOW) / item_height;
@@ -53,10 +69,110 @@ CBEGlobals::CBEGlobals()
x = getScreenStartX(width);
y = getScreenStartY(height);
timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU];
}
CBEGlobals::~CBEGlobals()
{
ResetModules();
}
void CBEGlobals::ResetModules()
{
if (dline){
delete dline; dline = NULL;
}
if (ibox){
delete ibox; ibox = NULL;
}
if (header){
delete header; header = NULL;
}
if (footer){
delete footer; footer = NULL;
}
}
void CBEGlobals::paintDetails(int pos, int current)
{
int xpos = x - DETAILSLINE_WIDTH;
int ypos1 = y + header_height + pos*item_height;
int ypos2 = y + height - info_height - OFFSET_SHADOW;
int ypos1a = ypos1 + (item_height/2);
int ypos2a = ypos2 + (info_height/2);
if (pos >= 0)
{
if (dline == NULL)
dline = new CComponentsDetailsLine();
dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2);
dline->paint();
if (ibox == NULL)
ibox = new CComponentsInfoBox();
ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
ibox->setTextColor(COL_MENUCONTENTDARK_TEXT);
ibox->setFrameThickness(FRAME_WIDTH_MIN);
ibox->setCorner(RADIUS_LARGE);
ibox->enableShadow();
ibox->enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_MENUFOOT_PLUS_0, g_settings.theme.menu_Hint_gradient_direction);// COL_MENUFOOT_PLUS_0 is default footer color
ibox->setDimensionsAll(x, ypos2, width, info_height);
ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font);
ibox->paint();
}
else
{
if (dline)
{
if (dline->isPainted())
dline->hide();
}
if (ibox)
{
if (ibox->isPainted())
ibox->hide();
}
}
}
void CBEGlobals::paintBody()
{
PaintBoxRel(x, y + header_height, width, body_height, COL_MENUCONTENT_PLUS_0, RADIUS_NONE, CORNER_NONE, CC_SHADOW_ON);
}
void CBEGlobals::hide()
{
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
killDetails();
}
void CBEGlobals::killDetails()
{
if (dline)
dline->kill();
if (ibox)
ibox->kill();
}
void CBEGlobals::paintFoot(const size_t& label_count, const struct button_label * const content)
{
if (!footer)
footer = new CComponentsFooter();
footer->setCorner(RADIUS_LARGE, CORNER_BOTTOM);
footer->enableShadow(CC_SHADOW_ON, -1, true);
footer->paintButtons(x, y + header_height + body_height, width, footer_height, label_count, content);
}
void CBEGlobals::paintHead(const std::string& Caption, const char* Icon)
{
if (!header)
header = new CComponentsHeader();
header->setCaption(Caption);
header->setIcon(Icon);
header->setDimensionsAll(x, y, width, header_height);
header->setCorner(RADIUS_LARGE, CORNER_TOP);
header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true);
header->paint(CC_SAVE_SCREEN_NO);
}

View File

@@ -25,13 +25,14 @@
#include <driver/fontrenderer.h>
#include <gui/components/cc.h>
class CFrameBuffer;
class CBEGlobals
{
public:
CBEGlobals();
~CBEGlobals();
protected:
CComponentsDetailsLine *dline;
CComponentsInfoBox *ibox;
CComponentsHeader *header;
CComponentsFooter *footer;
CFrameBuffer *frameBuffer;
@@ -46,18 +47,31 @@ class CBEGlobals
int footer_height;
int info_height;
CComponentsHeader header;
CComponentsFooter footer;
unsigned int items_count;
Font *item_font;
Font *info_font;
int action_icon_width;
int status_icon_width;
int timeout;
unsigned int items_count;
int* timeout_ptr;
void init();
void paintHead(const std::string& Caption, const char* Icon);
void paintBody();
void paintFoot(const size_t& label_count, const struct button_label * const content);
virtual std::string getInfoText(int index) = 0;
void paintDetails(int pos, int current);
void killDetails();
public:
CBEGlobals();
virtual ~CBEGlobals();
void hide();
void ResetModules();
};
#endif

View File

@@ -89,7 +89,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
cc_body_gradient_enable = cc_body_gradient_enable_old = CC_COLGRAD_OFF/*g_settings.theme.menu_ButtonBar_gradient*/; //TODO: not complete implemented at the moment
cc_body_gradient_direction = CFrameBuffer::gradientVertical;
cc_body_gradient_mode = CColorGradient::gradientDark2Light;
btn_auto_frame_col = false;
btn_auto_frame_col = false; //TODO: currently global disabled
corner_rad = RADIUS_LARGE;
corner_type = CORNER_BOTTOM;
@@ -106,103 +106,132 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width)
{
/* clean up before init*/
/* clean up before init */
if (btn_container)
btn_container->clear();
if (label_count == 0)
return;
/* set general available full basic space for button chain,
* in this case this is footer width
*/
int w_chain = width - 2*cch_offset;
/* global increments */
size_t i = 0;
size_t l_count = label_count;
/* calculate current available space for button container depends
* of already enbedded footer objects.
* If already existing some items then subtract those width from footer width.
* ...so we have the possible usable size for button container.
/*
* Evaluate parameter 'chain_width':
*
* Set usable basic space for button container,
* Default width this is footer width minus offset left and right of button container (btn_container).
*/
int w_container = max(0, width - 2*cch_offset);
/*
* Calculate current available space for button container depends of already embedded footer objects.
* If already existing some items then subtract those width from footer width.
* ...so we have the maximal possible usable size for button container.
*/
if(!v_cc_items.empty()){
for (size_t j= 0; j< size(); j++)
w_chain -= getCCItem(j)->getWidth();
for (i = 0; i< size(); i++){
if (getCCItem(i) != btn_container) // avoid to point on button container itself!
w_container -= getCCItem(i)->getWidth();
}
w_container = max(0, w_container);
}
/* On defined parameter chain_width
* calculate current available space for button container depends
* of passed chain with parameter
* Consider that chain_width is not too large.
/*
* On defined parameter chain_width (means width of button container),
* compare and if required recalculate current available space for button container depends of passed chain with parameter.
* Consider that chain_width is not too large. In this case parameter chain_width will be ignored.
*/
if (chain_width > 0 && chain_width <= w_chain){
if (chain_width <= w_chain){
w_chain = chain_width;
if (chain_width){
if (chain_width <= w_container){
w_container = chain_width;
}else{
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFooter]\t[%s - %d], NOTE: parameter chain_width is too large, defined value = %d, fallback to maximal value = %d => \033[0m\n",
__func__, __LINE__, chain_width, w_container);
}
}
/* initialize button container (chain object): this contains all passed (as interleaved) button label items,
* With this container we can work inside footer as primary container (in this context '=this') and the parent for the button label container (chain object).
* Button label container (chain object) itself is concurrent to the parent object for button objects.
/*
* Evaluate parameter 'label_width':
*
* button label width is auto generated, if no label width is defined.
* If is parameter label_width too large, we use maximal possible value.
*/
int w_tmp = w_container - cch_offset * ((int)l_count-1);
int w_btn = w_tmp / (int)l_count;
if (label_width && (label_width <= w_btn))
w_btn = label_width;
w_container = min(w_container, (w_btn * (int)l_count) + cch_offset * ((int)l_count-1));
/*
* Initialize button container: this object contains all passed button label items,
* Button container represents the parent for button labels and is working as single child object inside footer.
*/
int dist = height/2-cch_offset;
int h_chain = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
int x_chain = width/2 - w_chain/2;
int y_chain = height/2 - h_chain/2;
int h_container = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
int x_container = width/2 - w_container/2; //FIXME: only centered position, other items will be overpainted
int y_container = height/2 - h_container/2;
if (cch_icon_obj)
x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset;
x_container = cch_offset+cch_icon_obj->getWidth()+cch_offset;
if (btn_container == NULL){
btn_container = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
btn_container = new CComponentsFrmChain(x_container, y_container, w_container, h_container, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
btn_container->setAppendOffset(0, 0);
btn_container->setCorner(this->corner_rad, this->corner_type);
//btn_container->setCorner(this->corner_rad, this->corner_type);
btn_container->doPaintBg(false);
}
/* Calculate usable width of button labels inside button object container
* related to available width of chain object and passed
* label_width parameter.
* Parameter is used as minimal value and will be reduced
* if it is too large.
* Too small label_width parameter will be compensated by
* button objects itself.
/*
* Reassign current available container width after initialized button labels.
*/
int w_offset = int((label_count-1)*cch_offset);
int w_btn = btn_container->getWidth()/label_count - w_offset;
if (label_width){
int w_label = label_width;
int w_defined = int(label_width*label_count);
int w_max = btn_container->getWidth() - w_offset;
while (w_defined > w_max){
w_label--;
w_defined = int(w_label*label_count) - w_offset;
}
w_btn = w_label;
}
w_container = btn_container->getWidth();
/* generate button objects passed from button label content
* with default width to chain object.
/*
* Primary x postion of buttons inside button container is fix,
* height and y position of button labels are calculated by button container
* dimensions and have a fix value.
*/
vector<CComponentsItem*> v_btns;
int h_btn = /*(ccf_enable_button_bg ? */btn_container->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
for (size_t i= 0; i< label_count; i++){
int x_btn = 0;
int h_btn = btn_container->getHeight()- 2*fr_thickness - ccf_button_shadow_width;
int y_btn = btn_container->getHeight()/2 - h_btn/2;
/*
* Init button label objects
*/
for (i = 0; i < l_count; i++){
/*
* init button label face values
*/
string txt = content[i].locale == NONEXISTANT_LOCALE ? content[i].text : g_Locale->getText(content[i].locale);
string icon_name = string(content[i].button);
//ignore item, if no text and icon are defined;
/*
* Ignore item, if no text and no icon is defined.
*/
if (txt.empty() && icon_name.empty()){
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] ignore item [%zu], no icon and text defined!\n", __func__, __LINE__, i);
//l_count -= 1;
dprintf(DEBUG_NORMAL, "[CComponentsFooter]\t[%s - %d]\tignore item [%d], no icon and text defined!\n", __func__, __LINE__, i);
continue;
}
int y_btn = btn_container->getHeight()/2 - h_btn/2;
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] y_btn [%d] ccf_button_shadow_width [%d]\n", __func__, __LINE__, y_btn, ccf_button_shadow_width);
CComponentsButton *btn = new CComponentsButton(0, y_btn, w_btn, h_btn, txt, icon_name, NULL, false, true, ccf_enable_button_shadow);
/*
* Create all button label objects and add to button container
* Set properties, like position, font, key values, coler etc...
*/
CComponentsButton *btn = new CComponentsButton(x_btn, y_btn, w_btn, h_btn, txt, icon_name, btn_container, false, true, ccf_enable_button_shadow);
btn->setButtonFont(ccf_btn_font);
btn->doPaintBg(ccf_enable_button_bg);
x_btn += btn_container->getCCItem(i)->getWidth();
x_btn += cch_offset;
btn->setButtonDirectKeys(content[i].directKeys);
btn->setButtonResult(content[i].btn_result);
btn->setButtonAlias(content[i].btn_alias);
btn->setButtonFont(ccf_btn_font);
//set button frames to icon color, predefined for available color buttons
btn->doPaintBg(true);
/*
* Set button frames to icon color, predefined for available color buttons
*/
if (btn_auto_frame_col){
fb_pixel_t f_col = btn->getColorFrame();
if (icon_name == NEUTRINO_ICON_BUTTON_RED)
@@ -215,35 +244,47 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
f_col = COL_DARK_BLUE;
btn->setColorFrame(f_col);
}
v_btns.push_back(btn);
if (w_btn < btn->getWidth()){
btn->setWidth(w_btn);
btn->setButtonFont(NULL);
}
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%u] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), (uint32_t)i, btn->getWidth(), w_btn, btn_container->getWidth());
}
/* add generated button objects to chain object.
/*
* Get the current required space for button labels after adding of all buttons.
* This is required to check possible changed dimensions after init and
* could be required if user has changed settings like font scale, font size or similar setting while runtime or
* reserved size of footer is too small. It is recommended to allocate enough space from the outset.
*/
if (!v_btns.empty()){
/*add all buttons into button container*/
btn_container->addCCItem(v_btns);
int w_cont_used = 0;
size_t c_btns = btn_container->size();
for (i = 0; i < c_btns; i++){
w_cont_used += btn_container->getCCItem(i)->getWidth();
}
w_cont_used += cch_offset * (l_count -1);
if (w_cont_used > w_container){
/*
* recalculate width of labels
*/
int w_used_tmp = w_cont_used;
int w_btn_tmp = w_btn;
if (w_used_tmp >= w_container){
//w_btn_tmp = w_btn;
for (i = 0; i < c_btns; i++){
w_btn_tmp -= c_btns;
btn_container->getCCItem(i)->setWidth(w_btn_tmp); // value = 0 forces recalculation, refresh is required
static_cast<CComponentsButton*>(btn_container->getCCItem(i))->Refresh();
w_used_tmp -= max(0, btn_container->getCCItem(i)->getWidth());
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFooter]\t[%s - %d] item %d -> w_used_tmp [%d] :: w_btn_tmp [%d] w_container = %d\033[0m\n", __func__, __LINE__, (int)i, w_used_tmp, w_btn_tmp, w_container);
}
}
/* set position of labels, as centered inside button container*/
int w_chain_used = 0;
for (size_t a= 0; a< btn_container->size(); a++)
w_chain_used += btn_container->getCCItem(a)->getWidth();
w_chain_used += (btn_container->size()-1)*cch_offset;
int x_btn = btn_container->getWidth()/2 - w_chain_used/2;
btn_container->getCCItem(0)->setXPos(x_btn);
for (size_t c= 1; c< btn_container->size(); c++){
x_btn += btn_container->getCCItem(c-1)->getWidth()+ cch_offset;
btn_container->getCCItem(c)->setXPos(x_btn);
/*
* Trim position of labels, after possible changed width of button labels
*/
x_btn = 0;
btn_container->front()->setXPos(x_btn);
for (i = 1; i < c_btns; i++){
x_btn += btn_container->getCCItem(i-1)->getWidth() + cch_offset;;
if (i < c_btns)
btn_container->getCCItem(i)->setXPos(x_btn);
}
}
}

View File

@@ -650,6 +650,9 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
ddmode is always 1 ("CH1/CH2").
*/
audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode);
std::string desc = "N/A";
if (!g_RemoteControl->current_PIDs.APIDs.empty())
desc = g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].desc;
if (type == AUDIO_FMT_MPEG || type == AUDIO_FMT_MP3)
{
@@ -661,9 +664,9 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
"single_ch"
};
int max_mode = sizeof(mpegmodes) / sizeof(mpegmodes[0]);
snprintf(buf, sizeof(buf), "%s %s (%d)",type == AUDIO_FMT_MPEG ? "MPEG":"MP3",
snprintf(buf, sizeof(buf), "MPEG %s (%d) (%s)",
(mode > max_mode) ? "unk" : mpegmodes[mode],
freq);
freq, desc.c_str());
}
else if (type == AUDIO_FMT_DOLBY_DIGITAL || type == AUDIO_FMT_DD_PLUS)
{
@@ -679,10 +682,10 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
"L/C/R/SL/SR"
};
int max_mode = sizeof(ddmodes) / sizeof(ddmodes[0]);
snprintf(buf, sizeof(buf), "%s %s (%d)",
snprintf(buf, sizeof(buf), "%s %s (%d) (%s)",
(type == AUDIO_FMT_DOLBY_DIGITAL) ? "DD" : "DD+",
(mode > max_mode) ? "unk" : ddmodes[mode],
freq);
freq, desc.c_str());
}
else if (type == AUDIO_FMT_AAC || type == AUDIO_FMT_AAC_PLUS)
{
@@ -700,16 +703,16 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos)
"Dual-Mono"
};
int max_mode = sizeof(aacmodes) / sizeof(aacmodes[0]);
snprintf(buf, sizeof(buf), "%s %s (%d)",
snprintf(buf, sizeof(buf), "%s %s (%d) (%s)",
(type == AUDIO_FMT_AAC) ? "AAC" : "AAC+",
(mode > max_mode) ? "unk" : aacmodes[mode],
freq);
freq, desc.c_str());
}
else
{
snprintf(buf, sizeof(buf), "%s (%d)",
snprintf(buf, sizeof(buf), "%s (%d) (%s)",
g_Locale->getText(LOCALE_STREAMINFO_AUDIOTYPE_UNKNOWN),
freq);
freq, desc.c_str());
}
g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT);

View File

@@ -661,7 +661,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
footer->setIcon(NEUTRINO_ICON_INFO);
//add button labels with conventional button label struct
footer->setButtonLabels(TestButtons, TestButtonsCount, 0, footer->getWidth()/TestButtonsCount);
footer->setButtonLabels(TestButtons, TestButtonsCount, 1000, footer->getWidth()/TestButtonsCount);
//also possible: use directly button name and as 2nd parameter string or locale as text
// footer->setButtonLabel(NULL, "Test", 0, 250);

View File

@@ -657,8 +657,8 @@ struct button_label TimerListButtons[] =
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW },
{ NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD },
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY },
{ NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE },
{ NEUTRINO_ICON_BUTTON_PLAY , NONEXISTANT_LOCALE }
{ NEUTRINO_ICON_BUTTON_INFO_SMALL, LOCALE_TIMERLIST_INFO },
{ NEUTRINO_ICON_BUTTON_PLAY , LOCALE_TIMERLIST_SEND_TIMER }
};
// int to match the type in paintButtons
int TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]);
@@ -1412,9 +1412,9 @@ void CTimerList::paintFoot()
footer.enableShadow(CC_SHADOW_ON, -1, true);
if (timerlist.empty())
footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, 2, &(TimerListButtons[1]), width/(2+1));
footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, 2, &(TimerListButtons[1]));
else
footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, c, TimerListButtons, width/(c-1));
footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, width, footer_height, c, TimerListButtons);
}
void CTimerList::paint()

View File

@@ -553,6 +553,7 @@ void CUpnpBrowserGui::selectDevice()
{
m_folderplay = false;
selectItem("0");
m_frameBuffer->Clear();
refresh=true;
}
else if (msg == CRCInput::RC_blue)

View File

@@ -1552,7 +1552,7 @@ void CMenuWidget::setFooter(const struct button_label *_fbutton_labels, const in
if (!footer)
footer = new CComponentsFooter(x, y + height, width + scrollbar_width, 0, 0, NULL, CC_SHADOW_ON);
footer->setWidth(width + scrollbar_width);
footer->setButtonLabels(fbutton_labels, fbutton_count, 0, width/fbutton_count);
footer->setButtonLabels(fbutton_labels, fbutton_count);
footer_height = footer->getHeight();
footer_width = footer->getWidth();
}else{

View File

@@ -2348,6 +2348,7 @@ typedef enum
LOCALE_TIMERLIST_CHANNEL,
LOCALE_TIMERLIST_CHANNELSELECT,
LOCALE_TIMERLIST_DELETE,
LOCALE_TIMERLIST_INFO,
LOCALE_TIMERLIST_MENUMODIFY,
LOCALE_TIMERLIST_MENUNEW,
LOCALE_TIMERLIST_MESSAGE,
@@ -2383,6 +2384,7 @@ typedef enum
LOCALE_TIMERLIST_REPEATCOUNT_HINT_1,
LOCALE_TIMERLIST_REPEATCOUNT_HINT_2,
LOCALE_TIMERLIST_SAVE,
LOCALE_TIMERLIST_SEND_TIMER,
LOCALE_TIMERLIST_STANDBY,
LOCALE_TIMERLIST_STANDBY_OFF,
LOCALE_TIMERLIST_STANDBY_ON,

View File

@@ -2348,6 +2348,7 @@ const char * locale_real_names[] =
"timerlist.channel",
"timerlist.channelselect",
"timerlist.delete",
"timerlist.info",
"timerlist.menumodify",
"timerlist.menunew",
"timerlist.message",
@@ -2383,6 +2384,7 @@ const char * locale_real_names[] =
"timerlist.repeatcount.hint_1",
"timerlist.repeatcount.hint_2",
"timerlist.save",
"timerlist.send.timer",
"timerlist.standby",
"timerlist.standby.off",
"timerlist.standby.on",