Merge remote-tracking branch 'uncool/cst-next'

This need buildfixes and some functional updates...
This commit is contained in:
Stefan Seyfried
2015-12-13 17:41:55 +01:00
320 changed files with 21291 additions and 13199 deletions

View File

@@ -107,7 +107,7 @@ void CColorChooser::setColor()
int w_col = mheight*4;
int h_col = mheight*4-10;
if ((g_settings.gradiant) && ((chooser_gradient == gradient_head_body) || (chooser_gradient == gradient_head_text))) {
if ((g_settings.theme.menu_Head_gradient) && ((chooser_gradient == gradient_head_body) || (chooser_gradient == gradient_head_text))) {
CComponentsHeader header(x_col, y_col+((h_col-hheight)/2), w_col, hheight, "Head");
if (chooser_gradient == gradient_head_body)
header.setColorBody(col);
@@ -270,7 +270,7 @@ void CColorChooser::paint()
for (int i = 0; i < 4; i++)
paintSlider(x + 10, y + hheight + mheight * i, value[i], colorchooser_names[i], iconnames[i], (i == 0));
if ((!g_settings.gradiant) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) {
if ((!g_settings.theme.menu_Head_gradient) || ((chooser_gradient != gradient_head_body) && (chooser_gradient != gradient_head_text))) {
//color preview
frameBuffer->paintBoxRel(x+offset+160,y+hheight+5, mheight*4, mheight*4-10, COL_MENUHEAD_PLUS_0);
frameBuffer->paintBoxRel(x+offset+162,y+hheight+2+5, mheight*4-4 ,mheight*4-4-10, 254);

View File

@@ -186,7 +186,8 @@
#define NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE "mute_zap_gray"
/* menu hints */
#define NEUTRINO_ICON_HINT_BACK "hint_back"
#define NEUTRINO_ICON_HINT_BACK "hint_back"
#define NEUTRINO_ICON_HINT_NEXT "hint_next"
/* main menu */
#define NEUTRINO_ICON_HINT_TVRADIO_SWITCH "hint_tvradio_switch"
#define NEUTRINO_ICON_HINT_TVMODE "hint_tvmode"
@@ -292,6 +293,4 @@
#define NEUTRINO_ICON_BUTTON_LONGPRESS "longpress"
#define NEUTRINO_ICON_VARPATH "/var/share/tuxbox/neutrino/icons/" //alternatively path for user-defined icons
#endif /* __gui_widget_icons_h__ */

View File

@@ -207,7 +207,7 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
int new_selected = selected + step;
if (new_selected >= (int) getItemCount()) {
if ((getItemCount() - listmaxshow -1 < selected) && (selected != (getItemCount() - 1)) && (step != 1))
if (((getItemCount() - listmaxshow -1 < selected) && (step != 1)) || (selected != (getItemCount() - 1)))
new_selected = getItemCount() - 1;
else if (((getItemCount() / listmaxshow) + 1) * listmaxshow == getItemCount() + listmaxshow) // last page has full entries
new_selected = 0;

View File

@@ -38,7 +38,7 @@
#include <gui/pluginlist.h>
#include <gui/widget/stringinput.h>
#include <neutrino_menue.h>
#include <driver/fade.h>
#include <driver/display.h>
#include <system/helpers.h>
@@ -493,7 +493,7 @@ CMenuWidget::CMenuWidget()
selected = -1;
iconOffset = 0;
offx = offy = 0;
from_wizard = false;
from_wizard = SNeutrinoSettings::WIZARD_OFF;
fade = true;
sb_width = 0;
savescreen = false;
@@ -562,11 +562,12 @@ void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widge
current_page = 0;
offx = offy = 0;
from_wizard = false;
from_wizard = SNeutrinoSettings::WIZARD_OFF;
fade = true;
savescreen = false;
background = NULL;
has_hints = false;
brief_hints = BRIEF_HINT_NO;
hint_painted = false;
hint_height = 0;
fbutton_count = 0;
@@ -966,7 +967,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
return retval;
}
void CMenuWidget::integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut)
void CMenuWidget::integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut, bool enabled)
{
bool separatorline = false;
unsigned int number_of_plugins = (unsigned int) g_PluginList->getNumberOfPlugins();
@@ -982,7 +983,7 @@ void CMenuWidget::integratePlugins(CPlugins::i_type_t integration, const unsigne
}
printf("[neutrino] integratePlugins: add %s\n", g_PluginList->getName(count));
neutrino_msg_t dk = (shortcut != CRCInput::RC_nokey) ? CRCInput::convertDigitToKey(sc++) : CRCInput::RC_nokey;
CMenuForwarder *fw_plugin = new CMenuForwarder(g_PluginList->getName(count), true, NULL, CPluginsExec::getInstance(), to_string(count).c_str(), dk);
CMenuForwarder *fw_plugin = new CMenuForwarder(g_PluginList->getName(count), enabled, NULL, CPluginsExec::getInstance(), to_string(count).c_str(), dk);
fw_plugin->setHint(g_PluginList->getHintIcon(count), g_PluginList->getDescription(count));
addItem(fw_plugin);
}
@@ -1009,15 +1010,20 @@ void CMenuWidget::hide()
void CMenuWidget::checkHints()
{
brief_hints = (brief_hints || (from_wizard == SNeutrinoSettings::WIZARD_START));
GenericMenuBack->setHint("", NONEXISTANT_LOCALE);
GenericMenuNext->setHint("", NONEXISTANT_LOCALE);
for (unsigned int i= 0; i< items.size(); i++) {
if(items[i]->hintIcon || items[i]->hint != NONEXISTANT_LOCALE || !items[i]->hintText.empty()) {
has_hints = true;
break;
}
}
if (has_hints)
GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK);
if (has_hints) {
GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, brief_hints ? LOCALE_MENU_HINT_BACK_BRIEF : LOCALE_MENU_HINT_BACK);
GenericMenuNext->setHint(NEUTRINO_ICON_HINT_NEXT, brief_hints ? LOCALE_MENU_HINT_NEXT_BRIEF : LOCALE_MENU_HINT_NEXT);
}
}
void CMenuWidget::calcSize()
@@ -1239,8 +1245,10 @@ void CMenuWidget::paintItems()
}
/*adds the typical menu intro with optional subhead, separator, back or cancel button and separatorline to menu*/
void CMenuWidget::addIntroItems(neutrino_locale_t subhead_text, neutrino_locale_t section_text, int buttontype)
void CMenuWidget::addIntroItems(neutrino_locale_t subhead_text, neutrino_locale_t section_text, int buttontype, bool brief_hint)
{
brief_hints = brief_hint;
if (subhead_text != NONEXISTANT_LOCALE)
addItem(new CMenuSeparator(CMenuSeparator::ALIGN_LEFT | CMenuSeparator::SUB_HEAD | CMenuSeparator::STRING, subhead_text));
@@ -1301,6 +1309,10 @@ void CMenuWidget::paintHint(int pos)
if (pos < 0 && !hint_painted)
return;
info_box->enableGradient(g_settings.theme.menu_Hint_gradient != 0);
info_box->set2ndColor(COL_INFOBAR_SHADOW_PLUS_1); // COL_INFOBAR_SHADOW_PLUS_1 is default footer color
if (hint_painted) {
/* clear detailsline line */
@@ -1356,7 +1368,7 @@ void CMenuWidget::paintHint(int pos)
info_box->setDimensionsAll(x, ypos2, iwidth, hint_height);
info_box->setFrameThickness(2);
info_box->removeLineBreaks(str);
info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]);
info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT], COL_MENUCONTENT_TEXT);
info_box->setCorner(RADIUS_LARGE);
info_box->syncSysColors();
info_box->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
@@ -1822,6 +1834,7 @@ int CMenuOptionChooser::exec(CMenuTarget*)
}
}
paint(true);
OnAfterChangeOption();
if(observ && !luaAction.empty()) {
if (optionValname)
wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, optionValname);
@@ -2169,7 +2182,7 @@ int CMenuSeparator::paint(bool selected)
if ((type & SUB_HEAD))
{
item_color = COL_MENUHEAD_TEXT;
item_bgcolor = COL_MENUHEAD_PLUS_0;
item_bgcolor = g_settings.theme.menu_Head_gradient ? COL_MENUCONTENT_PLUS_0 : COL_MENUHEAD_PLUS_0;
}
else
{

View File

@@ -46,6 +46,7 @@
#include <gui/components/cc.h>
#include <string>
#include <vector>
#include <neutrino_menue.h>
extern "C" {
#include <lua.h>
#include <lauxlib.h>
@@ -354,7 +355,7 @@ struct CMenuOptionChooserCompareItem: public std::binary_function <const CMenuOp
};
};
class CMenuOptionChooser : public CAbstractMenuOptionChooser
class CMenuOptionChooser : public CAbstractMenuOptionChooser, public sigc::trackable
{
public:
struct keyval
@@ -429,7 +430,7 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
int getWidth(void);
void setOptions(const struct keyval * const Options, const unsigned Number_Of_Options);
void setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options);
sigc::signal<void> OnAfterChangeOption;
int paint(bool selected);
int exec(CMenuTarget* parent);
@@ -516,6 +517,7 @@ class CMenuWidget : public CMenuTarget
int full_width, full_height;
bool savescreen;
bool has_hints; // is any items has hints
bool brief_hints;
bool hint_painted; // is hint painted
int fbutton_width;
@@ -527,7 +529,7 @@ class CMenuWidget : public CMenuTarget
unsigned int current_page;
unsigned int total_pages;
bool exit_pressed;
bool from_wizard;
int from_wizard;
bool fade;
bool washidden;
int nextShortcut;
@@ -556,7 +558,12 @@ class CMenuWidget : public CMenuTarget
BTN_TYPE_NEXT = 3,
BTN_TYPE_NO = -1
};
virtual void addIntroItems(neutrino_locale_t subhead_text = NONEXISTANT_LOCALE, neutrino_locale_t section_text = NONEXISTANT_LOCALE, int buttontype = BTN_TYPE_BACK );
enum
{
BRIEF_HINT_NO = 0,
BRIEF_HINT_YES = 1
};
virtual void addIntroItems(neutrino_locale_t subhead_text = NONEXISTANT_LOCALE, neutrino_locale_t section_text = NONEXISTANT_LOCALE, int buttontype = BTN_TYPE_BACK, bool brief_hint = BRIEF_HINT_NO);
bool hasItem();
void resetWidget(bool delete_items = false);
void insertItem(const uint& item_id, CMenuItem* menuItem);
@@ -568,12 +575,12 @@ class CMenuWidget : public CMenuTarget
virtual void hide();
virtual int exec(CMenuTarget* parent, const std::string & actionKey);
virtual const char *getName();
virtual void integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut=CRCInput::RC_nokey);
void setSelected(const int &Preselected){ preselected = Preselected; };
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; };
int getSelected()const { return selected; };
void move(int xoff, int yoff);
int getSelectedLine(void)const {return exit_pressed ? -1 : selected;};
void setWizardMode(bool _from_wizard) { from_wizard = _from_wizard;};
void setWizardMode(int _from_wizard) { from_wizard = _from_wizard;};
void enableFade(bool _enable) { fade = _enable; };
void enableSaveScreen(bool enable);
void paintHint(int num);

