- audioplayer/screensaver: refresh screensaver picture when title was changed

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2018-06-01 23:32:04 +02:00
committed by Thilo Graf
parent 4d934ad173
commit 730a357368
3 changed files with 18 additions and 2 deletions

View File

@@ -2127,6 +2127,10 @@ void CAudioPlayerGui::play(unsigned int pos)
m_time_total = m_playlist[m_current].MetaData.total_time; m_time_total = m_playlist[m_current].MetaData.total_time;
m_state = CAudioPlayerGui::PLAY; m_state = CAudioPlayerGui::PLAY;
m_curr_audiofile = m_playlist[m_current]; m_curr_audiofile = m_playlist[m_current];
if (m_screensaver && g_settings.audioplayer_cover_as_screensaver)
CScreenSaver::getInstance()->forceRefresh();
// Play // Play
CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1); CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1);

View File

@@ -60,6 +60,7 @@ CScreenSaver::CScreenSaver()
clr.i_color = COL_DARK_GRAY; clr.i_color = COL_DARK_GRAY;
pip_channel_id = 0; pip_channel_id = 0;
idletime = time(NULL); idletime = time(NULL);
force_refresh = false;
} }
CScreenSaver::~CScreenSaver() CScreenSaver::~CScreenSaver()
@@ -158,11 +159,20 @@ void* CScreenSaver::ScreenSaverPrg(void* arg)
{ {
PScreenSaver->ReadDir(); PScreenSaver->ReadDir();
PScreenSaver->paint(); PScreenSaver->paint();
sleep(g_settings.screensaver_timeout); int t = g_settings.screensaver_timeout;
while (t--)
{
sleep(1);
if (PScreenSaver->force_refresh)
{
PScreenSaver->force_refresh = false;
break;
}
}
} }
} }
else else
PScreenSaver->paint(); //just paint first found picture PScreenSaver->paint();
return 0; return 0;
} }

View File

@@ -41,6 +41,7 @@ class CScreenSaver : public sigc::trackable
std::vector<std::string> v_bg_files; std::vector<std::string> v_bg_files;
unsigned int index; unsigned int index;
t_channel_id pip_channel_id; t_channel_id pip_channel_id;
bool force_refresh;
bool status_mute; bool status_mute;
bool ReadDir(); bool ReadDir();
@@ -77,6 +78,7 @@ class CScreenSaver : public sigc::trackable
void resetIdleTime() { idletime = time(NULL); } void resetIdleTime() { idletime = time(NULL); }
time_t getIdleTime() { return idletime; } time_t getIdleTime() { return idletime; }
void forceRefresh() { force_refresh = true; }
}; };
#endif // __CSCREENSAVER_H__ #endif // __CSCREENSAVER_H__