progressbar-menu-tomworld

This commit is contained in:
Jacek Jendrzej
2013-03-11 12:18:17 +01:00
committed by [CST] Focus
parent aeb3ead6a9
commit 369289d179
12 changed files with 264 additions and 63 deletions

View File

@@ -86,6 +86,7 @@ libneutrino_gui_a_SOURCES = \
pictureviewer_setup.cpp \
pluginlist.cpp \
plugins.cpp \
progressbar_setup.cpp \
proxyserver_setup.cpp \
rc_lock.cpp \
record_setup.cpp \

View File

@@ -43,6 +43,7 @@
#include "screensetup.h"
#include "osdlang_setup.h"
#include "filebrowser.h"
#include "progressbar_setup.h"
#include <gui/widget/icons.h>
#include <gui/widget/colorchooser.h>
@@ -427,24 +428,29 @@ int COsdSetup::showOsdSetup()
mf->setHint("", LOCALE_MENU_HINT_SCREEN_SETUP);
osd_menu->addItem(mf);
//progressbar
CMenuForwarder * progress = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1);
progress->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR);
osd_menu->addItem(progress);
//infobar
CMenuWidget osd_menu_infobar(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOBAR);
showOsdInfobarSetup(&osd_menu_infobar);
mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, &osd_menu_infobar, NULL, CRCInput::RC_1);
mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, &osd_menu_infobar, NULL, CRCInput::RC_2);
mf->setHint("", LOCALE_MENU_HINT_INFOBAR_SETUP);
osd_menu->addItem(mf);
//channellist
CMenuWidget osd_menu_chanlist(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_CHANNELLIST);
showOsdChanlistSetup(&osd_menu_chanlist);
mf = new CMenuForwarder(LOCALE_MISCSETTINGS_CHANNELLIST, true, NULL, &osd_menu_chanlist, NULL, CRCInput::RC_2);
mf = new CMenuForwarder(LOCALE_MISCSETTINGS_CHANNELLIST, true, NULL, &osd_menu_chanlist, NULL, CRCInput::RC_3);
mf->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SETUP);
osd_menu->addItem(mf);
//screenshot
CMenuWidget osd_menu_screenshot(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_SCREENSHOT);
showOsdScreenShotSetup(&osd_menu_screenshot);
mf = new CMenuForwarder(LOCALE_SCREENSHOT_MENU, true, NULL, &osd_menu_screenshot, NULL, CRCInput::RC_3);
mf = new CMenuForwarder(LOCALE_SCREENSHOT_MENU, true, NULL, &osd_menu_screenshot, NULL, CRCInput::RC_4);
mf->setHint("", LOCALE_MENU_HINT_SCREENSHOT_SETUP);
osd_menu->addItem(mf);
@@ -506,11 +512,6 @@ int COsdSetup::showOsdSetup()
mc->setHint("", LOCALE_MENU_HINT_BIGWINDOWS);
osd_menu->addItem(mc);
// color progress bar
mc = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR);
osd_menu->addItem(mc);
int res = osd_menu->exec(NULL, "");
delete osd_menu;
@@ -727,14 +728,6 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS[LOCAL
{ 5 , LOCALE_MISCSETTINGS_INFOBAR_DISP_5 },
{ 6 , LOCALE_MISCSETTINGS_INFOBAR_DISP_6 }
};
#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT 4
const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT]=
{
{ 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_0 },
{ 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_1 },
{ 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_2 },
{ 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_3 }
};
//infobar
void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
@@ -763,11 +756,6 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
mc->setHint("", LOCALE_MENU_HINT_INFOBAR_SAT);
menu_infobar->addItem(mc);
// infobar progress
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR);
menu_infobar->addItem(mc);
// flash/hdd progress
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, &g_settings.infobar_show_sysfs_hdd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_INFOBAR_FILESYS);

View File

