vfd: rework vfd menu (use ItemSlider), vfdcontroler deprecated

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1420 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: aac749a682
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2011-05-02 (Mon, 02 May 2011)
This commit is contained in:
Jacek Jendrzej
2011-05-02 10:57:53 +00:00
parent 8caff275a3
commit d40975bd0c
7 changed files with 64 additions and 19 deletions

View File

@@ -87,10 +87,10 @@ void CVFD::count_down() {
if (timeout_cnt > 0) {
timeout_cnt--;
if (timeout_cnt == 0) {
if (atoi(g_settings.lcd_setting_dim_brightness) > 0) {
if (g_settings.lcd_setting_dim_brightness > -1) {
// save lcd brightness, setBrightness() changes global setting
int b = g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS];
setBrightness(atoi(g_settings.lcd_setting_dim_brightness));
setBrightness(g_settings.lcd_setting_dim_brightness);
g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] = b;
} else {
setPower(0);
@@ -102,7 +102,7 @@ void CVFD::count_down() {
void CVFD::wake_up() {
if (atoi(g_settings.lcd_setting_dim_time) > 0) {
timeout_cnt = atoi(g_settings.lcd_setting_dim_time);
atoi(g_settings.lcd_setting_dim_brightness) > 0 ?
g_settings.lcd_setting_dim_brightness > -1 ?
setBrightness(g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS]) : setPower(1);
}
else

View File

@@ -61,11 +61,21 @@ CVfdSetup::~CVfdSetup()
}
int CVfdSetup::exec(CMenuTarget* parent, const std::string &)
int CVfdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init lcd setup\n");
if(parent != NULL)
parent->hide();
if(actionKey=="def")
{
brightness = DEFAULT_VFD_BRIGHTNESS;
brightnessstandby = DEFAULT_VFD_STANDBYBRIGHTNESS;
brightnessdeepstandby = DEFAULT_VFD_STANDBYBRIGHTNESS;
CVFD::getInstance()->setBrightness(brightness);
CVFD::getInstance()->setBrightnessStandby(brightnessstandby);
CVFD::getInstance()->setBrightnessDeepStandby(brightnessdeepstandby);
return menu_return::RETURN_REPAINT;;
}
showSetup();
@@ -102,16 +112,27 @@ void CVfdSetup::showSetup()
vfds->addIntroItems(LOCALE_LCDMENU_HEAD);
vfds->setSelected(selected);
CVfdControler* lcdsliders = new CVfdControler(LOCALE_LCDMENU_HEAD, NULL);
bool vfd_enabled = (cs_get_revision() != 10);
CMenuWidget* lcdsliders = new CMenuWidget(LOCALE_LCDMENU_HEAD, NEUTRINO_ICON_LCD,width);
lcdsliders->addIntroItems(LOCALE_LCDMENU_LCDCONTROLER);
lcdsliders->setSelected(selected);
//vfd
brightness = CVFD::getInstance()->getBrightness();
brightnessstandby = CVFD::getInstance()->getBrightnessStandby();
brightnessdeepstandby = CVFD::getInstance()->getBrightnessDeepStandby();
lcdsliders->addItem(new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESS, &brightness, true, 0, 15, this, 0, 0, NONEXISTANT_LOCALE, NULL, true));
lcdsliders->addItem(new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESSSTANDBY, &brightnessstandby, true, 0, 15, this, 0, 0, NONEXISTANT_LOCALE, NULL, true));
if(cs_get_revision() > 7)
lcdsliders->addItem(new CMenuOptionNumberChooser(LOCALE_LCDCONTROLER_BRIGHTNESSDEEPSTANDBY, &brightnessdeepstandby, true, 0, 15, this, 0, 0, NONEXISTANT_LOCALE, NULL, true));
lcdsliders->addItem(GenericMenuSeparatorLine);
lcdsliders->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, "def", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
lcdsliders->addItem(GenericMenuSeparatorLine);
lcdsliders->addItem(new CMenuOptionNumberChooser(LOCALE_LCDMENU_DIM_BRIGHTNESS, &g_settings.lcd_setting_dim_brightness, vfd_enabled, -1, 15, NULL, 0, -1, LOCALE_OPTIONS_OFF, NULL, true));
CStringInput * dim_time = new CStringInput(LOCALE_LCDMENU_DIM_TIME, g_settings.lcd_setting_dim_time, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"0123456789 ");
vfds->addItem(new CMenuForwarder(LOCALE_LCDMENU_DIM_TIME, vfd_enabled, g_settings.lcd_setting_dim_time,dim_time));
lcdsliders->addItem(new CMenuForwarder(LOCALE_LCDMENU_DIM_TIME, vfd_enabled, g_settings.lcd_setting_dim_time,dim_time));
CStringInput * dim_brightness = new CStringInput(LOCALE_LCDMENU_DIM_BRIGHTNESS, g_settings.lcd_setting_dim_brightness, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"0123456789 ");
vfds->addItem(new CMenuForwarder(LOCALE_LCDMENU_DIM_BRIGHTNESS, vfd_enabled, g_settings.lcd_setting_dim_brightness,dim_brightness));
vfds->addItem(GenericMenuSeparatorLine);
vfds->addItem(new CMenuForwarder(LOCALE_LCDMENU_LCDCONTROLER, vfd_enabled, NULL, lcdsliders, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
if(cs_get_revision() > 7)
@@ -139,4 +160,22 @@ void CVfdSetup::showSetup()
selected = vfds->getSelected();
delete vfds;
}
bool CVfdSetup::changeNotify(const neutrino_locale_t OptionName, void */* data */)
{
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LCDCONTROLER_BRIGHTNESS))
{
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
CVFD::getInstance()->setBrightness(brightness);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LCDCONTROLER_BRIGHTNESSSTANDBY))
{
CVFD::getInstance()->setMode(CVFD::MODE_STANDBY);
CVFD::getInstance()->setBrightnessStandby(brightnessstandby);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LCDCONTROLER_BRIGHTNESSDEEPSTANDBY))
{
CVFD::getInstance()->setBrightnessDeepStandby(brightnessdeepstandby);
}
return true;
}

