port rounded corner code from tuxbox CVSuse getScreenStartX(),getScreenStartY(),h_max(),w_max() routines

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@87 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2009-12-17 09:58:55 +00:00
parent dfe40f9833
commit 49e009134b
11 changed files with 1109 additions and 1077 deletions

View File

@@ -1,16 +1,21 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.cpp,v 1.3 2004/03/17 22:56:08 rasc Exp $
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.cpp,v 1.4 2009/12/15 09:42:59 dbt Exp $
*
* -- some odd module to calc max. screen usage of an menue
* -- this should be somewhere else (neutrino needs redesign)
*
* (C) 2004 by rasc
*
*
*/
#include <config.h>
#include "global.h"
#include "driver/screen_max.h"
// -- this is a simple odd class provided for 'static' usage
// -- to calculate max. usage of a preferred menue size (x,y)
// -- this is due to 16:9 TV zoom functions, which are cutting menues.
@@ -24,6 +29,7 @@
//
// 2004-03-17 rasc
int w_max (int w_size, int w_add)
{
int dw;
@@ -37,6 +43,7 @@ int w_max (int w_size, int w_add)
return ret;
}
int h_max (int h_size, int h_add)
{
int dh;
@@ -49,3 +56,21 @@ int h_max (int h_size, int h_add)
return ret;
}
//some helpers to get x and y screen values vor menus and windows
int getScreenStartX (int width)
{
int w = width;
return (((g_settings.screen_EndX- g_settings.screen_StartX)-w) / 2) + g_settings.screen_StartX;
}
int getScreenStartY (int height)
{
int y = height;
return (((g_settings.screen_EndY- g_settings.screen_StartY)-y) / 2) + g_settings.screen_StartY;
}

View File

