From 9adeb86df165e27e4f40a041fed393a51f6e2bd2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 10 Apr 2018 22:30:17 +0200 Subject: [PATCH] infobar timout: add member to get current timeout modes Avoids multiple code in some source files. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e0be304aefa18da0abcc93dd19b8f3129a46239a Author: Thilo Graf Date: 2018-04-10 (Tue, 10 Apr 2018) Origin message was: ------------------ infobar timout: add member to get current timeout modes Avoids multiple code in some source files. --- src/gui/channellist.cpp | 12 ++---------- src/gui/infoviewer.cpp | 10 ++++++++++ src/gui/infoviewer.h | 1 + src/neutrino.cpp | 6 +----- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 19c28d0c5..4024e3090 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1427,11 +1427,7 @@ int CChannelList::numericZap(int key) CZapitChannel* chan = getChannel(chn); if (doZap) { - int mode = CNeutrinoApp::getInstance()->getMode(); - if ( - ((mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) && g_settings.timing[SNeutrinoSettings::HANDLING_INFOBAR] == 0) || - ((mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) && g_settings.timing[SNeutrinoSettings::HANDLING_INFOBAR_RADIO] == 0) - ) + if (!g_InfoViewer->hasTimeout()) g_InfoViewer->killTitle(); if(chan && SameTP(chan)) { @@ -1553,11 +1549,7 @@ void CChannelList::virtual_zap_mode(bool up) g_InfoViewer->resetSwitchMode(); //disable virtual_zap_mode if (doZap) { - int mode = CNeutrinoApp::getInstance()->getMode(); - if ( - ((mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) && g_settings.timing[SNeutrinoSettings::HANDLING_INFOBAR] == 0) || - ((mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) && g_settings.timing[SNeutrinoSettings::HANDLING_INFOBAR_RADIO] == 0) - ) + if (!g_InfoViewer->hasTimeout()) g_InfoViewer->killTitle(); if(channel && SameTP(channel)) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index c2b9f8364..976670546 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -2551,3 +2551,13 @@ void CInfoViewer::ecmInfoBox_hide() ecmInfoBox = NULL; } } + +bool CInfoViewer::hasTimeout() +{ + int mode = CNeutrinoApp::getInstance()->getMode(); + bool ret = ( + ((mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) && g_settings.handling_infobar[SNeutrinoSettings::HANDLING_INFOBAR] != 0) || + ((mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) && g_settings.handling_infobar[SNeutrinoSettings::HANDLING_INFOBAR_RADIO] != 0) + ); + return ret; +} diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index ab30d5423..167c487ca 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -223,5 +223,6 @@ class CInfoViewer uint32_t getUpdateTimer(void) { return lcdUpdateTimer; } inline t_channel_id get_current_channel_id(void) { return current_channel_id; } void ResetModules(); + bool hasTimeout(); }; #endif diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 775d3935a..f6574ad21 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3083,11 +3083,7 @@ void CNeutrinoApp::RealRun() else if( ( msg == CRCInput::RC_help ) || ( msg == CRCInput::RC_info) || ( msg == NeutrinoMessages::SHOW_INFOBAR ) ) { - bool enabled_by_timing = ( - ((mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) && g_settings.handling_infobar[SNeutrinoSettings::HANDLING_INFOBAR] != 0) || - ((mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) && g_settings.handling_infobar[SNeutrinoSettings::HANDLING_INFOBAR_RADIO] != 0) - ); - bool show_info = ((msg != NeutrinoMessages::SHOW_INFOBAR) || (g_InfoViewer->is_visible || enabled_by_timing)); + bool show_info = ((msg != NeutrinoMessages::SHOW_INFOBAR) || (g_InfoViewer->is_visible || g_InfoViewer->hasTimeout())); // turn on LCD display CVFD::getInstance()->wake_up();