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.
This commit is contained in:
2014-01-07 11:53:02 +01:00
parent 12fd92e3e4
commit 7403aa2d46
3 changed files with 24 additions and 19 deletions

View File

@@ -648,7 +648,7 @@ void CMoviePlayerGui::PlayFile(void)
} }
if (time_forced) { if (time_forced) {
time_forced = false; time_forced = false;
FileTime.hide(); FileTime.kill();
} }
} else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) {
if (playstate == CMoviePlayerGui::PAUSE) { if (playstate == CMoviePlayerGui::PAUSE) {
@@ -752,7 +752,7 @@ void CMoviePlayerGui::PlayFile(void)
//showHelpTS(); //showHelpTS();
} else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) { } else if(timeshift && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) {
bool restore = FileTime.IsVisible(); bool restore = FileTime.IsVisible();
FileTime.hide(); FileTime.kill();
if( msg == CRCInput::RC_epg ) if( msg == CRCInput::RC_epg )
g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName()); 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(); clearSubtitle();
playback->SetSpeed(1); playback->SetSpeed(1);

View File

@@ -63,10 +63,8 @@ void CTimeOSD::Init()
int x_old = x, y_old = y, width_old = width, height_old = height; int x_old = x, y_old = y, width_old = width, height_old = height;
CVolumeHelper::getInstance()->refresh(cl_font); CVolumeHelper::getInstance()->refresh(cl_font);
CVolumeHelper::getInstance()->getTimeDimensions(&x, &y, &width, &height); CVolumeHelper::getInstance()->getTimeDimensions(&x, &y, &width, &height);
if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) { if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height))
cleanCCForm(); clear();
clearCCItems();
}
// set corner radius depending on clock height // set corner radius depending on clock height
corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0; corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0;
@@ -74,10 +72,13 @@ void CTimeOSD::Init()
initCCLockItems(); initCCLockItems();
} }
#if 0 //if hide() or kill() required, it's recommended to use it separately
CTimeOSD::~CTimeOSD() CTimeOSD::~CTimeOSD()
{ {
hide(); CComponents::kill();
clear();
} }
#endif
void CTimeOSD::initTimeString() void CTimeOSD::initTimeString()
{ {
@@ -134,12 +135,10 @@ void CTimeOSD::switchMode(int position, int duration)
break; break;
case MODE_DESC: case MODE_DESC:
m_mode = MODE_BAR; m_mode = MODE_BAR;
kill(); CComponents::kill();
break; break;
case MODE_BAR: case MODE_BAR:
m_mode = MODE_HIDE; KillAndResetTimescale();
timescale.kill();
timescale.reset();
frameBuffer->blit(); frameBuffer->blit();
return; return;
default: default:
@@ -149,13 +148,18 @@ void CTimeOSD::switchMode(int position, int duration)
update(position, duration); update(position, duration);
} }
void CTimeOSD::hide(void) void CTimeOSD::kill()
{ {
if (m_mode != MODE_HIDE) { if (m_mode != MODE_HIDE) {
m_mode = MODE_HIDE; KillAndResetTimescale();
timescale.kill(); CComponents::kill();
timescale.reset();
kill();
frameBuffer->blit(); frameBuffer->blit();
} }
} }
void CTimeOSD::KillAndResetTimescale()
{
m_mode = MODE_HIDE;
timescale.kill();
timescale.reset();
}

View File

@@ -48,12 +48,13 @@ class CTimeOSD : public CComponentsFrmClock
void Init(); void Init();
void initTimeString(); void initTimeString();
void updatePos(int position, int duration); void updatePos(int position, int duration);
void KillAndResetTimescale();
public: public:
CTimeOSD(); CTimeOSD();
~CTimeOSD(); // ~CTimeOSD(); is inherited
void show(time_t time_show, bool force = true); void show(time_t time_show, bool force = true);
void hide(); void kill();
bool IsVisible() {return m_mode != MODE_HIDE;} bool IsVisible() {return m_mode != MODE_HIDE;}
void update(int position, int duration); void update(int position, int duration);
void switchMode(int position, int duration); void switchMode(int position, int duration);