InfoClock: Fix display clock in movie browser, file browser etc.

This commit is contained in:
M. Liebmann
2013-11-22 08:52:08 +01:00
parent 6a5d335430
commit 7466d6f19c
10 changed files with 57 additions and 40 deletions

View File

@@ -251,8 +251,6 @@ void* CComponentsFrmClock::initClockThread(void *arg)
time_t count = time(0); time_t count = time(0);
//start loop for paint //start loop for paint
while(1) { while(1) {
sleep(clock->cl_interval);
if (clock->paintClock) { if (clock->paintClock) {
//refresh item property values //refresh item property values
clock->refresh(); clock->refresh();
@@ -265,6 +263,7 @@ void* CComponentsFrmClock::initClockThread(void *arg)
clock->cl_thread = 0; clock->cl_thread = 0;
break; break;
} }
sleep(clock->cl_interval);
} }
return 0; return 0;
} }

View File

@@ -94,3 +94,19 @@ void CInfoClock::paint(bool do_save_bg)
//paint the clock //paint the clock
paintForm(do_save_bg); paintForm(do_save_bg);
} }
bool CInfoClock::enableInfoClock(bool enable)
{
bool ret = false;
if (g_settings.mode_clock) {
if (enable) {
if (!paintClock)
ret = StartClock();
}
else {
if (paintClock)
ret = StopClock();
}
}
return ret;
}

View File

@@ -45,6 +45,7 @@ class CInfoClock : public CComponentsFrmClock
bool StartClock(); bool StartClock();
bool StopClock(); bool StopClock();
bool enableInfoClock(bool enable);
void ClearDisplay(); void ClearDisplay();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
}; };

View File

@@ -39,6 +39,7 @@
#include <neutrinoMessages.h> #include <neutrinoMessages.h>
#include <gui/audiomute.h> #include <gui/audiomute.h>
#include <gui/infoclock.h>
#include <gui/movieplayer.h> #include <gui/movieplayer.h>
#include <gui/pictureviewer.h> #include <gui/pictureviewer.h>
#if ENABLE_UPNP #if ENABLE_UPNP
@@ -52,6 +53,7 @@
#include <system/debug.h> #include <system/debug.h>
#include <video.h> #include <video.h>
extern cVideo * videoDecoder; extern cVideo * videoDecoder;
extern CInfoClock *InfoClock;
CMediaPlayerMenu::CMediaPlayerMenu() CMediaPlayerMenu::CMediaPlayerMenu()
{ {
@@ -106,6 +108,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey)
else if (actionKey == "movieplayer") else if (actionKey == "movieplayer")
{ {
audiomute->enableMuteIcon(false); audiomute->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
int mode = CNeutrinoApp::getInstance()->getMode(); int mode = CNeutrinoApp::getInstance()->getMode();
if( mode == NeutrinoMessages::mode_radio ) if( mode == NeutrinoMessages::mode_radio )
videoDecoder->StopPicture(); videoDecoder->StopPicture();
@@ -113,6 +116,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey)
if( mode == NeutrinoMessages::mode_radio ) if( mode == NeutrinoMessages::mode_radio )
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg");
audiomute->enableMuteIcon(true); audiomute->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
return res; return res;
} }

View File

@@ -203,6 +203,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
} }
else if (actionKey == "ytplayback") { else if (actionKey == "ytplayback") {
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
isMovieBrowser = true; isMovieBrowser = true;
moviebrowser->setMode(MB_SHOW_YT); moviebrowser->setMode(MB_SHOW_YT);
} }
@@ -245,8 +246,10 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
if (moviebrowser->getMode() == MB_SHOW_YT) if (moviebrowser->getMode() == MB_SHOW_YT) {
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
}
if (timeshift){ if (timeshift){
timeshift = 0; timeshift = 0;
@@ -399,6 +402,7 @@ bool CMoviePlayerGui::SelectFile()
} }
else { // filebrowser else { // filebrowser
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
if (filebrowser->exec(Path_local.c_str()) == true) { if (filebrowser->exec(Path_local.c_str()) == true) {
Path_local = filebrowser->getCurrentDir(); Path_local = filebrowser->getCurrentDir();
CFile *file; CFile *file;
@@ -437,6 +441,7 @@ bool CMoviePlayerGui::SelectFile()
} else } else
menu_ret = filebrowser->getMenuRet(); menu_ret = filebrowser->getMenuRet();
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
} }
if(ret && file_name.empty()) { if(ret && file_name.empty()) {
std::string::size_type pos = full_name.find_last_of('/'); std::string::size_type pos = full_name.find_last_of('/');
@@ -573,6 +578,7 @@ void CMoviePlayerGui::PlayFile(void)
} }
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
while (playstate >= CMoviePlayerGui::PLAY) while (playstate >= CMoviePlayerGui::PLAY)
{ {
@@ -835,9 +841,7 @@ void CMoviePlayerGui::PlayFile(void)
restoreNeutrino(); restoreNeutrino();
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
if (g_settings.mode_clock)
InfoClock->StartClock();
} }
void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/) void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/)

