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

View File

@@ -94,3 +94,19 @@ void CInfoClock::paint(bool do_save_bg)
//paint the clock
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 StopClock();
bool enableInfoClock(bool enable);
void ClearDisplay();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};

View File

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

View File

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

View File

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

View File

@@ -54,8 +54,7 @@ CTimeOSD::~CTimeOSD()
void CTimeOSD::show(time_t time_show)
{
if (g_settings.mode_clock)
InfoClock->StartClock();
InfoClock->enableInfoClock(false);
GetDimensions();
visible = true;
@@ -77,8 +76,6 @@ void CTimeOSD::GetDimensions()
m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00");
t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number);
m_width += t1;
if(g_settings.mode_clock)
m_xend = m_xend - m_width - (m_width/4);
}
void CTimeOSD::update(time_t time_show)
@@ -142,8 +139,7 @@ void CTimeOSD::hide()
if(!visible)
return;
if (g_settings.mode_clock)
InfoClock->StopClock();
InfoClock->enableInfoClock(true);
//GetDimensions();
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/color.h>
#include <gui/infoclock.h>
#include <gui/movieplayer.h>
#include <gui/components/cc.h>
@@ -66,6 +67,7 @@
extern cVideo * videoDecoder;
extern CPictureViewer * g_PicViewer;
extern CInfoClock *InfoClock;
const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN};
const struct button_label BrowseButtons[4] =
@@ -453,6 +455,7 @@ void CUpnpBrowserGui::selectDevice()
return;
CAudioMute::getInstance()->enableMuteIcon(false);
InfoClock->enableInfoClock(false);
while (loop)
{
@@ -542,6 +545,7 @@ printf("msg: %x\n", (int) msg);
}
}
CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
}
void CUpnpBrowserGui::playnext(void)

View File

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

View File

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