@@ -0,0 +1,114 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
progressbar_setup menu
Suggested by tomworld
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "progressbar_setup.h"
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <neutrino_menue.h>
#include <driver/screen_max.h>
#include <system/debug.h>
#define LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT 4
const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT]=
{
{ 0 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_0 },
{ 1 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_1 },
{ 2 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_2 },
{ 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 }
};
#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2
const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]=
{
{ 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 },
{ 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }
};
CProgressbarSetup::CProgressbarSetup()
{
width = w_max (40, 10); //%
}
CProgressbarSetup::~CProgressbarSetup()
{
}
int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &)
{
printf("[neutrino] init progressbar menu setup...\n");
if (parent)
parent->hide();
return showMenu();
}
int CProgressbarSetup::showMenu()
{
//menue init
CMenuWidget *progress = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_PROGRESSBAR);
//intros: back ande save
progress->addIntroItems(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR);
//infobar progresscolor on/off
COnOffNotifier* miscProgressNotifier = new COnOffNotifier(0);
CMenuOptionChooser *progresscolor;
progresscolor = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier);
progresscolor->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR);
//infobar design
CMenuOptionChooser *progressdesign = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color);
progressdesign->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN);
//infobar progressbarposition
CMenuOptionChooser *progressbarposition;
progressbarposition = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_POSITION, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT, true);
progressbarposition->setHint("", LOCALE_MENU_HINT_INFOBAR_POSITION);
miscProgressNotifier->addItem(progressdesign);
//paint items
progress->addItem(progresscolor);
progress->addItem(progressdesign);
progress->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MISCSETTINGS_INFOBAR));
progress->addItem(progressbarposition);
int res = progress->exec (NULL, "");
delete miscProgressNotifier;
delete progress;
return res;
}

View File

@@ -0,0 +1,46 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
progressbar_setup menu
Suggested by tomworld
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __PROGRESSBAR_SETUP__
#define __PROGRESSBAR_SETUP__
#include <string>
#include <gui/widget/menue.h>
class CProgressbarSetup : public CMenuTarget, CChangeObserver
{
private:
int width;
int showMenu();
public:
CProgressbarSetup();
~CProgressbarSetup();
int exec(CMenuTarget* parent, const std::string &);
};
#endif

View File

@@ -153,11 +153,11 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y,
// max height progressbar bar, if icon height larger than pb_height then get height from icon
int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height;
// max height of active/passive bar
int bar_height = pb_max_height - 2*frame_widht;
if (!blink || !g_settings.progressbar_color)
{
// max height of active/passive bar
int bar_height = pb_max_height - 2*frame_widht;
int start_x_passive_bar = start_x + active_pb_width;
int width_passive_bar = pb_max_width - active_pb_width;
@@ -202,63 +202,85 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y,
width, pb_max_height, shadowbar_col, c_rad); // shadow
}
if (active_pb_width != last_width) {
if (active_pb_width != last_width)
{
int step;
int i, j;
int b = 0;
if (active_pb_width > last_width) {
for (i = 0; (i < rd) && (i < maxi); i++) {
if (active_pb_width > last_width)
{
for (i = 0; (i < rd) && (i < maxi); i++)
{ //green section
step = 255 / rd;
if (invert)
rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red
else
rgb = RED + ((unsigned char)(step * i) << 8); // adding green
color = make16color(rgb);
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW,
POINT, POINT, color);
if (g_settings.progressbar_design == 0)
{
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color);
}
else
frameBuffer->paintBoxRel(pos_x + i * ITEMW,start_y, POINT, bar_height, color);
}
for (; (i < yw) && (i < maxi); i++) {
for (; (i < yw) && (i < maxi); i++)
{ //yello section
step = 255 / yw / 2;
if (invert)
rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green
else
rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red
color = make16color(rgb);
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW,
POINT, POINT, color);
if (g_settings.progressbar_design == 0)
{
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color);
}
else
frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color);
}
for (; (i < gn) && (i < maxi); i++) {
for (; (i < gn) && (i < maxi); i++)
{ //red section
step = 255 / gn;
if (invert)
rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green
else
rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red
color = make16color(rgb);
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW,
POINT, POINT, color);
if (g_settings.progressbar_design == 0)
{
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color);
}
else
frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color);
}
}
for(i = maxi; i < total; i++) {
for(i = maxi; i < total; i++)
{
for(j = 0; j <= hcnt; j++)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW,
POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive
if (g_settings.progressbar_design == 0)
frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive
else
frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, COL_INFOBAR_PLUS_3);//fill passive
}
last_width = active_pb_width;
}
}
// paint icon if present
if (iconfile != NULL){
if (iconfile != NULL)
{
int icon_y = pos_y + pb_max_height / 2 - icon_h / 2;
frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y);
}
// upper text
int upper_labeltext_y = start_y - frame_widht;
if (upper_labeltext != NULL) {
if (upper_labeltext != NULL)
{
g_Font[font_pbar]->RenderString(start_x +2,
upper_labeltext_y,
width,