View File

@@ -53,6 +53,7 @@
#include <gui/components/cc.h> #include <gui/components/cc.h>
#include <gui/widget/buttons.h> #include <gui/widget/buttons.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <gui/infoclock.h>
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <gui/widget/messagebox.h> #include <gui/widget/messagebox.h>
@@ -72,6 +73,7 @@
#include <video.h> #include <video.h>
extern cVideo * videoDecoder; extern cVideo * videoDecoder;
extern CInfoClock *InfoClock;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
bool comparePictureByDate (const CPicture& a, const CPicture& b) bool comparePictureByDate (const CPicture& a, const CPicture& b)
@@ -254,6 +256,7 @@ int CPictureViewerGui::show()
m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); m_currentTitle = m_audioPlayer->getAudioPlayerM_current();
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
while (loop) while (loop)
{ {
@@ -638,6 +641,7 @@ int CPictureViewerGui::show()
hide(); hide();
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
return(res); return(res);
} }

View File

@@ -54,8 +54,7 @@ CTimeOSD::~CTimeOSD()
void CTimeOSD::show(time_t time_show) void CTimeOSD::show(time_t time_show)
{ {
if (g_settings.mode_clock) InfoClock->enableInfoClock(false);
InfoClock->StartClock();
GetDimensions(); GetDimensions();
visible = true; visible = true;
@@ -77,8 +76,6 @@ void CTimeOSD::GetDimensions()
m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00"); m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00");
t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number); t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number);
m_width += t1; m_width += t1;
if(g_settings.mode_clock)
m_xend = m_xend - m_width - (m_width/4);
} }
void CTimeOSD::update(time_t time_show) void CTimeOSD::update(time_t time_show)
@@ -142,8 +139,7 @@ void CTimeOSD::hide()
if(!visible) if(!visible)
return; return;
if (g_settings.mode_clock) InfoClock->enableInfoClock(true);
InfoClock->StopClock();
//GetDimensions(); //GetDimensions();
frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height); frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height);

View File

@@ -51,6 +51,7 @@
#include <gui/audiomute.h> #include <gui/audiomute.h>
#include <gui/color.h> #include <gui/color.h>
#include <gui/infoclock.h>
#include <gui/movieplayer.h> #include <gui/movieplayer.h>
#include <gui/components/cc.h> #include <gui/components/cc.h>
@@ -66,6 +67,7 @@
extern cVideo * videoDecoder; extern cVideo * videoDecoder;
extern CPictureViewer * g_PicViewer; extern CPictureViewer * g_PicViewer;
extern CInfoClock *InfoClock;
const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN}; const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN};
const struct button_label BrowseButtons[4] = const struct button_label BrowseButtons[4] =
@@ -453,6 +455,7 @@ void CUpnpBrowserGui::selectDevice()
return; return;
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
while (loop) while (loop)
{ {
@@ -542,6 +545,7 @@ printf("msg: %x\n", (int) msg);
} }
} }
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
} }
void CUpnpBrowserGui::playnext(void) void CUpnpBrowserGui::playnext(void)

View File

@@ -107,9 +107,6 @@ void CVolumeBar::initVolumeBarSize()
mute_corrY = (height - mute_dy) / 2; mute_corrY = (height - mute_dy) / 2;
cvh->setMuteIconCorrY(mute_corrY); cvh->setMuteIconCorrY(mute_corrY);
if ((g_settings.mode_clock) && (!CNeutrinoApp::getInstance()->isMuted()))
CInfoClock::getInstance()->ClearDisplay();
vb_pbh = height-8; vb_pbh = height-8;
vb_pby = height/2-vb_pbh/2; vb_pby = height/2-vb_pbh/2;

View File

