Screensaver: add option to show current time instead images

This commit is contained in:
2015-12-27 22:26:23 +01:00
parent ff667dfef3
commit 0b3576b4a7
9 changed files with 90 additions and 27 deletions

View File

@@ -1344,8 +1344,9 @@ menu.hint_scrambled_message Bei aktivierter Option erscheint eine Meldung, wenn
menu.hint_screen_setup Konfigurieren Sie den Bildschirmbereich für die Menüanzeige
menu.hint_screensaver_delay Legen sie die Zeit (in Minuten) fest, nach der der Bildschirmschoner starten soll oder schaltet ihn aus
menu.hint_screensaver_dir Wählen Sie das Verzeichnis, in dem die Bilder für Ihren Bildschirmschoner gespeichert sind
menu.hint_screensaver_mode Modus des Bilschirmschoners wählen.
menu.hint_screensaver_random Aktviere/deaktiviere zufällige Bilderauswahl.
menu.hint_screensaver_timeout Wählen Sie Die Wartezeit bis zum Bilderwechsel des Bildschirmschoners
menu.hint_screensaver_timeout Wechselintervall des Bildschirmschoners
menu.hint_screensaver_setup Konfigurieren Sie die Optionen des Bildschirmschoners für den Audioplayer und den Radio-Modus
menu.hint_screenshot_count Wählen Sie, wie viele Screenshots erstellt werden sollen
menu.hint_screenshot_cover Während der Wiedergabe von Aufnahmen kann ein Screenshot für die Vorschau im Moviebrowser erstellt werden
@@ -2145,9 +2146,12 @@ scrambled_channel Verschlüsselung aktiv
screensaver.delay Verzögerung
screensaver.dir Verzeichnis
screensaver.menu Bildschirmschoner
screensaver.mode Modus
screensaver.mode_clock Uhr
screensaver.mode_image Bilder
screensaver.off Bildschirmschoner aus
screensaver.random Zufällige Bilderwahl
screensaver.timeout Bilderwechsel
screensaver.timeout Wechselintervall
screensetup.lowerright grün = Bildrand unten, rechts
screensetup.upperleft rot = Bildrand oben, links
screenshot.count Anzahl

View File

@@ -1344,8 +1344,9 @@ menu.hint_scrambled_message Show scrambled message, when channel cannot be decod
menu.hint_screen_setup Configure screen margins
menu.hint_screensaver_delay Set the time (in minutes) after which the screensaver has to start or turn it off
menu.hint_screensaver_dir Select directory in which the screensaver has to start
menu.hint_screensaver_mode Select screensaver mode.
menu.hint_screensaver_random Enable/disable random image selection.
menu.hint_screensaver_timeout Select the timeout to change pictures in screensavers
menu.hint_screensaver_timeout Select the timeout to changes in screensavers
menu.hint_screensaver_setup Configure screensaver options for audioplayer and radio mode
menu.hint_screenshot_count When no GUI on screen, you can save 1-5\nscreenshot serie
menu.hint_screenshot_cover ON: When playing record, overwrite single\nscreenshot to show inside MovieBrowser
@@ -2145,9 +2146,12 @@ scrambled_channel Scrambled channel
screensaver.delay Delay
screensaver.dir Directory
screensaver.menu Screensaver
screensaver.mode Mode
screensaver.mode_clock Clock
screensaver.mode_image Images
screensaver.off Screensaver off
screensaver.random Random Images
screensaver.timeout Change pictures
screensaver.timeout Change interval
screensetup.lowerright green = setup lower right
screensetup.upperleft red = setup upper left
screenshot.count Count

View File

