merge neutrino-mp progressbar code, (C) martii

This commit is contained in:
[CST] Focus
2014-07-17 15:15:43 +04:00
parent 7cee5d3b2e
commit 416646bbff
23 changed files with 623 additions and 271 deletions

View File

@@ -48,13 +48,29 @@ const CMenuOptionChooser::keyval PROGRESSBAR_INFOBAR_POSITION_OPTIONS[PROGRESSBA
{ 3 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_3 }
};
#define PROGRESSBAR_DESIGN_COUNT 4
const CMenuOptionChooser::keyval PROGRESSBAR_DESIGN_OPTIONS[PROGRESSBAR_DESIGN_COUNT]=
/* these are more descriptive... */
#define _LOCALE_PROGRESSBAR_COLOR_MATRIX LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_0
#define _LOCALE_PROGRESSBAR_COLOR_VERTICAL LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_1
#define _LOCALE_PROGRESSBAR_COLOR_HORIZONTAL LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_2
#define _LOCALE_PROGRESSBAR_COLOR_FULL LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_3
#define _LOCALE_PROGRESSBAR_COLOR_MONO LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_4
#define PROGRESSBAR_COLOR_OPTION_COUNT 6
const CMenuOptionChooser::keyval PROGRESSBAR_COLOR_OPTIONS[PROGRESSBAR_COLOR_OPTION_COUNT] =
{
{ 0 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_0 },
{ 1 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_1 },
{ 2 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_2 },
{ 3 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_3 }
{ CProgressBar::PB_OFF, LOCALE_OPTIONS_OFF },
{ CProgressBar::PB_MONO, _LOCALE_PROGRESSBAR_COLOR_MONO },
{ CProgressBar::PB_MATRIX, _LOCALE_PROGRESSBAR_COLOR_MATRIX },
{ CProgressBar::PB_LINES_V, _LOCALE_PROGRESSBAR_COLOR_VERTICAL },
{ CProgressBar::PB_LINES_H, _LOCALE_PROGRESSBAR_COLOR_HORIZONTAL },
{ CProgressBar::PB_COLOR, _LOCALE_PROGRESSBAR_COLOR_FULL },
};
#define PROGRESSBAR_TIMESCALE_INVERT_OPTION_COUNT 2
const CMenuOptionChooser::keyval PROGRESSBAR_TIMESCALE_INVERT_OPTIONS[PROGRESSBAR_TIMESCALE_INVERT_OPTION_COUNT] =
{
{ 0, LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_RED_GREEN },
{ 1, LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_GREEN_RED }
};
CProgressbarSetup::CProgressbarSetup()
@@ -67,10 +83,23 @@ CProgressbarSetup::~CProgressbarSetup()
}
int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &)
bool CProgressbarSetup::changeNotify(const neutrino_locale_t /* OptionName */, void * /* data */)
{
return true; // repaint
}
int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
printf("[neutrino] init progressbar menu setup...\n");
if (actionKey == "reset") {
g_settings.progressbar_timescale_red = 0;
g_settings.progressbar_timescale_green = 100;
g_settings.progressbar_timescale_yellow = 70;
g_settings.progressbar_timescale_invert = false;
return menu_return::RETURN_REPAINT;
}
if (parent)
parent->hide();
@@ -79,6 +108,7 @@ int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &)
int CProgressbarSetup::showMenu()
{
#if 0
//menue init
CMenuWidget *progress = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_PROGRESSBAR);
@@ -94,7 +124,7 @@ int CProgressbarSetup::showMenu()
//design
CMenuOptionChooser *design;
design = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, PROGRESSBAR_DESIGN_OPTIONS, PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color);
design = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, g_settings.progressbar_color);
design->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_DESIGN);
//infobar position
@@ -115,4 +145,74 @@ int CProgressbarSetup::showMenu()
delete progress;
return res;
#endif
CMenuWidget m(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_PROGRESSBAR);
m.addIntroItems(LOCALE_MISCSETTINGS_PROGRESSBAR /*, LOCALE_MISCSETTINGS_GENERAL*/);
// general progress bar design
CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_LONG,
&g_settings.progressbar_design, PROGRESSBAR_COLOR_OPTIONS + 1, PROGRESSBAR_COLOR_OPTION_COUNT - 1, true, this);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR);
m.addItem(mc);
// progress bar gradient
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_GRADIENT, &g_settings.progressbar_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_GRADIENT);
m.addItem(mc);
// preview
CMenuProgressbar *mb = new CMenuProgressbar(LOCALE_MISCSETTINGS_PROGRESSBAR_PREVIEW);
mb->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_PREVIEW);
m.addItem(mb);
m.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE));
CMenuOptionNumberChooser *nc;
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_RED, &g_settings.progressbar_timescale_red, true, 0, 100, this);
nc->setNumericInput(true);
nc->setNumberFormat("%d %%");
nc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_RED);
m.addItem(nc);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_YELLOW, &g_settings.progressbar_timescale_yellow, true, 0, 100, this);
nc->setNumericInput(true);
nc->setNumberFormat("%d %%");
nc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_YELLOW);
m.addItem(nc);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_GREEN, &g_settings.progressbar_timescale_green, true, 0, 100, this);
nc->setNumericInput(true);
nc->setNumberFormat("%d %%");
nc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_GREEN);
m.addItem(nc);
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_INVERT, &g_settings.progressbar_timescale_invert, PROGRESSBAR_TIMESCALE_INVERT_OPTIONS, PROGRESSBAR_TIMESCALE_INVERT_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_INVERT);
m.addItem(mc);
mb = new CMenuProgressbar(LOCALE_MISCSETTINGS_PROGRESSBAR_PREVIEW);
mb->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_PREVIEW);
mb->getScale()->setType(CProgressBar::PB_TIMESCALE);
m.addItem(mb);
CMenuForwarder* mf = new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, "reset", CRCInput::RC_red);
mf->setHint("", LOCALE_OPTIONS_HINT_DEFAULT);
m.addItem(mf);
// extended channel list (progressbars)
m.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MAINMENU_CHANNELS));
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.channellist_progressbar_design, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EXTENDED);
m.addItem(mc);
mb = new CMenuProgressbar(LOCALE_MISCSETTINGS_PROGRESSBAR_PREVIEW);
mb->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_PREVIEW);
mb->getScale()->setType(CProgressBar::PB_TIMESCALE);
mb->getScale()->setDesign(g_settings.channellist_progressbar_design);
mb->getScale()->doPaintBg(false);
m.addItem(mb);
return m.exec(NULL, "");
}