tuxbox-port: modul files added

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


Origin commit data
------------------
Branch: ni/coolstream
Commit: a508e4ab5f
Author: Thilo Graf <dbt@novatux.de>
Date: 2010-11-28 (Sun, 28 Nov 2010)



------------------
This commit was generated by Migit
This commit is contained in:
2010-11-27 23:16:38 +00:00
parent bda8ee6ae4
commit 9aaf46e79f
29 changed files with 3645 additions and 0 deletions

40
data/themes/Classic.theme Normal file
View File

@@ -0,0 +1,40 @@
infobar_alpha=20
infobar_red=5
infobar_green=10
infobar_blue=60
infobar_Text_alpha=0
infobar_Text_red=100
infobar_Text_green=100
infobar_Text_blue=100
menu_Head_alpha=20
menu_Head_red=5
menu_Head_green=10
menu_Head_blue=60
menu_Head_Text_alpha=0
menu_Head_Text_red=100
menu_Head_Text_green=100
menu_Head_Text_blue=100
menu_Content_alpha=20
menu_Content_red=50
menu_Content_green=50
menu_Content_blue=50
menu_Content_Text_alpha=0
menu_Content_Text_red=100
menu_Content_Text_green=100
menu_Content_Text_blue=100
menu_Content_Selected_alpha=20
menu_Content_Selected_red=5
menu_Content_Selected_green=10
menu_Content_Selected_blue=60
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_red=100
menu_Content_Selected_Text_green=100
menu_Content_Selected_Text_blue=100
menu_Content_inactive_alpha=20
menu_Content_inactive_red=50
menu_Content_inactive_green=50
menu_Content_inactive_blue=50
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_red=80
menu_Content_inactive_Text_green=80
menu_Content_inactive_Text_blue=80

40
data/themes/Crema.theme Normal file
View File

@@ -0,0 +1,40 @@
infobar_Text_alpha=0
infobar_Text_blue=83
infobar_Text_green=84
infobar_Text_red=84
infobar_alpha=0
infobar_blue=28
infobar_green=0
infobar_red=0
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_blue=76
menu_Content_Selected_Text_green=76
menu_Content_Selected_Text_red=75
menu_Content_Selected_alpha=10
menu_Content_Selected_blue=27
menu_Content_Selected_green=0
menu_Content_Selected_red=0
menu_Content_Text_alpha=0
menu_Content_Text_blue=0
menu_Content_Text_green=0
menu_Content_Text_red=0
menu_Content_alpha=20
menu_Content_blue=70
menu_Content_green=100
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_blue=43
menu_Content_inactive_Text_green=45
menu_Content_inactive_Text_red=44
menu_Content_inactive_alpha=20
menu_Content_inactive_blue=71
menu_Content_inactive_green=100
menu_Content_inactive_red=100
menu_Content_red=100
menu_Head_Text_alpha=0
menu_Head_Text_blue=83
menu_Head_Text_green=84
menu_Head_Text_red=84
menu_Head_alpha=0
menu_Head_blue=28
menu_Head_green=0
menu_Head_red=0

40
data/themes/DVB2000.theme Normal file
View File

@@ -0,0 +1,40 @@
infobar_alpha=5
infobar_red=0
infobar_green=19
infobar_blue=0
infobar_Text_alpha=0
infobar_Text_red=100
infobar_Text_green=100
infobar_Text_blue=100
menu_Head_alpha=0
menu_Head_red=25
menu_Head_green=25
menu_Head_blue=25
menu_Head_Text_alpha=0
menu_Head_Text_red=100
menu_Head_Text_green=100
menu_Head_Text_blue=0
menu_Content_alpha=0
menu_Content_red=0
menu_Content_green=20
menu_Content_blue=0
menu_Content_Text_alpha=0
menu_Content_Text_red=100
menu_Content_Text_green=100
menu_Content_Text_blue=100
menu_Content_Selected_alpha=0
menu_Content_Selected_red=100
menu_Content_Selected_green=100
menu_Content_Selected_blue=100
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_blue=0
menu_Content_inactive_alpha=20
menu_Content_inactive_red=0
menu_Content_inactive_green=25
menu_Content_inactive_blue=0
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_red=100
menu_Content_inactive_Text_green=100
menu_Content_inactive_Text_blue=0

View File

@@ -0,0 +1,40 @@
infobar_alpha=20
infobar_red=0
infobar_green=0
infobar_blue=20
infobar_Text_alpha=0
infobar_Text_red=100
infobar_Text_green=100
infobar_Text_blue=100
menu_Head_alpha=0
menu_Head_red=0
menu_Head_green=0
menu_Head_blue=50
menu_Head_Text_alpha=0
menu_Head_Text_red=95
menu_Head_Text_green=100
menu_Head_Text_blue=100
menu_Content_alpha=20
menu_Content_red=0
menu_Content_green=0
menu_Content_blue=20
menu_Content_Text_alpha=0
menu_Content_Text_red=100
menu_Content_Text_green=100
menu_Content_Text_blue=100
menu_Content_Selected_alpha=15
menu_Content_Selected_red=0
menu_Content_Selected_green=65
menu_Content_Selected_blue=0
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_blue=0
menu_Content_inactive_alpha=20
menu_Content_inactive_red=0
menu_Content_inactive_green=0
menu_Content_inactive_blue=15
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_red=55
menu_Content_inactive_Text_green=70
menu_Content_inactive_Text_blue=85

View File

@@ -0,0 +1,40 @@
infobar_alpha=0
infobar_red=25
infobar_green=10
infobar_blue=10
infobar_Text_alpha=0
infobar_Text_red=100
infobar_Text_green=100
infobar_Text_blue=100
menu_Head_alpha=0
menu_Head_red=25
menu_Head_green=10
menu_Head_blue=10
menu_Head_Text_alpha=0
menu_Head_Text_red=65
menu_Head_Text_green=65
menu_Head_Text_blue=65
menu_Content_alpha=5
menu_Content_red=20
menu_Content_green=20
menu_Content_blue=20
menu_Content_Text_alpha=0
menu_Content_Text_red=100
menu_Content_Text_green=100
menu_Content_Text_blue=100
menu_Content_Selected_alpha=5
menu_Content_Selected_red=55
menu_Content_Selected_green=55
menu_Content_Selected_blue=55
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_blue=0
menu_Content_inactive_alpha=5
menu_Content_inactive_red=20
menu_Content_inactive_green=20
menu_Content_inactive_blue=20
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_red=60
menu_Content_inactive_Text_green=60
menu_Content_inactive_Text_blue=60

51
data/themes/Gray.theme Normal file
View File

@@ -0,0 +1,51 @@
font_file=/share/fonts/neutrino.ttf
infobar_Text_alpha=0
infobar_Text_blue=100
infobar_Text_green=100
infobar_Text_red=100
infobar_alpha=0
infobar_blue=40
infobar_green=29
infobar_red=25
lcd_autodimm=0
lcd_brightness=10
lcd_contrast=15
lcd_deepbrightness=5
lcd_dim_brightness=8
lcd_dim_time=10
lcd_inverse=0
lcd_power=1
lcd_show_volume=1
lcd_standbybrightness=3
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_blue=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_alpha=0
menu_Content_Selected_blue=70
menu_Content_Selected_green=65
menu_Content_Selected_red=65
menu_Content_Text_alpha=0
menu_Content_Text_blue=100
menu_Content_Text_green=100
menu_Content_Text_red=100
menu_Content_alpha=0
menu_Content_blue=40
menu_Content_green=30
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_blue=100
menu_Content_inactive_Text_green=100
menu_Content_inactive_Text_red=100
menu_Content_inactive_alpha=0
menu_Content_inactive_blue=40
menu_Content_inactive_green=30
menu_Content_inactive_red=25
menu_Content_red=25
menu_Head_Text_alpha=0
menu_Head_Text_blue=0
menu_Head_Text_green=70
menu_Head_Text_red=95
menu_Head_alpha=0
menu_Head_blue=30
menu_Head_green=20
menu_Head_red=15

13
data/themes/Makefile.am Normal file
View File

@@ -0,0 +1,13 @@
installdir = $(DATADIR)/neutrino/themes
install_DATA = \
Classic.theme \
Crema.theme \
DVB2000.theme \
DarkBlue.theme \
DarkBrown.theme \
Gray.theme \
MonoChrom.theme \
Olive.theme \
Red.theme \
VirginMedia.theme

View File

@@ -0,0 +1,40 @@
infobar_Text_alpha=0
infobar_Text_blue=100
infobar_Text_green=100
infobar_Text_red=100
infobar_alpha=0
infobar_blue=0
infobar_green=0
infobar_red=0
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_blue=26
menu_Content_Selected_Text_green=25
menu_Content_Selected_Text_red=25
menu_Content_Selected_alpha=20
menu_Content_Selected_blue=74
menu_Content_Selected_green=75
menu_Content_Selected_red=75
menu_Content_Text_alpha=0
menu_Content_Text_blue=85
menu_Content_Text_green=85
menu_Content_Text_red=85
menu_Content_alpha=20
menu_Content_blue=25
menu_Content_green=25
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_blue=55
menu_Content_inactive_Text_green=55
menu_Content_inactive_Text_red=55
menu_Content_inactive_alpha=20
menu_Content_inactive_blue=25
menu_Content_inactive_green=25
menu_Content_inactive_red=25
menu_Content_red=25
menu_Head_Text_alpha=0
menu_Head_Text_blue=100
menu_Head_Text_green=100
menu_Head_Text_red=100
menu_Head_alpha=0
menu_Head_blue=0
menu_Head_green=0
menu_Head_red=0

40
data/themes/NovaTux.theme Normal file
View File

@@ -0,0 +1,40 @@
infobar_Text_alpha=0
infobar_Text_blue=80
infobar_Text_green=80
infobar_Text_red=80
infobar_alpha=0
infobar_blue=25
infobar_green=14
infobar_red=5
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_blue=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_alpha=0
menu_Content_Selected_blue=5
menu_Content_Selected_green=40
menu_Content_Selected_red=65
menu_Content_Text_alpha=0
menu_Content_Text_blue=75
menu_Content_Text_green=75
menu_Content_Text_red=75
menu_Content_alpha=0
menu_Content_blue=25
menu_Content_green=15
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_blue=45
menu_Content_inactive_Text_green=40
menu_Content_inactive_Text_red=40
menu_Content_inactive_alpha=0
menu_Content_inactive_blue=25
menu_Content_inactive_green=15
menu_Content_inactive_red=0
menu_Content_red=0
menu_Head_Text_alpha=0
menu_Head_Text_blue=10
menu_Head_Text_green=40
menu_Head_Text_red=70
menu_Head_alpha=0
menu_Head_blue=5
menu_Head_green=5
menu_Head_red=5

40
data/themes/Olive.theme Normal file
View File

@@ -0,0 +1,40 @@
infobar_Text_alpha=0
infobar_Text_blue=20
infobar_Text_green=20
infobar_Text_red=20
infobar_alpha=0
infobar_blue=80
infobar_green=80
infobar_red=80
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_blue=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_alpha=0
menu_Content_Selected_blue=0
menu_Content_Selected_green=85
menu_Content_Selected_red=65
menu_Content_Text_alpha=0
menu_Content_Text_blue=100
menu_Content_Text_green=100
menu_Content_Text_red=100
menu_Content_alpha=20
menu_Content_blue=0
menu_Content_green=0
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_blue=60
menu_Content_inactive_Text_green=60
menu_Content_inactive_Text_red=60
menu_Content_inactive_alpha=20
menu_Content_inactive_blue=0
menu_Content_inactive_green=0
menu_Content_inactive_red=0
menu_Content_red=0
menu_Head_Text_alpha=0
menu_Head_Text_blue=20
menu_Head_Text_green=20
menu_Head_Text_red=20
menu_Head_alpha=0
menu_Head_blue=80
menu_Head_green=80
menu_Head_red=80

51
data/themes/Red.theme Normal file
View File

@@ -0,0 +1,51 @@
font_file=/share/fonts/neutrino.ttf
infobar_Text_alpha=0
infobar_Text_blue=100
infobar_Text_green=100
infobar_Text_red=100
infobar_alpha=20
infobar_blue=0
infobar_green=14
infobar_red=40
lcd_autodimm=0
lcd_brightness=10
lcd_contrast=15
lcd_deepbrightness=5
lcd_dim_brightness=8
lcd_dim_time=10
lcd_inverse=0
lcd_power=1
lcd_show_volume=1
lcd_standbybrightness=3
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_blue=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_alpha=20
menu_Content_Selected_blue=100
menu_Content_Selected_green=100
menu_Content_Selected_red=100
menu_Content_Text_alpha=0
menu_Content_Text_blue=100
menu_Content_Text_green=100
menu_Content_Text_red=100
menu_Content_alpha=20
menu_Content_blue=0
menu_Content_green=15
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_blue=35
menu_Content_inactive_Text_green=85
menu_Content_inactive_Text_red=85
menu_Content_inactive_alpha=20
menu_Content_inactive_blue=0
menu_Content_inactive_green=15
menu_Content_inactive_red=35
menu_Content_red=40
menu_Head_Text_alpha=0
menu_Head_Text_blue=0
menu_Head_Text_green=70
menu_Head_Text_red=95
menu_Head_alpha=0
menu_Head_blue=0
menu_Head_green=10
menu_Head_red=40

View File

@@ -0,0 +1,40 @@
infobar_alpha=20
infobar_red=0
infobar_green=0
infobar_blue=0
infobar_Text_alpha=0
infobar_Text_red=100
infobar_Text_green=100
infobar_Text_blue=100
menu_Head_alpha=0
menu_Head_red=0
menu_Head_green=0
menu_Head_blue=0
menu_Head_Text_alpha=0
menu_Head_Text_red=100
menu_Head_Text_green=100
menu_Head_Text_blue=100
menu_Content_alpha=0
menu_Content_red=0
menu_Content_green=0
menu_Content_blue=0
menu_Content_Text_alpha=0
menu_Content_Text_red=100
menu_Content_Text_green=100
menu_Content_Text_blue=100
menu_Content_Selected_alpha=20
menu_Content_Selected_red=100
menu_Content_Selected_green=85
menu_Content_Selected_blue=0
menu_Content_Selected_Text_alpha=0
menu_Content_Selected_Text_red=0
menu_Content_Selected_Text_green=0
menu_Content_Selected_Text_blue=0
menu_Content_inactive_alpha=0
menu_Content_inactive_red=0
menu_Content_inactive_green=0
menu_Content_inactive_blue=0
menu_Content_inactive_Text_alpha=0
menu_Content_inactive_Text_red=60
menu_Content_inactive_Text_green=60
menu_Content_inactive_Text_blue=60

283
src/gui/keybind_setup.cpp Normal file
View File

