mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
CComponentsFrmClock: Add blinking function
This commit is contained in:
@@ -84,6 +84,8 @@ void CComponentsFrmClock::initVarClock()
|
||||
|
||||
cl_thread = 0;
|
||||
cl_interval = 1;
|
||||
|
||||
cl_blink_str = "";
|
||||
}
|
||||
|
||||
CComponentsFrmClock::~CComponentsFrmClock()
|
||||
@@ -97,7 +99,7 @@ void CComponentsFrmClock::initTimeString()
|
||||
struct tm t;
|
||||
time_t ltime;
|
||||
ltime=time(<ime);
|
||||
strftime((char*) &cl_timestr, sizeof(cl_timestr), cl_format_str, localtime_r(<ime, &t));
|
||||
strftime((char*) &cl_timestr, sizeof(cl_timestr), cl_format_str.c_str(), localtime_r(<ime, &t));
|
||||
}
|
||||
|
||||
// How does it works?
|
||||
@@ -262,9 +264,19 @@ void* CComponentsFrmClock::initClockThread(void *arg)
|
||||
|
||||
CComponentsFrmClock *clock = static_cast<CComponentsFrmClock*>(arg);
|
||||
time_t count = time(0);
|
||||
std::string format_str_save = clock->cl_format_str;
|
||||
//start loop for paint
|
||||
while(1) {
|
||||
if (clock->paintClock) {
|
||||
// Blinking depending on the blink format string
|
||||
if (!clock->cl_blink_str.empty() && (clock->cl_format_str.length() == clock->cl_blink_str.length())) {
|
||||
if (clock->cl_format_str == clock->cl_blink_str.c_str())
|
||||
clock->cl_format_str = format_str_save;
|
||||
else {
|
||||
format_str_save = clock->cl_format_str;
|
||||
clock->cl_format_str = clock->cl_blink_str;
|
||||
}
|
||||
}
|
||||
//paint segements, but wihtout saved backgrounds
|
||||
clock->paint(CC_SAVE_SCREEN_NO);
|
||||
count = time(0);
|
||||
|
Reference in New Issue
Block a user