@@ -1,5 +1,5 @@
/*
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.h,v 1.1 2004/03/17 21:30:51 rasc Exp $
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/screen_max.h,v 1.2 2009/12/15 09:42:59 dbt Exp $
*
*
* This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,8 @@
int w_max (int w_size, int w_add);
int h_max (int h_size, int h_add);
int getScreenStartX(int width);
int getScreenStartY(int height);
#endif

View File

@@ -68,6 +68,7 @@
#include <system/settings.h>
#include <xmltree/xmlinterface.h>
#include <driver/screen_max.h>
#include <algorithm>
#include <sys/time.h>
@@ -118,17 +119,17 @@ const std::string icecasturl = "http://dir.xiph.org/yp.xml";
const long int GET_ICECAST_TIMEOUT = 90; // list is about 500kB!
CAudiofileExt::CAudiofileExt()
: CAudiofile(), firstChar('\0')
: CAudiofile(), firstChar('\0')
{
}
CAudiofileExt::CAudiofileExt(std::string name, CFile::FileType type)
: CAudiofile(name, type), firstChar('\0')
: CAudiofile(name, type), firstChar('\0')
{
}
CAudiofileExt::CAudiofileExt(const CAudiofileExt& src)
: CAudiofile(src), firstChar(src.firstChar)
: CAudiofile(src), firstChar(src.firstChar)
{
}
@@ -158,7 +159,7 @@ static void *myrealloc(void *ptr, size_t size)
{
/* There might be a realloc() out there that doesn't like reallocing
NULL pointers, so we take care of it here */
if(ptr)
if (ptr)
return realloc(ptr, size);
else
return malloc(size);
@@ -199,7 +200,7 @@ void CAudioPlayerGui::Init(void)
m_select_title_by_name = g_settings.audioplayer_select_title_by_name==1;
if(strlen(g_settings.network_nfs_audioplayerdir)!=0)
if (strlen(g_settings.network_nfs_audioplayerdir)!=0)
m_Path = g_settings.network_nfs_audioplayerdir;
else
m_Path = "/";
@@ -277,18 +278,18 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
m_listmaxshow = (m_height - m_info_height - m_title_height - m_theight - 2*m_buttonHeight) / (m_fheight);
m_height = m_theight + m_info_height + m_title_height + 2*m_buttonHeight + m_listmaxshow * m_fheight; // recalc height
m_x = (((g_settings.screen_EndX - g_settings.screen_StartX) - (m_width + ConnectLineBox_Width)) / 2)
+ g_settings.screen_StartX + ConnectLineBox_Width;
m_y = (((g_settings.screen_EndY- g_settings.screen_StartY) - m_height)/ 2) + g_settings.screen_StartY;
m_x = getScreenStartX( m_width + ConnectLineBox_Width ) + ConnectLineBox_Width;
m_y = getScreenStartY( m_height );
m_idletime=time(NULL);
m_screensaver=false;
if(parent)
if (parent)
{
parent->hide();
}
#if 0
if(g_settings.video_Format != g_settings.video_backgroundFormat)
if (g_settings.video_Format != g_settings.video_backgroundFormat)
g_Controld->setVideoFormat(g_settings.video_backgroundFormat);
#endif
bool usedBackground = m_frameBuffer->getuseBackground();
@@ -369,15 +370,15 @@ int CAudioPlayerGui::show()
bool clear_before_update = false;
m_key_level = 0;
while(loop)
while (loop)
{
if(!m_screensaver)
if (!m_screensaver)
{
updateMetaData();
}
updateTimes();
if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_audio)
if (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_audio)
{
// stop if mode was changed in another thread
loop = false;
@@ -386,13 +387,13 @@ int CAudioPlayerGui::show()
(CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) &&
(!m_playlist.empty()))
{
if(m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
playNext();
}
if (update)
{
if(clear_before_update)
if (clear_before_update)
{
hide();
clear_before_update = false;
@@ -402,26 +403,26 @@ int CAudioPlayerGui::show()
}
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
if( msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER)
if ( msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER)
{
int timeout = time(NULL) - m_idletime;
int screensaver_timeout = atoi(g_settings.audioplayer_screensaver);
if(screensaver_timeout !=0 && timeout > screensaver_timeout*60 && !m_screensaver)
if (screensaver_timeout !=0 && timeout > screensaver_timeout*60 && !m_screensaver)
screensaver(true);
if(msg == NeutrinoMessages::EVT_TIMER && data == stimer) {
if(m_screensaver) {
if (msg == NeutrinoMessages::EVT_TIMER && data == stimer) {
if (m_screensaver) {
char fname[255];
sprintf(fname, "%s/mp3-%d.jpg", DATADIR "/neutrino/icons", pic_index);
int ret = access(fname, F_OK);
printf("CAudioPlayerGui::show: new pic %s: %s\n", fname, ret ? "not found" : "found");
if(ret == 0) {
if (ret == 0) {
pic_index++;
videoDecoder->StopPicture();
videoDecoder->ShowPicture(fname);
} else if(pic_index) {
} else if (pic_index) {
pic_index = 0;
videoDecoder->StopPicture();
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/mp3.jpg");
@@ -434,15 +435,15 @@ int CAudioPlayerGui::show()
else
{
m_idletime = time(NULL);
if(m_screensaver)
if (m_screensaver)
{
screensaver(false);
}
}
if( msg == CRCInput::RC_tv)
if ( msg == CRCInput::RC_tv)
{
if(m_inetmode) {
if (m_inetmode) {
m_inetmode = false;
m_radiolist = m_playlist;
m_playlist = m_filelist;
@@ -520,19 +521,19 @@ int CAudioPlayerGui::show()
}
}
}
else if((msg &~ CRCInput::RC_Repeat) == CRCInput::RC_up || (msg &~ CRCInput::RC_Repeat) == CRCInput::RC_page_up)
else if ((msg &~ CRCInput::RC_Repeat) == CRCInput::RC_up || (msg &~ CRCInput::RC_Repeat) == CRCInput::RC_page_up)
{
if(m_show_playlist && !m_playlist.empty() )
if (m_show_playlist && !m_playlist.empty() )
{
int step = 0;
int prevselected = m_selected;
step = msg == CRCInput::RC_page_up ? m_listmaxshow : 1;
m_selected -= step;
if((prevselected-step) < 0)
if ((prevselected-step) < 0)
m_selected = m_playlist.size()-1;
#if 0
if(m_selected == 0)
if (m_selected == 0)
{
m_selected = m_playlist.size()-1;
}
@@ -544,7 +545,7 @@ int CAudioPlayerGui::show()
paintItem(prevselected - m_liststart);
unsigned int oldliststart = m_liststart;
m_liststart = (m_selected/m_listmaxshow)*m_listmaxshow;
if(oldliststart != m_liststart)
if (oldliststart != m_liststart)
{
update = true;
}
@@ -554,15 +555,15 @@ int CAudioPlayerGui::show()
}
}
}
else if((msg &~ CRCInput::RC_Repeat) == CRCInput::RC_down || (msg &~ CRCInput::RC_Repeat) == CRCInput::RC_page_down)
else if ((msg &~ CRCInput::RC_Repeat) == CRCInput::RC_down || (msg &~ CRCInput::RC_Repeat) == CRCInput::RC_page_down)
{
if(m_show_playlist && !m_playlist.empty() )
if (m_show_playlist && !m_playlist.empty() )
{
int prevselected = m_selected;
unsigned int step = msg == CRCInput::RC_page_down ? m_listmaxshow : 1;
m_selected += step;
if(m_selected >= m_playlist.size()) {
if (m_selected >= m_playlist.size()) {
if (((m_playlist.size() / m_listmaxshow) + 1) * m_listmaxshow == m_playlist.size() + m_listmaxshow) // last page has full entries
m_selected = 0;
else
@@ -573,7 +574,7 @@ int CAudioPlayerGui::show()
paintItem(prevselected - m_liststart);
unsigned int oldliststart = m_liststart;
m_liststart = (m_selected/m_listmaxshow)*m_listmaxshow;
if(oldliststart != m_liststart)
if (oldliststart != m_liststart)
{
update = true;
}
@@ -594,23 +595,23 @@ int CAudioPlayerGui::show()
}
else if (msg == CRCInput::RC_red)
{
if(m_key_level == 0)
if (m_key_level == 0)
{
if (!m_playlist.empty())
{
//xx CPlayList::iterator p = m_playlist.begin()+selected;
removeFromPlaylist(m_selected);
if((int)m_selected == m_current)
if ((int)m_selected == m_current)
{
m_current--;
//stop(); // Stop if song is deleted, next song will be startet automat.
}
if(m_selected >= m_playlist.size())
if (m_selected >= m_playlist.size())
m_selected = m_playlist.size() == 0 ? m_playlist.size() : m_playlist.size() - 1;
update = true;
}
}
else if(m_key_level == 1)
else if (m_key_level == 1)
{
stop();
}
@@ -622,10 +623,10 @@ int CAudioPlayerGui::show()
}
else if (msg == CRCInput::RC_stop)
{
if(m_key_level == 1)
if (m_key_level == 1)
stop();
}
else if(msg == CRCInput::RC_green)
else if (msg == CRCInput::RC_green)
{
if (m_key_level == 0)
{
@@ -634,13 +635,13 @@ int CAudioPlayerGui::show()
}
else if (m_key_level == 1)
{
if(m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
rev();
}
else
{ // key_level == 2
if(m_state == CAudioPlayerGui::STOP)
if (m_state == CAudioPlayerGui::STOP)
{
if (!m_playlist.empty())
{
@@ -667,9 +668,9 @@ int CAudioPlayerGui::show()
}
}
}
else if(msg == CRCInput::RC_yellow)
else if (msg == CRCInput::RC_yellow)
{
if(m_key_level == 0)
if (m_key_level == 0)
{
if (!m_playlist.empty())
{
@@ -679,7 +680,7 @@ int CAudioPlayerGui::show()
update = true;
}
}
else if(m_key_level == 1)
else if (m_key_level == 1)
{
pause();
}
@@ -691,7 +692,7 @@ int CAudioPlayerGui::show()
paint();
}
}
else if(msg == CRCInput::RC_blue)
else if (msg == CRCInput::RC_blue)
{
if (m_key_level == 0)
{
@@ -721,20 +722,24 @@ int CAudioPlayerGui::show()
//InputSelector.addItem(GenericMenuSeparator);
hide();
InputSelector.exec(NULL, "");
if(select >= 0)
if (select >= 0)
old_select = select;
switch (select) {
case 0: scanXmlFile(RADIO_STATION_XML_FILE);
case 0:
scanXmlFile(RADIO_STATION_XML_FILE);
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
paintLCD();
break;
case 1: openSCbrowser();
case 1:
openSCbrowser();
break;
case 2: readDir_ic();
case 2:
readDir_ic();
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
paintLCD();
break;
default: break;
default:
break;
}
update=true;
}
@@ -745,7 +750,7 @@ int CAudioPlayerGui::show()
}
else if (m_key_level == 1)
{
if(m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
ff();
}
else // key_level == 2
@@ -767,7 +772,7 @@ int CAudioPlayerGui::show()
}
}
}
else if(msg == CRCInput::RC_help)
else if (msg == CRCInput::RC_help)
{
if (m_key_level == 2)
m_key_level = 0;
@@ -784,15 +789,15 @@ int CAudioPlayerGui::show()
}
}
// there are only two keylevels in the "STOP"-case
else if(m_key_level == 1)
else if (m_key_level == 1)
{
m_key_level = 2;
}
paintFoot();
}
else if(msg == CRCInput::RC_0)
else if (msg == CRCInput::RC_0)
{
if(m_current >= 0)
if (m_current >= 0)
{
m_selected = m_current;
update = true;
@@ -811,7 +816,7 @@ int CAudioPlayerGui::show()
g_RCInput->getMsg_ms(&msg, &data, AUDIOPLAYERGUI_SMSKEY_TIMEOUT - 200);
/* show a hint box with current char (too slow at the moment?)*/
/* show a hint box with current char (too slow at the moment?)*/
#if 1
char selectedKey[1];
sprintf(selectedKey,"%c",smsKey);
@@ -848,7 +853,7 @@ int CAudioPlayerGui::show()
}
#ifdef ENABLE_GUI_MOUNT
else if((msg == CRCInput::RC_setup) && !m_inetmode)
else if ((msg == CRCInput::RC_setup) && !m_inetmode)
{
CNFSSmallMenu nfsMenu;
nfsMenu.exec(this, "");
@@ -860,15 +865,15 @@ int CAudioPlayerGui::show()
//loop = false;
}
#endif
else if(msg == NeutrinoMessages::CHANGEMODE)
else if (msg == NeutrinoMessages::CHANGEMODE)
{
if((data & NeutrinoMessages::mode_mask) != NeutrinoMessages::mode_audio)
if ((data & NeutrinoMessages::mode_mask) != NeutrinoMessages::mode_audio)
{
loop = false;
m_LastMode=data;
}
}
else if(msg == NeutrinoMessages::RECORD_START ||
else if (msg == NeutrinoMessages::RECORD_START ||
msg == NeutrinoMessages::ZAPTO ||
msg == NeutrinoMessages::STANDBY_ON ||
msg == NeutrinoMessages::SHUTDOWN ||
@@ -878,13 +883,13 @@ int CAudioPlayerGui::show()
loop = false;
g_RCInput->postMsg(msg, data);
}
else if(msg == NeutrinoMessages::EVT_TIMER)
else if (msg == NeutrinoMessages::EVT_TIMER)
{
CNeutrinoApp::getInstance()->handleMsg( msg, data );
}
else
{
if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
loop = false;
}
@@ -895,7 +900,7 @@ int CAudioPlayerGui::show()
}
hide();
if(m_state != CAudioPlayerGui::STOP)
if (m_state != CAudioPlayerGui::STOP)
stop();
return ret;
@@ -908,9 +913,9 @@ bool CAudioPlayerGui::playNext(bool allow_rotate)
if (!(m_playlist.empty()))
{
int next = getNext();
if(next >= 0)
if (next >= 0)
play(next);
else if(allow_rotate)
else if (allow_rotate)
play(0);
else
stop();
@@ -926,11 +931,11 @@ bool CAudioPlayerGui::playPrev(bool allow_rotate)
if (!(m_playlist.empty()))
{
if(m_current == -1)
if (m_current == -1)
stop();
else if(m_current-1 > 0)
else if (m_current-1 > 0)
play(m_current-1);
else if(allow_rotate)
else if (allow_rotate)
play(m_playlist.size()-1);
else
play(0);
@@ -1004,7 +1009,7 @@ void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, cons
CURL *curl_handle;
struct MemoryStruct chunk;
printf("CAudioPlayerGui::processPlaylistUrl (%s, %s)\n", url, name);
printf("CAudioPlayerGui::processPlaylistUrl (%s, %s)\n", url, name);
chunk.memory=NULL; /* we expect realloc(NULL, size) to work */
chunk.size = 0; /* no data at this point */
@@ -1078,7 +1083,7 @@ printf("CAudioPlayerGui::processPlaylistUrl (%s, %s)\n", url, name);
}
}
if(chunk.memory)
if (chunk.memory)
free(chunk.memory);
/* we're done with libcurl, so clean it up */
@@ -1174,10 +1179,10 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag,
// show status
int global = 100*listPos / maxProgress;
progress.showGlobalStatus(global);
#ifdef LCD_UPDATE
#ifdef LCD_UPDATE
CVFD::getInstance()->showProgressBar(global, "read xmldata...");
CVFD::getInstance()->setMode(CVFD::MODE_PROGRESSBAR);
#endif // LCD_UPDATE
#endif // LCD_UPDATE
if (usechild) {
xmlNodePtr child = element->xmlChildrenNode;
@@ -1259,7 +1264,7 @@ bool CAudioPlayerGui::openFilebrowser(void)
m_Path = filebrowser.getCurrentDir();
CFileList::const_iterator files = filebrowser.getSelectedFiles().begin();
for(; files != filebrowser.getSelectedFiles().end();files++)
for (; files != filebrowser.getSelectedFiles().end(); files++)
{
if (maxProgress > SHOW_FILE_LOAD_LIMIT)
{
@@ -1268,10 +1273,10 @@ bool CAudioPlayerGui::openFilebrowser(void)
int global = 100*currentProgress/maxProgress;
progress.showGlobalStatus(global);
progress.showStatusMessageUTF(files->Name);
#ifdef LCD_UPDATE
#ifdef LCD_UPDATE
CVFD::getInstance()->showProgressBar(global, "read metadata...");
CVFD::getInstance()->setMode(CVFD::MODE_PROGRESSBAR);
#endif // LCD_UPDATE
#endif // LCD_UPDATE
}
if ((files->getType() == CFile::FILE_CDR)
|| (files->getType() == CFile::FILE_OGG)
@@ -1286,11 +1291,11 @@ bool CAudioPlayerGui::openFilebrowser(void)
files->getType());
addToPlaylist(audiofile);
}
if(files->getType() == CFile::STREAM_AUDIO)
if (files->getType() == CFile::STREAM_AUDIO)
{
std::string filename = files->Name;
FILE *fd = fopen(filename.c_str(), "r");
if(fd)
if (fd)
{
char buf[512];
unsigned int len = fread(buf, sizeof(char), 512, fd);
@@ -1308,7 +1313,7 @@ bool CAudioPlayerGui::openFilebrowser(void)
}
}
}
else if(files->getType() == CFile::FILE_PLAYLIST)
else if (files->getType() == CFile::FILE_PLAYLIST)
{
std::string sPath = files->Name.substr(0, files->Name.rfind('/'));
std::ifstream infile;
@@ -1318,9 +1323,9 @@ bool CAudioPlayerGui::openFilebrowser(void)
{
infile.getline(cLine, 255);
// remove CR
if(cLine[strlen(cLine)-1]=='\r')
if (cLine[strlen(cLine)-1]=='\r')
cLine[strlen(cLine)-1]=0;
if(strlen(cLine) > 0 && cLine[0]!='#')
if (strlen(cLine) > 0 && cLine[0]!='#')
{
char *url = strstr(cLine, "http://");
if (url != NULL) {
@@ -1336,23 +1341,23 @@ bool CAudioPlayerGui::openFilebrowser(void)
std::string filename = sPath + '/' + cLine;
std::string::size_type pos;
while((pos=filename.find('\\'))!=std::string::npos)
while ((pos=filename.find('\\'))!=std::string::npos)
filename[pos]='/';
std::ifstream testfile;
testfile.open(filename.c_str(), std::ifstream::in);
if(testfile.good())
if (testfile.good())
{
#ifdef AUDIOPLAYER_CHECK_FOR_DUPLICATES
// Check for duplicates and remove (new entry has higher prio)
// this really needs some time :(
for (unsigned long i=0;i<m_playlist.size();i++)
for (unsigned long i=0; i<m_playlist.size(); i++)
{
if(m_playlist[i].Filename == filename)
if (m_playlist[i].Filename == filename)
removeFromPlaylist(i);
}
#endif
if(strcasecmp(filename.substr(filename.length()-3,3).c_str(), "url")==0)
if (strcasecmp(filename.substr(filename.length()-3,3).c_str(), "url")==0)
{
addUrl2Playlist(filename.c_str());
}
@@ -1385,7 +1390,7 @@ bool CAudioPlayerGui::openFilebrowser(void)
}
infile.close();
}
else if(files->getType() == CFile::FILE_XML)
else if (files->getType() == CFile::FILE_XML)
{
if (!files->Name.empty())
{
@@ -1448,7 +1453,7 @@ bool CAudioPlayerGui::openSCbrowser(void)
neutrino_msg_t msg;
neutrino_msg_data_t data;
g_RCInput->getMsg(&msg, &data, 0);
for(; (files != filebrowser.getSelectedFiles().end()) && (msg != CRCInput::RC_home);files++)
for (; (files != filebrowser.getSelectedFiles().end()) && (msg != CRCInput::RC_home); files++)
{
//if (maxProgress > SHOW_FILE_LOAD_LIMIT)
{
@@ -1457,10 +1462,10 @@ bool CAudioPlayerGui::openSCbrowser(void)
int global = 100*currentProgress/maxProgress;
progress.showGlobalStatus(global);
progress.showStatusMessageUTF(files->Name);
#ifdef LCD_UPDATE
#ifdef LCD_UPDATE
CVFD::getInstance()->showProgressBar(global, "read metadata...");
CVFD::getInstance()->setMode(CVFD::MODE_PROGRESSBAR);
#endif // LCD_UPDATE
#endif // LCD_UPDATE
}
//printf("processPlaylistUrl(%s, %s)\n", files->Url.c_str(), files->Name.c_str());
processPlaylistUrl(files->Url.c_str(), files->Name.c_str(), files->Time);
@@ -1493,7 +1498,7 @@ bool CAudioPlayerGui::openSCbrowser(void)
void CAudioPlayerGui::hide()
{
// printf("hide(){\n");
if(m_visible)
if (m_visible)
{
m_frameBuffer->paintBackgroundBoxRel(m_x - ConnectLineBox_Width-1, m_y + m_title_height - 1,
m_width + ConnectLineBox_Width+2, m_height + 2 - m_title_height);
@@ -1570,7 +1575,7 @@ void CAudioPlayerGui::paintItem(int pos)
{
// id3tag noch nicht geholt
GetMetaData(m_playlist[pos + m_liststart]);
if(m_state != CAudioPlayerGui::STOP && !g_settings.audioplayer_highprio)
if (m_state != CAudioPlayerGui::STOP && !g_settings.audioplayer_highprio)
usleep(100*1000);
}
char sNr[20];
@@ -1619,18 +1624,18 @@ void CAudioPlayerGui::paintHead()
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(m_x + 35, m_y + m_theight + m_title_height + 0,
m_width - 45, strCaption, COL_MENUHEAD, 0, true); // UTF-8
int ypos = m_y + m_title_height;
if(m_theight > 26)
if (m_theight > 26)
ypos = (m_theight - 26) / 2 + m_y + m_title_height;
#ifdef ENABLE_GUI_MOUNT
if (!m_inetmode)
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, m_x + m_width - 30, ypos);
#endif
#if 1
if( CNeutrinoApp::getInstance()->isMuted() )
if ( CNeutrinoApp::getInstance()->isMuted() )
{
int xpos = m_x + m_width - 75;
ypos = m_y + m_title_height;
if(m_theight > 32)
if (m_theight > 32)
ypos = (m_theight - 32) / 2 + m_y + m_title_height;
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos, ypos);
}
@@ -1723,8 +1728,7 @@ void CAudioPlayerGui::paintFoot()
else
::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale,
m_x + 10, top + 4, ButtonWidth, 1, &(AudioPlayerButtons[7][0]));
} else
if (m_inetmode)
} else if (m_inetmode)
::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale,
m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[8]);
else
@@ -1776,7 +1780,7 @@ void CAudioPlayerGui::paintFoot()
void CAudioPlayerGui::paintInfo()
{
int c_rad_mid = RADIUS_MID;
if(m_state == CAudioPlayerGui::STOP && m_show_playlist)
if (m_state == CAudioPlayerGui::STOP && m_show_playlist)
m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width, m_title_height);
else
{
@@ -1805,7 +1809,7 @@ void CAudioPlayerGui::paintInfo()
int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8
int xstart = (m_width - w) / 2;
if(xstart < 10)
if (xstart < 10)
xstart = 10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_fheight, m_width - 20,
tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1835,7 +1839,7 @@ void CAudioPlayerGui::paintInfo()
}
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); // UTF-8
xstart=(m_width-w)/2;
if(xstart < 10)
if (xstart < 10)
xstart=10;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x+xstart, m_y +4+ 2*m_fheight, m_width- 20, tmp, COL_MENUCONTENTSELECTED, 0, true); // UTF-8
@@ -1856,7 +1860,7 @@ void CAudioPlayerGui::paint()
{
m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow;
paintHead();
for (unsigned int count=0;count<m_listmaxshow;count++)
for (unsigned int count=0; count<m_listmaxshow; count++)
{
paintItem(count);
}
@@ -1976,21 +1980,21 @@ void CAudioPlayerGui::stop()
m_key_level = 0;
paintFoot();
if(CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->stop();
}
//------------------------------------------------------------------------
void CAudioPlayerGui::pause()
{
if(m_state == CAudioPlayerGui::PLAY
if (m_state == CAudioPlayerGui::PLAY
|| m_state == CAudioPlayerGui::FF
|| m_state == CAudioPlayerGui::REV)
{
m_state = CAudioPlayerGui::PAUSE;
CAudioPlayer::getInstance()->pause();
}
else if(m_state == CAudioPlayerGui::PAUSE)
else if (m_state == CAudioPlayerGui::PAUSE)
{
m_state = CAudioPlayerGui::PLAY;
CAudioPlayer::getInstance()->pause();
@@ -2001,12 +2005,12 @@ void CAudioPlayerGui::pause()
void CAudioPlayerGui::ff(unsigned int seconds)
{
if(m_state == CAudioPlayerGui::FF)
if (m_state == CAudioPlayerGui::FF)
{
m_state = CAudioPlayerGui::PLAY;
CAudioPlayer::getInstance()->ff(seconds);
}
else if(m_state == CAudioPlayerGui::PLAY
else if (m_state == CAudioPlayerGui::PLAY
|| m_state == CAudioPlayerGui::PAUSE
|| m_state == CAudioPlayerGui::REV)
{
@@ -2019,12 +2023,12 @@ void CAudioPlayerGui::ff(unsigned int seconds)
void CAudioPlayerGui::rev(unsigned int seconds)
{
if(m_state == CAudioPlayerGui::REV)
if (m_state == CAudioPlayerGui::REV)
{
m_state = CAudioPlayerGui::PLAY;
CAudioPlayer::getInstance()->rev(seconds);
}
else if(m_state == CAudioPlayerGui::PLAY
else if (m_state == CAudioPlayerGui::PLAY
|| m_state == CAudioPlayerGui::PAUSE
|| m_state == CAudioPlayerGui::FF)
{
@@ -2042,37 +2046,37 @@ void CAudioPlayerGui::play(unsigned int pos)
unsigned int old_selected = m_selected;
m_current = pos;
if(g_settings.audioplayer_follow)
if (g_settings.audioplayer_follow)
m_selected = pos;
if(m_selected - m_liststart >= m_listmaxshow && g_settings.audioplayer_follow)
if (m_selected - m_liststart >= m_listmaxshow && g_settings.audioplayer_follow)
{
m_liststart = m_selected;
if(!m_screensaver)
if (!m_screensaver)
paint();
}
else if(m_liststart < m_selected && g_settings.audioplayer_follow)
else if (m_liststart < m_selected && g_settings.audioplayer_follow)
{
m_liststart = m_selected - m_listmaxshow + 1;
if(!m_screensaver)
if (!m_screensaver)
paint();
}
else
{
if(old_current >= m_liststart && old_current - m_liststart < m_listmaxshow)
if (old_current >= m_liststart && old_current - m_liststart < m_listmaxshow)
{
if(!m_screensaver)
if (!m_screensaver)
paintItem(old_current - m_liststart);
}
if(pos >= m_liststart && pos - m_liststart < m_listmaxshow)
if (pos >= m_liststart && pos - m_liststart < m_listmaxshow)
{
if(!m_screensaver)
if (!m_screensaver)
paintItem(pos - m_liststart);
}
if(g_settings.audioplayer_follow)
if (g_settings.audioplayer_follow)
{
if(old_selected >= m_liststart && old_selected - m_liststart < m_listmaxshow)
if(!m_screensaver)
if (old_selected >= m_liststart && old_selected - m_liststart < m_listmaxshow)
if (!m_screensaver)
paintItem(old_selected - m_liststart);
}
}
@@ -2094,10 +2098,10 @@ void CAudioPlayerGui::play(unsigned int pos)
//LCD
paintLCD();
// Display
if(!m_screensaver)
if (!m_screensaver)
paintInfo();
m_key_level = 1;
if(!m_screensaver)
if (!m_screensaver)
paintFoot();
}
//------------------------------------------------------------------------
@@ -2105,9 +2109,9 @@ void CAudioPlayerGui::play(unsigned int pos)
int CAudioPlayerGui::getNext()
{
int ret= m_current + 1;
if(m_playlist.empty())
if (m_playlist.empty())
return -1;
if((unsigned)ret >= m_playlist.size())
if ((unsigned)ret >= m_playlist.size())
{
if (g_settings.audioplayer_repeat_on == 1)
ret = 0;
@@ -2124,10 +2128,10 @@ void CAudioPlayerGui::updateMetaData()
bool updateLcd = false;
bool updateScreen = false;
if(m_state == CAudioPlayerGui::STOP || !m_show_playlist)
if (m_state == CAudioPlayerGui::STOP || !m_show_playlist)
return;
if( CAudioPlayer::getInstance()->hasMetaDataChanged()
if ( CAudioPlayer::getInstance()->hasMetaDataChanged()
|| m_metainfo.empty() )
{
const CAudioMetaData meta =
@@ -2181,11 +2185,11 @@ void CAudioPlayerGui::updateMetaData()
updateLcd = true;
}
//printf("CAudioPlayerGui::updateMetaData: updateLcd %d\n", updateLcd);
if(updateLcd)
if (updateLcd)
paintLCD();
if(updateScreen)
if (updateScreen)
paintInfo();
if(updateMeta || updateScreen)
if (updateMeta || updateScreen)
{
m_frameBuffer->paintBoxRel(m_x + 10, m_y + 4 + 2*m_fheight, m_width - 20,
m_sheight, COL_MENUCONTENTSELECTED_PLUS_0);
@@ -2210,7 +2214,7 @@ void CAudioPlayerGui::updateTimes(const bool force)
if (m_curr_audiofile.MetaData.total_time != CAudioPlayer::getInstance()->getTimeTotal())
{
m_curr_audiofile.MetaData.total_time = CAudioPlayer::getInstance()->getTimeTotal();
if(m_current >= 0)
if (m_current >= 0)
m_playlist[m_current].MetaData.total_time = CAudioPlayer::getInstance()->getTimeTotal();
}
updateTotal = true;
@@ -2220,7 +2224,7 @@ void CAudioPlayerGui::updateTimes(const bool force)
m_time_played = CAudioPlayer::getInstance()->getTimePlayed();
updatePlayed = true;
}
if(!m_screensaver)
if (!m_screensaver)
{
char tot_time[11];
snprintf(tot_time, 10, " / %ld:%02ld", m_time_total / 60, m_time_total % 60);
@@ -2236,7 +2240,7 @@ void CAudioPlayerGui::updateTimes(const bool force)
{
m_frameBuffer->paintBoxRel(m_x + m_width - w1 - 10, m_y + 4, w1 + 4,
m_fheight, COL_MENUCONTENTSELECTED_PLUS_0);
if(m_time_total > 0)
if (m_time_total > 0)
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + m_width - w1 - 10, m_y + 4 + m_fheight,
w1, tot_time, COL_MENUCONTENTSELECTED);
}
@@ -2254,7 +2258,7 @@ void CAudioPlayerGui::updateTimes(const bool force)
}
}
}
if((updatePlayed || updateTotal) && m_time_total != 0)
if ((updatePlayed || updateTotal) && m_time_total != 0)
{
CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total, CNeutrinoApp::getInstance()->isMuted());
}
@@ -2265,7 +2269,7 @@ void CAudioPlayerGui::updateTimes(const bool force)
void CAudioPlayerGui::paintLCD()
{
switch(m_state)
switch (m_state)
{
case CAudioPlayerGui::STOP:
CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_STOP);
@@ -2276,7 +2280,7 @@ void CAudioPlayerGui::paintLCD()
CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title,
m_curr_audiofile.MetaData.album);
if(m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0)
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0)
CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total, CNeutrinoApp::getInstance()->isMuted());
#ifdef INCLUDE_UNUSED_STUFF
@@ -2305,7 +2309,7 @@ void CAudioPlayerGui::paintLCD()
void CAudioPlayerGui::screensaver(bool on)
{
if(on)
if (on)
{
m_screensaver = true;
m_frameBuffer->ClearFrameBuffer();
@@ -2313,7 +2317,7 @@ void CAudioPlayerGui::screensaver(bool on)
}
else
{
if(stimer)
if (stimer)
g_RCInput->killTimer(stimer);
stimer = 0;
m_screensaver = false;
@@ -2344,7 +2348,7 @@ void CAudioPlayerGui::GetMetaData(CAudiofileExt &File)
std::string tmp = File.Filename.substr(File.Filename.rfind('/') + 1);
tmp = tmp.substr(0,tmp.length()-4); //remove extension (.mp3)
std::string::size_type i = tmp.rfind(" - ");
if(i != std::string::npos)
if (i != std::string::npos)
{ // Trennzeichen " - " gefunden
File.MetaData.artist = tmp.substr(0, i);
File.MetaData.title = tmp.substr(i + 3);
@@ -2352,7 +2356,7 @@ void CAudioPlayerGui::GetMetaData(CAudiofileExt &File)
else
{
i = tmp.rfind('-');
if(i != std::string::npos)
if (i != std::string::npos)
{ //Trennzeichen "-"
File.MetaData.artist = tmp.substr(0, i);
File.MetaData.title = tmp.substr(i + 1);
@@ -2422,7 +2426,7 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &info, CAudiofileExt &fil
if (!file.MetaData.title.empty())
title = file.MetaData.title;
if(g_settings.audioplayer_display == TITLE_ARTIST)
if (g_settings.audioplayer_display == TITLE_ARTIST)
{
fileInfo += title;
if (!title.empty() && !artist.empty()) fileInfo += ", ";
@@ -2507,11 +2511,11 @@ void CAudioPlayerGui::removeFromPlaylist(long pos)
// behind item to delete
long p = 0;
for (CTitle2Pos::iterator title=m_title2Pos.begin();
title!=m_title2Pos.end();title++)
title!=m_title2Pos.end(); title++)
{
CPosList newList;
for (CPosList::iterator posIt=title->second.begin();
posIt!=title->second.end();posIt++)
posIt!=title->second.end(); posIt++)
{
p = *(posIt);
if (*posIt > pos)
@@ -2579,7 +2583,7 @@ void CAudioPlayerGui::selectTitle(unsigned char selectionChar)
unsigned int oldliststart = m_liststart;
m_liststart = (m_selected / m_listmaxshow)*m_listmaxshow;
//printf("before paint\n");
if(oldliststart != m_liststart)
if (oldliststart != m_liststart)
{
paint();
}
@@ -2593,12 +2597,12 @@ void CAudioPlayerGui::selectTitle(unsigned char selectionChar)
void CAudioPlayerGui::printSearchTree()
{
for (CTitle2Pos::iterator it=m_title2Pos.begin();
it!=m_title2Pos.end();it++)
it!=m_title2Pos.end(); it++)
{
printf("key: %c\n",it->first);
long pos=-1;
for (CPosList::iterator it2=it->second.begin();
it2!=it->second.end();it2++)
it2!=it->second.end(); it2++)
{
pos++;
printf(" val: %ld ",*it2);
@@ -2632,7 +2636,7 @@ void CAudioPlayerGui::buildSearchTree()
long listPos = -1;
for (CAudioPlayList::iterator it=m_playlist.begin();
it!=m_playlist.end();it++)
it!=m_playlist.end(); it++)
{
// if (m_state == CAudioPlayerGui::PLAY)
// usleep(10*1000);
@@ -2804,7 +2808,7 @@ void CAudioPlayerGui::savePlaylist()
playlistFile << "#EXTM3U" << std::endl;
CAudioPlayList::const_iterator it;
for (it = m_playlist.begin();it!=m_playlist.end();it++)
for (it = m_playlist.begin(); it!=m_playlist.end(); it++)
{
playlistFile << "#EXTINF:" << it->MetaData.total_time << ","
<< it->MetaData.artist << " - " << it->MetaData.title << std::endl;
@@ -2845,7 +2849,7 @@ std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
// fromDir: /foo/bar/angle/1 (length: 16)
// absFilename: /foo/bar/devil/2/fire.mp3 (length: 19)
// -> /foo/bar/ is prefix, lastSlash will be 8
for (int i=0;i<length;i++)
for (int i=0; i<length; i++)
{
if (fromDir[i] == absFilename[i])
{
@@ -2869,7 +2873,7 @@ std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
// relFromDir is now /angle/1
// go up as many directories as neccessary
for (unsigned int i=0;i<relFromDir.size();i++)
for (unsigned int i=0; i<relFromDir.size(); i++)
{
if (relFromDir[i] == '/')
{

View File

@@ -35,7 +35,7 @@
#include <neutrino.h>
#include <system/settings.h>
#include <driver/screen_max.h>
#include <gui/widget/messagebox.h>
#include <gui/widget/hintbox.h>
#include <gui/widget/stringinput.h>
@@ -85,7 +85,7 @@ int CBookmarkManager::createBookmark (const std::string & url, const std::string
CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_");
bookmarkname_input.exec(NULL, "");
// TODO: return -1 if no name was entered
if(!strlen(bookmarkname)) return -1;
if (!strlen(bookmarkname)) return -1;
return createBookmark(std::string(bookmarkname), url, time);
}
@@ -218,7 +218,7 @@ void CBookmarkManager::flush() {
const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
{
if(parent)
if (parent)
{
parent->hide();
}
@@ -227,13 +227,11 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
visible = false;
selected = 0;
// Max
width = 720;
if(g_settings.screen_EndX-g_settings.screen_StartX < width)
width=g_settings.screen_EndX-g_settings.screen_StartX-10;
width = w_max( 720, 10 );
buttonHeight = 25;
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
x=getScreenStartX( width );
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-( height+ info_height) ) / 2) + g_settings.screen_StartY;
listmaxshow = (height-theight-0)/(fheight*2);
liststart = 0;
@@ -241,30 +239,29 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
height = (g_settings.screen_EndY-g_settings.screen_StartY)-(info_height+50);
listmaxshow = (height-theight-0)/(fheight*2);
height = theight+0+listmaxshow*fheight*2; // recalc height
if(bookmarks.size() < listmaxshow)
if (bookmarks.size() < listmaxshow)
{
listmaxshow=bookmarks.size();
height = theight+0+listmaxshow*fheight*2; // recalc height
}
if(selected==bookmarks.size() && !(bookmarks.empty()))
if (selected==bookmarks.size() && !(bookmarks.empty()))
{
selected=bookmarks.size()-1;
liststart = (selected/listmaxshow)*listmaxshow;
}
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-( height+ info_height) ) / 2) + g_settings.screen_StartY;
int res = -1;
unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
uint32_t msg; uint32_t data;
uint32_t msg;
uint32_t data;
bool loop=true;
bool update=true;
while(loop)
while (loop)
{
if(update)
if (update)
{
hide();
update=false;
@@ -272,10 +269,10 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
}
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
if( msg <= CRCInput::RC_MaxRC )
if ( msg <= CRCInput::RC_MaxRC )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
if( ( msg == CRCInput::RC_timeout ) ||
if ( ( msg == CRCInput::RC_timeout ) ||
( msg == CRCInput::RC_home) )
{ //Exit after timeout or cancel key
res = -1;
@@ -284,7 +281,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
else if ((msg == CRCInput::RC_up) && !(bookmarks.empty()))
{
int prevselected=selected;
if(selected==0)
if (selected==0)
{
selected = bookmarks.size()-1;
}
@@ -293,7 +290,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
paintItem(prevselected - liststart);
unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow;
if(oldliststart!=liststart)
if (oldliststart!=liststart)
{
paint();
}
@@ -309,7 +306,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
paintItem(prevselected - liststart);
unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow;
if(oldliststart!=liststart)
if (oldliststart!=liststart)
{
paint();
}
@@ -323,33 +320,33 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
res = selected;
loop=false;
}
else if((msg == CRCInput::RC_red) && !(bookmarks.empty()))
else if ((msg == CRCInput::RC_red) && !(bookmarks.empty()))
{
removeBookmark(selected);
update=true;
}
else if((msg==CRCInput::RC_yellow) && !(bookmarks.empty()))
else if ((msg==CRCInput::RC_yellow) && !(bookmarks.empty()))
{
renameBookmark(selected);
update=true;
}
else if((msg==CRCInput::RC_blue)||(msg==CRCInput::RC_green)||
else if ((msg==CRCInput::RC_blue)||(msg==CRCInput::RC_green)||
(CRCInput::isNumeric(msg)) )
{
//Ignore
}
else if(msg==CRCInput::RC_setup)
else if (msg==CRCInput::RC_setup)
{
res=-1;
loop=false;
}
else if( msg == CRCInput::RC_help )
else if ( msg == CRCInput::RC_help )
{
// TODO Add Help
}
else
{
if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
loop = false;
res = menu_return::RETURN_EXIT_ALL;
@@ -390,20 +387,20 @@ void CBookmarkManager::paintItem(int pos)
}
int real_width=width;
if(bookmarks.size()>listmaxshow)
if (bookmarks.size()>listmaxshow)
{
real_width-=15; //scrollbar
}
frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor);
if(liststart+pos<bookmarks.size())
if (liststart+pos<bookmarks.size())
{
CBookmark theBookmark = bookmarks[liststart+pos];
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, real_width-10, theBookmark.getName(), color, fheight, true); // UTF-8
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+2*fheight, real_width-10, theBookmark.getUrl(), color, fheight, true); // UTF-8
// LCD Display
if(liststart+pos==selected)
if (liststart+pos==selected)
{
CVFD::getInstance()->showMenuText(0, theBookmark.getName(), -1, true); // UTF-8
CVFD::getInstance()->showMenuText(1, theBookmark.getUrl(), -1, true); // UTF-8
@@ -415,7 +412,7 @@ void CBookmarkManager::paintItem(int pos)
void CBookmarkManager::hide()
{
if(visible)
if (visible)
{
frameBuffer->paintBackgroundBoxRel(x, y, width, height+ info_height+ 5);
visible = false;
@@ -467,11 +464,11 @@ void CBookmarkManager::paint()
paintHead();
for(unsigned int count=0;count<listmaxshow;count++)
for (unsigned int count=0; count<listmaxshow; count++)
{
paintItem(count);
}
if(bookmarks.size()>listmaxshow)
if (bookmarks.size()>listmaxshow)
{
int ypos = y+ theight;
int sb = 2*fheight* listmaxshow;

View File

@@ -62,9 +62,8 @@ CDBoxInfoWidget::CDBoxInfoWidget()
width = w_max (600, 0);
height = h_max (hheight+14*mheight+ 10, 0);
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
}
@@ -106,11 +105,11 @@ void CDBoxInfoWidget::paint()
int fp_ver = 0;
int fp = open("/dev/dbox/fp0", O_RDWR);
if(fp > 0) {
if (fp > 0) {
fp_ver = ioctl(fp, FP_IOCTL_GETID);
if(fp_ver < 0) fp_ver = 0;
if (fp_ver < 0) fp_ver = 0;
ioctl(fp, FP_IOCTL_UPGRADE_CTRL, &is_val);
if(is_val != 1) is_val = 0;
if (is_val != 1) is_val = 0;
ioctl(fp, FP_IOCTL_GET_LNB_CURRENT, &power);
close(fp);
}
@@ -123,12 +122,12 @@ void CDBoxInfoWidget::paint()
} else {
fgets(buf,255,fd);
while(!feof(fd)) {
if(fgets(buf,255,fd)!=NULL) {
while (!feof(fd)) {
if (fgets(buf,255,fd)!=NULL) {
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, buf, COL_MENUCONTENT);
ypos+= mheight;
i++;
if(i > 6) break;
if (i > 6) break;
}
}
fclose(fd);
@@ -164,7 +163,7 @@ void CDBoxInfoWidget::paint()
upminutes = (int) info.uptime / 60;
uphours = (upminutes / 60) % 24;
upminutes %= 60;
if(uphours)
if (uphours)
sprintf(ubuf,"%2d:%02d, ", uphours, upminutes);
else
sprintf(ubuf,"%d min, ", upminutes);
@@ -198,7 +197,7 @@ void CDBoxInfoWidget::paint()
perror("/var statfs");
if (::statfs("/hdd", &s) == 0) {
//printf("STATFS: type %lX free: %ld\n", s.f_type, s.f_bfree);
if( (s.f_type != (int) 0xEF53) && (s.f_type != (int) 0x52654973) && (s.f_type != (int) 0x6969) && (s.f_type != (int) 0xFF534D42) && (s.f_type != (int) 0x517B) && (s.f_type != (int) 0x58465342) )
if ( (s.f_type != (int) 0xEF53) && (s.f_type != (int) 0x52654973) && (s.f_type != (int) 0x6969) && (s.f_type != (int) 0xFF534D42) && (s.f_type != (int) 0x517B) && (s.f_type != (int) 0x58465342) )
return;
//printf("/hdd filesystem total %ldKb, free %ldKb\n", (long)(s.f_blocks/1024)*s.f_bsize, (long)(s.f_bfree/1024)*s.f_bsize);
sprintf(ubuf, "/hdd filesystem total %ldKb, free %ldKb", (long)(s.f_blocks/1024)*s.f_bsize, (long)(s.f_bfree/1024)*s.f_bsize);

View File

@@ -135,7 +135,7 @@ void CEpgData::start()
topheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getHeight();
topboxheight = topheight + 6;
if(topboxheight < PIC_H) topboxheight = PIC_H;
if (topboxheight < PIC_H) topboxheight = PIC_H;
botheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getHeight();
botboxheight = botheight + 6;
@@ -144,7 +144,7 @@ void CEpgData::start()
sb = medlinecount* medlineheight;
oy = botboxheight+medlinecount*medlineheight; // recalculate //FIXME
sy = (((g_settings.screen_EndY-g_settings.screen_StartY)-(oy- topboxheight) ) / 2) + g_settings.screen_StartY;
sy = getScreenStartY(oy- topboxheight);
toph = topboxheight;
}
@@ -154,7 +154,7 @@ void CEpgData::addTextToArray(const std::string & text) // UTF-8
if (text==" ")
{
emptyLineCount ++;
if(emptyLineCount<2)
if (emptyLineCount<2)
{
epgText.push_back(text);
}
@@ -174,24 +174,24 @@ void CEpgData::processTextToArray(std::string text) // UTF-8
text += ' ';
char* text_= (char*) text.c_str();
while(*text_!=0)
while (*text_!=0)
{
if ( (*text_==' ') || (*text_=='\n') || (*text_=='-') || (*text_=='.') )
{
// Houdini: if there is a newline (especially in the Premiere Portal EPGs) do not forget to add aktWord to aktLine
// after width check, if width check failes do newline, add aktWord to next line
// and "reinsert" i.e. reloop for the \n
if(*text_!='\n')
if (*text_!='\n')
aktWord += *text_;
// check the wordwidth - add to this line if size ok
int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord, true);
if((aktWordWidth+aktWidth)<(ox- 20- 15))
if ((aktWordWidth+aktWidth)<(ox- 20- 15))
{//space ok, add
aktWidth += aktWordWidth;
aktLine += aktWord;
if(*text_=='\n')
if (*text_=='\n')
{ //enter-handler
addTextToArray( aktLine );
aktLine = "";
@@ -207,7 +207,7 @@ void CEpgData::processTextToArray(std::string text) // UTF-8
aktWord = "";
// Houdini: in this case where we skipped \n and space is too low, exec newline and rescan \n
// otherwise next word comes direct after aktLine
if(*text_=='\n')
if (*text_=='\n')
continue;
}
}
@@ -232,7 +232,7 @@ void CEpgData::showText( int startPos, int ypos )
frameBuffer->paintBoxRel(sx, y, ox- 15, sb, COL_MENUCONTENT_PLUS_0);
for(int i=startPos; i<textCount && i<startPos+medlinecount; i++,y+=medlineheight)
for (int i=startPos; i<textCount && i<startPos+medlinecount; i++,y+=medlineheight)
{
if ( i< info1_lines )
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->RenderString(sx+10, y+medlineheight, ox- 15- 15, epgText[i], COL_MENUCONTENT, 0, true); // UTF-8
@@ -469,7 +469,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
static unsigned long long id;
static time_t startzeit;
if(a_startzeit)
if (a_startzeit)
startzeit=*a_startzeit;
id=a_id;
@@ -480,7 +480,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
//start();
frameBuffer->paintBoxRel(g_settings.screen_StartX, g_settings.screen_StartY, 50, height+5, COL_INFOBAR_PLUS_0);
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(g_settings.screen_StartX+10, g_settings.screen_StartY+height, 40, "-@-", COL_INFOBAR);
if(!bigFonts && g_settings.bigFonts) {
if (!bigFonts && g_settings.bigFonts) {
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getSize() * BIG_FONT_FAKTOR));
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() * BIG_FONT_FAKTOR));
}
@@ -516,9 +516,9 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
std::string::size_type nPosDot = epgData.info1.find('.');
if (std::string::npos != nPosDot) {
nPosDot += 2; // Skip dot and first blank
/* Houdini: changed for safty reason (crashes with some events at WDR regional)
/* Houdini: changed for safty reason (crashes with some events at WDR regional)
if (nPosDot < epgData.info2.length()) { // Make sure we don't overrun the buffer
*/
*/
if (nPosDot < epgData.info2.length() && nPosDot < epgData.info1.length()) { // Make sure we don't overrun the buffer
// Check if the stuff after the dot equals the beginning of info2
@@ -548,7 +548,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
// 21.07.2005 - rainerk
// Show extended information
if(0 != epgData.itemDescriptions.size() && 0 != epgData.items.size()) {
if (0 != epgData.itemDescriptions.size() && 0 != epgData.items.size()) {
char line[256];
std::vector<std::string>::iterator description;
std::vector<std::string>::iterator item;
@@ -613,11 +613,11 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
{
for (unsigned int i=0; i< tags.size(); i++)
{
if( tags[i].streamContent == 1 && (tags[i].componentType == 2 || tags[i].componentType == 3) )
if ( tags[i].streamContent == 1 && (tags[i].componentType == 2 || tags[i].componentType == 3) )
{
frameBuffer->paintIcon("16_9.raw" ,ox+sx-(ICON_LARGE_WIDTH+2)-(ICON_LARGE_WIDTH+2),sy + oy+5 );
}
else if( tags[i].streamContent == 2 && tags[i].componentType == 5 )
else if ( tags[i].streamContent == 2 && tags[i].componentType == 5 )
{
frameBuffer->paintIcon("dd.raw", ox+sx-(ICON_LARGE_WIDTH+2), sy + oy+5);
}
@@ -656,7 +656,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);
while(loop)
while (loop)
{
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
@@ -705,7 +705,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
break;
case CRCInput::RC_down:
if(showPos+scrollCount<textCount)
if (showPos+scrollCount<textCount)
{
showPos += scrollCount;
showText(showPos,textypos);
@@ -714,7 +714,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
case CRCInput::RC_up:
showPos -= scrollCount;
if(showPos<0)
if (showPos<0)
showPos = 0;
else
showText(showPos,textypos);
@@ -725,7 +725,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
if (!g_settings.minimode && (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF))
{
//CTimerdClient timerdclient;
if(g_Timerd->isTimerdAvailable())
if (g_Timerd->isTimerdAvailable())
{
bool doRecord = true;
//char *recDir = g_settings.network_nfs_recordingdir;
@@ -769,7 +769,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ),
TIMERD_APIDS_CONF, true, recDir,false) == -1)
{
if(askUserOnTimerConflict(epgData.epg_times.startzeit - (ANNOUNCETIME + 120),
if (askUserOnTimerConflict(epgData.epg_times.startzeit - (ANNOUNCETIME + 120),
epgData.epg_times.startzeit + epgData.epg_times.dauer))
{
g_Timerd->addRecordTimerEvent(channel_id,
@@ -794,7 +794,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
case CRCInput::RC_yellow:
{
//CTimerdClient timerdclient;
if(g_Timerd->isTimerdAvailable())
if (g_Timerd->isTimerdAvailable())
{
g_Timerd->addZaptoTimerEvent(channel_id,
epgData.epg_times.startzeit,
@@ -814,11 +814,11 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
showTimerEventBar (false);
start();
//printf("bigFonts %d\n", bigFonts);
if(bigFonts)
if (bigFonts)
{
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getSize() * BIG_FONT_FAKTOR));
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() * BIG_FONT_FAKTOR));
}else
} else
{
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getSize() / BIG_FONT_FAKTOR));
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIG_FONT_FAKTOR));
@@ -1004,7 +1004,7 @@ int CEpgData::FollowScreenings (const t_channel_id channel_id, const std::string
strftime(tmpstr, sizeof(tmpstr), ". %H:%M ", tmStartZeit );
screening_dates += tmpstr;
if (screening_dates != screening_nodual){
if (screening_dates != screening_nodual) {
screening_nodual=screening_dates;
processTextToArray(screening_dates ); // UTF-8
}

View File

@@ -66,8 +66,8 @@ void CImageInfo::Init(void)
width = frameBuffer->getScreenWidth() - 10;
height = frameBuffer->getScreenHeight() - 10;
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
}
CImageInfo::~CImageInfo()

View File

@@ -56,6 +56,7 @@
#include <gui/widget/helpbox.h>
#include <gui/widget/stringinput.h>
#include <driver/screen_max.h>
#include <system/settings.h>
@@ -87,7 +88,7 @@ CPictureViewerGui::CPictureViewerGui()
selected = 0;
m_sort = FILENAME;
m_viewer = new CPictureViewer();
if(strlen(g_settings.network_nfs_picturedir)!=0)
if (strlen(g_settings.network_nfs_picturedir)!=0)
Path = g_settings.network_nfs_picturedir;
else
Path = "/";
@@ -112,13 +113,8 @@ CPictureViewerGui::~CPictureViewerGui()
int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey)
{
selected = 0;
width = 710;
height = 570;
if((g_settings.screen_EndX- g_settings.screen_StartX) < width)
width=(g_settings.screen_EndX- g_settings.screen_StartX);
if((g_settings.screen_EndY- g_settings.screen_StartY) < height)
height=(g_settings.screen_EndY- g_settings.screen_StartY);
width = w_max (710, 0);
height = h_max (570, 0);
sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
buttonHeight = std::min(25, sheight);
@@ -127,18 +123,18 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey)
listmaxshow = (height-theight-2*buttonHeight)/(fheight);
height = theight+2*buttonHeight+listmaxshow*fheight; // recalc height
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height)/ 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
m_viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling);
m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY);
if(g_settings.video_Format == 3)
if (g_settings.video_Format == 3)
m_viewer->SetAspectRatio(16.0/9);
else
m_viewer->SetAspectRatio(4.0/3);
if(parent)
if (parent)
parent->hide();
// tell neutrino we're in pic_mode
@@ -180,28 +176,28 @@ int CPictureViewerGui::show()
bool loop=true;
bool update=true;
while(loop)
while (loop)
{
if(update)
if (update)
{
hide();
update=false;
paint();
}
if(m_state!=SLIDESHOW)
if (m_state!=SLIDESHOW)
timeout=50; // egal
else
{
timeout=(m_time+atoi(g_settings.picviewer_slide_time)-(long)time(NULL))*10;
if(timeout <0 )
if (timeout <0 )
timeout=1;
}
g_RCInput->getMsg( &msg, &data, timeout );
if( msg == CRCInput::RC_home)
if ( msg == CRCInput::RC_home)
{ //Exit after cancel key
if(m_state!=MENU)
if (m_state!=MENU)
{
endView();
update=true;
@@ -211,7 +207,7 @@ int CPictureViewerGui::show()
}
else if (msg == CRCInput::RC_timeout)
{
if(m_state == SLIDESHOW)
if (m_state == SLIDESHOW)
{
m_time=(long)time(NULL);
unsigned int next = selected + 1;
@@ -269,7 +265,7 @@ int CPictureViewerGui::show()
if ((m_state == MENU) && (!playlist.empty()))
{
int prevselected=selected;
if(selected==0)
if (selected==0)
{
selected = playlist.size()-1;
}
@@ -278,7 +274,7 @@ int CPictureViewerGui::show()
paintItem(prevselected - liststart);
unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow;
if(oldliststart!=liststart)
if (oldliststart!=liststart)
{
update=true;
}
@@ -297,7 +293,7 @@ int CPictureViewerGui::show()
paintItem(prevselected - liststart);
unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow;
if(oldliststart!=liststart)
if (oldliststart!=liststart)
{
update=true;
}
@@ -326,7 +322,7 @@ int CPictureViewerGui::show()
}
}
}
else if(msg==CRCInput::RC_green)
else if (msg==CRCInput::RC_green)
{
if (m_state == MENU)
{
@@ -342,9 +338,9 @@ int CPictureViewerGui::show()
{
Path = filebrowser.getCurrentDir();
CFileList::const_iterator files = filebrowser.getSelectedFiles().begin();
for(; files != filebrowser.getSelectedFiles().end();files++)
for (; files != filebrowser.getSelectedFiles().end(); files++)
{
if(files->getType() == CFile::FILE_PICTURE)
if (files->getType() == CFile::FILE_PICTURE)
{
CPicture pic;
pic.Filename = files->Name;
@@ -352,7 +348,7 @@ int CPictureViewerGui::show()
pic.Name = tmp.substr(0,tmp.rfind('.'));
pic.Type = tmp.substr(tmp.rfind('.')+1);
struct stat statbuf;
if(stat(pic.Filename.c_str(),&statbuf) != 0)
if (stat(pic.Filename.c_str(),&statbuf) != 0)
printf("stat error");
pic.Date = statbuf.st_mtime;
playlist.push_back(pic);
@@ -368,7 +364,7 @@ int CPictureViewerGui::show()
update=true;
}
}
else if(msg==CRCInput::RC_yellow)
else if (msg==CRCInput::RC_yellow)
{
if (m_state == MENU && !playlist.empty())
{
@@ -377,7 +373,7 @@ int CPictureViewerGui::show()
update=true;
}
}
else if(msg==CRCInput::RC_blue)
else if (msg==CRCInput::RC_blue)
{
if ((m_state == MENU) && (!playlist.empty()))
{
@@ -385,13 +381,13 @@ int CPictureViewerGui::show()
view(selected);
m_state=SLIDESHOW;
} else {
if(m_state == SLIDESHOW)
if (m_state == SLIDESHOW)
m_state = VIEW;
else
m_state = SLIDESHOW;
}
}
else if(msg==CRCInput::RC_help)
else if (msg==CRCInput::RC_help)
{
if (m_state == MENU)
{
@@ -399,7 +395,7 @@ int CPictureViewerGui::show()
paint();
}
}
else if( msg == CRCInput::RC_1 )
else if ( msg == CRCInput::RC_1 )
{
if (m_state != MENU)
{
@@ -407,14 +403,14 @@ int CPictureViewerGui::show()
}
}
else if( msg == CRCInput::RC_2 )
else if ( msg == CRCInput::RC_2 )
{
if (m_state != MENU)
{
m_viewer->Move(0,-50);
}
}
else if( msg == CRCInput::RC_3 )
else if ( msg == CRCInput::RC_3 )
{
if (m_state != MENU)
{
@@ -422,7 +418,7 @@ int CPictureViewerGui::show()
}
}
else if( msg == CRCInput::RC_4 )
else if ( msg == CRCInput::RC_4 )
{
if (m_state != MENU)
{
@@ -431,16 +427,16 @@ int CPictureViewerGui::show()
}
else if ( msg == CRCInput::RC_5 )
{
if(m_state==MENU)
if (m_state==MENU)
{
if (!playlist.empty())
{
if(m_sort==FILENAME)
if (m_sort==FILENAME)
{
m_sort=DATE;
std::sort(playlist.begin(),playlist.end(),comparePictureByDate);
}
else if(m_sort==DATE)
else if (m_sort==DATE)
{
m_sort=FILENAME;
std::sort(playlist.begin(),playlist.end(),comparePictureByFilename);
@@ -449,28 +445,28 @@ int CPictureViewerGui::show()
}
}
}
else if( msg == CRCInput::RC_6 )
else if ( msg == CRCInput::RC_6 )
{
if (m_state != MENU && playlist.empty())
{
m_viewer->Move(50,0);
}
}
else if( msg == CRCInput::RC_8 )
else if ( msg == CRCInput::RC_8 )
{
if (m_state != MENU && playlist.empty())
{
m_viewer->Move(0,50);
}
}
else if(msg==CRCInput::RC_0)
else if (msg==CRCInput::RC_0)
{
if (!playlist.empty())
view(selected, true);
}
else if(msg==CRCInput::RC_setup)
else if (msg==CRCInput::RC_setup)
{
if(m_state==MENU)
if (m_state==MENU)
{
CNFSSmallMenu nfsMenu;
nfsMenu.exec(this, "");
@@ -478,15 +474,15 @@ int CPictureViewerGui::show()
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, g_Locale->getText(LOCALE_PICTUREVIEWER_HEAD));
}
}
else if(msg == NeutrinoMessages::CHANGEMODE)
else if (msg == NeutrinoMessages::CHANGEMODE)
{
if((data & NeutrinoMessages::mode_mask) !=NeutrinoMessages::mode_pic)
if ((data & NeutrinoMessages::mode_mask) !=NeutrinoMessages::mode_pic)
{
loop = false;
m_LastMode=data;
}
}
else if(msg == NeutrinoMessages::RECORD_START ||
else if (msg == NeutrinoMessages::RECORD_START ||
msg == NeutrinoMessages::ZAPTO ||
msg == NeutrinoMessages::STANDBY_ON ||
msg == NeutrinoMessages::SHUTDOWN ||
@@ -498,11 +494,11 @@ int CPictureViewerGui::show()
loop = false;
g_RCInput->postMsg(msg, data);
}
else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) {
else if ((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) {
}
else
{
if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
loop = false;
}
@@ -517,7 +513,7 @@ int CPictureViewerGui::show()
void CPictureViewerGui::hide()
{
if(visible) {
if (visible) {
frameBuffer->paintBackground();
visible = false;
}
@@ -552,7 +548,7 @@ void CPictureViewerGui::paintItem(int pos)
}
frameBuffer->paintBoxRel(x, ypos, width-15, fheight, bgcolor, liststart+pos == selected ? ROUND_RADIUS : 0);
if(liststart+pos<playlist.size())
if (liststart+pos<playlist.size())
{
std::string tmp = playlist[liststart+pos].Name;
tmp += " (";
@@ -578,7 +574,7 @@ void CPictureViewerGui::paintHead()
frameBuffer->paintIcon("mp3.raw",x+7,y+10);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+35,y+theight+0, width- 45, strCaption, COL_MENUHEAD, 0, true); // UTF-8
int ypos=y+0;
if(theight > 26)
if (theight > 26)
ypos = (theight-26) / 2 + y ;
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, x+ width- 60, ypos );
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, x+ width- 30, ypos );
@@ -610,9 +606,9 @@ void CPictureViewerGui::paintFoot()
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_5, x+ 0* ButtonWidth2 + 25, y+(height-buttonHeight)-3);
std::string tmp = g_Locale->getText(LOCALE_PICTUREVIEWER_SORTORDER);
tmp += ' ';
if(m_sort==FILENAME)
if (m_sort==FILENAME)
tmp += g_Locale->getText(LOCALE_PICTUREVIEWER_SORTORDER_DATE);
else if(m_sort==DATE)
else if (m_sort==DATE)
tmp += g_Locale->getText(LOCALE_PICTUREVIEWER_SORTORDER_FILENAME);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+ 0* ButtonWidth2 +53 , y+(height-buttonHeight)+24 - 4, ButtonWidth2- 28, tmp, COL_INFOBAR, 0, true); // UTF-8
@@ -634,7 +630,7 @@ void CPictureViewerGui::paint()
liststart = (selected/listmaxshow)*listmaxshow;
paintHead();
for(unsigned int count=0;count<listmaxshow;count++)
for (unsigned int count=0; count<listmaxshow; count++)
{
paintItem(count);
}
@@ -664,17 +660,17 @@ void CPictureViewerGui::view(unsigned int index, bool unscaled)
strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[index].Date));
//CVFD::getInstance()->showMenuText(1, timestring); //FIXME
if(unscaled)
if (unscaled)
m_viewer->DecodeImage(playlist[index].Filename, true, unscaled);
m_viewer->ShowImage(playlist[index].Filename, unscaled);
//Decode next
unsigned int next=selected+1;
if(next > playlist.size()-1)
if (next > playlist.size()-1)
next=0;
if(m_state==MENU)
if (m_state==MENU)
m_state=VIEW;
if(m_state==VIEW)
if (m_state==VIEW)
m_viewer->DecodeImage(playlist[next].Filename,true);
else
m_viewer->DecodeImage(playlist[next].Filename,false);
@@ -682,7 +678,7 @@ void CPictureViewerGui::view(unsigned int index, bool unscaled)
void CPictureViewerGui::endView()
{
if(m_state != MENU)
if (m_state != MENU)
m_state=MENU;
}

View File

@@ -54,6 +54,7 @@
#include <neutrino.h>
#include <plugins.h>
#include <driver/encoding.h>
#include <driver/screen_max.h>
#include <zapit/client/zapittools.h>
@@ -76,12 +77,8 @@ CPluginList::CPluginList(const neutrino_locale_t Name, const uint32_t listtype)
name = Name;
pluginlisttype = listtype;
selected = 0;
width = 500;
if(width>(g_settings.screen_EndX-g_settings.screen_StartX))
width=(g_settings.screen_EndX-g_settings.screen_StartX);
height = 526;
if((height+50)>(g_settings.screen_EndY-g_settings.screen_StartY))
height=(g_settings.screen_EndY-g_settings.screen_StartY) - 50; // 2*25 pixel frei
width = w_max( 500, 0 );
height = h_max( 526, 50 ); // 2*25 pixel frei
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
//
fheight1 = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE]->getHeight();
@@ -90,8 +87,8 @@ CPluginList::CPluginList(const neutrino_locale_t Name, const uint32_t listtype)
//
listmaxshow = (height-theight-0)/fheight;
height = theight+0+listmaxshow*fheight; // recalc height
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
liststart = 0;
}
@@ -310,16 +307,12 @@ void CPluginList::paintHead()
void CPluginList::paint()
{
hide();
width = 500;
if(width>(g_settings.screen_EndX-g_settings.screen_StartX))
width=(g_settings.screen_EndX-g_settings.screen_StartX);
height = 526;
if((height+50)>(g_settings.screen_EndY-g_settings.screen_StartY))
height=(g_settings.screen_EndY-g_settings.screen_StartY) - 50; // 2*25 pixel frei
width = w_max( 500, 0 );
height = h_max( 526, 50 ); // 2*25 pixel frei
listmaxshow = (height-theight-0)/fheight;
height = theight+0+listmaxshow*fheight; // recalc height
x=(((g_settings.screen_EndX- g_settings.screen_StartX)-width) / 2) + g_settings.screen_StartX;
y=(((g_settings.screen_EndY- g_settings.screen_StartY)-height) / 2) + g_settings.screen_StartY;
x=getScreenStartX( width );
y=getScreenStartY( height );
liststart = (selected/listmaxshow)*listmaxshow;

View File

@@ -57,8 +57,8 @@
*/
#ifdef USE_VBI_INTERFACE
#define AVIA_VBI_START_VTXT 1
#define AVIA_VBI_STOP_VTXT 2
#define AVIA_VBI_START_VTXT 1
#define AVIA_VBI_STOP_VTXT 2
#endif
#include <daemonc/remotecontrol.h>
@@ -76,9 +76,9 @@ bool CPlugins::plugin_exists(const std::string & filename)
int CPlugins::find_plugin(const std::string & filename)
{
for(int i = 0; i < (int) plugin_list.size();i++)
for (int i = 0; i < (int) plugin_list.size(); i++)
{
if( (filename.compare(plugin_list[i].filename) == 0) || (filename.compare(plugin_list[i].filename + ".cfg") == 0) )
if ( (filename.compare(plugin_list[i].filename) == 0) || (filename.compare(plugin_list[i].filename + ".cfg") == 0) )
return i;
}
return -1;
@@ -136,7 +136,7 @@ void CPlugins::scanDir(const char *dir)
// This behavior is used to make sure plugins can be disabled
// by creating a .cfg in PLUGINDIR_VAR (PLUGINDIR often is read only).
if(!plugin_exists(new_plugin.filename))
if (!plugin_exists(new_plugin.filename))
{
plugin_list.push_back(new_plugin);
number_of_plugins++;
@@ -175,7 +175,7 @@ bool CPlugins::parseCfg(plugin *plugin_data)
inFile.open(plugin_data->cfgfile.c_str());
while(linecount < 20 && getline(inFile, line[linecount++]));
while (linecount < 20 && getline(inFile, line[linecount++]));
plugin_data->fb = false;
plugin_data->rc = false;
@@ -276,9 +276,9 @@ PluginParam * CPlugins::makeParam(const char * const id, const int value, Plugin
void CPlugins::start_plugin_by_name(const std::string & filename,int param)
{
for(int i = 0; i < (int) plugin_list.size();i++)
for (int i = 0; i < (int) plugin_list.size(); i++)
{
if(filename.compare(g_PluginList->getName(i))==0)
if (filename.compare(g_PluginList->getName(i))==0)
{
startPlugin(i,param);
return;
@@ -332,7 +332,7 @@ void CPlugins::startPlugin(int number,int param)
//bool ispip = strncmp(plugin_list[number].pluginfile.c_str(), "pip", 3) ? false : true;
bool ispip = strstr(plugin_list[number].pluginfile.c_str(), "pip") != 0;
//printf("exec: %s pip: %d\n", plugin_list[number].pluginfile.c_str(), ispip);
if(ispip && !g_RemoteControl->is_video_started)
if (ispip && !g_RemoteControl->is_video_started)
return;
if (plugin_list[number].type == CPlugins::P_TYPE_SCRIPT)
{
@@ -394,7 +394,7 @@ void CPlugins::startPlugin(int number,int param)
close(fd);
}
#endif
if(param>0)
if (param>0)
vtpid=param;
startparam = makeParam(P_ID_VTXTPID, vtpid, startparam);
}
@@ -408,7 +408,7 @@ void CPlugins::startPlugin(int number,int param)
}
PluginParam *par = startparam;
for( ; par; par=par->next )
for ( ; par; par=par->next )
{
printf("[CPlugins] (id,val):(%s,%s)\n", par->id, par->val);
}
@@ -420,7 +420,7 @@ void CPlugins::startPlugin(int number,int param)
if ( depstring[0] )
{
p=depstring;
while( 1 )
while ( 1 )
{
argv[ argc ] = p;
argc++;
@@ -434,7 +434,7 @@ void CPlugins::startPlugin(int number,int param)
break;
}
}
for( i=0; i<argc; i++ )
for ( i=0; i<argc; i++ )
{
std::string libname = argv[i];
printf("[CPlugins] try load shared lib : %s\n",argv[i]);
@@ -462,14 +462,14 @@ void CPlugins::startPlugin(int number,int param)
dlclose(handle);
} else {
printf("[CPlugins] try exec...\n");
if(ispip) {
if (ispip) {
g_Sectionsd->setPauseScanning (true);
g_Zapit->setEventMode(false);
#if 0
//g_Controld->setEventMode(false);
#endif
if(g_Zapit->isPlayBackActive()) {
if(!CNeutrinoApp::getInstance()->recordingstatus)
if (g_Zapit->isPlayBackActive()) {
if (!CNeutrinoApp::getInstance()->recordingstatus)
g_Zapit->setRecordMode(true);
} else {
/* no playback, we playing file ? zap to channel */
@@ -501,7 +501,7 @@ void CPlugins::startPlugin(int number,int param)
if (plugin_list[number].lcd)
{
if(lcd_fd != -1)
if (lcd_fd != -1)
close(lcd_fd);
CLCD::getInstance()->resume();
}
@@ -515,8 +515,8 @@ void CPlugins::startPlugin(int number,int param)
#endif
}
frameBuffer->paintBackgroundBox(0,0,720,576);
if(ispip) {
if(!CNeutrinoApp::getInstance()->recordingstatus) {
if (ispip) {
if (!CNeutrinoApp::getInstance()->recordingstatus) {
g_Zapit->setRecordMode(false);
}
#if 0
@@ -544,7 +544,7 @@ void CPlugins::startPlugin(int number,int param)
}
/* unload shared libs */
for( i=0; i<argc; i++ )
for ( i=0; i<argc; i++ )
{
if ( libhandle[i] )
dlclose(libhandle[i]);
@@ -552,7 +552,7 @@ void CPlugins::startPlugin(int number,int param)
break;
}
for(par = startparam ; par; )
for (par = startparam ; par; )
{
/* we must not free par->id, since it is the original */
free(par->val);
@@ -565,7 +565,7 @@ void CPlugins::startPlugin(int number,int param)
g_RCInput->clearRCMsg();
g_RCInput->stopInput();
//frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t));
printf("Starting %s\n", plugin_list[number].pluginfile.c_str());
printf("Starting %s\n", plugin_list[number].pluginfile.c_str());
mysystem((char *) plugin_list[number].pluginfile.c_str(), NULL, NULL);
//frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t));
frameBuffer->paintBackground();
@@ -577,7 +577,7 @@ printf("Starting %s\n", plugin_list[number].pluginfile.c_str());
bool CPlugins::hasPlugin(CPlugins::p_type_t type)
{
for (std::vector<plugin>::iterator it=plugin_list.begin();
it!=plugin_list.end();it++)
it!=plugin_list.end(); it++)
{
if (it->type == type && !it->hide)
return true;

View File

@@ -106,7 +106,7 @@ public:
bool changeNotify(const neutrino_locale_t OptionName, void *)
{
CTimerd::CTimerEventTypes type = (CTimerd::CTimerEventTypes) *iType;
if(type == CTimerd::TIMER_RECORD)
if (type == CTimerd::TIMER_RECORD)
{
*stopTime=(time(NULL)/60)*60;
struct tm *tmTime2 = localtime(stopTime);
@@ -123,7 +123,7 @@ public:
m1->setActive (false);
m6->setActive(false);
}
if(type == CTimerd::TIMER_RECORD ||
if (type == CTimerd::TIMER_RECORD ||
type == CTimerd::TIMER_ZAPTO ||
type == CTimerd::TIMER_NEXTPROGRAM)
{
@@ -133,15 +133,15 @@ public:
{
m2->setActive(false);
}
if(type == CTimerd::TIMER_STANDBY)
if (type == CTimerd::TIMER_STANDBY)
m3->setActive(true);
else
m3->setActive(false);
if(type == CTimerd::TIMER_REMIND)
if (type == CTimerd::TIMER_REMIND)
m4->setActive(true);
else
m4->setActive(false);
if(type == CTimerd::TIMER_EXEC_PLUGIN)
if (type == CTimerd::TIMER_EXEC_PLUGIN)
m5->setActive(true);
else
m5->setActive(false);
@@ -166,7 +166,7 @@ public:
bool changeNotify(const neutrino_locale_t OptionName, void *)
{
if(*iRepeat >= (int)CTimerd::TIMERREPEAT_WEEKDAYS)
if (*iRepeat >= (int)CTimerd::TIMERREPEAT_WEEKDAYS)
m1->setActive (true);
else
m1->setActive (false);
@@ -208,9 +208,9 @@ public:
bool changeNotify(const neutrino_locale_t OptionName, void *)
{
if(OptionName == LOCALE_TIMERLIST_APIDS_DFLT)
if (OptionName == LOCALE_TIMERLIST_APIDS_DFLT)
{
if(*o_dflt==0)
if (*o_dflt==0)
{
m_std->setActive(true);
m_alt->setActive(true);
@@ -228,7 +228,7 @@ public:
}
else
{
if(*o_std || *o_alt || *o_ac3)
if (*o_std || *o_alt || *o_ac3)
*o_dflt=0;
}
return true;
@@ -260,9 +260,9 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
if (strcmp(key, "modifytimer") == 0)
{
timerlist[selected].announceTime = timerlist[selected].alarmTime -60;
if(timerlist[selected].eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS)
if (timerlist[selected].eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS)
Timer->getWeekdaysFromStr(&timerlist[selected].eventRepeat, m_weekdaysStr);
if(timerlist[selected].eventType == CTimerd::TIMER_RECORD)
if (timerlist[selected].eventType == CTimerd::TIMER_RECORD)
{
timerlist[selected].announceTime -= 120; // 2 more mins for rec timer
if (timer_apids_dflt)
@@ -296,9 +296,9 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
eventinfo.recordingSafety = false;
timerNew.standby_on = (timerNew_standby_on == 1);
void *data=NULL;
if(timerNew.eventType == CTimerd::TIMER_STANDBY)
if (timerNew.eventType == CTimerd::TIMER_STANDBY)
data=&(timerNew.standby_on);
else if(timerNew.eventType==CTimerd::TIMER_NEXTPROGRAM ||
else if (timerNew.eventType==CTimerd::TIMER_NEXTPROGRAM ||
timerNew.eventType==CTimerd::TIMER_ZAPTO ||
timerNew.eventType==CTimerd::TIMER_RECORD)
{
@@ -318,7 +318,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
} else
data= &eventinfo;
}
else if(timerNew.eventType==CTimerd::TIMER_REMIND)
else if (timerNew.eventType==CTimerd::TIMER_REMIND)
data= timerNew.message;
else if (timerNew.eventType==CTimerd::TIMER_EXEC_PLUGIN)
{
@@ -326,7 +326,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
return menu_return::RETURN_REPAINT;
data= timerNew.pluginName;
}
if(timerNew.eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS)
if (timerNew.eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS)
Timer->getWeekdaysFromStr(&timerNew.eventRepeat, m_weekdaysStr);
if (Timer->addTimerEvent(timerNew.eventType,data,timerNew.announceTime,timerNew.alarmTime,
@@ -356,7 +356,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
return menu_return::RETURN_EXIT;
}
if(parent)
if (parent)
{
parent->hide();
}
@@ -364,7 +364,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
int ret = show();
return ret;
/*
/*
if( ret > -1)
{
return menu_return::RETURN_REPAINT;
@@ -387,9 +387,9 @@ void CTimerList::updateEvents(void)
Timer->getTimerList (timerlist);
//Remove last deleted event from List
CTimerd::TimerList::iterator timer = timerlist.begin();
for(; timer != timerlist.end();timer++)
for (; timer != timerlist.end(); timer++)
{
if(timer->eventID==skipEventID)
if (timer->eventID==skipEventID)
{
timerlist.erase(timer);
break;
@@ -405,17 +405,17 @@ void CTimerList::updateEvents(void)
listmaxshow = (height-theight-0)/(fheight*2);
height = theight+0+listmaxshow*fheight*2; // recalc height
if(timerlist.size() < listmaxshow)
if (timerlist.size() < listmaxshow)
{
listmaxshow=timerlist.size();
height = theight+0+listmaxshow*fheight*2; // recalc height
}
if(selected==timerlist.size() && !(timerlist.empty()))
if (selected==timerlist.size() && !(timerlist.empty()))
{
selected=timerlist.size()-1;
liststart = (selected/listmaxshow)*listmaxshow;
}
x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2;
x=getScreenStartX( width );
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2;
}
@@ -428,13 +428,13 @@ int CTimerList::show()
int res = menu_return::RETURN_REPAINT;
unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);
::TIMING_MENU]);
bool loop=true;
bool update=true;
while(loop)
while (loop)
{
if(update)
if (update)
{
hide();
updateEvents();
@@ -443,11 +443,11 @@ int CTimerList::show()
}
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
if( msg <= CRCInput::RC_MaxRC )
if ( msg <= CRCInput::RC_MaxRC )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);
::TIMING_MENU]);
if( ( msg == CRCInput::RC_timeout ) ||
if ( ( msg == CRCInput::RC_timeout ) ||
( msg == CRCInput::RC_home) )
{ //Exit after timeout or cancel key
loop=false;
@@ -455,7 +455,7 @@ int CTimerList::show()
else if ((msg == CRCInput::RC_up) && !(timerlist.empty()))
{
int prevselected=selected;
if(selected==0)
if (selected==0)
{
selected = timerlist.size()-1;
}
@@ -464,7 +464,7 @@ int CTimerList::show()
paintItem(prevselected - liststart);
unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow;
if(oldliststart!=liststart)
if (oldliststart!=liststart)
{
paint();
}
@@ -480,7 +480,7 @@ int CTimerList::show()
paintItem(prevselected - liststart);
unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow;
if(oldliststart!=liststart)
if (oldliststart!=liststart)
{
paint();
}
@@ -499,13 +499,13 @@ int CTimerList::show()
else
update=true;
}
else if((msg == CRCInput::RC_red) && !(timerlist.empty()))
else if ((msg == CRCInput::RC_red) && !(timerlist.empty()))
{
Timer->removeTimerEvent(timerlist[selected].eventID);
skipEventID=timerlist[selected].eventID;
update=true;
}
else if(msg==CRCInput::RC_green)
else if (msg==CRCInput::RC_green)
{
if (newTimer()==menu_return::RETURN_EXIT_ALL)
{
@@ -515,32 +515,32 @@ int CTimerList::show()
else
update=true;
}
else if(msg==CRCInput::RC_yellow)
else if (msg==CRCInput::RC_yellow)
{
update=true;
}
else if((msg==CRCInput::RC_blue)||
else if ((msg==CRCInput::RC_blue)||
(CRCInput::isNumeric(msg)) )
{
//pushback key if...
g_RCInput->postMsg( msg, data );
loop=false;
}
else if(msg==CRCInput::RC_setup)
else if (msg==CRCInput::RC_setup)
{
res=menu_return::RETURN_EXIT_ALL;
loop=false;
}
else if( msg == CRCInput::RC_help || msg == CRCInput::RC_info)
else if ( msg == CRCInput::RC_help || msg == CRCInput::RC_info)
{
CTimerd::responseGetTimer* timer=&timerlist[selected];
if(timer!=NULL)
if (timer!=NULL)
{
if(timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_ZAPTO)
if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_ZAPTO)
{
hide();
res = g_EpgData->show(timer->channel_id, timer->epgID, &timer->epg_starttime);
if(res==menu_return::RETURN_EXIT_ALL)
if (res==menu_return::RETURN_EXIT_ALL)
loop=false;
else
paint();
@@ -555,7 +555,7 @@ int CTimerList::show()
}
else
{
if( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
loop = false;
res = menu_return::RETURN_EXIT_ALL;
@@ -569,7 +569,7 @@ int CTimerList::show()
void CTimerList::hide()
{
if(visible)
if (visible)
{
frameBuffer->paintBackgroundBoxRel(x, y, width, height+ info_height+ 5);
visible = false;
@@ -602,13 +602,13 @@ void CTimerList::paintItem(int pos)
}
int real_width=width;
if(timerlist.size()>listmaxshow)
if (timerlist.size()>listmaxshow)
{
real_width-=15; //scrollbar
}
frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor);
if(liststart+pos<timerlist.size())
if (liststart+pos<timerlist.size())
{
CTimerd::responseGetTimer & timer = timerlist[liststart+pos];
char zAlarmTime[25] = {0};
@@ -618,7 +618,7 @@ void CTimerList::paintItem(int pos)
struct tm *stopTime = localtime(&(timer.stopTime));
strftime(zStopTime,20,"%d.%m. %H:%M",stopTime);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, 150, zAlarmTime, color, fheight, true); // UTF-8
if(timer.stopTime != 0)
if (timer.stopTime != 0)
{
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+2*fheight, 150, zStopTime, color, fheight, true); // UTF-8
}
@@ -637,29 +637,29 @@ void CTimerList::paintItem(int pos)
}
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+160+(real_width-160)/2,ypos+fheight, (real_width-160)/2-5, convertTimerType2String(timer.eventType), color, fheight, true); // UTF-8
std::string zAddData("");
switch(timer.eventType)
switch (timer.eventType)
{
case CTimerd::TIMER_NEXTPROGRAM :
case CTimerd::TIMER_ZAPTO :
case CTimerd::TIMER_RECORD :
{
zAddData = convertChannelId2String(timer.channel_id); // UTF-8
if(timer.apids != TIMERD_APIDS_CONF)
if (timer.apids != TIMERD_APIDS_CONF)
{
std::string sep = "";
zAddData += " (";
if(timer.apids & TIMERD_APIDS_STD)
if (timer.apids & TIMERD_APIDS_STD)
{
zAddData += "STD";
sep = "/";
}
if(timer.apids & TIMERD_APIDS_ALT)
if (timer.apids & TIMERD_APIDS_ALT)
{
zAddData += sep;
zAddData += "ALT";
sep = "/";
}
if(timer.apids & TIMERD_APIDS_AC3)
if (timer.apids & TIMERD_APIDS_AC3)
{
zAddData += sep;
zAddData += "AC3";
@@ -667,7 +667,7 @@ void CTimerList::paintItem(int pos)
}
zAddData += ')';
}
if(timer.epgID!=0)
if (timer.epgID!=0)
{
CEPGData epgdata;
//if (g_Sectionsd->getEPGid(timer.epgID, timer.epg_starttime, &epgdata))
@@ -676,13 +676,13 @@ void CTimerList::paintItem(int pos)
zAddData += " : ";
zAddData += epgdata.title;
}
else if(strlen(timer.epgTitle)!=0)
else if (strlen(timer.epgTitle)!=0)
{
zAddData += " : ";
zAddData += timer.epgTitle;
}
}
else if(strlen(timer.epgTitle)!=0)
else if (strlen(timer.epgTitle)!=0)
{
zAddData += " : ";
zAddData += timer.epgTitle;
@@ -704,15 +704,15 @@ void CTimerList::paintItem(int pos)
zAddData = timer.pluginName;
}
break;
default:{}
default: {}
}
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+160,ypos+2*fheight, real_width-165, zAddData, color, fheight, true); // UTF-8
// LCD Display
if(liststart+pos==selected)
if (liststart+pos==selected)
{
std::string line1 = convertTimerType2String(timer.eventType); // UTF-8
std::string line2 = zAlarmTime;
switch(timer.eventType)
switch (timer.eventType)
{
case CTimerd::TIMER_RECORD :
line2+= " -";
@@ -726,13 +726,14 @@ void CTimerList::paintItem(int pos)
break;
case CTimerd::TIMER_STANDBY :
{
if(timer.standby_on)
if (timer.standby_on)
line1+=" ON";
else
line1+=" OFF";
}
break;
default:;
default:
;
}
CVFD::getInstance()->showMenuText(0, line1.c_str(), -1, true); // UTF-8
//CVFD::getInstance()->showMenuText(1, line2.c_str(), -1, true); // UTF-8
@@ -747,7 +748,7 @@ void CTimerList::paintHead()
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+35,y+theight+0, width- 45, g_Locale->getText(LOCALE_TIMERLIST_NAME), COL_MENUHEAD, 0, true); // UTF-8
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, x+ width- 30, y+ 5 );
/* if (bouquetList!=NULL)
/* if (bouquetList!=NULL)
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, x+ width- 60, y+ 5 );*/
}
@@ -783,12 +784,12 @@ void CTimerList::paint()
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, g_Locale->getText(LOCALE_TIMERLIST_NAME));
paintHead();
for(unsigned int count=0;count<listmaxshow;count++)
for (unsigned int count=0; count<listmaxshow; count++)
{
paintItem(count);
}
if(timerlist.size()>listmaxshow)
if (timerlist.size()>listmaxshow)
{
int ypos = y+ theight;
int sb = 2*fheight* listmaxshow;
@@ -806,55 +807,71 @@ void CTimerList::paint()
const char * CTimerList::convertTimerType2String(const CTimerd::CTimerEventTypes type) // UTF-8
{
switch(type)
switch (type)
{
case CTimerd::TIMER_SHUTDOWN : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SHUTDOWN );
case CTimerd::TIMER_NEXTPROGRAM : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_NEXTPROGRAM);
case CTimerd::TIMER_ZAPTO : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_ZAPTO );
case CTimerd::TIMER_STANDBY : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_STANDBY );
case CTimerd::TIMER_RECORD : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_RECORD );
case CTimerd::TIMER_REMIND : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_REMIND );
case CTimerd::TIMER_SLEEPTIMER : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SLEEPTIMER );
case CTimerd::TIMER_EXEC_PLUGIN : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_EXECPLUGIN );
default : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_UNKNOWN );
case CTimerd::TIMER_SHUTDOWN :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SHUTDOWN );
case CTimerd::TIMER_NEXTPROGRAM :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_NEXTPROGRAM);
case CTimerd::TIMER_ZAPTO :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_ZAPTO );
case CTimerd::TIMER_STANDBY :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_STANDBY );
case CTimerd::TIMER_RECORD :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_RECORD );
case CTimerd::TIMER_REMIND :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_REMIND );
case CTimerd::TIMER_SLEEPTIMER :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SLEEPTIMER );
case CTimerd::TIMER_EXEC_PLUGIN :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_EXECPLUGIN );
default :
return g_Locale->getText(LOCALE_TIMERLIST_TYPE_UNKNOWN );
}
}
std::string CTimerList::convertTimerRepeat2String(const CTimerd::CTimerEventRepeat rep) // UTF-8
{
switch(rep)
switch (rep)
{
case CTimerd::TIMERREPEAT_ONCE : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_ONCE );
case CTimerd::TIMERREPEAT_DAILY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_DAILY );
case CTimerd::TIMERREPEAT_WEEKLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEEKLY );
case CTimerd::TIMERREPEAT_BIWEEKLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BIWEEKLY );
case CTimerd::TIMERREPEAT_FOURWEEKLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FOURWEEKLY );
case CTimerd::TIMERREPEAT_MONTHLY : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONTHLY );
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION : return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BYEVENTDESCRIPTION);
case CTimerd::TIMERREPEAT_ONCE :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_ONCE );
case CTimerd::TIMERREPEAT_DAILY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_DAILY );
case CTimerd::TIMERREPEAT_WEEKLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEEKLY );
case CTimerd::TIMERREPEAT_BIWEEKLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BIWEEKLY );
case CTimerd::TIMERREPEAT_FOURWEEKLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FOURWEEKLY );
case CTimerd::TIMERREPEAT_MONTHLY :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONTHLY );
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION :
return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_BYEVENTDESCRIPTION);
default:
if(rep >=CTimerd::TIMERREPEAT_WEEKDAYS)
if (rep >=CTimerd::TIMERREPEAT_WEEKDAYS)
{
int weekdays = (((int)rep) >> 9);
std::string weekdayStr="";
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONDAY);
weekdays >>= 1;
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_TUESDAY);
weekdays >>= 1;
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEDNESDAY);
weekdays >>= 1;
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_THURSDAY);
weekdays >>= 1;
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FRIDAY);
weekdays >>= 1;
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_SATURDAY);
weekdays >>= 1;
if(weekdays & 1)
if (weekdays & 1)
weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_SUNDAY);
return weekdayStr;
}
@@ -938,7 +955,7 @@ int CTimerList::modifyTimer()
timerSettings.addItem( m1);
CDateInput timerSettings_stopTime(LOCALE_TIMERLIST_STOPTIME, &timer->stopTime , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2);
if(timer->stopTime != 0)
if (timer->stopTime != 0)
{
CMenuForwarder *m2 = new CMenuForwarder(LOCALE_TIMERLIST_STOPTIME, true, timerSettings_stopTime.getValue (), &timerSettings_stopTime );
timerSettings.addItem( m2);
@@ -957,7 +974,7 @@ int CTimerList::modifyTimer()
//printf("TIMER: rec dir %s len %s\n", timer->recordingDir, strlen(timer->recordingDir));
if(!strlen(timer->recordingDir))
if (!strlen(timer->recordingDir))
strncpy(timer->recordingDir,g_settings.network_nfs_recordingdir,sizeof(timer->recordingDir));
CMountChooser recDirs(LOCALE_TIMERLIST_RECORDING_DIR,NEUTRINO_ICON_SETTINGS,NULL,
@@ -994,7 +1011,7 @@ int CTimerList::modifyTimer()
CMenuOptionChooser* ma4 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_APIDS_AC3, &timer_apids_ac3, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true, &apid_notifier);
timerSettings_apids.addItem(ma4);
apid_notifier.setItems(ma1,ma2,ma3,ma4);
if(timer->eventType == CTimerd::TIMER_RECORD)
if (timer->eventType == CTimerd::TIMER_RECORD)
{
timerSettings.addItem( new CMenuForwarder(LOCALE_TIMERLIST_APIDS, true, NULL, &timerSettings_apids ));
}
@@ -1052,7 +1069,7 @@ int CTimerList::newTimer()
toDelete.push_back(mwradio);
ZapitChannelList* channels = &(g_bouquetManager->Bouquets[i]->tvChannels);
for(int j = 0; j < (int) channels->size(); j++) {
for (int j = 0; j < (int) channels->size(); j++) {
char cChannelId[3+16+1+1];
sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", (*channels)[j]->channel_id);
mwtv->addItem(new CMenuForwarderNonLocalized((*channels)[j]->getName().c_str(), true, NULL, this, (std::string(cChannelId) + (*channels)[j]->getName()).c_str()));
@@ -1062,7 +1079,7 @@ int CTimerList::newTimer()
channels = &(g_bouquetManager->Bouquets[i]->radioChannels);
for(int j = 0; j < (int) channels->size(); j++) {
for (int j = 0; j < (int) channels->size(); j++) {
char cChannelId[3+16+1+1];
sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", (*channels)[j]->channel_id);
mwradio->addItem(new CMenuForwarderNonLocalized((*channels)[j]->getName().c_str(), true, NULL, this, (std::string(cChannelId) + (*channels)[j]->getName()).c_str()));
@@ -1117,7 +1134,7 @@ int CTimerList::newTimer()
int ret=timerSettings.exec(this,"");
// delete dynamic created objects
for(unsigned int count=0;count<toDelete.size();count++)
for (unsigned int count=0; count<toDelete.size(); count++)
{
delete toDelete[count];
}
@@ -1135,12 +1152,12 @@ bool askUserOnTimerConflict(time_t announceTime, time_t stopTime)
std::string timerbuf = g_Locale->getText(LOCALE_TIMERLIST_OVERLAPPING_TIMER);
timerbuf += "\n";
for (CTimerd::TimerList::iterator it = overlappingTimers.begin();
it != overlappingTimers.end();it++)
it != overlappingTimers.end(); it++)
{
timerbuf += CTimerList::convertTimerType2String(it->eventType);
timerbuf += " (";
timerbuf += CTimerList::convertChannelId2String(it->channel_id); // UTF-8
if(it->epgID != 0)
if (it->epgID != 0)
{
CEPGData epgdata;
//if (g_Sectionsd->getEPGid(it->epgID, it->epg_starttime, &epgdata))
@@ -1149,7 +1166,7 @@ bool askUserOnTimerConflict(time_t announceTime, time_t stopTime)
timerbuf += ":";
timerbuf += epgdata.title;
}
else if(strlen(it->epgTitle)!=0)
else if (strlen(it->epgTitle)!=0)
{
timerbuf += ":";
timerbuf += it->epgTitle;