Need advise on CSettings
#1
Hi,

I wanted to add selectable teletext font to XBMC. I'm not experienced in C++ so that probably explains my failure, but I feel I'm close so I would appreciate if you can point me to the right direction.

I added a new setting in the settings.xml and the strings into strings.po and this works nicely in the XBMC settings giving me a spinner to choose the font.

Code:
<setting id="videoplayer.teletextfont" type="string" label="23056" help="36549">
          <level>1</level>
          <default>teletext.ttf</default>
          <constraints>
            <options>fonts</options>
          </constraints>
          <control type="spinner" format="string" />
        </setting>

Then in teletext.cpp the TeletextFont was previously hardcoded to "special://xbmc/media/Fonts/teletext.ttf", but I changed it so that it's reading the setting I created:

Code:
std::string FontPath = "special://xbmc/media/Fonts/" + CSettings::Get().GetString("videoplayer.teletextfont");
  const char *TeletextFont = FontPath.c_str();

Unfortunately this does not seem to work. I can see in the XBMC logs that it's trying to open the font with just the path name /usr/share/xbmc/media/Fonts/. Ie. the font name in the settings (teletext.ttf) is not concatenated to the string.

Code:
18:17:38 T:140254283900736   DEBUG: OnKey: 250 (0xfa) pressed, action is XBMC.ActivateWindow(Teletext)
18:17:38 T:140254283900736   DEBUG: Activating window ID: 10600
18:17:38 T:140254283900736   DEBUG: ------ Window Init () ------
18:17:38 T:140254283900736   ERROR: Opening of Teletext font /usr/share/xbmc/media/Fonts/ failed

Am I doing something wrong with the setting or with the string handling (which seems to be a mess in C)? Thanks for any pointers you might be able to give!
Reply
#2
You could try the following:

std:Confusedtring FontPath = std:Confusedtring("special://xbmc/media/Fonts/") + CSettings::Get().GetString("videoplayer.teletextfont");
Reply

Logout Mark Read Team Forum Stats Members Help
Need advise on CSettings0