diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 91eaa3395..92cad4d56 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2123,7 +2123,7 @@ void CChannelList::paintHead() if (g_Sectionsd->getIsTimeSet()) { if (headerClock == NULL) { - headerClock = new CComponentsFrmClock(0, 0, 0, 0, "%H:%M"); + headerClock = new CComponentsFrmClock(0, 0, 0, 0, "%H:%M", true); headerClock->setClockBlink("%H %M"); headerClock->setClockIntervall(1); diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index c3d6e6bfe..e329ed275 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -76,11 +76,10 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons cl_thread = 0; cl_interval = 1; - activeClock = true; cl_blink_str = ""; paintClock = false; - activeClock = activ; + activeClock = activ; if (activeClock) startThread(); } @@ -373,3 +372,12 @@ Font** CComponentsFrmClock::getClockFont() return cl_font; } + +void CComponentsFrmClock::setClockActiv(bool activ/* = true*/) +{ + activeClock = activ; + if (activ && !cl_thread) + startThread(); + if (!activ && cl_thread) + stopThread(); +} diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index f9065f877..81e0e7a59 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -94,7 +94,7 @@ class CComponentsFrmClock : public CComponentsForm public: CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48, - const char* format_str = "%H:%M", bool activ=true, bool has_shadow = CC_SHADOW_OFF, + const char* format_str = "%H:%M", bool activ=false, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsFrmClock(); @@ -134,7 +134,7 @@ class CComponentsFrmClock : public CComponentsForm virtual void refresh() { initCCLockItems(); } ///set clock activ/inactiv - virtual void setClockActiv(bool activ = true){activeClock = activ;}; + virtual void setClockActiv(bool activ = true); }; #endif diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index ef833b272..b6a8efcba 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -610,7 +610,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "running_clock"){ if (clock_r == NULL){ - clock_r = new CComponentsFrmClock(100, 50, 0, 50, "%H.%M:%S"); + clock_r = new CComponentsFrmClock(100, 50, 0, 50, "%H.%M:%S", true); clock_r->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock_r->setClockIntervall(1); // clock_r->doPaintBg(false);