@@ -1419,6 +1419,13 @@ void COsdSetup::showOsdScreenShotSetup(CMenuWidget *menu_screenshot)
menu_screenshot->addItem(mc);
}
#define SCREENSAVER_MODE_OPTION_COUNT 2
const CMenuOptionChooser::keyval SCREENSAVER_MODE_OPTIONS[SCREENSAVER_MODE_OPTION_COUNT] =
{
{ 0, LOCALE_SCREENSAVER_MODE_IMAGE },
{ 1, LOCALE_SCREENSAVER_MODE_CLOCK }
};
void COsdSetup::showOsdScreensaverSetup(CMenuWidget *menu_screensaver)
{
menu_screensaver->addIntroItems(LOCALE_SCREENSAVER_MENU);
@@ -1430,6 +1437,12 @@ void COsdSetup::showOsdScreensaverSetup(CMenuWidget *menu_screensaver)
nc->setHint("", LOCALE_MENU_HINT_SCREENSAVER_DELAY);
menu_screensaver->addItem(nc);
// screensaver mode
CMenuOptionChooser* oc = new CMenuOptionChooser(LOCALE_SCREENSAVER_MODE, &g_settings.screensaver_mode, SCREENSAVER_MODE_OPTIONS, SCREENSAVER_MODE_OPTION_COUNT, true);
oc->setHint("", LOCALE_MENU_HINT_SCREENSAVER_MODE);
menu_screensaver->addItem(oc);
screensaverNotifier->addItem(oc);
// screensaver timeout
nc = new CMenuOptionNumberChooser(LOCALE_SCREENSAVER_TIMEOUT, &g_settings.screensaver_timeout, (g_settings.screensaver_delay != 0), 0, 60, NULL, CRCInput::RC_nokey, NULL, 0, 0, LOCALE_OPTIONS_OFF);
nc->setNumberFormat(std::string("%d ") + g_Locale->getText(LOCALE_UNIT_SHORT_SECOND));
@@ -1444,7 +1457,7 @@ void COsdSetup::showOsdScreensaverSetup(CMenuWidget *menu_screensaver)
screensaverNotifier->addItem(mf);
// screensaver random mode
CMenuOptionChooser* oc = new CMenuOptionChooser(LOCALE_SCREENSAVER_RANDOM, &g_settings.screensaver_random, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
oc = new CMenuOptionChooser(LOCALE_SCREENSAVER_RANDOM, &g_settings.screensaver_random, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
oc->setHint("", LOCALE_MENU_HINT_SCREENSAVER_RANDOM);
menu_screensaver->addItem(oc);
screensaverNotifier->addItem(oc);

View File

@@ -52,6 +52,7 @@ CScreenSaver::CScreenSaver()
m_viewer = new CPictureViewer();
index = 0;
status_mute = CAudioMute::getInstance()->getStatus();
scr_clock = NULL;
}
CScreenSaver::~CScreenSaver()
@@ -61,6 +62,8 @@ CScreenSaver::~CScreenSaver()
thrScreenSaver = 0;
delete m_viewer;
if (scr_clock)
delete scr_clock;
}
@@ -113,6 +116,12 @@ void CScreenSaver::Stop()
pthread_cancel(thrScreenSaver);
thrScreenSaver = 0;
if (scr_clock){
scr_clock->Stop();
delete scr_clock;
scr_clock = NULL;
}
m_frameBuffer->paintBackground(); //clear entire screen
CAudioMute::getInstance()->enableMuteIcon(status_mute);
@@ -136,12 +145,12 @@ void* CScreenSaver::ScreenSaverPrg(void* arg)
{
while(1)
{
PScreenSaver->PaintPicture();
PScreenSaver->paint();
sleep(g_settings.screensaver_timeout);
}
}
else
PScreenSaver->PaintPicture(); //just paint first found picture
PScreenSaver->paint(); //just paint first found picture
return 0;
}
@@ -219,26 +228,41 @@ bool CScreenSaver::ReadDir()
}
void CScreenSaver::PaintPicture()
void CScreenSaver::paint()
{
if(v_bg_files.empty())
return;
if (g_settings.screensaver_mode == SCR_MODE_IMAGE && !v_bg_files.empty()){
if( (index >= v_bg_files.size()) || (access(v_bg_files.at(index).c_str(), F_OK)) )
{
ReadDir();
index = 0;
return;
if( (index >= v_bg_files.size()) || (access(v_bg_files.at(index).c_str(), F_OK)) )
{
ReadDir();
index = 0;
return;
}
dprintf(DEBUG_INFO, "[CScreenSaver] %s - %d : %s\n", __func__, __LINE__, v_bg_files.at(index).c_str());
m_viewer->ShowImage(v_bg_files.at(index).c_str(), false /*unscaled*/);
if (!g_settings.screensaver_random)
index++;
else
index = rand() % v_bg_files.size();
if(index == v_bg_files.size())
index = 0;
}
else{
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);
}
if (scr_clock->isPainted())
scr_clock->Stop();
dprintf(DEBUG_INFO, "[CScreenSaver] %s - %d : %s\n", __func__, __LINE__, v_bg_files.at(index).c_str());
m_viewer->ShowImage(v_bg_files.at(index).c_str(), false /*unscaled*/);
if (!g_settings.screensaver_random)
index++;
else
index = rand() % v_bg_files.size();
if(index == v_bg_files.size())
index = 0;
scr_clock->kill();
scr_clock->setPosP(rand() % 80, rand() % 90);
scr_clock->Start();
}
}

