From fdd3e47db3bc90596d5fd037c40d944dcf5551a0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 11 Feb 2019 21:49:09 +0100 Subject: [PATCH] osd_setup.cpp: outsource radio text notifier handling into own method For usage with other functions. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/49667cc83e1e2b1d009d786e333d07f1d71d6e55 Author: Thilo Graf Date: 2019-02-11 (Mon, 11 Feb 2019) --- src/gui/osd_setup.cpp | 33 ++++++++++++++++++++++----------- src/gui/osd_setup.h | 2 +- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index f29c211c6..caf0de1b8 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -760,6 +760,8 @@ int COsdSetup::showOsdSetup() int res = osd_menu->exec(NULL, ""); + resetRadioText(); + if (oldVolumeSize != g_settings.volume_size) CVolumeHelper::getInstance()->refresh(); @@ -1597,17 +1599,7 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) return true; } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_RADIOTEXT)) { - if (g_settings.radiotext_enable) { - 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; - } + resetRadioText(); } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_DIGITS)) { CVolumeHelper::getInstance()->refresh(); @@ -1643,6 +1635,25 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) 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) { static int cselected = -1; diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h index 698f02e94..af1c911d0 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -85,7 +85,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver void paintWindowSize(int w, int h); void AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry); - + void resetRadioText(); public: enum INFOBAR_CHANNEL_LOGO_POS_OPTIONS {