mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CMoviePlayerGui: Bind enable/disable FileTime to enableInfoClock()
This commit is contained in:
@@ -32,9 +32,11 @@
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <gui/volumebar.h>
|
||||
#include <gui/movieplayer.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/timeosd.h>
|
||||
|
||||
|
||||
extern CTimeOSD *FileTimeOSD;
|
||||
|
||||
CInfoClock::CInfoClock():CComponentsFrmClock( 1, 1, NULL, "%H:%M:%S", NULL, false, 1, NULL, CC_SHADOW_ON)
|
||||
{
|
||||
@@ -122,6 +124,23 @@ bool CInfoClock::enableInfoClock(bool enable)
|
||||
ret = StopInfoClock();
|
||||
}
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
if (FileTimeOSD->getRestore()) {
|
||||
FileTimeOSD->setMode(FileTimeOSD->getTmpMode());
|
||||
FileTimeOSD->update(CMoviePlayerGui::getInstance().GetPosition(),
|
||||
CMoviePlayerGui::getInstance().GetDuration());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (FileTimeOSD->getMode() != CTimeOSD::MODE_HIDE) {
|
||||
FileTimeOSD->setTmpMode();
|
||||
FileTimeOSD->setRestore();
|
||||
if (FileTimeOSD->getRestore())
|
||||
FileTimeOSD->kill();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -80,6 +80,7 @@ extern cVideo * videoDecoder;
|
||||
extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */
|
||||
|
||||
extern CVolume* g_volume;
|
||||
extern CTimeOSD *FileTimeOSD;
|
||||
|
||||
#define TIMESHIFT_SECONDS 3
|
||||
#define ISO_MOUNT_POINT "/media/iso"
|
||||
@@ -206,8 +207,6 @@ void CMoviePlayerGui::Init(void)
|
||||
blockedFromPlugin = false;
|
||||
m_screensaver = false;
|
||||
m_idletime = time(NULL);
|
||||
m_mode = CTimeOSD::MODE_HIDE;
|
||||
m_restore = false;
|
||||
}
|
||||
|
||||
void CMoviePlayerGui::cutNeutrino()
|
||||
@@ -281,6 +280,10 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
|
||||
ClearFlags();
|
||||
ClearQueue();
|
||||
|
||||
FileTimeOSD->kill();
|
||||
FileTimeOSD->setMode(CTimeOSD::MODE_HIDE);
|
||||
time_forced = false;
|
||||
|
||||
if (actionKey == "tsmoviebrowser") {
|
||||
isMovieBrowser = true;
|
||||
moviebrowser->setMode(MB_SHOW_RECORDS);
|
||||
@@ -469,11 +472,6 @@ void CMoviePlayerGui::enableOsdElements(bool mute)
|
||||
CAudioMute::getInstance()->enableMuteIcon(true);
|
||||
|
||||
CInfoClock::getInstance()->enableInfoClock(true);
|
||||
|
||||
if (m_restore) {
|
||||
FileTime.setMode(m_mode);
|
||||
FileTime.update(position, duration);
|
||||
}
|
||||
}
|
||||
|
||||
void CMoviePlayerGui::disableOsdElements(bool mute)
|
||||
@@ -482,11 +480,6 @@ void CMoviePlayerGui::disableOsdElements(bool mute)
|
||||
CAudioMute::getInstance()->enableMuteIcon(false);
|
||||
|
||||
CInfoClock::getInstance()->enableInfoClock(false);
|
||||
|
||||
m_mode = FileTime.getMode();
|
||||
m_restore = FileTime.IsVisible();
|
||||
if (m_restore)
|
||||
FileTime.kill();
|
||||
}
|
||||
|
||||
void CMoviePlayerGui::makeFilename()
|
||||
@@ -1204,8 +1197,8 @@ bool CMoviePlayerGui::PlayFileStart(void)
|
||||
speed = -1;
|
||||
playback->SetSpeed(-1);
|
||||
playstate = CMoviePlayerGui::REW;
|
||||
if (!FileTime.IsVisible() && !time_forced) {
|
||||
FileTime.switchMode(position, duration);
|
||||
if (!FileTimeOSD->IsVisible() && !time_forced) {
|
||||
FileTimeOSD->switchMode(position, duration);
|
||||
time_forced = true;
|
||||
}
|
||||
} else if (timeshift == TSHIFT_MODE_OFF || !g_settings.timeshift_pause) {
|
||||
@@ -1300,7 +1293,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
|
||||
if ((playstate >= CMoviePlayerGui::PLAY) && (timeshift != TSHIFT_MODE_OFF || (playstate != CMoviePlayerGui::PAUSE))) {
|
||||
if (playback->GetPosition(position, duration)) {
|
||||
FileTime.update(position, duration);
|
||||
FileTimeOSD->update(position, duration);
|
||||
if (duration > 100)
|
||||
file_prozent = (unsigned char) (position / (duration / 100));
|
||||
|
||||
@@ -1332,7 +1325,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
if (playstate == CMoviePlayerGui::STOPPED)
|
||||
at_eof = true;
|
||||
|
||||
FileTime.update(position, duration);
|
||||
FileTimeOSD->update(position, duration);
|
||||
}
|
||||
showSubtitle(0);
|
||||
|
||||
@@ -1407,7 +1400,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
} else if (msg == (neutrino_msg_t) g_settings.mpkey_play) {
|
||||
if (time_forced) {
|
||||
time_forced = false;
|
||||
FileTime.kill();
|
||||
FileTimeOSD->kill();
|
||||
}
|
||||
if (playstate > CMoviePlayerGui::PLAY) {
|
||||
playstate = CMoviePlayerGui::PLAY;
|
||||
@@ -1473,7 +1466,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
clearSubtitle();
|
||||
update_lcd = true;
|
||||
} else if (msg == (neutrino_msg_t) g_settings.mpkey_time) {
|
||||
FileTime.switchMode(position, duration);
|
||||
FileTimeOSD->switchMode(position, duration);
|
||||
} else if (msg == (neutrino_msg_t) g_settings.mbkey_cover) {
|
||||
makeScreenShot(false, true);
|
||||
} else if (msg == (neutrino_msg_t) g_settings.key_screenshot) {
|
||||
@@ -1495,8 +1488,8 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
updateLcd();
|
||||
}
|
||||
|
||||
if (!FileTime.IsVisible() && !time_forced) {
|
||||
FileTime.switchMode(position, duration);
|
||||
if (!FileTimeOSD->IsVisible() && !time_forced) {
|
||||
FileTimeOSD->switchMode(position, duration);
|
||||
time_forced = true;
|
||||
}
|
||||
if (timeshift == TSHIFT_MODE_OFF)
|
||||
@@ -1572,8 +1565,8 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
update_lcd = true;
|
||||
clearSubtitle();
|
||||
} else if (timeshift != TSHIFT_MODE_OFF && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) {
|
||||
bool restore = FileTime.IsVisible();
|
||||
FileTime.kill();
|
||||
bool restore = FileTimeOSD->IsVisible();
|
||||
FileTimeOSD->kill();
|
||||
|
||||
if (msg == CRCInput::RC_epg )
|
||||
g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName());
|
||||
@@ -1586,15 +1579,15 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
frameBuffer->paintBackground();
|
||||
}
|
||||
if (restore)
|
||||
FileTime.show(position);
|
||||
FileTimeOSD->show(position);
|
||||
#if 0
|
||||
} else if (msg == CRCInput::RC_red) {
|
||||
bool restore = FileTime.IsVisible();
|
||||
FileTime.kill();
|
||||
bool restore = FileTimeOSD->IsVisible();
|
||||
FileTimeOSD->kill();
|
||||
CStreamInfo2 streaminfo;
|
||||
streaminfo.exec(NULL, "");
|
||||
if (restore)
|
||||
FileTime.show(position);
|
||||
FileTimeOSD->show(position);
|
||||
update_lcd = true;
|
||||
#endif
|
||||
} else if (msg == NeutrinoMessages::SHOW_EPG) {
|
||||
@@ -1625,12 +1618,12 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
} else if (msg == (neutrino_msg_t) CRCInput::RC_setup) {
|
||||
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::SHOW_MAINMENU, 0);
|
||||
} else if (msg == CRCInput::RC_red || msg == CRCInput::RC_green || msg == CRCInput::RC_yellow || msg == CRCInput::RC_blue ) {
|
||||
//maybe move FileTime.kill to Usermenu to simplify this call
|
||||
bool restore = FileTime.IsVisible();
|
||||
FileTime.kill();
|
||||
//maybe move FileTimeOSD->kill to Usermenu to simplify this call
|
||||
bool restore = FileTimeOSD->IsVisible();
|
||||
FileTimeOSD->kill();
|
||||
CNeutrinoApp::getInstance()->usermenu.showUserMenu(msg);
|
||||
if (restore)
|
||||
FileTime.show(position);
|
||||
FileTimeOSD->show(position);
|
||||
update_lcd = true;
|
||||
} else {
|
||||
if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) {
|
||||
@@ -1665,7 +1658,7 @@ void CMoviePlayerGui::PlayFileEnd(bool restore)
|
||||
{
|
||||
printf("%s: stopping, this %p thread %p\n", __func__, this, CMoviePlayerGui::bgPlayThread);fflush(stdout);
|
||||
if (filelist_it == filelist.end())
|
||||
FileTime.kill();
|
||||
FileTimeOSD->kill();
|
||||
clearSubtitle();
|
||||
|
||||
playback->SetSpeed(1);
|
||||
@@ -2190,7 +2183,7 @@ void CMoviePlayerGui::UpdatePosition()
|
||||
if (playback->GetPosition(position, duration)) {
|
||||
if (duration > 100)
|
||||
file_prozent = (unsigned char) (position / (duration / 100));
|
||||
FileTime.update(position, duration);
|
||||
FileTimeOSD->update(position, duration);
|
||||
#ifdef DEBUG
|
||||
printf("CMoviePlayerGui::%s: spd %d pos %d/%d (%d, %d%%)\n", __func__, speed, position, duration, duration-position, file_prozent);
|
||||
#endif
|
||||
|
@@ -118,7 +118,6 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
int startposition;
|
||||
int position;
|
||||
int duration;
|
||||
CTimeOSD FileTime;
|
||||
|
||||
unsigned short numpida;
|
||||
unsigned short vpid;
|
||||
@@ -189,9 +188,6 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
static CMoviePlayerGui* instance_mp;
|
||||
static CMoviePlayerGui* instance_bg;
|
||||
|
||||
CTimeOSD::mode m_mode;
|
||||
bool m_restore;
|
||||
|
||||
void Init(void);
|
||||
void PlayFile();
|
||||
bool PlayFileStart();
|
||||
@@ -242,7 +238,6 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
bool Playing() { return playing; };
|
||||
bool osdTimeVisible() { return FileTime.IsVisible(); };
|
||||
std::string CurrentAudioName() { return currentaudioname; };
|
||||
int GetSpeed() { return speed; }
|
||||
int GetPosition() { return position; }
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <gui/audiomute.h>
|
||||
#include <gui/color_custom.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/timeosd.h>
|
||||
#include <gui/widget/icons.h>
|
||||
#include <gui/widget/colorchooser.h>
|
||||
#include <gui/widget/stringinput.h>
|
||||
@@ -67,6 +68,7 @@ extern CRemoteControl * g_RemoteControl;
|
||||
|
||||
extern const char * locale_real_names[];
|
||||
extern std::string ttx_font_file;
|
||||
extern CTimeOSD *FileTimeOSD;
|
||||
|
||||
COsdSetup::COsdSetup(int wizard_mode)
|
||||
{
|
||||
@@ -1286,19 +1288,19 @@ void COsdSetup::showOsdInfoclockSetup(CMenuWidget *menu_infoclock)
|
||||
{
|
||||
menu_infoclock->addIntroItems(LOCALE_MISCSETTINGS_INFOCLOCK);
|
||||
|
||||
CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOCLOCK, &g_settings.mode_clock, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::RC_red);
|
||||
CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOCLOCK, &g_settings.mode_clock, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_red);
|
||||
mc->setHint("", LOCALE_MENU_HINT_CLOCK_MODE);
|
||||
menu_infoclock->addItem(mc);
|
||||
|
||||
menu_infoclock->addItem(GenericMenuSeparatorLine);
|
||||
|
||||
// size of info clock
|
||||
CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE_HEIGHT, &g_settings.infoClockFontSize, true, 30, 120);
|
||||
CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE_HEIGHT, &g_settings.infoClockFontSize, true, 30, 120, this);
|
||||
mn->setHint("", LOCALE_MENU_HINT_CLOCK_SIZE);
|
||||
menu_infoclock->addItem(mn);
|
||||
|
||||
// clock with seconds
|
||||
mc = new CMenuOptionChooser(LOCALE_CLOCK_SECONDS, &g_settings.infoClockSeconds, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
|
||||
mc = new CMenuOptionChooser(LOCALE_CLOCK_SECONDS, &g_settings.infoClockSeconds, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
|
||||
mc->setHint("", LOCALE_MENU_HINT_CLOCK_SECONDS);
|
||||
menu_infoclock->addItem(mc);
|
||||
|
||||
@@ -1391,6 +1393,12 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
return false;
|
||||
}
|
||||
else if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOCLOCK)) ||
|
||||
(ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SIZE_HEIGHT)) ||
|
||||
(ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SECONDS))) {
|
||||
CInfoClock::getInstance()->ClearDisplay();
|
||||
FileTimeOSD->Init();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -32,12 +32,16 @@
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <gui/volumebar.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/timeosd.h>
|
||||
#include "screensaver.h"
|
||||
|
||||
|
||||
CTimeOSD::CTimeOSD():CComponentsFrmClock( 1, 1, NULL, "%H:%M:%S", NULL, false, 1, NULL, CC_SHADOW_ON)
|
||||
{
|
||||
m_mode = MODE_HIDE;
|
||||
tmp_mode = MODE_HIDE;
|
||||
m_restore = false;
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -45,7 +49,6 @@ void CTimeOSD::Init()
|
||||
{
|
||||
paint_bg = g_settings.infoClockBackground;
|
||||
m_time_show = time(0);
|
||||
m_mode = MODE_HIDE;
|
||||
|
||||
//use current theme colors
|
||||
setColorAll(COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0);
|
||||
@@ -59,13 +62,7 @@ void CTimeOSD::Init()
|
||||
setColorBody(COL_BACKGROUND_PLUS_0);
|
||||
}
|
||||
|
||||
//set height, NOTE: height is strictly bound to settings
|
||||
if (g_settings.infoClockFontSize != height){
|
||||
height = g_settings.infoClockFontSize;
|
||||
int dx = 0;
|
||||
int dy = height;
|
||||
setClockFont(*CNeutrinoFonts::getInstance()->getDynFont(dx, dy, cl_format_str, cl_font_style));
|
||||
}
|
||||
setClockFont(CInfoClock::getInstance()->getClockFont());
|
||||
|
||||
// set corner radius depending on clock height
|
||||
corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0;
|
||||
@@ -84,6 +81,14 @@ CTimeOSD::~CTimeOSD()
|
||||
}
|
||||
#endif
|
||||
|
||||
CTimeOSD* CTimeOSD::getInstance()
|
||||
{
|
||||
static CTimeOSD* timeOSD = NULL;
|
||||
if(!timeOSD)
|
||||
timeOSD = new CTimeOSD();
|
||||
return timeOSD;
|
||||
}
|
||||
|
||||
void CTimeOSD::initTimeString()
|
||||
{
|
||||
struct tm t;
|
||||
|
@@ -42,10 +42,10 @@ class CTimeOSD : public CComponentsFrmClock
|
||||
|
||||
private:
|
||||
CProgressBar timescale;
|
||||
mode m_mode;
|
||||
mode m_mode, tmp_mode;
|
||||
bool m_restore;
|
||||
time_t m_time_show;
|
||||
|
||||
void Init();
|
||||
void initTimeString();
|
||||
void updatePos(int position, int duration);
|
||||
void KillAndResetTimescale();
|
||||
@@ -53,6 +53,8 @@ class CTimeOSD : public CComponentsFrmClock
|
||||
public:
|
||||
CTimeOSD();
|
||||
// ~CTimeOSD(); is inherited
|
||||
void Init();
|
||||
static CTimeOSD* getInstance();
|
||||
void show(time_t time_show, bool force = true);
|
||||
void kill();
|
||||
bool IsVisible() {return m_mode != MODE_HIDE;}
|
||||
@@ -60,6 +62,10 @@ class CTimeOSD : public CComponentsFrmClock
|
||||
void switchMode(int position, int duration);
|
||||
mode getMode() { return m_mode; };
|
||||
void setMode (mode mode_) { m_mode = mode_; };
|
||||
mode getTmpMode() { return tmp_mode; };
|
||||
void setTmpMode () { tmp_mode = m_mode; };
|
||||
bool getRestore() { return m_restore; };
|
||||
void setRestore() { m_restore = (m_mode != MODE_HIDE); };
|
||||
void setHeight(const int){}//NOTE: dummy member, height is strictly bound to settings
|
||||
};
|
||||
#endif
|
||||
|
@@ -33,9 +33,12 @@
|
||||
|
||||
#include <neutrino.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/timeosd.h>
|
||||
#include <driver/neutrinofonts.h>
|
||||
#include <system/debug.h>
|
||||
|
||||
extern CTimeOSD *FileTimeOSD;
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -134,7 +137,7 @@ void CVolumeBar::initVolumeBarPosition()
|
||||
break;
|
||||
}
|
||||
case VOLUMEBAR_POS_TOP_LEFT:
|
||||
if (CMoviePlayerGui::getInstance().osdTimeVisible())
|
||||
if (FileTimeOSD->IsVisible())
|
||||
y = clock_y + clock_height + v_spacer + OFFSET_SHADOW;
|
||||
break;
|
||||
case VOLUMEBAR_POS_BOTTOM_LEFT:
|
||||
|
@@ -100,6 +100,7 @@
|
||||
#include "gui/widget/menue.h"
|
||||
#include "gui/widget/msgbox.h"
|
||||
#include "gui/infoclock.h"
|
||||
#include "gui/timeosd.h"
|
||||
#include "gui/parentallock_setup.h"
|
||||
#ifdef ENABLE_PIP
|
||||
#include "gui/pipsetup.h"
|
||||
@@ -146,6 +147,7 @@
|
||||
int old_b_id = -1;
|
||||
|
||||
CInfoClock *InfoClock;
|
||||
CTimeOSD *FileTimeOSD;
|
||||
int allow_flash = 1;
|
||||
Zapit_config zapitCfg;
|
||||
char zapit_lat[20]="#";
|
||||
@@ -2155,6 +2157,8 @@ TIMER_START();
|
||||
|
||||
g_RemoteControl = new CRemoteControl;
|
||||
g_EpgData = new CEpgData;
|
||||
InfoClock = CInfoClock::getInstance();
|
||||
FileTimeOSD = CTimeOSD::getInstance();
|
||||
g_InfoViewer = new CInfoViewer;
|
||||
g_EventList = new CEventList;
|
||||
|
||||
@@ -2341,9 +2345,6 @@ void CNeutrinoApp::RealRun()
|
||||
|
||||
dprintf(DEBUG_NORMAL, "initialized everything\n");
|
||||
|
||||
//activating infoclock
|
||||
InfoClock = CInfoClock::getInstance();
|
||||
|
||||
if(g_settings.power_standby || init_cec_setting)
|
||||
standbyMode(true, true);
|
||||
|
||||
@@ -4224,6 +4225,8 @@ void stop_daemons(bool stopall, bool for_flash)
|
||||
videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)0);
|
||||
}
|
||||
|
||||
delete InfoClock;
|
||||
delete FileTimeOSD;
|
||||
delete &CMoviePlayerGui::getInstance();
|
||||
|
||||
CZapit::getInstance()->Stop();
|
||||
|
Reference in New Issue
Block a user