View File

@@ -334,7 +334,27 @@ void DisplayErrorMessage(const char * const ErrorMsg)
ShowMsg(LOCALE_MESSAGEBOX_ERROR, ErrorMsg, CMessageBox::mbrCancel, CMessageBox::mbCancel, NEUTRINO_ICON_ERROR);
}
void DisplayInfoMessage(const char * const ErrorMsg)
void DisplayErrorMessage(const char * const ErrorMsg, const neutrino_locale_t Caption)
{
ShowMsg(LOCALE_MESSAGEBOX_INFO, ErrorMsg, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
ShowMsg(Caption, ErrorMsg, CMessageBox::mbrCancel, CMessageBox::mbCancel, NEUTRINO_ICON_ERROR);
}
void DisplayErrorMessage(const char * const ErrorMsg, const std::string &Caption)
{
ShowMsg(Caption, ErrorMsg, CMessageBox::mbrCancel, CMessageBox::mbCancel, NEUTRINO_ICON_ERROR);
}
void DisplayInfoMessage(const char * const InfoMsg)
{
ShowMsg(LOCALE_MESSAGEBOX_INFO, InfoMsg, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
}
void DisplayInfoMessage(const char * const InfoMsg, const neutrino_locale_t Caption)
{
ShowMsg(Caption, InfoMsg, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
}
void DisplayInfoMessage(const char * const InfoMsg, const std::string &Caption)
{
ShowMsg(Caption, InfoMsg, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
}

View File

@@ -108,6 +108,10 @@ int ShowMsg(const std::string &Caption, const std::string & Text, const CMessage
int ShowMsg(const std::string &Caption, const neutrino_locale_t Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon = NULL, const int Width = 450, const int timeout = -1, bool returnDefaultOnTimeout = false); // UTF-8
void DisplayErrorMessage(const char * const ErrorMsg); // UTF-8
void DisplayErrorMessage(const char * const ErrorMsg, const neutrino_locale_t Caption); // UTF-8
void DisplayErrorMessage(const char * const ErrorMsg, const std::string &Caption); // UTF-8
void DisplayInfoMessage(const char * const InfoMsg); // UTF-8
void DisplayInfoMessage(const char * const InfoMsg, const neutrino_locale_t Caption); // UTF-8
void DisplayInfoMessage(const char * const InfoMsg, const std::string &Caption); // UTF-8
#endif

View File

@@ -60,11 +60,13 @@ void CProgressWindow::Init()
int h_txt = max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), h_item);
status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt);
status_txt->setColorBody(col_body);
status_txt->doPaintTextBoxBg(true);
addWindowItem(status_txt);
y_item += h_txt + 10;
//create local_bar object
local_bar = new CProgressBar();
local_bar->allowPaint(false);
local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
local_bar->setColorBody(col_body);
local_bar->setActiveColor(COL_MENUCONTENT_PLUS_7);
@@ -75,6 +77,7 @@ void CProgressWindow::Init()
//create global_bar object
global_bar = new CProgressBar();
global_bar->allowPaint(false);
global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
global_bar->setColorBody(col_body);
global_bar->setActiveColor(COL_MENUCONTENT_PLUS_7);
@@ -83,7 +86,8 @@ void CProgressWindow::Init()
addWindowItem(global_bar);
y_item += 2*h_pbar;
height = y_item + ccw_head->getHeight();
h_height = ccw_head->getHeight();
height = y_item + h_height;
setCenterPos();
}
@@ -97,12 +101,47 @@ void CProgressWindow::setTitle(const neutrino_locale_t title)
#endif // VFD_UPDATE
}
void CProgressWindow::setTitle(const std::string & title)
{
setWindowCaption(title);
#ifdef VFD_UPDATE
CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
#endif // VFD_UPDATE
}
//if header is disabled we need new position for body items
void CProgressWindow::fitItems()
{
if (ccw_show_header)
return;
for(size_t i=0; i<ccw_body->size() ;i++){
int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - 10;
ccw_body->getCCItem(i)->setYPos(y_item);
}
}
void CProgressWindow::showStatus(const unsigned int prog)
{
if (global_progress == prog)
return;
if (!global_bar->isPainted()){
int g_height = global_bar->getHeight();
global_bar->setYPos(local_bar->getYPos() + g_height/2);
global_bar->setHeight(g_height + g_height/2);
}
showGlobalStatus(prog);
}
void CProgressWindow::showGlobalStatus(const unsigned int prog)
{
if (global_progress == prog)
return;
global_bar->allowPaint(true);
global_progress = prog;
global_bar->setValues(prog, 100);
global_bar->paint(false);
@@ -117,6 +156,7 @@ void CProgressWindow::showLocalStatus(const unsigned int prog)
if (local_progress == prog)
return;
local_bar->allowPaint(true);
local_progress = prog;
local_bar->setValues(prog, 100);
local_bar->paint(false);
@@ -163,3 +203,9 @@ int CProgressWindow::exec(CMenuTarget* parent, const std::string & /*actionKey*/
return menu_return::RETURN_REPAINT;
}
void CProgressWindow::paint(bool do_save_bg)
{
fitItems();
CComponentsWindow::paint(do_save_bg);
}

View File

@@ -37,8 +37,9 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
unsigned int global_progress;
unsigned int local_progress;
int w_bar_frame;
int h_height;
void Init();
void fitItems();
public:
@@ -48,10 +49,13 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
virtual int exec( CMenuTarget* parent, const std::string & actionKey );
virtual void showGlobalStatus(const unsigned int prog);
virtual unsigned int getGlobalStatus(void);
virtual void showLocalStatus(const unsigned int prog);
virtual void showStatusMessageUTF(const std::string & text); // UTF-8
void showStatus(const unsigned int prog);
void showGlobalStatus(const unsigned int prog);
unsigned int getGlobalStatus(void);
void showLocalStatus(const unsigned int prog);
void showStatusMessageUTF(const std::string & text); // UTF-8
void paint(bool do_save_bg = true);
void setTitle(const std::string & title);
};