@@ -0,0 +1,283 @@
/*
$port: keybind_setup.cpp,v 1.4 2010/09/20 10:24:12 tuxbox-cvs Exp $
keybindings setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "gui/keybind_setup.h"
#include "gui/user_menue_setup.h"
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include "gui/filebrowser.h"
#include <driver/screen_max.h>
#include <system/debug.h>
CKeybindSetup::CKeybindSetup()
{
frameBuffer = CFrameBuffer::getInstance();
keySetupNotifier = new CKeySetupNotifier;
keySetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
width = w_max (30, 10);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
CKeybindSetup::~CKeybindSetup()
{
}
int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init keybindings setup\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
if(actionKey == "loadkeys") {
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("conf");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec("/var/tuxbox/config") == true) {
CNeutrinoApp::getInstance()->loadKeys(fileBrowser.getSelectedFile()->Name.c_str());
printf("[neutrino keybind_setup] new keys: %s\n", fileBrowser.getSelectedFile()->Name.c_str());
}
return menu_return::RETURN_REPAINT;
}
else if(actionKey == "savekeys") {
CFileBrowser fileBrowser;
fileBrowser.Dir_Mode = true;
if (fileBrowser.exec("/var/tuxbox") == true) {
char fname[256] = "keys.conf", sname[256];
CStringInputSMS * sms = new CStringInputSMS(LOCALE_EXTRA_SAVEKEYS, fname, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789. ");
sms->exec(NULL, "");
sprintf(sname, "%s/%s", fileBrowser.getSelectedFile()->Name.c_str(), fname);
printf("[neutrino keybind_setup] save keys: %s\n", sname);
CNeutrinoApp::getInstance()->saveKeys(sname);
delete sms;
}
return menu_return::RETURN_REPAINT;
}
showKeySetup();
return res;
}
void CKeybindSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
#define KEYBINDINGMENU_BOUQUETHANDLING_OPTION_COUNT 3
const CMenuOptionChooser::keyval KEYBINDINGMENU_BOUQUETHANDLING_OPTIONS[KEYBINDINGMENU_BOUQUETHANDLING_OPTION_COUNT] =
{
{ 0, LOCALE_KEYBINDINGMENU_BOUQUETCHANNELS_ON_OK },
{ 1, LOCALE_KEYBINDINGMENU_BOUQUETLIST_ON_OK },
{ 2, LOCALE_KEYBINDINGMENU_ALLCHANNELS_ON_OK }
};
typedef struct key_settings_t
{
const neutrino_locale_t keydescription;
int * keyvalue_p;
} key_settings_struct_t;
const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] =
{
{LOCALE_KEYBINDINGMENU_TVRADIOMODE, &g_settings.key_tvradio_mode, },
{LOCALE_KEYBINDINGMENU_POWEROFF, &g_settings.key_power_off, },
{LOCALE_KEYBINDINGMENU_PAGEUP, &g_settings.key_channelList_pageup, },
{LOCALE_KEYBINDINGMENU_PAGEDOWN, &g_settings.key_channelList_pagedown, },
{LOCALE_EXTRA_KEY_LIST_START, &g_settings.key_list_start, },
{LOCALE_EXTRA_KEY_LIST_END, &g_settings.key_list_end, },
{LOCALE_KEYBINDINGMENU_CANCEL, &g_settings.key_channelList_cancel, },
{LOCALE_KEYBINDINGMENU_SORT, &g_settings.key_channelList_sort, },
{LOCALE_KEYBINDINGMENU_ADDRECORD, &g_settings.key_channelList_addrecord, },
{LOCALE_KEYBINDINGMENU_ADDREMIND, &g_settings.key_channelList_addremind, },
{LOCALE_KEYBINDINGMENU_BOUQUETUP, &g_settings.key_bouquet_up, },
{LOCALE_KEYBINDINGMENU_BOUQUETDOWN, &g_settings.key_bouquet_down, },
{LOCALE_KEYBINDINGMENU_CHANNELUP, &g_settings.key_quickzap_up, },
{LOCALE_KEYBINDINGMENU_CHANNELDOWN, &g_settings.key_quickzap_down, },
{LOCALE_KEYBINDINGMENU_SUBCHANNELUP, &g_settings.key_subchannel_up, },
{LOCALE_KEYBINDINGMENU_SUBCHANNELDOWN, &g_settings.key_subchannel_down, },
{LOCALE_KEYBINDINGMENU_ZAPHISTORY, &g_settings.key_zaphistory, },
{LOCALE_KEYBINDINGMENU_LASTCHANNEL, &g_settings.key_lastchannel, },
{LOCALE_MPKEY_REWIND, &g_settings.mpkey_rewind, },
{LOCALE_MPKEY_FORWARD, &g_settings.mpkey_forward, },
{LOCALE_MPKEY_PAUSE, &g_settings.mpkey_pause, },
{LOCALE_MPKEY_STOP, &g_settings.mpkey_stop, },
{LOCALE_MPKEY_PLAY, &g_settings.mpkey_play, },
{LOCALE_MPKEY_AUDIO, &g_settings.mpkey_audio, },
{LOCALE_MPKEY_TIME, &g_settings.mpkey_time, },
{LOCALE_MPKEY_BOOKMARK, &g_settings.mpkey_bookmark, },
{LOCALE_EXTRA_KEY_TIMESHIFT, &g_settings.key_timeshift, },
{LOCALE_MPKEY_PLUGIN, &g_settings.mpkey_plugin, },
{LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, },
{LOCALE_EXTRA_KEY_UNLOCK, &g_settings.key_unlock, },
};
void CKeybindSetup::showKeySetup()
{
//keysetup menu
CMenuWidget* keySettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width);
//keybindings menu
CMenuWidget* bindSettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width);
keySettings->addIntroItems(LOCALE_MAINSETTINGS_KEYBINDING);
//keybindings
int shortcut = 1;
showKeyBindSetup(bindSettings);
keySettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_HEAD, true, NULL, bindSettings, NULL, CRCInput::convertDigitToKey(shortcut++)));
keySettings->addItem(GenericMenuSeparator);
keySettings->addItem(new CMenuForwarder(LOCALE_EXTRA_LOADKEYS, true, NULL, this, "loadkeys", CRCInput::convertDigitToKey(shortcut++)));
keySettings->addItem(new CMenuForwarder(LOCALE_EXTRA_SAVEKEYS, true, NULL, this, "savekeys", CRCInput::convertDigitToKey(shortcut++)));
//rc tuning
keySetupNotifier = new CKeySetupNotifier;
CStringInput * keySettings_repeat_genericblocker = new CStringInput(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, g_settings.repeat_genericblocker, 3, LOCALE_REPEATBLOCKER_HINT_1, LOCALE_REPEATBLOCKER_HINT_2, "0123456789 ", keySetupNotifier);
CStringInput * keySettings_repeatBlocker = new CStringInput(LOCALE_KEYBINDINGMENU_REPEATBLOCK, g_settings.repeat_blocker, 3, LOCALE_REPEATBLOCKER_HINT_1, LOCALE_REPEATBLOCKER_HINT_2, "0123456789 ", keySetupNotifier);
keySetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
keySettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_RC));
keySettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_REPEATBLOCK, true, g_settings.repeat_blocker, keySettings_repeatBlocker));
keySettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, true, g_settings.repeat_genericblocker, keySettings_repeat_genericblocker));
//user menues
keySettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_USERMENU_HEAD));
keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_RED, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_RED,0), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_GREEN, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_GREEN,1), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_YELLOW, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_YELLOW,2), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
keySettings->addItem(new CMenuForwarder(LOCALE_USERMENU_BUTTON_BLUE, true, NULL, new CUserMenuSetup(LOCALE_USERMENU_BUTTON_BLUE,3), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
keySettings->exec(NULL, "");
keySettings->hide();
delete keySettings;
}
void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
{
bindSettings->addIntroItems(LOCALE_KEYBINDINGMENU_HEAD);
for (int i = 0; i < KEYBINDS_COUNT; i++)
keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS);
//modes
CMenuWidget* bindSettings_modes = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width);
showKeyBindModeSetup(bindSettings_modes);
bindSettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_MODECHANGE, true, NULL, bindSettings_modes, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
// channellist keybindings
CMenuWidget* bindSettings_chlist = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width);
showKeyBindChannellistSetup(bindSettings_chlist);
bindSettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_CHANNELLIST, true, NULL, bindSettings_chlist, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
// Zapping keys quickzap
CMenuWidget* bindSettings_qzap = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width);
showKeyBindQuickzapSetup(bindSettings_qzap);
bindSettings->addItem(new CMenuForwarder(LOCALE_KEYBINDINGMENU_QUICKZAP, true, NULL, bindSettings_qzap, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
//movieplayer
CMenuWidget* bindSettings_mplayer = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width);
showKeyBindMovieplayerSetup(bindSettings_mplayer);
bindSettings->addItem(new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, bindSettings_mplayer, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
//misc
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC));
//bindSettings->addItem(new CMenuForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN]));
bindSettings->addItem(new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, NULL, keychooser[KEY_UNLOCK]));
//bindSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_ZAP_CYCLE, &g_settings.zap_cycle, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
bindSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_MENU_LEFT_EXIT, &g_settings.menu_left_exit, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
bindSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_AUDIO_RUN_PLAYER, &g_settings.audio_run_player, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
}
void CKeybindSetup::showKeyBindModeSetup(CMenuWidget *bindSettings_modes)
{
bindSettings_modes->addIntroItems(LOCALE_KEYBINDINGMENU_MODECHANGE);
bindSettings_modes->addItem(new CMenuForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, NULL, keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
bindSettings_modes->addItem(new CMenuForwarder(key_settings[KEY_POWER_OFF].keydescription, true, NULL, keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
}
void CKeybindSetup::showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist)
{
bindSettings_chlist->addIntroItems(LOCALE_KEYBINDINGMENU_CHANNELLIST);
CMenuOptionChooser *oj = new CMenuOptionChooser(LOCALE_KEYBINDINGMENU_BOUQUETHANDLING, &g_settings.bouquetlist_mode, KEYBINDINGMENU_BOUQUETHANDLING_OPTIONS, KEYBINDINGMENU_BOUQUETHANDLING_OPTION_COUNT, true );
bindSettings_chlist->addItem(oj);
for (int i = KEY_PAGE_UP; i <= KEY_BOUQUET_DOWN; i++)
bindSettings_chlist->addItem(new CMenuForwarder(key_settings[i].keydescription, true, NULL, keychooser[i]));
bindSettings_chlist->addItem(new CMenuOptionChooser(LOCALE_EXTRA_SMS_CHANNEL, &g_settings.sms_channel, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
}
void CKeybindSetup::showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap)
{
bindSettings_qzap->addIntroItems(LOCALE_KEYBINDINGMENU_QUICKZAP);
for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++)
bindSettings_qzap->addItem(new CMenuForwarder(key_settings[i].keydescription, true, NULL, keychooser[i]));
}
void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplayer)
{
bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER);
for (int i = MPKEY_REWIND; i <= MPKEY_PLUGIN; i++)
bindSettings_mplayer->addItem(new CMenuForwarder(key_settings[i].keydescription, true, NULL, keychooser[i]));
}

106
src/gui/keybind_setup.h Normal file
View File

@@ -0,0 +1,106 @@
/*
$port: keybind_setup.h,v 1.2 2010/09/07 09:22:36 tuxbox-cvs Exp $
keybindings setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __keybind_setup__
#define __keybind_setup__
#include <gui/widget/menue.h>
#include <gui/widget/icons.h>
#include <gui/widget/keychooser.h>
#include <driver/framebuffer.h>
#include <system/setting_helpers.h>
#include <string>
class CKeybindSetup : public CMenuTarget
{
public:
enum keynames
{
KEY_TV_RADIO_MODE,
KEY_POWER_OFF,
KEY_PAGE_UP,
KEY_PAGE_DOWN,
KEY_LIST_START,
KEY_LIST_END,
KEY_CANCEL_ACTION,
KEY_SORT,
KEY_ADD_RECORD,
KEY_ADD_REMIND,
KEY_BOUQUET_UP,
KEY_BOUQUET_DOWN,
KEY_CHANNEL_UP,
KEY_CHANNEL_DOWN,
KEY_SUBCHANNEL_UP,
KEY_SUBCHANNEL_DOWN,
KEY_ZAP_HISTORY,
KEY_LASTCHANNEL,
MPKEY_REWIND,
MPKEY_FORWARD,
MPKEY_PAUSE,
MPKEY_STOP,
MPKEY_PLAY,
MPKEY_AUDIO,
MPKEY_TIME,
MPKEY_BOOKMARK,
KEY_TIMESHIFT,
MPKEY_PLUGIN,
KEY_PLUGIN,
KEY_UNLOCK,
KEYBINDS_COUNT
};
private:
CFrameBuffer *frameBuffer;
CKeySetupNotifier *keySetupNotifier;
CKeyChooser * keychooser[KEYBINDS_COUNT];
int x, y, width, height, hheight, mheight;
void hide();
void showKeySetup();
void showKeyBindSetup(CMenuWidget *bindSettings);
void showKeyBindModeSetup(CMenuWidget *bindSettings_modes);
void showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist);
void showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap);
void showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplayer);
public:
CKeybindSetup();
~CKeybindSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

530
src/gui/osd_setup.cpp Normal file
View File

@@ -0,0 +1,530 @@
/*
$port: osd_setup.cpp,v 1.6 2010/09/30 20:13:59 tuxbox-cvs Exp $
osd_setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "osd_setup.h"
#include "alphasetup.h"
#include "themes.h"
#include "screensetup.h"
#include "osdlang_setup.h"
#include "themes.h"
#include "filebrowser.h"
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <gui/widget/icons.h>
#include <gui/widget/colorchooser.h>
#include <gui/widget/stringinput.h>
#include <driver/screen_max.h>
#include <system/debug.h>
static CTimingSettingsNotifier timingsettingsnotifier;
extern const char * locale_real_names[];
extern std::string ttx_font_file;
COsdSetup::COsdSetup(bool wizard_mode)
{
frameBuffer = CFrameBuffer::getInstance();
colorSetupNotifier = new CColorSetupNotifier();
colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
fontsizenotifier = new CFontSizeNotifier;
is_wizard = wizard_mode;
width = w_max (30, 10); //%
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
COsdSetup::~COsdSetup()
{
delete colorSetupNotifier;
delete fontsizenotifier;
}
void COsdSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
dprintf(DEBUG_DEBUG, "init osd setup\n");
if(parent != NULL)
parent->hide();
if(actionKey == "select_font")
{
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("ttf");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec(FONTDIR) == true)
{
strcpy(g_settings.font_file, fileBrowser.getSelectedFile()->Name.c_str());
printf("[neutrino] new font file %s\n", fileBrowser.getSelectedFile()->Name.c_str());
CNeutrinoApp::getInstance()->SetupFonts();
}
return menu_return::RETURN_REPAINT;
}
else if(actionKey == "ttx_font")
{
CFileBrowser fileBrowser;
CFileFilter fileFilter;
fileFilter.addFilter("ttf");
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec(FONTDIR) == true)
{
strcpy(g_settings.ttx_font_file, fileBrowser.getSelectedFile()->Name.c_str());
ttx_font_file = fileBrowser.getSelectedFile()->Name;
printf("[neutrino] ttx font file %s\n", fileBrowser.getSelectedFile()->Name.c_str());
CNeutrinoApp::getInstance()->SetupFonts();
}
return menu_return::RETURN_REPAINT;
}
else if (actionKey == "font_scaling") {
int xre = g_settings.screen_xres;
int yre = g_settings.screen_yres;
CMenuWidget fontscale(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_COLORS);
fontscale.addIntroItems(LOCALE_FONTMENU_SCALING);
fontscale.addItem(new CMenuOptionNumberChooser(LOCALE_FONTMENU_SCALING_X, &xre, true, 50, 200));
fontscale.addItem(new CMenuOptionNumberChooser(LOCALE_FONTMENU_SCALING_Y, &yre, true, 50, 200));
fontscale.exec(NULL, "");
if (xre != g_settings.screen_xres || yre != g_settings.screen_yres) {
printf("[neutrino] new font scale settings x: %d%% y: %d%%\n", xre, yre);
g_settings.screen_xres = xre;
g_settings.screen_yres = yre;
CNeutrinoApp::getInstance()->SetupFonts();
}
return menu_return::RETURN_REPAINT;
}
else if(actionKey=="osd.def") {
for (int i = 0; i < TIMING_SETTING_COUNT; i++)
g_settings.timing[i] = default_timing[i];
CNeutrinoApp::getInstance()->SetupTiming();
return menu_return::RETURN_REPAINT;
}
showOsdSetup();
return menu_return::RETURN_REPAINT;
}
#define OSD_PRESET_OPTIONS_COUNT 2
const CMenuOptionChooser::keyval OSD_PRESET_OPTIONS[OSD_PRESET_OPTIONS_COUNT] =
{
{ 0, LOCALE_COLORMENU_SD_PRESET },
{ 1, LOCALE_COLORMENU_HD_PRESET }
};
#define INFOBAR_CASYSTEM_MODE_OPTION_COUNT 4
const CMenuOptionChooser::keyval INFOBAR_CASYSTEM_MODE_OPTIONS[INFOBAR_CASYSTEM_MODE_OPTION_COUNT] =
{
{ 0, LOCALE_OPTIONS_ON },
{ 1, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_MODE },
{ 2, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_MINI },
{ 3, LOCALE_OPTIONS_OFF },
};
#define SHOW_INFOMENU_MODE_OPTION_COUNT 2
const CMenuOptionChooser::keyval SHOW_INFOMENU_MODE_OPTIONS[SHOW_INFOMENU_MODE_OPTION_COUNT] =
{
{ 0, LOCALE_MAINMENU_HEAD },
{ 1, LOCALE_MAINMENU_SERVICE },
};
#define MENU_CORNERSETTINGS_TYPE_OPTION_COUNT 2
const CMenuOptionChooser::keyval MENU_CORNERSETTINGS_TYPE_OPTIONS[MENU_CORNERSETTINGS_TYPE_OPTION_COUNT] =
{
{ 0, LOCALE_EXTRA_ROUNDED_CORNERS_OFF },
{ 1, LOCALE_EXTRA_ROUNDED_CORNERS_ON }
};
#define INFOBAR_SUBCHAN_DISP_POS_OPTIONS_COUNT 5
const CMenuOptionChooser::keyval INFOBAR_SUBCHAN_DISP_POS_OPTIONS[INFOBAR_SUBCHAN_DISP_POS_OPTIONS_COUNT]=
{
{ 0 , LOCALE_SETTINGS_POS_TOP_RIGHT },
{ 1 , LOCALE_SETTINGS_POS_TOP_LEFT },
{ 2 , LOCALE_SETTINGS_POS_BOTTOM_LEFT },
{ 3 , LOCALE_SETTINGS_POS_BOTTOM_RIGHT },
{ 4 , LOCALE_INFOVIEWER_SUBCHAN_INFOBAR }
};
#define VOLUMEBAR_DISP_POS_OPTIONS_COUNT 6
const CMenuOptionChooser::keyval VOLUMEBAR_DISP_POS_OPTIONS[VOLUMEBAR_DISP_POS_OPTIONS_COUNT]=
{
{ 0 , LOCALE_SETTINGS_POS_TOP_RIGHT },
{ 1 , LOCALE_SETTINGS_POS_TOP_LEFT },
{ 2 , LOCALE_SETTINGS_POS_BOTTOM_LEFT },
{ 3 , LOCALE_SETTINGS_POS_BOTTOM_RIGHT },
{ 4 , LOCALE_SETTINGS_POS_DEFAULT_CENTER },
{ 5 , LOCALE_SETTINGS_POS_HIGHER_CENTER }
};
#define MENU_DISP_POS_OPTIONS_COUNT 5
const CMenuOptionChooser::keyval MENU_DISP_POS_OPTIONS[MENU_DISP_POS_OPTIONS_COUNT]=
{
{ 0 , LOCALE_SETTINGS_POS_DEFAULT_CENTER },
{ 1 , LOCALE_SETTINGS_POS_TOP_LEFT },
{ 2 , LOCALE_SETTINGS_POS_TOP_RIGHT },
{ 3 , LOCALE_SETTINGS_POS_BOTTOM_LEFT },
{ 4 , LOCALE_SETTINGS_POS_BOTTOM_RIGHT }
};
//show osd setup
void COsdSetup::showOsdSetup()
{
//osd main menu
CMenuWidget *osd_menu = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, width);
osd_menu->setWizardMode(is_wizard);
//menu colors
CMenuWidget *osd_menu_colors = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, width);
//intro with subhead and back button
osd_menu->addIntroItems(LOCALE_MAINSETTINGS_OSD);
//item menu colors
showOsdMenueColorSetup(osd_menu_colors);
osd_menu->addItem(new CMenuForwarder(LOCALE_COLORMENU_MENUCOLORS, true, NULL, osd_menu_colors, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
//fonts
CMenuWidget *osd_menu_fonts = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, width);
showOsdFontSizeSetup(osd_menu_fonts);
osd_menu->addItem(new CMenuForwarder(LOCALE_FONTMENU_HEAD, true, NULL, osd_menu_fonts, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
//timeouts
CMenuWidget *osd_menu_timing = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width);
showOsdTimeoutSetup(osd_menu_timing);
osd_menu->addItem(new CMenuForwarder(LOCALE_COLORMENU_TIMING, true, NULL, osd_menu_timing, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
//screen
osd_menu->addItem(new CMenuForwarder(LOCALE_VIDEOMENU_SCREENSETUP, true, NULL, new CScreenSetup(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
//infobar
CMenuWidget *osd_menu_infobar = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width);
showOsdInfobarSetup(osd_menu_infobar);
osd_menu->addItem(new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, osd_menu_infobar, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1));
//monitor
CScreenPresetNotifier * presetNotify = new CScreenPresetNotifier();
osd_menu->addItem(new CMenuOptionChooser(LOCALE_COLORMENU_OSD_PRESET, &g_settings.screen_preset, OSD_PRESET_OPTIONS, OSD_PRESET_OPTIONS_COUNT, true, presetNotify));
osd_menu->addItem(GenericMenuSeparatorLine);
//options
osd_menu->addItem(new CMenuOptionChooser(LOCALE_EXTRA_ROUNDED_CORNERS, &g_settings.rounded_corners, MENU_CORNERSETTINGS_TYPE_OPTIONS, MENU_CORNERSETTINGS_TYPE_OPTION_COUNT, true));
osd_menu->addItem(new CMenuOptionChooser(LOCALE_EXTRA_SCRAMBLED_MESSAGE, &g_settings.scrambled_message, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
osd_menu->addItem(new CMenuOptionChooser(LOCALE_INFOVIEWER_SUBCHAN_DISP_POS, &g_settings.infobar_subchan_disp_pos, INFOBAR_SUBCHAN_DISP_POS_OPTIONS, INFOBAR_SUBCHAN_DISP_POS_OPTIONS_COUNT, true));
osd_menu->addItem(new CMenuOptionChooser(LOCALE_EXTRA_VOLUME_POS, &g_settings.volume_pos, VOLUMEBAR_DISP_POS_OPTIONS, VOLUMEBAR_DISP_POS_OPTIONS_COUNT, true));
osd_menu->addItem(new CMenuOptionChooser(LOCALE_SETTINGS_MENU_POS, &g_settings.menu_pos, MENU_DISP_POS_OPTIONS, MENU_DISP_POS_OPTIONS_COUNT, true));
osd_menu->addItem(new CMenuOptionChooser(LOCALE_COLORMENU_FADE, &g_settings.widget_fade, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true ));
osd_menu->exec(NULL, "");
osd_menu->hide();
delete osd_menu;
}
//menue colors
void COsdSetup::showOsdMenueColorSetup(CMenuWidget *menu_colors)
{
menu_colors->addIntroItems(LOCALE_COLORMENU_MENUCOLORS);
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_THEMESELECT, true, NULL, new CThemes(), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED) );
CColorChooser* chHeadcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &g_settings.menu_Head_red, &g_settings.menu_Head_green, &g_settings.menu_Head_blue,
&g_settings.menu_Head_alpha, colorSetupNotifier);
CColorChooser* chHeadTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &g_settings.menu_Head_Text_red, &g_settings.menu_Head_Text_green, &g_settings.menu_Head_Text_blue,
NULL, colorSetupNotifier);
CColorChooser* chContentcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &g_settings.menu_Content_red, &g_settings.menu_Content_green, &g_settings.menu_Content_blue,
&g_settings.menu_Content_alpha, colorSetupNotifier);
CColorChooser* chContentTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &g_settings.menu_Content_Text_red, &g_settings.menu_Content_Text_green, &g_settings.menu_Content_Text_blue,
NULL, colorSetupNotifier);
CColorChooser* chContentSelectedcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &g_settings.menu_Content_Selected_red, &g_settings.menu_Content_Selected_green, &g_settings.menu_Content_Selected_blue,
&g_settings.menu_Content_Selected_alpha, colorSetupNotifier);
CColorChooser* chContentSelectedTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &g_settings.menu_Content_Selected_Text_red, &g_settings.menu_Content_Selected_Text_green, &g_settings.menu_Content_Selected_Text_blue,
NULL, colorSetupNotifier);
CColorChooser* chContentInactivecolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &g_settings.menu_Content_inactive_red, &g_settings.menu_Content_inactive_green, &g_settings.menu_Content_inactive_blue,
&g_settings.menu_Content_inactive_alpha, colorSetupNotifier);
CColorChooser* chContentInactiveTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &g_settings.menu_Content_inactive_Text_red, &g_settings.menu_Content_inactive_Text_green, &g_settings.menu_Content_inactive_Text_blue,
NULL, colorSetupNotifier);
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORMENUSETUP_MENUHEAD));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chHeadcolor ));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_TEXTCOLOR, true, NULL, chHeadTextcolor ));
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORMENUSETUP_MENUCONTENT));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chContentcolor ));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_TEXTCOLOR, true, NULL, chContentTextcolor ));
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORMENUSETUP_MENUCONTENT_INACTIVE));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chContentInactivecolor ));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_TEXTCOLOR, true, NULL, chContentInactiveTextcolor));
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORMENUSETUP_MENUCONTENT_SELECTED));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chContentSelectedcolor ));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_TEXTCOLOR, true, NULL, chContentSelectedTextcolor ));
CColorChooser* chInfobarcolor = new CColorChooser(LOCALE_COLORMENU_BACKGROUND, &g_settings.infobar_red,
&g_settings.infobar_green, &g_settings.infobar_blue, &g_settings.infobar_alpha, colorSetupNotifier);
CColorChooser* chInfobarTextcolor = new CColorChooser(LOCALE_COLORMENU_TEXTCOLOR, &g_settings.infobar_Text_red,
&g_settings.infobar_Text_green, &g_settings.infobar_Text_blue, NULL, colorSetupNotifier);
menu_colors->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORSTATUSBAR_TEXT));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_BACKGROUND, true, NULL, chInfobarcolor ));
menu_colors->addItem( new CMenuForwarder(LOCALE_COLORMENU_TEXTCOLOR, true, NULL, chInfobarTextcolor ));
}
//font settings
const SNeutrinoSettings::FONT_TYPES channellist_font_sizes[4] =
{
SNeutrinoSettings::FONT_TYPE_CHANNELLIST,
SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR,
SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER,
SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP
};
const SNeutrinoSettings::FONT_TYPES eventlist_font_sizes[4] =
{
SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE,
SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE,
SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL,
SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME,
};
const SNeutrinoSettings::FONT_TYPES infobar_font_sizes[4] =
{
SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER,
SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME,
SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO,
SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL
};
const SNeutrinoSettings::FONT_TYPES epg_font_sizes[4] =
{
SNeutrinoSettings::FONT_TYPE_EPG_TITLE,
SNeutrinoSettings::FONT_TYPE_EPG_INFO1,
SNeutrinoSettings::FONT_TYPE_EPG_INFO2,
SNeutrinoSettings::FONT_TYPE_EPG_DATE
};
const SNeutrinoSettings::FONT_TYPES gamelist_font_sizes[2] =
{
SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE,
SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMSMALL
};
const SNeutrinoSettings::FONT_TYPES other_font_sizes[4] =
{
SNeutrinoSettings::FONT_TYPE_MENU,
SNeutrinoSettings::FONT_TYPE_MENU_TITLE,
SNeutrinoSettings::FONT_TYPE_MENU_INFO,
SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM
};
font_sizes_groups font_sizes_groups[6] =
{
{LOCALE_FONTMENU_MENU , 4, other_font_sizes , "fontsize.doth"},
{LOCALE_FONTMENU_CHANNELLIST, 4, channellist_font_sizes, "fontsize.dcha"},
{LOCALE_FONTMENU_EVENTLIST , 4, eventlist_font_sizes , "fontsize.deve"},
{LOCALE_FONTMENU_EPG , 4, epg_font_sizes , "fontsize.depg"},
{LOCALE_FONTMENU_INFOBAR , 4, infobar_font_sizes , "fontsize.dinf"},
{LOCALE_FONTMENU_GAMELIST , 2, gamelist_font_sizes , "fontsize.dgam"}
};
#define FONT_STYLE_REGULAR 0
#define FONT_STYLE_BOLD 1
#define FONT_STYLE_ITALIC 2
font_sizes_struct neutrino_font[FONT_TYPE_COUNT] =
{
{LOCALE_FONTSIZE_MENU , 20, FONT_STYLE_BOLD , 0},
{LOCALE_FONTSIZE_MENU_TITLE , 30, FONT_STYLE_BOLD , 0},
{LOCALE_FONTSIZE_MENU_INFO , 16, FONT_STYLE_REGULAR, 0},
{LOCALE_FONTSIZE_EPG_TITLE , 25, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_EPG_INFO1 , 17, FONT_STYLE_ITALIC , 2},
{LOCALE_FONTSIZE_EPG_INFO2 , 17, FONT_STYLE_REGULAR, 2},
{LOCALE_FONTSIZE_EPG_DATE , 15, FONT_STYLE_REGULAR, 2},
{LOCALE_FONTSIZE_EVENTLIST_TITLE , 30, FONT_STYLE_REGULAR, 0},
{LOCALE_FONTSIZE_EVENTLIST_ITEMLARGE, 20, FONT_STYLE_BOLD , 1},
{LOCALE_FONTSIZE_EVENTLIST_ITEMSMALL, 14, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_EVENTLIST_DATETIME , 16, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_GAMELIST_ITEMLARGE , 20, FONT_STYLE_BOLD , 1},
{LOCALE_FONTSIZE_GAMELIST_ITEMSMALL , 16, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_CHANNELLIST , 20, FONT_STYLE_BOLD , 1},
{LOCALE_FONTSIZE_CHANNELLIST_DESCR , 20, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_CHANNELLIST_NUMBER , 14, FONT_STYLE_BOLD , 2},
{LOCALE_FONTSIZE_CHANNEL_NUM_ZAP , 40, FONT_STYLE_BOLD , 0},
{LOCALE_FONTSIZE_INFOBAR_NUMBER , 50, FONT_STYLE_BOLD , 0},
{LOCALE_FONTSIZE_INFOBAR_CHANNAME , 30, FONT_STYLE_BOLD , 0},
{LOCALE_FONTSIZE_INFOBAR_INFO , 20, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_INFOBAR_SMALL , 14, FONT_STYLE_REGULAR, 1},
{LOCALE_FONTSIZE_FILEBROWSER_ITEM , 16, FONT_STYLE_BOLD , 1}
};
/* for font size setup */
class CMenuNumberInput : public CMenuForwarder, CMenuTarget, CChangeObserver
{
private:
CChangeObserver * observer;
CConfigFile * configfile;
int32_t defaultvalue;
char value[11];
protected:
virtual const char * getOption(void)
{
sprintf(value, "%u", configfile->getInt32(locale_real_names[text], defaultvalue));
return value;
}
virtual bool changeNotify(const neutrino_locale_t OptionName, void * Data)
{
configfile->setInt32(locale_real_names[text], atoi(value));
return observer->changeNotify(OptionName, Data);
}
public:
CMenuNumberInput(const neutrino_locale_t Text, const int32_t DefaultValue, CChangeObserver * const Observer, CConfigFile * const Configfile) : CMenuForwarder(Text, true, NULL, this)
{
observer = Observer;
configfile = Configfile;
defaultvalue = DefaultValue;
}
int exec(CMenuTarget * parent, const std::string & action_Key)
{
CStringInput input(text, (char *)getOption(), 3, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 ", this);
return input.exec(parent, action_Key);
}
};
void COsdSetup::AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry)
{
font_Settings.addItem(new CMenuNumberInput(neutrino_font[number_of_fontsize_entry].name, neutrino_font[number_of_fontsize_entry].defaultsize, fontsizenotifier, CNeutrinoApp::getInstance()->getConfigFile()));
}
//font settings menu
void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
{
CMenuWidget *fontSettings = menu_fonts;
fontSettings->addIntroItems(LOCALE_FONTMENU_HEAD);
fontSettings->addItem( new CMenuForwarder(LOCALE_COLORMENU_FONT, true, NULL, this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
fontSettings->addItem( new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, NULL, this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
fontSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FONTMENU_SIZES));
//submenu font scaling
fontSettings->addItem(new CMenuForwarder(LOCALE_FONTMENU_SCALING, true, NULL, this, "font_scaling", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_YELLOW));
//fontSettings->addItem( new CMenuForwarder(LOCALE_EPGPLUS_SELECT_FONT_NAME, true, NULL, this, "select_font"));
for (int i = 0; i < 6; i++)
{
CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING);
fontSettingsSubMenu->addIntroItems(font_sizes_groups[i].groupname);
for (unsigned int j = 0; j < font_sizes_groups[i].count; j++)
{
AddFontSettingItem(*fontSettingsSubMenu, font_sizes_groups[i].content[j]);
}
fontSettingsSubMenu->addItem(GenericMenuSeparatorLine);
fontSettingsSubMenu->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, font_sizes_groups[i].actionkey));
fontSettings->addItem(new CMenuForwarder(font_sizes_groups[i].groupname, true, NULL, fontSettingsSubMenu));
}
}
//osd timeouts
void COsdSetup::showOsdTimeoutSetup(CMenuWidget* menu_timeout)
{
menu_timeout->addIntroItems(LOCALE_COLORMENU_TIMING);
for (int i = 0; i < TIMING_SETTING_COUNT; i++)
{
CStringInput * timing_item = new CStringInput(timing_setting_name[i], g_settings.timing_string[i], 3, LOCALE_TIMING_HINT_1, LOCALE_TIMING_HINT_2, "0123456789 ", &timingsettingsnotifier);
menu_timeout->addItem(new CMenuForwarder(timing_setting_name[i], true, g_settings.timing_string[i], timing_item));
}
menu_timeout->addItem(GenericMenuSeparatorLine);
menu_timeout->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, "osd.def", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
}
#define LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS_COUNT 4
const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS_COUNT]=
{
{ 0 , LOCALE_MISCSETTINGS_INFOBAR_DISP_0 },
{ 1 , LOCALE_MISCSETTINGS_INFOBAR_DISP_1 },
{ 2 , LOCALE_MISCSETTINGS_INFOBAR_DISP_2 },
{ 3 , LOCALE_MISCSETTINGS_INFOBAR_DISP_3 }
};
void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
{
menu_infobar->addIntroItems(LOCALE_MISCSETTINGS_INFOBAR);
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_DISPLAY, &g_settings.casystem_display, INFOBAR_CASYSTEM_MODE_OPTIONS, INFOBAR_CASYSTEM_MODE_OPTION_COUNT, true));
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_DISP_LOG, &g_settings.infobar_show_channellogo, LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS_COUNT, true));
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_VIRTUAL_ZAP_MODE, &g_settings.virtual_zap_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, &g_settings.infobar_sat_display, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_VAR_HDD, &g_settings.infobar_show_var_hdd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW, &g_settings.infobar_show, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
}

