From 7403aa2d46540f1eaa8bd72c95cf6a9049ba6e62 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Jan 2014 11:53:02 +0100 Subject: [PATCH] CTimeOSD: use class konform member names CTimeOSD is inherited from CComponentsForm/Item. Therefore, it is usual to keep the functional layout. Overwritable virtual members should be used with same functionality. kill() is similar with paintBackground() known from CFrameBuffer, hide(bool) do restore saved background and expects a parameter. TODO: It works, but class layout of CTimeOSD is currently not conform with Components, because the functionalities are partially undermined and must be reworked. For Example: timescale and clock object not used as sub objects in a parent form object. --- src/gui/movieplayer.cpp | 6 +++--- src/gui/timeosd.cpp | 32 ++++++++++++++++++-------------- src/gui/timeosd.h | 5 +++-- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 01e975edf..eb6d10895 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -648,7 +648,7 @@ void CMoviePlayerGui::PlayFile(void) } if (time_forced) { time_forced = false; - FileTime.hide(); + FileTime.kill(); } } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { if (playstate == CMoviePlayerGui::PAUSE) { @@ -752,7 +752,7 @@ void CMoviePlayerGui::PlayFile(void) //showHelpTS(); } else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) { bool restore = FileTime.IsVisible(); - FileTime.hide(); + FileTime.kill(); if( msg == CRCInput::RC_epg ) g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName()); @@ -833,7 +833,7 @@ void CMoviePlayerGui::PlayFile(void) } } - FileTime.hide(); + FileTime.kill(); clearSubtitle(); playback->SetSpeed(1); diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index a6312102a..e08164061 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -63,10 +63,8 @@ void CTimeOSD::Init() int x_old = x, y_old = y, width_old = width, height_old = height; CVolumeHelper::getInstance()->refresh(cl_font); CVolumeHelper::getInstance()->getTimeDimensions(&x, &y, &width, &height); - if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) { - cleanCCForm(); - clearCCItems(); - } + if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) + clear(); // set corner radius depending on clock height corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0; @@ -74,10 +72,13 @@ void CTimeOSD::Init() initCCLockItems(); } +#if 0 //if hide() or kill() required, it's recommended to use it separately CTimeOSD::~CTimeOSD() { - hide(); + CComponents::kill(); + clear(); } +#endif void CTimeOSD::initTimeString() { @@ -134,12 +135,10 @@ void CTimeOSD::switchMode(int position, int duration) break; case MODE_DESC: m_mode = MODE_BAR; - kill(); + CComponents::kill(); break; case MODE_BAR: - m_mode = MODE_HIDE; - timescale.kill(); - timescale.reset(); + KillAndResetTimescale(); frameBuffer->blit(); return; default: @@ -149,13 +148,18 @@ void CTimeOSD::switchMode(int position, int duration) update(position, duration); } -void CTimeOSD::hide(void) +void CTimeOSD::kill() { if (m_mode != MODE_HIDE) { - m_mode = MODE_HIDE; - timescale.kill(); - timescale.reset(); - kill(); + KillAndResetTimescale(); + CComponents::kill(); frameBuffer->blit(); } } + +void CTimeOSD::KillAndResetTimescale() +{ + m_mode = MODE_HIDE; + timescale.kill(); + timescale.reset(); +} diff --git a/src/gui/timeosd.h b/src/gui/timeosd.h index 3f98bf47e..3b030a861 100644 --- a/src/gui/timeosd.h +++ b/src/gui/timeosd.h @@ -48,12 +48,13 @@ class CTimeOSD : public CComponentsFrmClock void Init(); void initTimeString(); void updatePos(int position, int duration); + void KillAndResetTimescale(); public: CTimeOSD(); - ~CTimeOSD(); +// ~CTimeOSD(); is inherited void show(time_t time_show, bool force = true); - void hide(); + void kill(); bool IsVisible() {return m_mode != MODE_HIDE;} void update(int position, int duration); void switchMode(int position, int duration);