View File

@@ -35,12 +35,16 @@
#include <string>
class CVfdSetup : public CMenuTarget
class CVfdSetup : public CMenuTarget, CChangeObserver
{
private:
int width, selected;
void showSetup();
virtual bool changeNotify(const neutrino_locale_t OptionName, void *data);
int brightness;
int brightnessstandby;
int brightnessdeepstandby;
public:
CVfdSetup();

View File

@@ -28,7 +28,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if 0
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -315,7 +315,6 @@ void CVfdControler::paintSlider(int px, int py, unsigned int spos, float factor,
{
int startx = lwidth + 15;
char wert[5];
frameBuffer->paintBoxRel(px + startx, py, 120, mheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintIcon(NEUTRINO_ICON_VOLUMEBODY, px + startx, py+2+mheight/4);
frameBuffer->paintIcon(selected ? NEUTRINO_ICON_VOLUMESLIDER2BLUE : NEUTRINO_ICON_VOLUMESLIDER2, (int)(px + (startx+3)+(spos / factor)), py+mheight/4);
@@ -325,3 +324,4 @@ void CVfdControler::paintSlider(int px, int py, unsigned int spos, float factor,
frameBuffer->paintBoxRel(px + startx + 120 + 10, py, 50, mheight, COL_MENUCONTENT_PLUS_0);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(px + startx + 120 + 10, py+mheight, width, wert, COL_MENUCONTENT, 0, true); // UTF-8
}
#endif

View File

@@ -29,7 +29,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if 0
/** ready to delete, deprecated **/
#ifndef __vfdcontroler__
#define __vfdcontroler__
@@ -75,3 +76,4 @@ class CVfdControler : public CMenuTarget
#endif
#endif

View File

@@ -775,7 +775,7 @@ printf("***************************** rec dir %s timeshift dir %s\n", g_settings
for (int i = 0; i < SNeutrinoSettings::LCD_SETTING_COUNT; i++)
g_settings.lcd_setting[i] = configfile.getInt32(lcd_setting[i].name, lcd_setting[i].default_value);
strcpy(g_settings.lcd_setting_dim_time, configfile.getString("lcd_dim_time","0").c_str());
strcpy(g_settings.lcd_setting_dim_brightness, configfile.getString("lcd_dim_brightness","0").c_str());
g_settings.lcd_setting_dim_brightness = configfile.getInt32("lcd_dim_brightness", 0);
g_settings.lcd_info_line = configfile.getInt32("lcd_info_line", 0);//channel name or clock
//Picture-Viewer
@@ -1290,7 +1290,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
for (int i = 0; i < SNeutrinoSettings::LCD_SETTING_COUNT; i++)
configfile.setInt32(lcd_setting[i].name, g_settings.lcd_setting[i]);
configfile.setString("lcd_dim_time", g_settings.lcd_setting_dim_time);
configfile.setString("lcd_dim_brightness", g_settings.lcd_setting_dim_brightness);
configfile.setInt32("lcd_dim_brightness", g_settings.lcd_setting_dim_brightness);
configfile.setInt32("lcd_info_line", g_settings.lcd_info_line);//channel name or clock
//Picture-Viewer
@@ -4504,7 +4504,7 @@ void CNeutrinoApp::loadColors(const char * fname)
for (int i = 0; i < SNeutrinoSettings::LCD_SETTING_COUNT; i++)
g_settings.lcd_setting[i] = tconfig.getInt32(lcd_setting[i].name, lcd_setting[i].default_value);
strcpy(g_settings.lcd_setting_dim_time, tconfig.getString("lcd_dim_time","0").c_str());
strcpy(g_settings.lcd_setting_dim_brightness, tconfig.getString("lcd_dim_brightness","0").c_str());
g_settings.lcd_setting_dim_brightness = tconfig.getInt32( "lcd_dim_brightness", 0 );
strcpy( g_settings.font_file, configfile.getString( "font_file", "/share/fonts/neutrino.ttf" ).c_str() );
colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
@@ -4570,7 +4570,7 @@ void CNeutrinoApp::saveColors(const char * fname)
for (int i = 0; i < SNeutrinoSettings::LCD_SETTING_COUNT; i++)
tconfig.setInt32(lcd_setting[i].name, g_settings.lcd_setting[i]);
tconfig.setString("lcd_dim_time", g_settings.lcd_setting_dim_time);
tconfig.setString("lcd_dim_brightness", g_settings.lcd_setting_dim_brightness);
tconfig.setInt32( "lcd_dim_brightness", g_settings.lcd_setting_dim_brightness );
tconfig.setString("font_file", g_settings.font_file);
tconfig.saveConfig(fname);

View File

@@ -398,7 +398,7 @@ struct SNeutrinoSettings
int lcd_setting[LCD_SETTING_COUNT];
int lcd_info_line;
char lcd_setting_dim_time[4];
char lcd_setting_dim_brightness[4];
int lcd_setting_dim_brightness;
int led_tv_mode;
int led_standby_mode;
int led_deep_mode;