osd_setup.cpp: outsource radio text notifier handling into own method

For usage with other functions.


Origin commit data
------------------
Commit: 49667cc83e
Author: Thilo Graf <dbt@novatux.de>
Date: 2019-02-11 (Mon, 11 Feb 2019)
This commit is contained in:
2019-02-11 21:49:09 +01:00
committed by vanhofen
parent de842e55b8
commit fdd3e47db3
2 changed files with 23 additions and 12 deletions

View File

@@ -760,6 +760,8 @@ int COsdSetup::showOsdSetup()
int res = osd_menu->exec(NULL, ""); int res = osd_menu->exec(NULL, "");
resetRadioText();
if (oldVolumeSize != g_settings.volume_size) if (oldVolumeSize != g_settings.volume_size)
CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->refresh();
@@ -1597,17 +1599,7 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
return true; return true;
} }
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_RADIOTEXT)) { else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_RADIOTEXT)) {
if (g_settings.radiotext_enable) { resetRadioText();
if (g_Radiotext == NULL)
g_Radiotext = new CRadioText;
if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio))
g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid);
} else {
if (g_Radiotext)
g_Radiotext->radiotext_stop();
delete g_Radiotext;
g_Radiotext = NULL;
}
} }
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_DIGITS)) { else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_DIGITS)) {
CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->refresh();
@@ -1643,6 +1635,25 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
return false; return false;
} }
void COsdSetup::resetRadioText()
{
if (g_settings.radiotext_enable) {
if (g_Radiotext == NULL)
g_Radiotext = new CRadioText;
if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio)){
printf("\033[32m[COsdSetup] %s - %d: %d\033[0m\n", __func__, __LINE__, g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid);
g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid);
}
} else {
if (g_Radiotext)
g_Radiotext->radiotext_stop();
delete g_Radiotext;
g_Radiotext = NULL;
}
}
int COsdSetup::showContextChanlistMenu(CChannelList *parent_channellist) int COsdSetup::showContextChanlistMenu(CChannelList *parent_channellist)
{ {
static int cselected = -1; static int cselected = -1;

View File

@@ -85,7 +85,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
void paintWindowSize(int w, int h); void paintWindowSize(int w, int h);
void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry); void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry);
void resetRadioText();
public: public:
enum INFOBAR_CHANNEL_LOGO_POS_OPTIONS enum INFOBAR_CHANNEL_LOGO_POS_OPTIONS
{ {