View File

@@ -56,7 +56,7 @@
#endif
#include <global.h>
#include <system/debug.h>
#include "textbox.h"
#include <gui/widget/icons.h>
@@ -186,7 +186,7 @@ void CTextBox::initVar(void)
m_cLineArray.clear();
m_renderMode = 0;
m_utf8_encoded = true;
// max_width = 0;
}
@@ -397,7 +397,7 @@ void CTextBox::refreshTextLineArray(void)
aktWord = m_cText.substr(pos_prev, pos - pos_prev + 1);
//calculate length of current found word
aktWordWidth = m_pcFontText->getRenderWidth(aktWord);
aktWordWidth = m_pcFontText->getRenderWidth(aktWord, m_utf8_encoded);
//set next start pos
pos_prev = pos + 1;
@@ -553,13 +553,13 @@ void CTextBox::refreshText(void)
//bg variables
int ax = m_cFrameTextRel.iX+m_cFrame.iX;
int ay = /*m_cFrameTextRel.iY+*/m_cFrame.iY;
int ay = m_cFrameTextRel.iY+m_cFrame.iY;
int dx = m_cFrameTextRel.iWidth;
int dy = m_cFrameTextRel.iHeight;
//find changes
bool has_changed = hasChanged(&ax, &ay, &dx, &dy);
//destroy pixel buffer on changed property values
if (has_changed){
if (m_bgpixbuf){
@@ -569,12 +569,20 @@ void CTextBox::refreshText(void)
}
}
//detect corrupt position values
if ((ax<=0) || (ay<=0)){
dprintf(DEBUG_NORMAL, "\033[33m[CTextBox] [%s - %d] ERROR! position out of range: ax = %d, ay = %d, dx = %d, dy = %d\033[0m\n", __func__, __LINE__, ax, ay, dx, dy);
return;
}
//save screen only if no paint of background required
if (!m_nPaintBackground && m_SaveScreen) {
if (m_bgpixbuf == NULL){
//TRACE("[CTextBox] %s save bg %d\r\n", __FUNCTION__, __LINE__);
m_bgpixbuf= new fb_pixel_t[dx * dy];
frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf);
if ((dx * dy) >0){
m_bgpixbuf= new fb_pixel_t[dx * dy];
frameBuffer->SaveScreen(ax, ay, dx, dy, m_bgpixbuf);
}
}
}
@@ -632,10 +640,10 @@ void CTextBox::refreshText(void)
{
//calculate centered xpos
if( m_nMode & CENTER ){
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i]))>>1) - text_Hborder_width;
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded))>>1) - text_Hborder_width;
}
else if ( m_nMode & RIGHT ){
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i])) - text_Hborder_width*2);
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded)) - text_Hborder_width*2);
if ( m_nMode & SCROLL )
x_center -= SCROLL_FRAME_WIDTH;
}
@@ -644,7 +652,7 @@ void CTextBox::refreshText(void)
//TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX);
m_pcFontText->RenderString(m_cFrame.iX + m_cFrameTextRel.iX + text_Hborder_width + x_center,
y+m_cFrame.iY, m_cFrameTextRel.iWidth, m_cLineArray[i].c_str(),
m_textColor, 0, m_renderMode | Font::IS_UTF8);
m_textColor, 0, m_renderMode | (m_utf8_encoded) ? Font::IS_UTF8 : 0);
m_old_cText = m_cText;
y += m_nFontTextHeight;
}

View File

@@ -148,6 +148,7 @@ class CTextBox
int m_nBgRadiusType;
bool m_nPaintBackground;
bool m_SaveScreen;
bool m_utf8_encoded;
Font* m_pcFontText;
int m_nFontTextHeight;
@@ -192,6 +193,8 @@ class CTextBox
void setWindowMaxDimensions(const int width, const int height);
void setWindowMinDimensions(const int width, const int height);
void setFontUseDigitHeight(bool set=true);
void enableUTF8(bool enable = true){m_utf8_encoded = enable;}
void disableUTF8(bool enable = false){enableUTF8(enable);}
inline bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);};
inline CBox getWindowsPos(void) {return(m_cFrame);};