View File

@@ -28,12 +28,14 @@
#include <driver/framebuffer.h>
#include <vector>
#include <string>
#include <gui/components/cc.h>
class CScreenSaver : public sigc::trackable
{
private:
CFrameBuffer *m_frameBuffer;
CPictureViewer *m_viewer;
CComponentsFrmClock *scr_clock;
pthread_t thrScreenSaver;
static void* ScreenSaverPrg(void *arg);
vector<string> v_bg_files;
@@ -42,9 +44,14 @@ class CScreenSaver : public sigc::trackable
bool status_mute;
bool ReadDir();
void PaintPicture();
void paint();
public:
enum
{
SCR_MODE_IMAGE,
SCR_MODE_CLOCK
};
CScreenSaver();
~CScreenSaver();
static CScreenSaver* getInstance();

View File

@@ -513,7 +513,8 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.screensaver_delay = configfile.getInt32("screensaver_delay", 1);
g_settings.screensaver_dir = configfile.getString("screensaver_dir", ICONSDIR);
g_settings.screensaver_timeout = configfile.getInt32("screensaver_timeout", 10);
g_settings.screensaver_random = configfile.getInt32("screensaver_random", false);
g_settings.screensaver_random = configfile.getInt32("screensaver_random", 0);
g_settings.screensaver_mode = configfile.getInt32("screensaver_mode", CScreenSaver::SCR_MODE_IMAGE);
//vcr
g_settings.vcr_AutoSwitch = configfile.getBool("vcr_AutoSwitch" , true );
@@ -1051,6 +1052,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setString("screensaver_dir", g_settings.screensaver_dir);
configfile.setInt32("screensaver_timeout", g_settings.screensaver_timeout);
configfile.setInt32("screensaver_random", g_settings.screensaver_random);
configfile.setInt32("screensaver_mode", g_settings.screensaver_mode);
//vcr
configfile.setBool("vcr_AutoSwitch" , g_settings.vcr_AutoSwitch );

View File

@@ -1371,6 +1371,7 @@ typedef enum
LOCALE_MENU_HINT_SCREEN_SETUP,
LOCALE_MENU_HINT_SCREENSAVER_DELAY,
LOCALE_MENU_HINT_SCREENSAVER_DIR,
LOCALE_MENU_HINT_SCREENSAVER_MODE,
LOCALE_MENU_HINT_SCREENSAVER_RANDOM,
LOCALE_MENU_HINT_SCREENSAVER_TIMEOUT,
LOCALE_MENU_HINT_SCREENSAVER_SETUP,
@@ -2172,6 +2173,9 @@ typedef enum
LOCALE_SCREENSAVER_DELAY,
LOCALE_SCREENSAVER_DIR,
LOCALE_SCREENSAVER_MENU,
LOCALE_SCREENSAVER_MODE,
LOCALE_SCREENSAVER_MODE_CLOCK,
LOCALE_SCREENSAVER_MODE_IMAGE,
LOCALE_SCREENSAVER_OFF,
LOCALE_SCREENSAVER_RANDOM,
LOCALE_SCREENSAVER_TIMEOUT,

View File

@@ -1371,6 +1371,7 @@ const char * locale_real_names[] =
"menu.hint_screen_setup",
"menu.hint_screensaver_delay",
"menu.hint_screensaver_dir",
"menu.hint_screensaver_mode",
"menu.hint_screensaver_random",
"menu.hint_screensaver_timeout",
"menu.hint_screensaver_setup",
@@ -2172,6 +2173,9 @@ const char * locale_real_names[] =
"screensaver.delay",
"screensaver.dir",
"screensaver.menu",
"screensaver.mode",
"screensaver.mode_clock",
"screensaver.mode_image",
"screensaver.off",
"screensaver.random",
"screensaver.timeout",

View File

@@ -241,6 +241,7 @@ struct SNeutrinoSettings
std::string screensaver_dir;
int screensaver_timeout;
int screensaver_random;
int screensaver_mode;
//vcr
int vcr_AutoSwitch;