CComponentsFrmClock: Fix thread handling

- Set clock activ = false for default


Origin commit data
------------------
Commit: ddc826ab51
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-02-13 (Thu, 13 Feb 2014)
This commit is contained in:
Michael Liebmann
2014-02-13 18:18:59 +01:00
parent 9de76bc073
commit c259eb1dc8
4 changed files with 14 additions and 6 deletions

View File

@@ -2123,7 +2123,7 @@ void CChannelList::paintHead()
if (g_Sectionsd->getIsTimeSet()) { if (g_Sectionsd->getIsTimeSet()) {
if (headerClock == NULL) { 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->setClockBlink("%H %M");
headerClock->setClockIntervall(1); headerClock->setClockIntervall(1);

View File

@@ -76,11 +76,10 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons
cl_thread = 0; cl_thread = 0;
cl_interval = 1; cl_interval = 1;
activeClock = true;
cl_blink_str = ""; cl_blink_str = "";
paintClock = false; paintClock = false;
activeClock = activ; activeClock = activ;
if (activeClock) if (activeClock)
startThread(); startThread();
} }
@@ -373,3 +372,12 @@ Font** CComponentsFrmClock::getClockFont()
return cl_font; return cl_font;
} }
void CComponentsFrmClock::setClockActiv(bool activ/* = true*/)
{
activeClock = activ;
if (activ && !cl_thread)
startThread();
if (!activ && cl_thread)
stopThread();
}

View File

@@ -94,7 +94,7 @@ class CComponentsFrmClock : public CComponentsForm
public: public:
CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48, 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); 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(); virtual ~CComponentsFrmClock();
@@ -134,7 +134,7 @@ class CComponentsFrmClock : public CComponentsForm
virtual void refresh() { initCCLockItems(); } virtual void refresh() { initCCLockItems(); }
///set clock activ/inactiv ///set clock activ/inactiv
virtual void setClockActiv(bool activ = true){activeClock = activ;}; virtual void setClockActiv(bool activ = true);
}; };
#endif #endif

View File

@@ -610,7 +610,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
} }
else if (actionKey == "running_clock"){ else if (actionKey == "running_clock"){
if (clock_r == NULL){ 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->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME);
clock_r->setClockIntervall(1); clock_r->setClockIntervall(1);
// clock_r->doPaintBg(false); // clock_r->doPaintBg(false);