COsdSetup: Display file names in font setup menu

This commit is contained in:
Michael Liebmann
2013-07-03 04:54:18 +02:00
parent 767ff03d98
commit 6d3a05fe0a
2 changed files with 20 additions and 8 deletions

View File

@@ -55,6 +55,7 @@
#include <zapit/femanager.h> #include <zapit/femanager.h>
#include <system/debug.h> #include <system/debug.h>
#include <system/helpers.h>
extern CRemoteControl * g_RemoteControl; extern CRemoteControl * g_RemoteControl;
@@ -81,6 +82,8 @@ COsdSetup::~COsdSetup()
{ {
delete colorSetupNotifier; delete colorSetupNotifier;
delete fontsizenotifier; delete fontsizenotifier;
delete mfFontFile;
delete mfTtxFontFile;
} }
//font settings //font settings
@@ -195,6 +198,8 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
strcpy(g_settings.font_file, fileBrowser.getSelectedFile()->Name.c_str()); strcpy(g_settings.font_file, fileBrowser.getSelectedFile()->Name.c_str());
printf("[neutrino] new font file %s\n", fileBrowser.getSelectedFile()->Name.c_str()); printf("[neutrino] new font file %s\n", fileBrowser.getSelectedFile()->Name.c_str());
CNeutrinoApp::getInstance()->SetupFonts(); CNeutrinoApp::getInstance()->SetupFonts();
osdFontFile = "(" + getBaseName(fileBrowser.getSelectedFile()->Name) + ")";
mfFontFile->setOption(osdFontFile.c_str());
} }
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
@@ -210,6 +215,8 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
ttx_font_file = fileBrowser.getSelectedFile()->Name; ttx_font_file = fileBrowser.getSelectedFile()->Name;
printf("[neutrino] ttx font file %s\n", fileBrowser.getSelectedFile()->Name.c_str()); printf("[neutrino] ttx font file %s\n", fileBrowser.getSelectedFile()->Name.c_str());
CNeutrinoApp::getInstance()->SetupFonts(); CNeutrinoApp::getInstance()->SetupFonts();
osdTtxFontFile = "(" + getBaseName(fileBrowser.getSelectedFile()->Name) + ")";
mfTtxFontFile->setOption(osdTtxFontFile.c_str());
} }
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
@@ -416,7 +423,7 @@ int COsdSetup::showOsdSetup()
osd_menu->addItem(mf); osd_menu->addItem(mf);
//fonts //fonts
CMenuWidget osd_menu_fonts(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, width, MN_WIDGET_ID_OSDSETUP_FONT); CMenuWidget osd_menu_fonts(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, w_max(50, 10), MN_WIDGET_ID_OSDSETUP_FONT);
showOsdFontSizeSetup(&osd_menu_fonts); showOsdFontSizeSetup(&osd_menu_fonts);
mf = new CMenuForwarder(LOCALE_FONTMENU_HEAD, true, NULL, &osd_menu_fonts, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf = new CMenuForwarder(LOCALE_FONTMENU_HEAD, true, NULL, &osd_menu_fonts, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", LOCALE_MENU_HINT_FONTS); mf->setHint("", LOCALE_MENU_HINT_FONTS);
@@ -653,7 +660,6 @@ void COsdSetup::AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSe
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.addItem(new CMenuNumberInput(neutrino_font[number_of_fontsize_entry].name, neutrino_font[number_of_fontsize_entry].defaultsize, fontsizenotifier, CNeutrinoApp::getInstance()->getConfigFile()));
} }
//font settings menu //font settings menu
void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
{ {
@@ -663,14 +669,18 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
fontSettings->addIntroItems(LOCALE_FONTMENU_HEAD); fontSettings->addIntroItems(LOCALE_FONTMENU_HEAD);
// select gui font file // select gui font file
mf = new CMenuForwarder(LOCALE_COLORMENU_FONT, true, NULL, this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); osdFontFile = g_settings.font_file;
mf->setHint("", LOCALE_MENU_HINT_FONT_GUI); osdFontFile = "(" + getBaseName(osdFontFile) + ")";
fontSettings->addItem(mf); mfFontFile = new CMenuForwarder(LOCALE_COLORMENU_FONT, true, osdFontFile.c_str(), this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mfFontFile->setHint("", LOCALE_MENU_HINT_FONT_GUI);
fontSettings->addItem(mfFontFile);
// select teletext font file // select teletext font file
mf = new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, NULL, this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); osdTtxFontFile = g_settings.ttx_font_file;
mf->setHint("", LOCALE_MENU_HINT_FONT_TTX); osdTtxFontFile = "(" + getBaseName(osdTtxFontFile) + ")";
fontSettings->addItem(mf); mfTtxFontFile = new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, osdTtxFontFile.c_str(), this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mfTtxFontFile->setHint("", LOCALE_MENU_HINT_FONT_TTX);
fontSettings->addItem(mfTtxFontFile);
// contrast fonts // contrast fonts
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_COLORMENU_CONTRAST_FONTS, &g_settings.contrast_fonts, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_COLORMENU_CONTRAST_FONTS, &g_settings.contrast_fonts, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);

View File

@@ -47,6 +47,8 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
CFontSizeNotifier *fontsizenotifier; CFontSizeNotifier *fontsizenotifier;
CMenuWidget *osd_menu; CMenuWidget *osd_menu;
CMenuWidget *submenu_menus; CMenuWidget *submenu_menus;
CMenuForwarder *mfFontFile, *mfTtxFontFile;
std::string osdFontFile, osdTtxFontFile;
int width; int width;
bool is_wizard; bool is_wizard;