96
src/gui/osd_setup.h Normal file
View File

@@ -0,0 +1,96 @@
/*
$port: osd_setup.h,v 1.1 2010/08/28 22:47:09 tuxbox-cvs Exp $
osd_setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __osd_setup__
#define __osd_setup__
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <system/setting_helpers.h>
#include <system/settings.h>
#include <string>
class COsdSetup : public CMenuTarget
{
private:
CFrameBuffer *frameBuffer;
CColorSetupNotifier *colorSetupNotifier;
CFontSizeNotifier *fontsizenotifier;
int x, y, width, height, hheight, mheight;
bool is_wizard;
void hide();
void showOsdSetup();
void showOsdMenueColorSetup(CMenuWidget *menu_colors);
void showOsdFontSizeSetup(CMenuWidget *menu_fonts);
void showOsdTimeoutSetup(CMenuWidget *menu_timeout);
void showOsdInfobarSetup(CMenuWidget *menu_infobar);
void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry);
public:
COsdSetup(bool wizard_mode = false);
~COsdSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
enum INFOBAR_CHANNEL_LOGO_POS_OPTIONS
{
INFOBAR_NO_LOGO,
INFOBAR_LOGO_AS_CHANNELLUM,
INFOBAR_LOGO_AS_CHANNELNAME,
INFOBAR_LOGO_BESIDE_CHANNELNAME
};
enum INFOBAR_CHANNEL_LOGO_BACKROUND_OPTIONS
{
INFOBAR_NO_BACKGROUND,
INFOBAR_LOGO_FRAMED,
INFOBAR_LOGO_SHADED
};
};
class COsdSetupChannelLogoNotifier : public CChangeObserver
{
private:
CMenuForwarder* toDisable1;
CMenuOptionChooser* toDisable2;
public:
COsdSetupChannelLogoNotifier( CMenuForwarder*, CMenuOptionChooser* );
bool changeNotify(const neutrino_locale_t, void * Data);
};
#endif

279
src/gui/osdlang_setup.cpp Normal file
View File

@@ -0,0 +1,279 @@
/*
$Id: osdlang_setup.cpp,v 1.2 2010/09/30 20:13:59 dbt Exp $
OSD-Language Setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "osdlang_setup.h"
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <gui/widget/icons.h>
#include <driver/screen_max.h>
#include <xmlinterface.h>
#include <system/debug.h>
#include <algorithm>
#include <dirent.h>
COsdLangSetup::COsdLangSetup(bool wizard_mode)
{
frameBuffer = CFrameBuffer::getInstance();
is_wizard = wizard_mode;
width = w_max (45, 10);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
COsdLangSetup::~COsdLangSetup()
{
}
void COsdLangSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
int COsdLangSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{
dprintf(DEBUG_DEBUG, "init international setup\n");
if(parent != NULL)
parent->hide();
showLocalSetup();
return menu_return::RETURN_REPAINT;
}
//show international settings menu
void COsdLangSetup::showLocalSetup()
{
//main local setup
CMenuWidget *localSettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_LANGUAGE, width);
localSettings->setWizardMode(is_wizard);
//add subhead and back button
localSettings->addIntroItems(LOCALE_LANGUAGESETUP_HEAD);
//language setup
CMenuWidget * osdl_setup = new CMenuWidget(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE/*, width*/);
showLanguageSetup(osdl_setup);
localSettings->addItem(new CMenuForwarder(LOCALE_LANGUAGESETUP_OSD, true, NULL, osdl_setup, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
//timezone setup
CMenuOptionStringChooser* tzSelect = getTzItems();
if (tzSelect != NULL)
localSettings->addItem(tzSelect);
//prefered audio language
CLangSelectNotifier *langNotifier = new CLangSelectNotifier();
CMenuWidget * prefMenu = new CMenuWidget(LOCALE_AUDIOMENU_PREF_LANGUAGES, NEUTRINO_ICON_LANGUAGE/*, width*/);
//call menue for prefered audio languages
showPrefMenu(prefMenu, langNotifier);
localSettings->addItem(new CMenuForwarder(LOCALE_AUDIOMENU_PREF_LANGUAGES, true, NULL, prefMenu, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
langNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
localSettings->exec(NULL, "");
localSettings->hide();
delete localSettings;
}
//returns items for selectable timezones
CMenuOptionStringChooser* COsdLangSetup::getTzItems()
{
xmlDocPtr parser = parseXmlFile("/etc/timezone.xml");
CMenuOptionStringChooser* tzSelect = NULL;
if (parser != NULL)
{
tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, g_settings.timezone, true, new CTZChangeNotifier(), CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true);
xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode;
bool found = false;
while (search)
{
if (!strcmp(xmlGetName(search), "zone"))
{
std::string name = xmlGetAttribute(search, "name");
std::string zone = xmlGetAttribute(search, "zone");
//printf("Timezone: %s -> %s\n", name.c_str(), zone.c_str());
tzSelect->addOption(name.c_str());
found = true;
}
search = search->xmlNextNode;
}
if (!found)
{
delete tzSelect;
tzSelect = NULL;
}
xmlFreeDoc(parser);
}
return tzSelect;
}
//shows locale setup for language selection
void COsdLangSetup::showLanguageSetup(CMenuWidget *osdl_setup)
{
struct dirent **namelist;
int n;
// printf("scanning locale dir now....(perhaps)\n");
char *pfad[] = {(char *) DATADIR "/neutrino/locale",(char *) "/var/tuxbox/config/locale"};
osdl_setup->addIntroItems();
for (int p = 0; p < 2; p++)
{
n = scandir(pfad[p], &namelist, 0, alphasort);
if (n < 0)
{
perror("loading locales: scandir");
}
else
{
for (int count=0; count<n; count++)
{
char * locale = strdup(namelist[count]->d_name);
char * pos = strstr(locale, ".locale");
if (pos != NULL)
{
char iname[50];
*pos = '\0';
sprintf(iname, "%s", locale);
CMenuOptionLanguageChooser* oj = new CMenuOptionLanguageChooser((char*)locale, this, iname);
oj->addOption(locale);
osdl_setup->addItem( oj );
} else
free(locale);
free(namelist[count]);
}
free(namelist);
}
}
}
//shows menue for prefered audio/epg languages
void COsdLangSetup::showPrefMenu(CMenuWidget *prefMenu, CLangSelectNotifier *langNotifier)
{
prefMenu->addItem(GenericMenuSeparator);
prefMenu->addItem(GenericMenuBack);
prefMenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_PREF_LANG_HEAD));
prefMenu->addItem(new CMenuOptionChooser(LOCALE_AUDIOMENU_AUTO_LANG, &g_settings.auto_lang, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL));
for(int i = 0; i < 3; i++)
{
CMenuOptionStringChooser * langSelect = new CMenuOptionStringChooser(LOCALE_AUDIOMENU_PREF_LANG, g_settings.pref_lang[i], true, langNotifier, CRCInput::convertDigitToKey(i+1), "", true);
std::map<std::string, std::string>::const_iterator it;
for(it = iso639rev.begin(); it != iso639rev.end(); it++)
langSelect->addOption(it->first.c_str());
prefMenu->addItem(langSelect);
}
prefMenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_PREF_SUBS_HEAD));
prefMenu->addItem(new CMenuOptionChooser(LOCALE_AUDIOMENU_AUTO_SUBS, &g_settings.auto_subs, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL));
for(int i = 0; i < 3; i++)
{
CMenuOptionStringChooser * langSelect = new CMenuOptionStringChooser(LOCALE_AUDIOMENU_PREF_SUBS, g_settings.pref_subs[i], true, NULL, CRCInput::convertDigitToKey(i+4), "", true);
std::map<std::string, std::string>::const_iterator it;
for(it = iso639rev.begin(); it != iso639rev.end(); it++)
langSelect->addOption(it->first.c_str());
prefMenu->addItem(langSelect);
}
}
bool COsdLangSetup::changeNotify(const neutrino_locale_t, void *)
{
//apply osd language
g_Locale->loadLocale(g_settings.language);
return true;
}
void sectionsd_set_languages(const std::vector<std::string>& newLanguages);
bool CLangSelectNotifier::changeNotify(const neutrino_locale_t, void *)
{
std::vector<std::string> v_languages;
bool found = false;
std::map<std::string, std::string>::const_iterator it;
//prefered audio languages
for(int i = 0; i < 3; i++)
{
if(strlen(g_settings.pref_lang[i]))
{
printf("setLanguages: %d: %s\n", i, g_settings.pref_lang[i]);
std::string temp(g_settings.pref_lang[i]);
for(it = iso639.begin(); it != iso639.end(); it++)
{
if(temp == it->second)
{
v_languages.push_back(it->first);
printf("setLanguages: adding %s\n", it->first.c_str());
found = true;
}
}
}
}
if(found)
sectionsd_set_languages(v_languages);
return true;
}

