diff --git a/data/locale/english.locale b/data/locale/english.locale index d578034b9..0347295a8 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2159,6 +2159,7 @@ screensaver.dir Directory screensaver.menu Screensaver screensaver.mode Mode screensaver.mode_clock Clock +screensaver.mode_clock_color Clock colored screensaver.mode_image Images screensaver.off Screensaver off screensaver.random Random Images diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 94f878488..f052b5b83 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1422,11 +1422,12 @@ void COsdSetup::showOsdScreenShotSetup(CMenuWidget *menu_screenshot) menu_screenshot->addItem(mc); } -#define SCREENSAVER_MODE_OPTION_COUNT 2 +#define SCREENSAVER_MODE_OPTION_COUNT 3 const CMenuOptionChooser::keyval SCREENSAVER_MODE_OPTIONS[SCREENSAVER_MODE_OPTION_COUNT] = { { 0, LOCALE_SCREENSAVER_MODE_IMAGE }, - { 1, LOCALE_SCREENSAVER_MODE_CLOCK } + { 1, LOCALE_SCREENSAVER_MODE_CLOCK }, + { 2, LOCALE_SCREENSAVER_MODE_CLOCK_COLOR } }; void COsdSetup::showOsdScreensaverSetup(CMenuWidget *menu_screensaver) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index c6cb91405..0cf4ac8b8 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -53,6 +53,7 @@ CScreenSaver::CScreenSaver() index = 0; status_mute = CAudioMute::getInstance()->getStatus(); scr_clock = NULL; + clr.i_color = COL_DARK_GRAY; } CScreenSaver::~CScreenSaver() @@ -250,7 +251,6 @@ void CScreenSaver::paint() if (!scr_clock){ scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H.%M:%S", "%H.%M %S", true); scr_clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]); - scr_clock->setTextColor(COL_DARK_GRAY); scr_clock->enableSaveBg(); scr_clock->doPaintBg(false); } @@ -258,7 +258,26 @@ void CScreenSaver::paint() scr_clock->Stop(); scr_clock->kill(); + scr_clock->setTextColor(clr.i_color); scr_clock->setPosP(rand() % 80, rand() % 90); scr_clock->Start(); + + if (g_settings.screensaver_mode == SCR_MODE_CLOCK_COLOR) { + srand (time(NULL)); + uint32_t brightness; + + // sorcery, no darkness + do { + clr.i_color = rand(); + brightness = (unsigned int)clr.uc_color.r * 19595 + (unsigned int)clr.uc_color.g * 38469 + (unsigned int)clr.uc_color.b * 7471; + //printf("[%s] %s: brightness: %d\n", __FILE__, __FUNCTION__, brightness>> 16); + } + while(brightness >> 16 < 80); + + clr.i_color &= 0x00FFFFFF; + //printf("[%s] %s: clr.i_color: r %02x g %02x b %02x a %02x\n", __FILE__, __FUNCTION__, clr.uc_color.r, clr.uc_color.g, clr.uc_color.b, clr.uc_color.a); + } + else + clr.i_color = COL_DARK_GRAY; } } diff --git a/src/gui/screensaver.h b/src/gui/screensaver.h index 865a12c08..23adbe940 100644 --- a/src/gui/screensaver.h +++ b/src/gui/screensaver.h @@ -46,11 +46,21 @@ class CScreenSaver : public sigc::trackable bool ReadDir(); void paint(); + union u_color { + struct s_color { + uint8_t b, g, r, a; + } uc_color; + unsigned int i_color; + }; + + u_color clr; + public: enum { SCR_MODE_IMAGE, - SCR_MODE_CLOCK + SCR_MODE_CLOCK, + SCR_MODE_CLOCK_COLOR }; CScreenSaver(); ~CScreenSaver(); diff --git a/src/system/locals.h b/src/system/locals.h index 2fbbe336a..4a3123646 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2186,6 +2186,7 @@ typedef enum LOCALE_SCREENSAVER_MENU, LOCALE_SCREENSAVER_MODE, LOCALE_SCREENSAVER_MODE_CLOCK, + LOCALE_SCREENSAVER_MODE_CLOCK_COLOR, LOCALE_SCREENSAVER_MODE_IMAGE, LOCALE_SCREENSAVER_OFF, LOCALE_SCREENSAVER_RANDOM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b9ab8d2b4..a5dd56ea8 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2186,6 +2186,7 @@ const char * locale_real_names[] = "screensaver.menu", "screensaver.mode", "screensaver.mode_clock", + "screensaver.mode_clock_color", "screensaver.mode_image", "screensaver.off", "screensaver.random",