@@ -2056,8 +2056,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
else if( msg == CRCInput::RC_text) { else if( msg == CRCInput::RC_text) {
g_RCInput->clearRCMsg(); g_RCInput->clearRCMsg();
if(g_settings.mode_clock) InfoClock->enableInfoClock(false);
InfoClock->StopClock();
StopSubtitles(); StopSubtitles();
tuxtx_stop_subtitle(); tuxtx_stop_subtitle();
@@ -2067,19 +2066,16 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
//if(!g_settings.cacheTXT) //if(!g_settings.cacheTXT)
// tuxtxt_stop(); // tuxtxt_stop();
g_RCInput->clearRCMsg(); g_RCInput->clearRCMsg();
if(g_settings.mode_clock) InfoClock->enableInfoClock(true);
InfoClock->StartClock();
StartSubtitles(); StartSubtitles();
} }
else if( msg == CRCInput::RC_setup ) { else if( msg == CRCInput::RC_setup ) {
if(!g_settings.minimode) { if(!g_settings.minimode) {
StopSubtitles(); StopSubtitles();
if(g_settings.mode_clock) InfoClock->enableInfoClock(false);
InfoClock->StopClock();
int old_ttx = g_settings.cacheTXT; int old_ttx = g_settings.cacheTXT;
mainMenu.exec(NULL, ""); mainMenu.exec(NULL, "");
if(g_settings.mode_clock) InfoClock->enableInfoClock(true);
InfoClock->StartClock();
StartSubtitles(); StartSubtitles();
saveSetup(NEUTRINO_SETTINGS_FILE); saveSetup(NEUTRINO_SETTINGS_FILE);
if (!g_settings.epg_scan) if (!g_settings.epg_scan)
@@ -2146,8 +2142,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
else if( msg == (neutrino_msg_t) g_settings.key_zaphistory ) { else if( msg == (neutrino_msg_t) g_settings.key_zaphistory ) {
// Zap-History "Bouquet" // Zap-History "Bouquet"
if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) { if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) {
InfoClock->enableInfoClock(false);
g_settings.mode_clock = false; g_settings.mode_clock = false;
InfoClock->StopClock();
} else { } else {
numericZap( msg ); numericZap( msg );
} }
@@ -2306,8 +2302,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
else { else {
if (msg == CRCInput::RC_home) { if (msg == CRCInput::RC_home) {
if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) { if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) {
InfoClock->enableInfoClock(false);
g_settings.mode_clock = false; g_settings.mode_clock = false;
InfoClock->StopClock();
} }
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
} }
@@ -2332,8 +2328,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu) int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu)
{ {
neutrino_msg_t msg = _msg; neutrino_msg_t msg = _msg;
if(g_settings.mode_clock) InfoClock->enableInfoClock(false);
InfoClock->StopClock();
StopSubtitles(); StopSubtitles();
@@ -2417,8 +2412,8 @@ _repeat:
goto _show; goto _show;
} }
if(!from_menu && g_settings.mode_clock) if (!from_menu)
InfoClock->StartClock(); InfoClock->enableInfoClock(true);
return ((nNewChannel >= 0) ? menu_return::RETURN_EXIT_ALL : menu_return::RETURN_REPAINT); return ((nNewChannel >= 0) ? menu_return::RETURN_EXIT_ALL : menu_return::RETURN_REPAINT);
} }
@@ -3308,9 +3303,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
} }
CVFD::getInstance()->setBacklight(g_settings.backlight_standby); CVFD::getInstance()->setBacklight(g_settings.backlight_standby);
if(g_settings.mode_clock) { InfoClock->enableInfoClock(false);
InfoClock->StopClock();
}
//remember tuned channel-id //remember tuned channel-id
standby_channel_id = CZapit::getInstance()->GetCurrentChannelID(); standby_channel_id = CZapit::getInstance()->GetCurrentChannelID();
@@ -3389,8 +3382,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
g_Sectionsd->setPauseScanning(false); g_Sectionsd->setPauseScanning(false);
//g_Sectionsd->setServiceChanged(live_channel_id, true ); //g_Sectionsd->setServiceChanged(live_channel_id, true );
if(g_settings.mode_clock) InfoClock->enableInfoClock(true);
InfoClock->StartClock();
g_audioMute->AudioMute(current_muted, true); g_audioMute->AudioMute(current_muted, true);
StartSubtitles(); StartSubtitles();
@@ -3454,11 +3446,11 @@ void CNeutrinoApp::switchTvRadioMode(const int prev_mode)
void CNeutrinoApp::switchClockOnOff() void CNeutrinoApp::switchClockOnOff()
{ {
if(g_settings.mode_clock) { if(g_settings.mode_clock) {
InfoClock->enableInfoClock(false);
g_settings.mode_clock = false; g_settings.mode_clock = false;
InfoClock->StopClock();
} else { } else {
g_settings.mode_clock = true; g_settings.mode_clock = true;
InfoClock->StartClock(); InfoClock->enableInfoClock(true);
} }
} }