89
src/gui/osdlang_setup.h Normal file
View File

@@ -0,0 +1,89 @@
/*
$Id: osdlang_setup.h,v 1.2 2010/09/30 20:13:59 dbt Exp $
OSD-Language Setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __osdlang_setup__
#define __osdlang_setup__
#include <global.h>
#include <neutrino.h>
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <system/setting_helpers.h>
#include <string>
#include "widget/menue.h"
class CLangSelectNotifier : public CChangeObserver
{
public:
bool changeNotify(const neutrino_locale_t, void * data);
};
class COsdLangSetup : public CMenuTarget, CChangeObserver
{
private:
CFrameBuffer *frameBuffer;
int x, y, width, height, menue_width, hheight, mheight;
bool is_wizard;
void hide();
void showLocalSetup();
void showLanguageSetup(CMenuWidget *osdl_setup);
void showPrefMenu(CMenuWidget *prefMenu, CLangSelectNotifier *langNotifier);
CMenuOptionStringChooser* getTzItems();
bool changeNotify(const neutrino_locale_t, void *);
public:
enum OSDLANG_SETUP_MODE
{
OSDLANG_SETUP_MODE_WIZARD_NO = 0,
OSDLANG_SETUP_MODE_WIZARD = 1
};
COsdLangSetup(bool wizard_mode = false);
~COsdLangSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

View File

@@ -0,0 +1,133 @@
/*
$port: parentallock_setup.cpp,v 1.4 2010/10/01 15:59:10 tuxbox-cvs Exp $
parentallock setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2009 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "gui/parentallock_setup.h"
#include <global.h>
#include <neutrino.h>
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <driver/screen_max.h>
#include <system/debug.h>
CParentalSetup::CParentalSetup()
{
frameBuffer = CFrameBuffer::getInstance();
width = w_max (35, 10); //%
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
CParentalSetup::~CParentalSetup()
{
}
int CParentalSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{
dprintf(DEBUG_DEBUG, "init parental setup\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
showParentalSetup();
return res;
}
void CParentalSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width, height);
}
#if 1
#define PARENTALLOCK_PROMPT_OPTION_COUNT 3
#else
#define PARENTALLOCK_PROMPT_OPTION_COUNT 4
#endif
const CMenuOptionChooser::keyval PARENTALLOCK_PROMPT_OPTIONS[PARENTALLOCK_PROMPT_OPTION_COUNT] =
{
{ PARENTALLOCK_PROMPT_NEVER , LOCALE_PARENTALLOCK_NEVER },
#if 0
{ PARENTALLOCK_PROMPT_ONSTART , LOCALE_PARENTALLOCK_ONSTART },
#endif
{ PARENTALLOCK_PROMPT_CHANGETOLOCKED, LOCALE_PARENTALLOCK_CHANGETOLOCKED },
{ PARENTALLOCK_PROMPT_ONSIGNAL , LOCALE_PARENTALLOCK_ONSIGNAL }
};
#define PARENTALLOCK_LOCKAGE_OPTION_COUNT 3
const CMenuOptionChooser::keyval PARENTALLOCK_LOCKAGE_OPTIONS[PARENTALLOCK_LOCKAGE_OPTION_COUNT] =
{
{ 12, LOCALE_PARENTALLOCK_LOCKAGE12 },
{ 16, LOCALE_PARENTALLOCK_LOCKAGE16 },
{ 18, LOCALE_PARENTALLOCK_LOCKAGE18 }
};
extern bool parentallocked;
void CParentalSetup::showParentalSetup()
{
//menue init
CMenuWidget* plock = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_LOCK, width);
//subhead
plock->addItem( new CMenuSeparator(CMenuSeparator::ALIGN_LEFT | CMenuSeparator::SUB_HEAD | CMenuSeparator::STRING, LOCALE_PARENTALLOCK_PARENTALLOCK));
// intros
plock->addIntroItems();
plock->addItem(new CMenuOptionChooser(LOCALE_PARENTALLOCK_PROMPT , &g_settings.parentallock_prompt , PARENTALLOCK_PROMPT_OPTIONS, PARENTALLOCK_PROMPT_OPTION_COUNT , !parentallocked));
plock->addItem(new CMenuOptionChooser(LOCALE_PARENTALLOCK_LOCKAGE, &g_settings.parentallock_lockage, PARENTALLOCK_LOCKAGE_OPTIONS, PARENTALLOCK_LOCKAGE_OPTION_COUNT, !parentallocked));
CPINChangeWidget * pinChangeWidget = new CPINChangeWidget(LOCALE_PARENTALLOCK_CHANGEPIN, g_settings.parentallock_pincode, 4, LOCALE_PARENTALLOCK_CHANGEPIN_HINT1);
plock->addItem( new CMenuForwarder(LOCALE_PARENTALLOCK_CHANGEPIN, true, g_settings.parentallock_pincode, pinChangeWidget));
plock->exec(NULL, "");
plock->hide();
delete plock;
}

View File

@@ -0,0 +1,58 @@
/*
$port: parentallock_setup.h,v 1.2 2009/11/22 15:36:52 tuxbox-cvs Exp $
parentallock setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2009 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __parentallock_setup__
#define __parentallock_setup__
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <string>
class CParentalSetup : public CMenuTarget
{
private:
CFrameBuffer *frameBuffer;
int x, y, width, height, hheight, mheight;
void hide();
void showParentalSetup();
public:
CParentalSetup();
~CParentalSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

View File

@@ -0,0 +1,110 @@
/*
$port: proxyserver_setup.cpp,v 1.2 2010/03/02 20:11:42 tuxbox-cvs Exp $
proxyserver_setup menue - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "gui/proxyserver_setup.h"
#include <global.h>
#include <neutrino.h>
#include <gui/widget/stringinput.h>
#include <driver/screen_max.h>
#include <system/debug.h>
CProxySetup::CProxySetup(const neutrino_locale_t title, const char * const IconName )
{
frameBuffer = CFrameBuffer::getInstance();
menue_title = title;
menue_icon = IconName;
width = w_max (35, 10);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
CProxySetup::~CProxySetup()
{
}
int CProxySetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{
dprintf(DEBUG_DEBUG, "init proxy menu\n");
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
showProxySetup();
return res;
}
void CProxySetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
/* shows entries for proxy settings */
void CProxySetup::showProxySetup()
{
//init
CMenuWidget * mn = new CMenuWidget(menue_title, menue_icon, width);
neutrino_locale_t subtitle = (menue_title == LOCALE_FLASHUPDATE_PROXYSERVER_SEP ? NONEXISTANT_LOCALE : LOCALE_FLASHUPDATE_PROXYSERVER_SEP);
mn->addIntroItems(subtitle);
CStringInputSMS * softUpdate_proxy = new CStringInputSMS(LOCALE_FLASHUPDATE_PROXYSERVER, g_settings.softupdate_proxyserver, 23, LOCALE_FLASHUPDATE_PROXYSERVER_HINT1, LOCALE_FLASHUPDATE_PROXYSERVER_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-.: ");
mn->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYSERVER, true, g_settings.softupdate_proxyserver, softUpdate_proxy, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
CStringInputSMS * softUpdate_proxyuser = new CStringInputSMS(LOCALE_FLASHUPDATE_PROXYUSERNAME, g_settings.softupdate_proxyusername, 23, LOCALE_FLASHUPDATE_PROXYUSERNAME_HINT1, LOCALE_FLASHUPDATE_PROXYUSERNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789!""§$%&/()=?-. ");
mn->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYUSERNAME, true, g_settings.softupdate_proxyusername, softUpdate_proxyuser, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
CStringInputSMS * softUpdate_proxypass = new CStringInputSMS(LOCALE_FLASHUPDATE_PROXYPASSWORD, g_settings.softupdate_proxypassword, 20, LOCALE_FLASHUPDATE_PROXYPASSWORD_HINT1, LOCALE_FLASHUPDATE_PROXYPASSWORD_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789!""§$%&/()=?-. ");
mn->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYPASSWORD, true, g_settings.softupdate_proxypassword, softUpdate_proxypass, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
mn->exec(NULL, "");
mn->hide();
delete mn;
}

View File

@@ -0,0 +1,62 @@
/*
$port: proxyserver_setup.h,v 1.1 2010/02/22 10:52:34 tuxbox-cvs Exp $
proxyserver_setup menue - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __proxyserver_setup__
#define __proxyserver_setup__
#include <gui/widget/menue.h>
#include <gui/widget/icons.h>
#include <driver/framebuffer.h>
#include <string>
class CProxySetup : public CMenuTarget
{
private:
CFrameBuffer *frameBuffer;
int x, y, width, height, hheight, mheight;
neutrino_locale_t menue_title;
std::string menue_icon;
void hide();
void showProxySetup();
public:
CProxySetup(const neutrino_locale_t title = LOCALE_FLASHUPDATE_PROXYSERVER_SEP, const char * const IconName = NEUTRINO_ICON_SETTINGS);
~CProxySetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

453
src/gui/themes.cpp Normal file
View File

@@ -0,0 +1,453 @@
/*
$port: themes.cpp,v 1.16 2010/09/05 21:27:44 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project
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.
Copyright (C) 2007, 2008, 2009 (flasher) Frank Liebelt
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/wait.h>
#include <global.h>
#include <neutrino.h>
#include "widget/menue.h"
#include <system/setting_helpers.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h>
#include <gui/widget/messagebox.h>
#include <driver/screen_max.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "themes.h"
#define THEMEDIR DATADIR "/neutrino/themes/"
#define USERDIR "/var" THEMEDIR
#define FILE_PREFIX ".theme"
CThemes::CThemes()
: themefile('\t')
{
frameBuffer = CFrameBuffer::getInstance();
width = w_max (500, 100);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
hasThemeChanged = false;
}
int CThemes::exec(CMenuTarget* parent, const std::string & actionKey)
{
int res = menu_return::RETURN_REPAINT;
if( !actionKey.empty() )
{
if (actionKey=="theme_neutrino")
{
setupDefaultColors();
notifier = new CColorSetupNotifier();
notifier->changeNotify(NONEXISTANT_LOCALE, NULL);
delete notifier;
}
else
{
std::string themeFile = actionKey;
if ( strstr(themeFile.c_str(), "{U}") != 0 )
{
themeFile.erase(0, 3);
readFile((char*)((std::string)USERDIR + themeFile + FILE_PREFIX).c_str());
}
else
readFile((char*)((std::string)THEMEDIR + themeFile + FILE_PREFIX).c_str());
}
return res;
}
if (parent)
parent->hide();
if ( !hasThemeChanged )
rememberOldTheme( true );
Show();
return res;
}
void CThemes::hide()
{
frameBuffer->paintBackgroundBoxRel(x, y, width, height);
}
void CThemes::readThemes(CMenuWidget &themes)
{
struct dirent **themelist;
int n;
const char *pfade[] = {THEMEDIR, USERDIR};
bool hasCVSThemes, hasUserThemes;
hasCVSThemes = hasUserThemes = false;
std::string userThemeFile = "";
CMenuForwarder* oj;
for(int p = 0;p < 2;p++)
{
n = scandir(pfade[p], &themelist, 0, alphasort);
if(n < 0)
perror("loading themes: scandir");
else
{
for(int count=0;count<n;count++)
{
char *file = themelist[count]->d_name;
char *pos = strstr(file, ".theme");
if(pos != NULL)
{
if ( p == 0 && hasCVSThemes == false ) {
themes.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_SELECT2));
hasCVSThemes = true;
} else if ( p == 1 && hasUserThemes == false ) {
themes.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_SELECT1));
hasUserThemes = true;
}
*pos = '\0';
if ( p == 1 ) {
userThemeFile = "{U}" + (std::string)file;
oj = new CMenuForwarderNonLocalized((char*)file, true, "", this, userThemeFile.c_str());
} else
oj = new CMenuForwarderNonLocalized((char*)file, true, "", this, file);
themes.addItem( oj );
}
}
free(themelist);
}
}
}
void CThemes::Show()
{
std::string file_name = "";
CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width);
themes.addIntroItems(LOCALE_COLORTHEMEMENU_HEAD2);
//set default theme
themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, NULL, this, "theme_neutrino", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
readThemes(themes);
CStringInputSMS *nameInput = new CStringInputSMS(LOCALE_COLORTHEMEMENU_NAME, &file_name, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789- ");
CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, nameInput, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
// Don't show SAVE if UserDir does'nt exist
if ( access(USERDIR, F_OK) != 0 ) { // check for existance
// mkdir must be called for each subdir which does not exist
// mkdir (USERDIR, S_IRUSR | S_IREAD | S_IWUSR | S_IWRITE | S_IXUSR | S_IEXEC) == 0) {
if (system (((std::string)"mkdir -p " + USERDIR).c_str()) != 0) {
printf("[neutrino theme] error creating %s\n", USERDIR);
}
}
if (access(USERDIR, F_OK) == 0 ) {
themes.addItem(GenericMenuSeparatorLine);
themes.addItem(m1);
} else {
delete m1;
printf("[neutrino theme] error accessing %s\n", USERDIR);
}
themes.exec(NULL, "");
themes.hide();
if (file_name.length() > 1) {
saveFile((char*)((std::string)USERDIR + file_name + FILE_PREFIX).c_str());
}
if (hasThemeChanged) {
if (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMessageBox::mbrYes)
rememberOldTheme( false );
else
hasThemeChanged = false;
}
}
void CThemes::rememberOldTheme(bool remember)
{
if ( remember ) {
oldThemeValues[0] = g_settings.menu_Head_alpha;
oldThemeValues[1] = g_settings.menu_Head_red;
oldThemeValues[2] = g_settings.menu_Head_green;
oldThemeValues[3] = g_settings.menu_Head_blue;
oldThemeValues[4] = g_settings.menu_Head_Text_alpha;
oldThemeValues[5] = g_settings.menu_Head_Text_red;
oldThemeValues[6] = g_settings.menu_Head_Text_green;
oldThemeValues[7] = g_settings.menu_Head_Text_blue;
oldThemeValues[8] = g_settings.menu_Content_alpha;
oldThemeValues[9] = g_settings.menu_Content_red;
oldThemeValues[10] = g_settings.menu_Content_green;
oldThemeValues[11] = g_settings.menu_Content_blue;
oldThemeValues[12] = g_settings.menu_Content_Text_alpha;
oldThemeValues[13] = g_settings.menu_Content_Text_red;
oldThemeValues[14] = g_settings.menu_Content_Text_green;
oldThemeValues[15] = g_settings.menu_Content_Text_blue;
oldThemeValues[16] = g_settings.menu_Content_Selected_alpha;
oldThemeValues[17] = g_settings.menu_Content_Selected_red;
oldThemeValues[18] = g_settings.menu_Content_Selected_green;
oldThemeValues[19] = g_settings.menu_Content_Selected_blue;
oldThemeValues[20] = g_settings.menu_Content_Selected_Text_alpha;
oldThemeValues[21] = g_settings.menu_Content_Selected_Text_red;
oldThemeValues[22] = g_settings.menu_Content_Selected_Text_green;
oldThemeValues[23] = g_settings.menu_Content_Selected_Text_blue;
oldThemeValues[24] = g_settings.menu_Content_inactive_alpha;
oldThemeValues[25] = g_settings.menu_Content_inactive_red;
oldThemeValues[26] = g_settings.menu_Content_inactive_green;
oldThemeValues[27] = g_settings.menu_Content_inactive_blue;
oldThemeValues[28] = g_settings.menu_Content_inactive_Text_alpha;
oldThemeValues[29] = g_settings.menu_Content_inactive_Text_red;
oldThemeValues[30] = g_settings.menu_Content_inactive_Text_green;
oldThemeValues[31] = g_settings.menu_Content_inactive_Text_blue;
oldThemeValues[32] = g_settings.infobar_alpha;
oldThemeValues[33] = g_settings.infobar_red;
oldThemeValues[34] = g_settings.infobar_green;
oldThemeValues[35] = g_settings.infobar_blue;
oldThemeValues[36] = g_settings.infobar_Text_alpha;
oldThemeValues[37] = g_settings.infobar_Text_red;
oldThemeValues[38] = g_settings.infobar_Text_green;
oldThemeValues[39] = g_settings.infobar_Text_blue;
} else {
g_settings.menu_Head_alpha = oldThemeValues[0];
g_settings.menu_Head_red = oldThemeValues[1];
g_settings.menu_Head_green = oldThemeValues[2];
g_settings.menu_Head_blue = oldThemeValues[3];
g_settings.menu_Head_Text_alpha = oldThemeValues[4];
g_settings.menu_Head_Text_red = oldThemeValues[5];
g_settings.menu_Head_Text_green = oldThemeValues[6];
g_settings.menu_Head_Text_blue = oldThemeValues[7];
g_settings.menu_Content_alpha = oldThemeValues[8];
g_settings.menu_Content_red = oldThemeValues[9];
g_settings.menu_Content_green = oldThemeValues[10];
g_settings.menu_Content_blue = oldThemeValues[11];
g_settings.menu_Content_Text_alpha = oldThemeValues[12];
g_settings.menu_Content_Text_red = oldThemeValues[13];
g_settings.menu_Content_Text_green = oldThemeValues[14];
g_settings.menu_Content_Text_blue = oldThemeValues[15];
g_settings.menu_Content_Selected_alpha = oldThemeValues[16];
g_settings.menu_Content_Selected_red = oldThemeValues[17];
g_settings.menu_Content_Selected_green = oldThemeValues[18];
g_settings.menu_Content_Selected_blue = oldThemeValues[19];
g_settings.menu_Content_Selected_Text_alpha = oldThemeValues[20];
g_settings.menu_Content_Selected_Text_red = oldThemeValues[21];
g_settings.menu_Content_Selected_Text_green = oldThemeValues[22];
g_settings.menu_Content_Selected_Text_blue = oldThemeValues[23];
g_settings.menu_Content_inactive_alpha = oldThemeValues[24];
g_settings.menu_Content_inactive_red = oldThemeValues[25];
g_settings.menu_Content_inactive_green = oldThemeValues[26];
g_settings.menu_Content_inactive_blue = oldThemeValues[27];
g_settings.menu_Content_inactive_Text_alpha = oldThemeValues[28];
g_settings.menu_Content_inactive_Text_red = oldThemeValues[29];
g_settings.menu_Content_inactive_Text_green = oldThemeValues[30];
g_settings.menu_Content_inactive_Text_blue = oldThemeValues[31];
g_settings.infobar_alpha = oldThemeValues[32];
g_settings.infobar_red = oldThemeValues[33];
g_settings.infobar_green = oldThemeValues[34];
g_settings.infobar_blue = oldThemeValues[35];
g_settings.infobar_Text_alpha = oldThemeValues[36];
g_settings.infobar_Text_red = oldThemeValues[37];
g_settings.infobar_Text_green = oldThemeValues[38];
g_settings.infobar_Text_blue = oldThemeValues[39];
notifier = new CColorSetupNotifier;
notifier->changeNotify(NONEXISTANT_LOCALE, NULL);
hasThemeChanged = false;
delete notifier;
}
}
void CThemes::readFile(char* themename)
{
if(themefile.loadConfig(themename))
{
g_settings.menu_Head_alpha = themefile.getInt32( "menu_Head_alpha", 0x00 );
g_settings.menu_Head_red = themefile.getInt32( "menu_Head_red", 0x00 );
g_settings.menu_Head_green = themefile.getInt32( "menu_Head_green", 0x0A );
g_settings.menu_Head_blue = themefile.getInt32( "menu_Head_blue", 0x19 );
g_settings.menu_Head_Text_alpha = themefile.getInt32( "menu_Head_Text_alpha", 0x00 );
g_settings.menu_Head_Text_red = themefile.getInt32( "menu_Head_Text_red", 0x5f );
g_settings.menu_Head_Text_green = themefile.getInt32( "menu_Head_Text_green", 0x46 );
g_settings.menu_Head_Text_blue = themefile.getInt32( "menu_Head_Text_blue", 0x00 );
g_settings.menu_Content_alpha = themefile.getInt32( "menu_Content_alpha", 0x14 );
g_settings.menu_Content_red = themefile.getInt32( "menu_Content_red", 0x00 );
g_settings.menu_Content_green = themefile.getInt32( "menu_Content_green", 0x0f );
g_settings.menu_Content_blue = themefile.getInt32( "menu_Content_blue", 0x23 );
g_settings.menu_Content_Text_alpha = themefile.getInt32( "menu_Content_Text_alpha", 0x00 );
g_settings.menu_Content_Text_red = themefile.getInt32( "menu_Content_Text_red", 0x64 );
g_settings.menu_Content_Text_green = themefile.getInt32( "menu_Content_Text_green", 0x64 );
g_settings.menu_Content_Text_blue = themefile.getInt32( "menu_Content_Text_blue", 0x64 );
g_settings.menu_Content_Selected_alpha = themefile.getInt32( "menu_Content_Selected_alpha", 0x14 );
g_settings.menu_Content_Selected_red = themefile.getInt32( "menu_Content_Selected_red", 0x19 );
g_settings.menu_Content_Selected_green = themefile.getInt32( "menu_Content_Selected_green", 0x37 );
g_settings.menu_Content_Selected_blue = themefile.getInt32( "menu_Content_Selected_blue", 0x64 );
g_settings.menu_Content_Selected_Text_alpha = themefile.getInt32( "menu_Content_Selected_Text_alpha", 0x00 );
g_settings.menu_Content_Selected_Text_red = themefile.getInt32( "menu_Content_Selected_Text_red", 0x00 );
g_settings.menu_Content_Selected_Text_green = themefile.getInt32( "menu_Content_Selected_Text_green", 0x00 );
g_settings.menu_Content_Selected_Text_blue = themefile.getInt32( "menu_Content_Selected_Text_blue", 0x00 );
g_settings.menu_Content_inactive_alpha = themefile.getInt32( "menu_Content_inactive_alpha", 0x14 );
g_settings.menu_Content_inactive_red = themefile.getInt32( "menu_Content_inactive_red", 0x00 );
g_settings.menu_Content_inactive_green = themefile.getInt32( "menu_Content_inactive_green", 0x0f );
g_settings.menu_Content_inactive_blue = themefile.getInt32( "menu_Content_inactive_blue", 0x23 );
g_settings.menu_Content_inactive_Text_alpha = themefile.getInt32( "menu_Content_inactive_Text_alpha", 0x00 );
g_settings.menu_Content_inactive_Text_red = themefile.getInt32( "menu_Content_inactive_Text_red", 55 );
g_settings.menu_Content_inactive_Text_green = themefile.getInt32( "menu_Content_inactive_Text_green", 70 );
g_settings.menu_Content_inactive_Text_blue = themefile.getInt32( "menu_Content_inactive_Text_blue", 85 );
g_settings.infobar_alpha = themefile.getInt32( "infobar_alpha", 0x14 );
g_settings.infobar_red = themefile.getInt32( "infobar_red", 0x00 );
g_settings.infobar_green = themefile.getInt32( "infobar_green", 0x0e );
g_settings.infobar_blue = themefile.getInt32( "infobar_blue", 0x23 );
g_settings.infobar_Text_alpha = themefile.getInt32( "infobar_Text_alpha", 0x00 );
g_settings.infobar_Text_red = themefile.getInt32( "infobar_Text_red", 0x64 );
g_settings.infobar_Text_green = themefile.getInt32( "infobar_Text_green", 0x64 );
g_settings.infobar_Text_blue = themefile.getInt32( "infobar_Text_blue", 0x64 );
notifier = new CColorSetupNotifier;
notifier->changeNotify(NONEXISTANT_LOCALE, NULL);
hasThemeChanged = true;
delete notifier;
}
else
printf("[neutrino theme] %s not found\n", themename);
}
void CThemes::saveFile(char * themename)
{
themefile.setInt32( "menu_Head_alpha", g_settings.menu_Head_alpha );
themefile.setInt32( "menu_Head_red", g_settings.menu_Head_red );
themefile.setInt32( "menu_Head_green", g_settings.menu_Head_green );
themefile.setInt32( "menu_Head_blue", g_settings.menu_Head_blue );
themefile.setInt32( "menu_Head_Text_alpha", g_settings.menu_Head_Text_alpha );
themefile.setInt32( "menu_Head_Text_red", g_settings.menu_Head_Text_red );
themefile.setInt32( "menu_Head_Text_green", g_settings.menu_Head_Text_green );
themefile.setInt32( "menu_Head_Text_blue", g_settings.menu_Head_Text_blue );
themefile.setInt32( "menu_Content_alpha", g_settings.menu_Content_alpha );
themefile.setInt32( "menu_Content_red", g_settings.menu_Content_red );
themefile.setInt32( "menu_Content_green", g_settings.menu_Content_green );
themefile.setInt32( "menu_Content_blue", g_settings.menu_Content_blue );
themefile.setInt32( "menu_Content_Text_alpha", g_settings.menu_Content_Text_alpha );
themefile.setInt32( "menu_Content_Text_red", g_settings.menu_Content_Text_red );
themefile.setInt32( "menu_Content_Text_green", g_settings.menu_Content_Text_green );
themefile.setInt32( "menu_Content_Text_blue", g_settings.menu_Content_Text_blue );
themefile.setInt32( "menu_Content_Selected_alpha", g_settings.menu_Content_Selected_alpha );
themefile.setInt32( "menu_Content_Selected_red", g_settings.menu_Content_Selected_red );
themefile.setInt32( "menu_Content_Selected_green", g_settings.menu_Content_Selected_green );
themefile.setInt32( "menu_Content_Selected_blue", g_settings.menu_Content_Selected_blue );
themefile.setInt32( "menu_Content_Selected_Text_alpha", g_settings.menu_Content_Selected_Text_alpha );
themefile.setInt32( "menu_Content_Selected_Text_red", g_settings.menu_Content_Selected_Text_red );
themefile.setInt32( "menu_Content_Selected_Text_green", g_settings.menu_Content_Selected_Text_green );
themefile.setInt32( "menu_Content_Selected_Text_blue", g_settings.menu_Content_Selected_Text_blue );
themefile.setInt32( "menu_Content_inactive_alpha", g_settings.menu_Content_inactive_alpha );
themefile.setInt32( "menu_Content_inactive_red", g_settings.menu_Content_inactive_red );
themefile.setInt32( "menu_Content_inactive_green", g_settings.menu_Content_inactive_green );
themefile.setInt32( "menu_Content_inactive_blue", g_settings.menu_Content_inactive_blue );
themefile.setInt32( "menu_Content_inactive_Text_alpha", g_settings.menu_Content_inactive_Text_alpha );
themefile.setInt32( "menu_Content_inactive_Text_red", g_settings.menu_Content_inactive_Text_red );
themefile.setInt32( "menu_Content_inactive_Text_green", g_settings.menu_Content_inactive_Text_green );
themefile.setInt32( "menu_Content_inactive_Text_blue", g_settings.menu_Content_inactive_Text_blue );
themefile.setInt32( "infobar_alpha", g_settings.infobar_alpha );
themefile.setInt32( "infobar_red", g_settings.infobar_red );
themefile.setInt32( "infobar_green", g_settings.infobar_green );
themefile.setInt32( "infobar_blue", g_settings.infobar_blue );
themefile.setInt32( "infobar_Text_alpha", g_settings.infobar_Text_alpha );
themefile.setInt32( "infobar_Text_red", g_settings.infobar_Text_red );
themefile.setInt32( "infobar_Text_green", g_settings.infobar_Text_green );
themefile.setInt32( "infobar_Text_blue", g_settings.infobar_Text_blue );
if (!themefile.saveConfig(themename))
printf("[neutrino theme] %s write error\n", themename);
}
// setup default Colors
void CThemes::setupDefaultColors()
{
g_settings.menu_Head_alpha = 0x00;
g_settings.menu_Head_red = 0x00;
g_settings.menu_Head_green = 0x0A;
g_settings.menu_Head_blue = 0x19;
g_settings.menu_Head_Text_alpha = 0x00;
g_settings.menu_Head_Text_red = 0x5f;
g_settings.menu_Head_Text_green = 0x46;
g_settings.menu_Head_Text_blue = 0x00;
g_settings.menu_Content_alpha = 0x14;
g_settings.menu_Content_red = 0x00;
g_settings.menu_Content_green = 0x0f;
g_settings.menu_Content_blue = 0x23;
g_settings.menu_Content_Text_alpha = 0x00;
g_settings.menu_Content_Text_red = 0x64;
g_settings.menu_Content_Text_green = 0x64;
g_settings.menu_Content_Text_blue = 0x64;
g_settings.menu_Content_Selected_alpha = 0x14;
g_settings.menu_Content_Selected_red = 0x19;
g_settings.menu_Content_Selected_green = 0x37;
g_settings.menu_Content_Selected_blue = 0x64;
g_settings.menu_Content_Selected_Text_alpha = 0x00;
g_settings.menu_Content_Selected_Text_red = 0x00;
g_settings.menu_Content_Selected_Text_green = 0x00;
g_settings.menu_Content_Selected_Text_blue = 0x00;
g_settings.menu_Content_inactive_alpha = 0x14;
g_settings.menu_Content_inactive_red = 0x00;
g_settings.menu_Content_inactive_green = 0x0f;
g_settings.menu_Content_inactive_blue = 0x23;
g_settings.menu_Content_inactive_Text_alpha = 0x00;
g_settings.menu_Content_inactive_Text_red = 55;
g_settings.menu_Content_inactive_Text_green = 70;
g_settings.menu_Content_inactive_Text_blue = 85;
g_settings.infobar_alpha = 0x14;
g_settings.infobar_red = 0x00;
g_settings.infobar_green = 0x0e;
g_settings.infobar_blue = 0x23;
g_settings.infobar_Text_alpha = 0x00;
g_settings.infobar_Text_red = 0x64;
g_settings.infobar_Text_green = 0x64;
g_settings.infobar_Text_blue = 0x64;
}

57
src/gui/themes.h Normal file
View File

@@ -0,0 +1,57 @@
/*
$port: themes.h,v 1.6 2010/06/01 19:58:38 tuxbox-cvs Exp $
Neutrino-GUI - DBoxII-Project
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.
Copyright (C) 2007, 2008, 2009 (flasher) Frank Liebelt
*/
#ifndef __cthemes__
#define __cthemes__
#include <string>
#include <configfile.h>
#include <driver/framebuffer.h>
#include <system/setting_helpers.h>
class CThemes : public CMenuTarget, CChangeObserver
{
private:
CFrameBuffer *frameBuffer;
CConfigFile themefile;
CColorSetupNotifier *notifier;
int x, y, width, height, hheight, mheight;
int oldThemeValues[40];
bool hasThemeChanged;
void Show();
void readFile(char* themename);
void saveFile(char* themename);
void readThemes(CMenuWidget &);
void rememberOldTheme(bool remember);
public:
CThemes();
void hide();
void setupDefaultColors();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

View File

@@ -0,0 +1,139 @@
/*
$port: user_menue_setup.cpp,v 1.1 2010/07/30 20:52:31 tuxbox-cvs Exp $
user_menue setup implementation - Neutrino-GUI
based up implementation by Günther
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "gui/user_menue_setup.h"
#include <global.h>
#include <neutrino.h>
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/keychooser.h>
#include <driver/screen_max.h>
#include <system/debug.h>
CUserMenuSetup::CUserMenuSetup(neutrino_locale_t menue_title, int menue_button)
{
frameBuffer = CFrameBuffer::getInstance();
local = menue_title;
button = menue_button;
width = w_max (35, 10);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
CUserMenuSetup::~CUserMenuSetup()
{
}
void CUserMenuSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
#define USERMENU_ITEM_OPTION_COUNT SNeutrinoSettings::ITEM_MAX
const CMenuOptionChooser::keyval USERMENU_ITEM_OPTIONS[USERMENU_ITEM_OPTION_COUNT] =
{
{ SNeutrinoSettings::ITEM_NONE, LOCALE_USERMENU_ITEM_NONE },
{ SNeutrinoSettings::ITEM_BAR, LOCALE_USERMENU_ITEM_BAR },
{ SNeutrinoSettings::ITEM_EPG_LIST, LOCALE_EPGMENU_EVENTLIST },
{ SNeutrinoSettings::ITEM_EPG_SUPER, LOCALE_EPGMENU_EPGPLUS },
{ SNeutrinoSettings::ITEM_EPG_INFO, LOCALE_EPGMENU_EVENTINFO },
{ SNeutrinoSettings::ITEM_EPG_MISC, LOCALE_USERMENU_ITEM_EPG_MISC },
{ SNeutrinoSettings::ITEM_AUDIO_SELECT, LOCALE_AUDIOSELECTMENUE_HEAD },
{ SNeutrinoSettings::ITEM_SUBCHANNEL, LOCALE_INFOVIEWER_SUBSERVICE },
{ SNeutrinoSettings::ITEM_RECORD, LOCALE_TIMERLIST_TYPE_RECORD },
{ SNeutrinoSettings::ITEM_MOVIEPLAYER_MB, LOCALE_MOVIEBROWSER_HEAD },
{ SNeutrinoSettings::ITEM_TIMERLIST, LOCALE_TIMERLIST_NAME },
{ SNeutrinoSettings::ITEM_REMOTE, LOCALE_RCLOCK_MENUEADD },
{ SNeutrinoSettings::ITEM_FAVORITS, LOCALE_FAVORITES_MENUEADD },
{ SNeutrinoSettings::ITEM_TECHINFO, LOCALE_EPGMENU_STREAMINFO },
{ SNeutrinoSettings::ITEM_PLUGIN, LOCALE_TIMERLIST_PLUGIN },
{ SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT },
{ SNeutrinoSettings::ITEM_IMAGEINFO, LOCALE_SERVICEMENU_IMAGEINFO },
{ SNeutrinoSettings::ITEM_BOXINFO, LOCALE_DBOXINFO },
{ SNeutrinoSettings::ITEM_CAM, LOCALE_CAM_SETTINGS }
};
int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &)
{
if(parent != NULL)
parent->hide();
showSetup();
return menu_return::RETURN_REPAINT;
}
void CUserMenuSetup::showSetup()
{
CMenuWidget * ums = new CMenuWidget(local, NEUTRINO_ICON_KEYBINDING, width);
//CUserMenuNotifier *notify = new CUserMenuNotifier();
CStringInputSMS name(LOCALE_USERMENU_NAME, &g_settings.usermenu_text[button], 11, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüß/- "/*, notify*/);
CMenuForwarder *mf = new CMenuForwarder(LOCALE_USERMENU_NAME, true, g_settings.usermenu_text[button],&name);
// notify->setItem(mf);
//-------------------------------------
ums->addIntroItems();
//-------------------------------------
ums->addItem(mf);
ums->addItem(GenericMenuSeparatorLine);
//-------------------------------------
char text[10];
for(int item = 0; item < SNeutrinoSettings::ITEM_MAX && item <13; item++) // Do not show more than 13 items
{
snprintf(text,10,"%d:",item);
text[9]=0;// terminate for sure
ums->addItem( new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT,true ));
}
ums->exec(NULL, "");
ums->hide();
delete ums;
}

View File

@@ -0,0 +1,62 @@
/*
$port: user_menue_setup.h,v 1.1 2010/07/30 20:52:31 tuxbox-cvs Exp $
user_menue setup implementation - Neutrino-GUI
based up implementation by Günther
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __user_menue_setup__
#define __user_menue_setup__
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <string>
class CUserMenuSetup : public CMenuTarget
{
private:
CFrameBuffer *frameBuffer;
int x, y, width, height, menue_width, hheight, mheight;
int button;
neutrino_locale_t local;
void hide();
void showSetup();
public:
CUserMenuSetup(neutrino_locale_t menue_title, int menue_button);
~CUserMenuSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

141
src/gui/vfd_setup.cpp Normal file
View File

@@ -0,0 +1,141 @@
/*
$similar port: lcd_setup.cpp,v 1.1 2010/07/30 20:52:16 tuxbox-cvs Exp $
vfd setup implementation, similar to lcd_setup.cpp of tuxbox-cvs - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "gui/vfd_setup.h"
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <gui/widget/icons.h>
#include <gui/widget/vfdcontroler.h>
#include <gui/widget/stringinput.h>
#include <driver/screen_max.h>
#include <system/debug.h>
#include <cs_api.h>
CVfdSetup::CVfdSetup()
{
frameBuffer = CFrameBuffer::getInstance();
width = w_max (30, 10);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
}
CVfdSetup::~CVfdSetup()
{
}
void CVfdSetup::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
int CVfdSetup::exec(CMenuTarget* parent, const std::string &)
{
dprintf(DEBUG_DEBUG, "init lcd setup\n");
if(parent != NULL)
parent->hide();
showSetup();
return menu_return::RETURN_REPAINT;
}
#define LCDMENU_STATUSLINE_OPTION_COUNT 2
const CMenuOptionChooser::keyval LCDMENU_STATUSLINE_OPTIONS[LCDMENU_STATUSLINE_OPTION_COUNT] =
{
{ 0, LOCALE_LCDMENU_STATUSLINE_PLAYTIME },
{ 1, LOCALE_LCDMENU_STATUSLINE_VOLUME }
//,{ 2, LOCALE_LCDMENU_STATUSLINE_BOTH }
};
#define LEDMENU_OPTION_COUNT 4
const CMenuOptionChooser::keyval LEDMENU_OPTIONS[LEDMENU_OPTION_COUNT] =
{
{ 0, LOCALE_LEDCONTROLER_OFF },
{ 1, LOCALE_LEDCONTROLER_ON_ALL },
{ 2, LOCALE_LEDCONTROLER_ON_LED1 },
{ 3, LOCALE_LEDCONTROLER_ON_LED2 }
};
void CVfdSetup::showSetup()
{
CMenuWidget *vfds = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_LCD, width);
vfds->addIntroItems(LOCALE_LCDMENU_HEAD);
CVfdControler* lcdsliders = new CVfdControler(LOCALE_LCDMENU_HEAD, NULL);
bool vfd_enabled = (cs_get_revision() != 10);
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));
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)
{
CMenuWidget * ledMenu = new CMenuWidget(LOCALE_LCDMENU_HEAD, NEUTRINO_ICON_LCD);
ledMenu->addIntroItems(LOCALE_LEDCONTROLER_MENU);
ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_MODE_TV, &g_settings.led_tv_mode, LEDMENU_OPTIONS, LEDMENU_OPTION_COUNT, true, new CLedControlNotifier()));
ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_MODE_STANDBY, &g_settings.led_standby_mode, LEDMENU_OPTIONS, LEDMENU_OPTION_COUNT, true));
ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_MODE_DEEPSTANDBY, &g_settings.led_deep_mode, LEDMENU_OPTIONS, LEDMENU_OPTION_COUNT, true));
ledMenu->addItem(new CMenuOptionChooser(LOCALE_LEDCONTROLER_BLINK, &g_settings.led_blink, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
vfds->addItem(new CMenuForwarder(LOCALE_LEDCONTROLER_MENU, true, NULL, ledMenu, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
}
vfds->addItem(GenericMenuSeparatorLine);
CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_LCDMENU_STATUSLINE, &g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME], LCDMENU_STATUSLINE_OPTIONS, LCDMENU_STATUSLINE_OPTION_COUNT, vfd_enabled);
vfds->addItem(oj);
vfds->exec(NULL, "");
vfds->hide();
delete vfds;
}

58
src/gui/vfd_setup.h Normal file
View File

@@ -0,0 +1,58 @@
/*
$similar port: lcd_setup.h,v 1.1 2010/07/30 20:52:16 tuxbox-cvs Exp $
vfd setup implementation, similar to lcd_setup.h of tuxbox-cvs - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 __lcd_setup__
#define __lcd_setup__
#include <gui/widget/menue.h>
#include <driver/framebuffer.h>
#include <string>
class CVfdSetup : public CMenuTarget
{
private:
CFrameBuffer *frameBuffer;
int x, y, width, height, hheight, mheight;
void hide();
void showSetup();
public:
CVfdSetup();
~CVfdSetup();
int exec(CMenuTarget* parent, const std::string & actionKey);
};
#endif

514
src/gui/videosettings.cpp Normal file
View File

@@ -0,0 +1,514 @@
/*
$port: video_setup.h,v 1.4 2009/11/22 15:36:52 tuxbox-cvs Exp $
video setup implementation - Neutrino-GUI
Copyright (C) 2001 Steffen Hehn 'McClean'
and some other guys
Homepage: http://dbox.cyberphoria.org/
Copyright (C) 2009 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
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 "videosettings.h"
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include "gui/widget/hintbox.h"
#include "gui/widget/messagebox.h"
#include <driver/screen_max.h>
#include <daemonc/remotecontrol.h>
#include <system/debug.h>
#include <cs_api.h>
#include <video_cs.h>
extern cVideo *videoDecoder;
extern int prev_video_mode;
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
CVideoSettings::CVideoSettings(bool wizard_mode)
{
frameBuffer = CFrameBuffer::getInstance();
is_wizard = wizard_mode;
SyncControlerForwarder = NULL;
VcrVideoOutSignalOptionChooser = NULL;
width = w_max (35, 20);
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10;
x = getScreenStartX (width);
y = getScreenStartY (height);
prev_video_mode == g_settings.video_Mode;
setupVideoSystem(false);
}
CVideoSettings::~CVideoSettings()
{
}
int CVideoSettings::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{
printf("[neutrino VideoSettings] %s: init video setup (Mode: %d)...\n",__FUNCTION__ , is_wizard);
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
showVideoSetup();
return res;
}
void CVideoSettings::hide()
{
frameBuffer->paintBackgroundBoxRel(x,y, width,height);
}
#define VIDEOMENU_43MODE_OPTION_COUNT 4
const CMenuOptionChooser::keyval VIDEOMENU_43MODE_OPTIONS[VIDEOMENU_43MODE_OPTION_COUNT] =
{
{ DISPLAY_AR_MODE_PANSCAN, LOCALE_VIDEOMENU_PANSCAN },
{ DISPLAY_AR_MODE_PANSCAN2, LOCALE_VIDEOMENU_PANSCAN2 },
{ DISPLAY_AR_MODE_LETTERBOX, LOCALE_VIDEOMENU_LETTERBOX },
{ DISPLAY_AR_MODE_NONE, LOCALE_VIDEOMENU_FULLSCREEN }
//{ 2, LOCALE_VIDEOMENU_AUTO } // whatever is this auto mode, it seems its totally broken
};
#define VIDEOMENU_VIDEOSIGNAL_HD1_OPTION_COUNT 8
const CMenuOptionChooser::keyval VIDEOMENU_VIDEOSIGNAL_HD1_OPTIONS[VIDEOMENU_VIDEOSIGNAL_HD1_OPTION_COUNT] =
{
{ ANALOG_SD_RGB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_SD_RGB_SCART }, /* composite + RGB (for both SCART and Cinch) */
{ ANALOG_SD_RGB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_SD_RGB_CINCH }, /* composite + RGB (for both SCART and Cinch) */
{ ANALOG_SD_YPRPB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_SD_YPRPB_SCART }, /* YPbPr SCART (with wrongly connected Cinch) */
{ ANALOG_SD_YPRPB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_SD_YPRPB_CINCH }, /* YPbPr Cinch (with wrongly connected SCART) */
{ ANALOG_HD_RGB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_HD_RGB_SCART },
{ ANALOG_HD_RGB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_HD_RGB_CINCH },
{ ANALOG_HD_YPRPB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_HD_YPRPB_SCART },
{ ANALOG_HD_YPRPB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_HD_YPRPB_CINCH }
};
#define VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTION_COUNT 4
const CMenuOptionChooser::keyval VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTIONS[VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTION_COUNT] =
{
{ ANALOG_SD_RGB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_SD_RGB_SCART }, /* composite + RGB */
{ ANALOG_SD_YPRPB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_SD_YPRPB_SCART }, /* YPbPr SCART */
{ ANALOG_HD_RGB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_HD_RGB_SCART },
{ ANALOG_HD_YPRPB_SCART, LOCALE_VIDEOMENU_ANALOG_MODE_HD_YPRPB_SCART },
};
// #define VIDEOMENU_VCRSIGNAL_OPTION_COUNT 2
// const CMenuOptionChooser::keyval VIDEOMENU_VCRSIGNAL_OPTIONS[VIDEOMENU_VCRSIGNAL_OPTION_COUNT] =
// {
// { 2, LOCALE_VIDEOMENU_VCRSIGNAL_SVIDEO },
// { 0, LOCALE_VIDEOMENU_VCRSIGNAL_COMPOSITE }
// };
#define VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTION_COUNT 4
const CMenuOptionChooser::keyval VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTIONS[VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTION_COUNT] =
{
{ ANALOG_SD_RGB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_SD_RGB_CINCH }, /* composite + RGB (for both SCART and Cinch) */
{ ANALOG_SD_YPRPB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_SD_YPRPB_CINCH }, /* YPbPr Cinch (with wrongly connected SCART) */
{ ANALOG_HD_RGB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_HD_RGB_CINCH },
{ ANALOG_HD_YPRPB_CINCH, LOCALE_VIDEOMENU_ANALOG_MODE_HD_YPRPB_CINCH }
};
/* numbers corresponding to video.cpp from zapit */
CMenuOptionChooser::keyval_ext VIDEOMENU_VIDEOMODE_OPTIONS[VIDEOMENU_VIDEOMODE_OPTION_COUNT] =
{
{ VIDEO_STD_SECAM, NONEXISTANT_LOCALE, "SECAM" },
{ VIDEO_STD_PAL, NONEXISTANT_LOCALE, "PAL" },
{ VIDEO_STD_576P, NONEXISTANT_LOCALE, "576p" },
{ VIDEO_STD_720P50, NONEXISTANT_LOCALE, "720p 50Hz" },
{ VIDEO_STD_1080I50, NONEXISTANT_LOCALE, "1080i 50Hz" },
{ VIDEO_STD_1080P24, NONEXISTANT_LOCALE, "1080p 24Hz" },
{ VIDEO_STD_1080P25, NONEXISTANT_LOCALE, "1080p 25Hz" },
{ VIDEO_STD_NTSC, NONEXISTANT_LOCALE, "NTSC" },
{ VIDEO_STD_480P, NONEXISTANT_LOCALE, "480p" },
{ VIDEO_STD_720P60, NONEXISTANT_LOCALE, "720p 60Hz" },
{ VIDEO_STD_1080I60, NONEXISTANT_LOCALE, "1080i 60Hz" },
{ VIDEO_STD_AUTO, NONEXISTANT_LOCALE, "Auto" }
};
#define VIDEOMENU_VIDEOFORMAT_OPTION_COUNT 3//2
const CMenuOptionChooser::keyval VIDEOMENU_VIDEOFORMAT_OPTIONS[VIDEOMENU_VIDEOFORMAT_OPTION_COUNT] =
{
{ DISPLAY_AR_4_3, LOCALE_VIDEOMENU_VIDEOFORMAT_43 },
{ DISPLAY_AR_16_9, LOCALE_VIDEOMENU_VIDEOFORMAT_169 },
{ DISPLAY_AR_14_9, LOCALE_VIDEOMENU_VIDEOFORMAT_149 }
};
#define VIDEOMENU_DBDR_OPTION_COUNT 3
const CMenuOptionChooser::keyval VIDEOMENU_DBDR_OPTIONS[VIDEOMENU_DBDR_OPTION_COUNT] =
{
{ 0, LOCALE_VIDEOMENU_DBDR_NONE },
{ 1, LOCALE_VIDEOMENU_DBDR_DEBLOCK },
{ 2, LOCALE_VIDEOMENU_DBDR_BOTH }
};
#define VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT 3
const CMenuOptionChooser::keyval VIDEOMENU_HDMI_CEC_MODE_OPTIONS[VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT] =
{
{ VIDEO_HDMI_CEC_MODE_OFF , LOCALE_VIDEOMENU_HDMI_CEC_MODE_OFF },
{ VIDEO_HDMI_CEC_MODE_TUNER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER },
{ VIDEO_HDMI_CEC_MODE_RECORDER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_RECORDER },
};
void CVideoSettings::showVideoSetup()
{
//init
CMenuWidget * videosetup = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width);
videosetup->setWizardMode(is_wizard);
//analog options
unsigned int system_rev = cs_get_revision();
CMenuOptionChooser * vs_analg_ch = NULL;
CMenuOptionChooser * vs_scart_ch = NULL;
CMenuOptionChooser * vs_chinch_ch = NULL;
if (system_rev == 0x06)
{
vs_analg_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_ANALOG_MODE, &g_settings.analog_mode1, VIDEOMENU_VIDEOSIGNAL_HD1_OPTIONS, VIDEOMENU_VIDEOSIGNAL_HD1_OPTION_COUNT, true, this);
}
else if (system_rev > 0x06)
{
if(system_rev != 10)
vs_scart_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_SCART, &g_settings.analog_mode1, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTIONS, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTION_COUNT, true, this);
vs_chinch_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_CINCH, &g_settings.analog_mode2, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTIONS, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTION_COUNT, true, this);
}
//4:3 mode
CMenuOptionChooser * vs_43mode_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_43MODE, &g_settings.video_43mode, VIDEOMENU_43MODE_OPTIONS, VIDEOMENU_43MODE_OPTION_COUNT, true, this);
//display format
CMenuOptionChooser * vs_dispformat_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, this);
//video system
CMenuOptionChooser * vs_videomodes_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOMODE, &g_settings.video_Mode, VIDEOMENU_VIDEOMODE_OPTIONS, VIDEOMENU_VIDEOMODE_OPTION_COUNT, true, this, CRCInput::RC_nokey, "", true);
//dbdr options
CMenuOptionChooser * vs_dbdropt_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_DBDR, &g_settings.video_dbdr, VIDEOMENU_DBDR_OPTIONS, VIDEOMENU_DBDR_OPTION_COUNT, true, this);
//video modes submenue
CMenuWidget* videomodes = new CMenuWidget(LOCALE_VIDEOMENU_ENABLED_MODES, NEUTRINO_ICON_SETTINGS);
videomodes->addItem(GenericMenuBack);
videomodes->addItem(GenericMenuSeparatorLine);
CAutoModeNotifier * anotify = new CAutoModeNotifier();
for (int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++)
videomodes->addItem(new CMenuOptionChooser(VIDEOMENU_VIDEOMODE_OPTIONS[i].valname, &g_settings.enabled_video_modes[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, anotify));
anotify->changeNotify(NONEXISTANT_LOCALE, 0);
CMenuForwarder * vs_videomodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES, true, NULL, videomodes, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED );
//cec
CMenuSeparator *vs_cec_sep = new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_VIDEOMENU_HDMI_CEC);
CMenuOptionChooser *vs_cec_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_MODE, &g_settings.hdmi_cec_mode, VIDEOMENU_HDMI_CEC_MODE_OPTIONS, VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT, true, this);
cec1 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON, &g_settings.hdmi_cec_view_on, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this);
cec2 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_STANDBY, &g_settings.hdmi_cec_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this);
//---------------------------------------
videosetup->addIntroItems(LOCALE_MAINSETTINGS_VIDEO, LOCALE_VIDEOMENU_TV_SCART);
//---------------------------------------
//videosetup->addItem(vs_scart_sep); //separator scart
if (vs_analg_ch != NULL)
videosetup->addItem(vs_analg_ch); //analog option
if (vs_scart_ch != NULL)
videosetup->addItem(vs_scart_ch); //scart
if (vs_chinch_ch != NULL)
videosetup->addItem(vs_chinch_ch);//chinch
videosetup->addItem(GenericMenuSeparatorLine);
//---------------------------------------
videosetup->addItem(vs_43mode_ch); //4:3 mode
videosetup->addItem(vs_dispformat_ch); //display format
videosetup->addItem(vs_videomodes_ch); //video system
videosetup->addItem(vs_dbdropt_ch); //dbdr options
videosetup->addItem(vs_videomodes_fw); //video modes submenue
//---------------------------------------
videosetup->addItem(vs_cec_sep); //cec
videosetup->addItem(vs_cec_ch);
videosetup->addItem(cec1);
videosetup->addItem(cec2);
videosetup->exec(NULL, "");
videosetup->hide();
delete videosetup;
}
void CVideoSettings::setVideoCECSettings()
{
setVideoSettings();
setCECSettings();
}
void CVideoSettings::setVideoSettings()
{
printf("[neutrino VideoSettings] %s init video settings...\n", __FUNCTION__);
videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode1);
videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode2);
setupVideoSystem(false/*don't ask*/);
videoDecoder->setAspectRatio(-1, g_settings.video_43mode);
videoDecoder->setAspectRatio(g_settings.video_Format, -1);
videoDecoder->SetDBDR(g_settings.video_dbdr);
}
void CVideoSettings::setCECSettings()
{
printf("[neutrino VideoSettings] %s init CEC settings...\n", __FUNCTION__);
videoDecoder->SetCECAutoStandby(g_settings.hdmi_cec_standby == 1);
videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1);
videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode);
}
void CVideoSettings::setupVideoSystem(bool do_ask)
{
printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__);
videoDecoder->SetVideoSystem(g_settings.video_Mode); //FIXME
if (do_ask)
{
if (prev_video_mode != g_settings.video_Mode)
{
frameBuffer->paintBackground();
if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_VIDEOMODE_OK), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_INFO) != CMessageBox::mbrYes)
{
g_settings.video_Mode = prev_video_mode;
videoDecoder->SetVideoSystem(g_settings.video_Mode);
}
}
else
prev_video_mode = g_settings.video_Mode;
}
}
bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void *data)
{
int val = 0;
if(data)
val = * (int *) data;
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_ANALOG_MODE))
{
videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode1);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_SCART))
{
videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode1);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_CINCH))
{
videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode2);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_MODE))
{
cec1->setActive(g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF);
cec2->setActive(g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF);
videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_STANDBY))
{
videoDecoder->SetCECAutoStandby(g_settings.hdmi_cec_standby == 1);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON))
{
videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_DBDR))
{
videoDecoder->SetDBDR(g_settings.video_dbdr);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VCRSIGNAL))
{
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOFORMAT) ||
ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_43MODE))
{
//if(g_settings.video_Format != 1 && g_settings.video_Format != 3)
if (g_settings.video_Format != 1 && g_settings.video_Format != 3 && g_settings.video_Format != 2)
g_settings.video_Format = 3;
videoDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOMODE))
{
setupVideoSystem(true/*ask*/);
}
#if 1
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_CONTRAST))
{
videoDecoder->SetControl(VIDEO_CONTROL_CONTRAST, val);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_BRIGHTNESS))
{
videoDecoder->SetControl(VIDEO_CONTROL_BRIGHTNESS, val);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_SHARPNESS))
{
videoDecoder->SetControl(VIDEO_CONTROL_SHARPNESS, val);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_SATURATION))
{
videoDecoder->SetControl(VIDEO_CONTROL_SATURATION, val);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HUE))
{
videoDecoder->SetControl(VIDEO_CONTROL_HUE, val);
}
#endif
return true;
}
void CVideoSettings::next43Mode(void)
{
printf("[neutrino VideoSettings] %s setting 43Mode...\n", __FUNCTION__);
neutrino_locale_t text;
int curmode = 0;
for (int i = 0; i < VIDEOMENU_43MODE_OPTION_COUNT; i++) {
if (VIDEOMENU_43MODE_OPTIONS[i].key == g_settings.video_43mode) {
curmode = i;
break;
}
}
curmode++;
if (curmode >= VIDEOMENU_43MODE_OPTION_COUNT)
curmode = 0;
text = VIDEOMENU_43MODE_OPTIONS[curmode].value;
g_settings.video_43mode = VIDEOMENU_43MODE_OPTIONS[curmode].key;
videoDecoder->setAspectRatio(-1, g_settings.video_43mode);
ShowHintUTF(LOCALE_VIDEOMENU_43MODE, g_Locale->getText(text), 450, 2);
}
void CVideoSettings::SwitchFormat()
{
printf("[neutrino VideoSettings] %s setting videoformat...\n", __FUNCTION__);
neutrino_locale_t text;
int curmode = 0;
for (int i = 0; i < VIDEOMENU_VIDEOFORMAT_OPTION_COUNT; i++) {
if (VIDEOMENU_VIDEOFORMAT_OPTIONS[i].key == g_settings.video_Format) {
curmode = i;
break;
}
}
curmode++;
if (curmode >= VIDEOMENU_VIDEOFORMAT_OPTION_COUNT)
curmode = 0;
text = VIDEOMENU_VIDEOFORMAT_OPTIONS[curmode].value;
g_settings.video_Format = VIDEOMENU_VIDEOFORMAT_OPTIONS[curmode].key;
videoDecoder->setAspectRatio(g_settings.video_Format, -1);
ShowHintUTF(LOCALE_VIDEOMENU_VIDEOFORMAT, g_Locale->getText(text), 450, 2);
}
void CVideoSettings::nextMode(void)
{
printf("[neutrino VideoSettings] %s setting video Mode...\n", __FUNCTION__);
const char * text;
int curmode = 0;
int i;
bool disp_cur = 1;
for (i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) {
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key == g_settings.video_Mode) {
curmode = i;
break;
}
}
text = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].valname;
while(1) {
CVFD::getInstance()->ShowText((char *)text);
int res = ShowHintUTF(LOCALE_VIDEOMENU_VIDEOMODE, text, 450, 2);
if(disp_cur && res != messages_return::handled)
break;
disp_cur = 0;
if(res == messages_return::handled) {
i = 0;
while (true) {
curmode++;
if (curmode >= VIDEOMENU_VIDEOMODE_OPTION_COUNT)
curmode = 0;
if (g_settings.enabled_video_modes[curmode])
break;
i++;
if (i >= VIDEOMENU_VIDEOMODE_OPTION_COUNT) {
CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName());
return;
}
}
text = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].valname;
}
else if(res == messages_return::cancel_info) {
g_settings.video_Mode = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].key;
//CVFD::getInstance()->ShowText((char *)text);
videoDecoder->SetVideoSystem(g_settings.video_Mode);
//return;
disp_cur = 1;
}
else
break;
}
CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName());
//ShowHintUTF(LOCALE_VIDEOMENU_VIDEOMODE, text, 450, 2);
}
//sets menu mode to "wizard" or "default"
void CVideoSettings::setWizardMode(bool mode)
{
printf("[neutrino VideoSettings] %s set video settings menu to mode %d...\n", __FUNCTION__, mode);
is_wizard = mode;
}