From 49e009134b7fe16eb83d2609412c1dec5552a911 Mon Sep 17 00:00:00 2001 From: satbaby Date: Thu, 17 Dec 2009 09:58:55 +0000 Subject: [PATCH] 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 --- src/driver/screen_max.cpp | 31 +- src/driver/screen_max.h | 5 +- src/gui/audioplayer.cpp | 700 ++++++++++++++++++------------------ src/gui/bookmarkmanager.cpp | 111 +++--- src/gui/dboxinfo.cpp | 73 ++-- src/gui/epgview.cpp | 508 +++++++++++++------------- src/gui/imageinfo.cpp | 16 +- src/gui/pictureviewer.cpp | 150 ++++---- src/gui/pluginlist.cpp | 25 +- src/gui/plugins.cpp | 110 +++--- src/gui/timerlist.cpp | 457 +++++++++++------------ 11 files changed, 1109 insertions(+), 1077 deletions(-) diff --git a/src/driver/screen_max.cpp b/src/driver/screen_max.cpp index 80dbb0060..404fbb50a 100644 --- a/src/driver/screen_max.cpp +++ b/src/driver/screen_max.cpp @@ -1,21 +1,26 @@ /* - * $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 + + + #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. // -- so using this function will make menues to obey max. screen settings. -// +// // usage: e.g. try to paint menue h: 500 w, 400 (but screen is limited // to (450 x 420)), functions will return 450 and 400 // the _add factor is for boundary... @@ -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; + +} + + + diff --git a/src/driver/screen_max.h b/src/driver/screen_max.h index 8b60d0570..50c9e7944 100644 --- a/src/driver/screen_max.h +++ b/src/driver/screen_max.h @@ -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 diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 1121719ab..537168231 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -68,6 +68,7 @@ #include #include +#include #include #include @@ -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 = "/"; @@ -264,10 +265,10 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) m_selected = 0; //m_width = 710; //if((g_settings.screen_EndX - g_settings.screen_StartX) < m_width+ConnectLineBox_Width) - m_width=(g_settings.screen_EndX - g_settings.screen_StartX) - ConnectLineBox_Width - 5; + m_width=(g_settings.screen_EndX - g_settings.screen_StartX) - ConnectLineBox_Width - 5; //m_height = 570; //if((g_settings.screen_EndY - g_settings.screen_StartY) < m_height) - m_height = (g_settings.screen_EndY - g_settings.screen_StartY - 5); + m_height = (g_settings.screen_EndY - g_settings.screen_StartY - 5); m_sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); m_buttonHeight = std::min(25, m_sheight); m_theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -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(); @@ -308,8 +309,8 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) CZapitClient::responseGetLastChannel firstchannel; g_Zapit->getLastChannel(firstchannel.channelNumber, firstchannel.mode); if ((firstchannel.mode == 'r') ? - (CNeutrinoApp::getInstance()->zapto_radio_on_init_done) : - (CNeutrinoApp::getInstance()->zapto_tv_on_init_done)) + (CNeutrinoApp::getInstance()->zapto_radio_on_init_done) : + (CNeutrinoApp::getInstance()->zapto_tv_on_init_done)) m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); else m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); @@ -318,8 +319,8 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) // Stop sectionsd g_Sectionsd->setPauseScanning(true); - puts("[audioplayer.cpp] executing " AUDIOPLAYER_START_SCRIPT "."); - if (system(AUDIOPLAYER_START_SCRIPT) != 0) + puts("[audioplayer.cpp] executing " AUDIOPLAYER_START_SCRIPT "."); + if (system(AUDIOPLAYER_START_SCRIPT) != 0) perror("Datei " AUDIOPLAYER_START_SCRIPT " fehlt.Bitte erstellen, wenn gebraucht.\nFile " AUDIOPLAYER_START_SCRIPT " not found. Please create if needed.\n"); show(); @@ -335,8 +336,8 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) //g_Zapit->zapTo_serviceID(channel_id); //g_Zapit->setStandby(false); - puts("[audioplayer.cpp] executing " AUDIOPLAYER_END_SCRIPT "."); - if (system(AUDIOPLAYER_END_SCRIPT) != 0) + puts("[audioplayer.cpp] executing " AUDIOPLAYER_END_SCRIPT "."); + if (system(AUDIOPLAYER_END_SCRIPT) != 0) perror("Datei " AUDIOPLAYER_END_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " AUDIOPLAYER_END_SCRIPT " not found. Please create if needed.\n"); // Start Sectionsd @@ -346,7 +347,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode ); g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 ); - // always exit all + // always exit all return menu_return::RETURN_EXIT_ALL; } @@ -369,30 +370,30 @@ 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; } - if ((m_state != CAudioPlayerGui::STOP) && - (CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && + if ((m_state != CAudioPlayerGui::STOP) && + (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; @@ -456,7 +457,7 @@ int CAudioPlayerGui::show() update = true; } else if (msg == CRCInput::RC_home) - { + { if (m_state != CAudioPlayerGui::STOP) stop(); else @@ -482,7 +483,7 @@ int CAudioPlayerGui::show() if (m_selected < m_listmaxshow) { m_selected = m_playlist.size()-1; - } + } else m_selected -= m_listmaxshow; m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow; @@ -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,26 +595,26 @@ 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; + update = true; } } - else if(m_key_level == 1) + else if (m_key_level == 1) { stop(); - } + } else { // key_level==2 @@ -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,32 +635,32 @@ 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 + } + else { // key_level == 2 - if(m_state == CAudioPlayerGui::STOP) + if (m_state == CAudioPlayerGui::STOP) { - if (!m_playlist.empty()) + if (!m_playlist.empty()) { savePlaylist(); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); update = true; } - } + } else { // keylevel 2 can only be reached if the currently played file // is no stream, so we do not have to test for this case int seconds=0; CIntInput secondsInput(LOCALE_AUDIOPLAYER_JUMP_DIALOG_TITLE, - seconds, - 5, - LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT1, - LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT2); + seconds, + 5, + LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT1, + LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT2); int res = secondsInput.exec(NULL,""); if (seconds != 0 && res!= menu_return::RETURN_EXIT_ALL) rev(seconds); @@ -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,11 +680,11 @@ int CAudioPlayerGui::show() update = true; } } - else if(m_key_level == 1) + else if (m_key_level == 1) { pause(); - } - else + } + else { // key_level==2 m_select_title_by_name =! m_select_title_by_name; if (m_select_title_by_name && m_playlistHasChanged) @@ -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) { @@ -705,36 +706,40 @@ int CAudioPlayerGui::show() // -- setup menue for inetradio input sprintf(cnt, "%d", count); InputSelector.addItem(new CMenuForwarder( - LOCALE_AUDIOPLAYER_ADD_LOC, true, NULL, InetRadioInputChanger, - cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); - - sprintf(cnt, "%d", ++count); - InputSelector.addItem(new CMenuForwarder( - LOCALE_AUDIOPLAYER_ADD_SC, true, NULL, InetRadioInputChanger, - cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); + LOCALE_AUDIOPLAYER_ADD_LOC, true, NULL, InetRadioInputChanger, + cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); sprintf(cnt, "%d", ++count); InputSelector.addItem(new CMenuForwarder( - LOCALE_AUDIOPLAYER_ADD_IC, true, NULL, InetRadioInputChanger, - cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); + LOCALE_AUDIOPLAYER_ADD_SC, true, NULL, InetRadioInputChanger, + cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); + + sprintf(cnt, "%d", ++count); + InputSelector.addItem(new CMenuForwarder( + LOCALE_AUDIOPLAYER_ADD_IC, true, NULL, InetRadioInputChanger, + cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); //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); - CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); - paintLCD(); - break; - case 1: openSCbrowser(); - break; - case 2: readDir_ic(); - CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); - paintLCD(); - break; - default: break; + case 0: + scanXmlFile(RADIO_STATION_XML_FILE); + CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); + paintLCD(); + break; + case 1: + openSCbrowser(); + break; + case 2: + readDir_ic(); + CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); + paintLCD(); + break; + default: + break; } update=true; } @@ -745,9 +750,9 @@ 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 { if (m_state != CAudioPlayerGui::STOP) @@ -756,10 +761,10 @@ int CAudioPlayerGui::show() // is no stream, so we do not have to test for this case int seconds=0; CIntInput secondsInput(LOCALE_AUDIOPLAYER_JUMP_DIALOG_TITLE, - seconds, - 5, - LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT1, - LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT2); + seconds, + 5, + LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT1, + LOCALE_AUDIOPLAYER_JUMP_DIALOG_HINT2); int res = secondsInput.exec(NULL,""); if (seconds != 0 && res!= menu_return::RETURN_EXIT_ALL) ff(seconds); @@ -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; @@ -803,26 +808,26 @@ int CAudioPlayerGui::show() if (m_select_title_by_name) { //printf("select by name\n"); - unsigned char smsKey = 0; - do + unsigned char smsKey = 0; + do { smsKey = m_SMSKeyInput.handleMsg(msg); //printf(" new key: %c", smsKey); 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); - int x1=(g_settings.screen_EndX- g_settings.screen_StartX)/2 + g_settings.screen_StartX-50; - int y1=(g_settings.screen_EndY- g_settings.screen_StartY)/2 + g_settings.screen_StartY; - int h = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight(); - int w = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(selectedKey); - m_frameBuffer->paintBoxRel(x1 - 7, y1 - h - 5, w + 14, h + 10, COL_MENUCONTENT_PLUS_6); - m_frameBuffer->paintBoxRel(x1 - 4, y1 - h - 3, w + 8, h + 6, COL_MENUCONTENTSELECTED_PLUS_0); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP] - ->RenderString(x1,y1,w+1,selectedKey,COL_MENUCONTENTSELECTED,0); + char selectedKey[1]; + sprintf(selectedKey,"%c",smsKey); + int x1=(g_settings.screen_EndX- g_settings.screen_StartX)/2 + g_settings.screen_StartX-50; + int y1=(g_settings.screen_EndY- g_settings.screen_StartY)/2 + g_settings.screen_StartY; + int h = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight(); + int w = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(selectedKey); + m_frameBuffer->paintBoxRel(x1 - 7, y1 - h - 5, w + 14, h + 10, COL_MENUCONTENT_PLUS_6); + m_frameBuffer->paintBoxRel(x1 - 4, y1 - h - 3, w + 8, h + 6, COL_MENUCONTENTSELECTED_PLUS_0); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP] + ->RenderString(x1,y1,w+1,selectedKey,COL_MENUCONTENTSELECTED,0); #endif } while (CRCInput::isNumeric(msg) && !(m_playlist.empty())); @@ -835,12 +840,12 @@ int CAudioPlayerGui::show() update = true; } m_SMSKeyInput.resetOldKey(); - } - else + } + else { //printf("numeric zap\n"); int val = 0; - if (getNumericInput(msg,val)) + if (getNumericInput(msg,val)) m_selected = std::min((int)m_playlist.size(), val) - 1; update = true; } @@ -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); @@ -956,7 +961,7 @@ bool CAudioPlayerGui::clearPlaylist(void) } bool CAudioPlayerGui::shufflePlaylist(void) -{ +{ RandomNumber rnd; bool result = false; if (!(m_playlist.empty())) @@ -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,9 +1083,9 @@ 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 */ curl_global_cleanup(); } @@ -1125,7 +1130,7 @@ void CAudioPlayerGui::readDir_ic(void) scanBox->hide(); scanXmlData(answer_parser, "server_name", "listen_url", "bitrate", true); } - else + else scanBox->hide(); delete scanBox; @@ -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; @@ -1190,7 +1195,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, type = xmlGetData(child); else if (bitratetag && strcmp(xmlGetName(child), bitratetag) == 0) { ptr = xmlGetData(child); - if (ptr) + if (ptr) bitrate = atoi(ptr); } child = child->xmlNextNode; @@ -1215,7 +1220,7 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, //printf("Processing %s, %s\n", url, name); if (strstr(url, ".m3u") || strstr(url, ".pls")) processPlaylistUrl(url, name); - else + else addUrl2Playlist(url, name, bitrate); } element = element->xmlNextNode; @@ -1233,8 +1238,8 @@ void CAudioPlayerGui::scanXmlData(xmlDocPtr answer_parser, const char *nametag, bool CAudioPlayerGui::openFilebrowser(void) { bool result = false; - CFileBrowser filebrowser((g_settings.filebrowser_denydirectoryleave) - ? g_settings.network_nfs_audioplayerdir : ""); + CFileBrowser filebrowser((g_settings.filebrowser_denydirectoryleave) + ? g_settings.network_nfs_audioplayerdir : ""); filebrowser.Multi_Select = true; filebrowser.Dirs_Selectable = true; @@ -1254,12 +1259,12 @@ bool CAudioPlayerGui::openFilebrowser(void) if (maxProgress > SHOW_FILE_LOAD_LIMIT) { progress.setTitle(LOCALE_AUDIOPLAYER_READING_FILES); - progress.exec(this,""); + progress.exec(this,""); } 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) @@ -1280,17 +1285,17 @@ bool CAudioPlayerGui::openFilebrowser(void) #ifdef ENABLE_FLAC || (files->getType() == CFile::FILE_FLAC) #endif - ) + ) { CAudiofileExt audiofile(files->Name, - files->getType()); + 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;igetType() == 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) { @@ -1456,11 +1461,11 @@ bool CAudioPlayerGui::openSCbrowser(void) // show progress int global = 100*currentProgress/maxProgress; progress.showGlobalStatus(global); - progress.showStatusMessageUTF(files->Name); - #ifdef LCD_UPDATE + progress.showStatusMessageUTF(files->Name); +#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,10 +1498,10 @@ 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); + m_width + ConnectLineBox_Width+2, m_height + 2 - m_title_height); clearItemID3DetailsLine(); m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width, m_title_height); m_visible = false; @@ -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]; @@ -1583,7 +1588,7 @@ void CAudioPlayerGui::paintItem(int pos) snprintf(dura, 8, "%ldk", m_playlist[pos + m_liststart].MetaData.total_time); else snprintf(dura, 8, "%ld:%02ld", m_playlist[pos + m_liststart].MetaData.total_time / 60, - m_playlist[pos + m_liststart].MetaData.total_time % 60); + m_playlist[pos + m_liststart].MetaData.total_time % 60); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(dura) + 5; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos + m_fheight, m_width - 30 - w, tmp, color, m_fheight, true); // UTF-8 @@ -1593,9 +1598,9 @@ void CAudioPlayerGui::paintItem(int pos) { if (m_state == CAudioPlayerGui::STOP) { - CVFD::getInstance()->showAudioTrack(m_playlist[pos + m_liststart].MetaData.artist, - m_playlist[pos + m_liststart].MetaData.title, - m_playlist[pos + m_liststart].MetaData.album); + CVFD::getInstance()->showAudioTrack(m_playlist[pos + m_liststart].MetaData.artist, + m_playlist[pos + m_liststart].MetaData.title, + m_playlist[pos + m_liststart].MetaData.album); } } } @@ -1612,25 +1617,25 @@ void CAudioPlayerGui::paintHead() std::string strCaption; if (m_inetmode) strCaption = g_Locale->getText(LOCALE_INETRADIO_NAME); - else + else strCaption = g_Locale->getText(LOCALE_AUDIOPLAYER_HEAD); m_frameBuffer->paintBoxRel(m_x, m_y + m_title_height, m_width, m_theight, COL_MENUHEAD_PLUS_0, c_rad_mid, CORNER_TOP); m_frameBuffer->paintIcon("mp3.raw",m_x + 7, m_y + m_title_height + 10); 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 + 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); } @@ -1705,31 +1710,30 @@ void CAudioPlayerGui::paintFoot() // play m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, m_x + 1 * ButtonWidth2 + 25, top + m_buttonHeight - 3); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL] - ->RenderString(m_x + 1 * ButtonWidth2 + 53, top + m_buttonHeight + 24 - 4, ButtonWidth2 - 28, - g_Locale->getText(LOCALE_AUDIOPLAYER_PLAY), COL_INFOBAR /*_SHADOW_PLUS_1*/, 0, true); // UTF-8 + ->RenderString(m_x + 1 * ButtonWidth2 + 53, top + m_buttonHeight + 24 - 4, ButtonWidth2 - 28, + g_Locale->getText(LOCALE_AUDIOPLAYER_PLAY), COL_INFOBAR /*_SHADOW_PLUS_1*/, 0, true); // UTF-8 // keylevel switch m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, m_x + 0 * ButtonWidth + 25, top + m_buttonHeight - 3); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL] - ->RenderString(m_x + 0 * ButtonWidth + 53 , top + m_buttonHeight + 24 - 4, ButtonWidth2 - 28, - g_Locale->getText(LOCALE_AUDIOPLAYER_KEYLEVEL), COL_INFOBAR /*_SHADOW_PLUS_1*/, 0, true); // UTF-8 + ->RenderString(m_x + 0 * ButtonWidth + 53 , top + m_buttonHeight + 24 - 4, ButtonWidth2 - 28, + g_Locale->getText(LOCALE_AUDIOPLAYER_KEYLEVEL), COL_INFOBAR /*_SHADOW_PLUS_1*/, 0, true); // UTF-8 } if (m_key_level == 0) { if (m_playlist.empty()) { - if (m_inetmode) - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[7]); - 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) ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[8]); + m_x + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[7]); else ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[1]); + m_x + 10, top + 4, ButtonWidth, 1, &(AudioPlayerButtons[7][0])); + } 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 + ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, + m_x + 10, top + 4, ButtonWidth, 4, AudioPlayerButtons[1]); } else if (m_key_level == 1) { @@ -1741,33 +1745,33 @@ void CAudioPlayerGui::paintFoot() { ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, m_x + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[6]); } - } - else + } + else { // key_level == 2 if (m_state == CAudioPlayerGui::STOP) { if (m_select_title_by_name) { - ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[5]); - } - else + ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, + m_x + ButtonWidth + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[5]); + } + else { ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[4]); + m_x + ButtonWidth + 10, top + 4, ButtonWidth, 2, AudioPlayerButtons[4]); } - } - else + } + else { if (m_select_title_by_name) { ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[3]); - } - else + m_x + ButtonWidth + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[3]); + } + else { ::paintButtons(m_frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, - m_x + ButtonWidth + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[2]); + m_x + ButtonWidth + 10, top + 4, ButtonWidth*2, 2, AudioPlayerButtons[2]); } } } @@ -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 @@ -1852,11 +1856,11 @@ void CAudioPlayerGui::paintInfo() void CAudioPlayerGui::paint() { - if (m_show_playlist) + if (m_show_playlist) { m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow; paintHead(); - for (unsigned int count=0;countpaintBackgroundBoxRel(xpos - 1, m_y + m_title_height, ConnectLineBox_Width + 1, - m_height - m_title_height); + m_frameBuffer->paintBackgroundBoxRel(xpos - 1, m_y + m_title_height, ConnectLineBox_Width + 1, + m_height - m_title_height); // paint Line if detail info (and not valid list pos) if (!m_playlist.empty() && (pos >= 0)) @@ -1930,7 +1934,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) m_frameBuffer->paintBoxRel(m_x, ypos2 + m_info_height -2, m_width -2 , 2 , col1); // m_frameBuffer->paintBoxRel(m_x, ypos2, m_width, m_info_height, col1); - // paint id3 infobox + // paint id3 infobox m_frameBuffer->paintBoxRel(m_x + 2, ypos2 + 2 , m_width - 4, m_info_height - 4, COL_MENUCONTENTDARK_PLUS_0); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos2 + 2 + 1*m_fheight, m_width- 80, m_playlist[m_selected].MetaData.title, COL_MENUCONTENTDARK, 0, true); // UTF-8 @@ -1947,7 +1951,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) } int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true) + 10; // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + m_width - w - 5, ypos2 + 2 + 1*m_fheight, - w, tmp, COL_MENUCONTENTDARK, 0, true); // UTF-8 + w, tmp, COL_MENUCONTENTDARK, 0, true); // UTF-8 tmp = m_playlist[m_selected].MetaData.artist; if (!(m_playlist[m_selected].MetaData.album.empty())) { @@ -1956,7 +1960,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) tmp += ')'; } g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos2 + 2*m_fheight - 2, m_width - 20, - tmp, COL_MENUCONTENTDARK, 0, true); // UTF-8 + tmp, COL_MENUCONTENTDARK, 0, true); // UTF-8 } else { @@ -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 - || m_state == CAudioPlayerGui::FF - || m_state == CAudioPlayerGui::REV) + 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,14 +2005,14 @@ 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 - || m_state == CAudioPlayerGui::PAUSE - || m_state == CAudioPlayerGui::REV) + else if (m_state == CAudioPlayerGui::PLAY + || m_state == CAudioPlayerGui::PAUSE + || m_state == CAudioPlayerGui::REV) { m_state = CAudioPlayerGui::FF; CAudioPlayer::getInstance()->ff(seconds); @@ -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); } } @@ -2090,14 +2094,14 @@ void CAudioPlayerGui::play(unsigned int pos) m_state = CAudioPlayerGui::PLAY; m_curr_audiofile = m_playlist[m_current]; // Play - CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1); + CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1); //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,18 +2185,18 @@ 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); + m_sheight, COL_MENUCONTENTSELECTED_PLUS_0); int xstart = ((m_width - 20 - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo))/2)+10; g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL] - ->RenderString(m_x + xstart, m_y + 4 + 2*m_fheight + m_sheight, - m_width- 2*xstart, m_metainfo, COL_MENUCONTENTSELECTED); + ->RenderString(m_x + xstart, m_y + 4 + 2*m_fheight + m_sheight, + m_width- 2*xstart, m_metainfo, COL_MENUCONTENTSELECTED); } } //------------------------------------------------------------------------ @@ -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); @@ -2234,9 +2238,9 @@ void CAudioPlayerGui::updateTimes(const bool force) if (updateTotal) { - 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) + 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) g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + m_width - w1 - 10, m_y + 4 + m_fheight, w1, tot_time, COL_MENUCONTENTSELECTED); } @@ -2244,7 +2248,7 @@ void CAudioPlayerGui::updateTimes(const bool force) { //m_frameBuffer->paintBoxRel(m_x + m_width - w1 - w2 - 15, m_y + 4, w2 + 4, m_fheight, m_frameBuffer->paintBoxRel(m_x + m_width - w1 - w2 - 16, m_y + 4, w2 + 5, m_fheight, - COL_MENUCONTENTSELECTED_PLUS_0); + COL_MENUCONTENTSELECTED_PLUS_0); struct timeval tv; gettimeofday(&tv, NULL); if ((m_state != CAudioPlayerGui::PAUSE) || (tv.tv_sec & 1)) @@ -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,47 +2269,47 @@ 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); - CVFD::getInstance()->showAudioProgress(0, CNeutrinoApp::getInstance()->isMuted()); - break; - case CAudioPlayerGui::PLAY: - CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PLAY); + case CAudioPlayerGui::STOP: + CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_STOP); + CVFD::getInstance()->showAudioProgress(0, CNeutrinoApp::getInstance()->isMuted()); + break; + case CAudioPlayerGui::PLAY: + CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PLAY); - 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) - CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total, CNeutrinoApp::getInstance()->isMuted()); + 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) + CVFD::getInstance()->showAudioProgress(100 * m_time_played / m_time_total, CNeutrinoApp::getInstance()->isMuted()); #ifdef INCLUDE_UNUSED_STUFF - else - CVFD::getInstance()->showAudioProgress(100 * CAudioPlayer::getInstance()->getScBuffered() / 65536, CNeutrinoApp::getInstance()->isMuted()); + else + CVFD::getInstance()->showAudioProgress(100 * CAudioPlayer::getInstance()->getScBuffered() / 65536, CNeutrinoApp::getInstance()->isMuted()); #endif /* INCLUDE_UNUSED_STUFF */ - break; - case CAudioPlayerGui::PAUSE: - CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PAUSE); - CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, - m_curr_audiofile.MetaData.album); - break; - case CAudioPlayerGui::FF: - CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_FF); - CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, - m_curr_audiofile.MetaData.album); - break; - case CAudioPlayerGui::REV: - CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_REV); - CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, - m_curr_audiofile.MetaData.album); - break; + break; + case CAudioPlayerGui::PAUSE: + CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PAUSE); + CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, + m_curr_audiofile.MetaData.album); + break; + case CAudioPlayerGui::FF: + CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_FF); + CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, + m_curr_audiofile.MetaData.album); + break; + case CAudioPlayerGui::REV: + CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_REV); + CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, + m_curr_audiofile.MetaData.album); + break; } } //------------------------------------------------------------------------ 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; @@ -2335,8 +2339,8 @@ void CAudioPlayerGui::GetMetaData(CAudiofileExt &File) if (CFile::STREAM_AUDIO != File.FileType) ret = CAudioPlayer::getInstance()->readMetaData( &File, - m_state != CAudioPlayerGui::STOP && - !g_settings.audioplayer_highprio); + m_state != CAudioPlayerGui::STOP && + !g_settings.audioplayer_highprio); if (!ret || (File.MetaData.artist.empty() && File.MetaData.title.empty() )) { @@ -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); @@ -2383,7 +2387,7 @@ bool CAudioPlayerGui::getNumericInput(neutrino_msg_t& msg, int& val) { g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->RenderString(x1, y1, w + 1, str, COL_MENUCONTENTSELECTED, 0); while (true) { - g_RCInput->getMsg(&msg, &data, 100); + g_RCInput->getMsg(&msg, &data, 100); if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) { // not a key event CNeutrinoApp::getInstance()->handleMsg(msg, data); @@ -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 += ", "; @@ -2440,7 +2444,7 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &info, CAudiofileExt &fil fileInfo += " ("; fileInfo += file.MetaData.album; fileInfo += ')'; - } + } if (fileInfo.empty()) { fileInfo += "Unknown"; @@ -2451,10 +2455,10 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &info, CAudiofileExt &fil //------------------------------------------------------------------------ void CAudioPlayerGui::addToPlaylist(CAudiofileExt &file) -{ +{ //printf("add2Playlist: %s\n", file.Filename.c_str()); if (m_select_title_by_name) - { + { if (!file.MetaData.bitrate) { std::string t = ""; @@ -2475,7 +2479,7 @@ void CAudioPlayerGui::removeFromPlaylist(long pos) firstChar = getFirstChar(m_playlist[pos]); } - m_playlist.erase(m_playlist.begin() + pos); + m_playlist.erase(m_playlist.begin() + pos); m_playlistHasChanged = true; if (m_select_title_by_name) @@ -2498,20 +2502,20 @@ void CAudioPlayerGui::removeFromPlaylist(long pos) { m_title2Pos.erase(item); } - } + } else { printf("could not find key: %c pos: %ld\n",firstChar,pos); } - // decrease position information for all titles with a position + // decrease position information for all titles with a position // 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) @@ -2521,7 +2525,7 @@ void CAudioPlayerGui::removeFromPlaylist(long pos) } //title->second.clear(); title->second = newList; - } + } #ifdef AUDIOPLAYER_TIME_DEBUG timeval end; gettimeofday(&end,NULL); @@ -2549,28 +2553,28 @@ void CAudioPlayerGui::selectTitle(unsigned char selectionChar) CPosList::iterator posIt = it->second.upper_bound(m_selected); if (posIt != it->second.end()) { - i = *posIt; + i = *posIt; //printf("upper bound i: %ld\n",i); - } + } else { if (it->second.size() > 0) { i = *(it->second.begin()); //printf("using begin i: %ld\n",i); - } + } else { //printf("no title with that key\n"); return; } - } - } + } + } else { //printf("no title with that key\n"); return; - } + } int prevselected = m_selected; m_selected = i; @@ -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); @@ -2682,7 +2686,7 @@ void CAudioPlayerGui::printTimevalDiff(timeval &start, timeval &end) if (usecs < 0) { usecs = 1000000 + usecs; - secs--; + secs--; } printf("%ld:%ld\n",secs,usecs); } @@ -2711,7 +2715,7 @@ void CAudioPlayerGui::savePlaylist() // let user select target directory this->hide(); - if (browser.exec(path)) + if (browser.exec(path)) { // refresh view this->paint(); @@ -2728,29 +2732,29 @@ void CAudioPlayerGui::savePlaylist() const int filenamesize = 30; char filename[filenamesize + 1] = ""; - if (file->getType() == CFile::FILE_PLAYLIST) + if (file->getType() == CFile::FILE_PLAYLIST) { // file is playlist so we should ask if we can overwrite it std::string name = file->getPath(); name += '/'; name += file->getFileName(); bool overwrite = askToOverwriteFile(name); - if (!overwrite) + if (!overwrite) { return; } snprintf(filename, name.size(), "%s", name.c_str()); - } - else if (file->getType() == CFile::FILE_DIR) + } + else if (file->getType() == CFile::FILE_DIR) { // query for filename this->hide(); CStringInputSMS filenameInput(LOCALE_AUDIOPLAYER_PLAYLIST_NAME, - filename, - filenamesize - 1, - LOCALE_AUDIOPLAYER_PLAYLIST_NAME_HINT1, - LOCALE_AUDIOPLAYER_PLAYLIST_NAME_HINT2, - "abcdefghijklmnopqrstuvwxyz0123456789-.,:!?/ "); + filename, + filenamesize - 1, + LOCALE_AUDIOPLAYER_PLAYLIST_NAME_HINT1, + LOCALE_AUDIOPLAYER_PLAYLIST_NAME_HINT2, + "abcdefghijklmnopqrstuvwxyz0123456789-.,:!?/ "); filenameInput.exec(NULL, ""); // refresh view this->paint(); @@ -2761,17 +2765,17 @@ void CAudioPlayerGui::savePlaylist() std::ifstream input(name.c_str()); // test if file exists and query for overwriting it or not - if (input.is_open()) + if (input.is_open()) { bool overwrite = askToOverwriteFile(name); - if (!overwrite) + if (!overwrite) { return; } } input.close(); - } - else + } + else { std::cout << "CAudioPlayerGui: neither .m3u nor directory selected, abort" << std::endl; return; @@ -2779,32 +2783,32 @@ void CAudioPlayerGui::savePlaylist() std::string absPlaylistFilename = absPlaylistDir; absPlaylistFilename += '/'; absPlaylistFilename += filename; - absPlaylistFilename += ".m3u"; + absPlaylistFilename += ".m3u"; std::ofstream playlistFile(absPlaylistFilename.c_str()); std::cout << "CAudioPlayerGui: writing playlist to " << absPlaylistFilename << std::endl; - if (!playlistFile) + if (!playlistFile) { // an error occured const int msgsize = 255; char msg[msgsize] = ""; snprintf(msg, - msgsize, - "%s\n%s", - g_Locale->getText(LOCALE_AUDIOPLAYER_PLAYLIST_FILEERROR_MSG), - absPlaylistFilename.c_str()); + msgsize, + "%s\n%s", + g_Locale->getText(LOCALE_AUDIOPLAYER_PLAYLIST_FILEERROR_MSG), + absPlaylistFilename.c_str()); DisplayErrorMessage(msg); // refresh view this->paint(); - std::cout << "CAudioPlayerGui: could not create play list file " - << absPlaylistFilename << std::endl; + std::cout << "CAudioPlayerGui: could not create play list file " + << absPlaylistFilename << std::endl; return; } // writing .m3u file 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; @@ -2814,7 +2818,7 @@ void CAudioPlayerGui::savePlaylist() playlistFile << absPath2Rel(absPlaylistDir, it->Filename) << std::endl; } playlistFile.close(); - } + } this->paint(); } //------------------------------------------------------------------------ @@ -2823,13 +2827,13 @@ bool CAudioPlayerGui::askToOverwriteFile(const std::string& filename) { char msg[filename.length() + 127]; snprintf(msg, - filename.length() + 126, - "%s\n%s", - g_Locale->getText(LOCALE_AUDIOPLAYER_PLAYLIST_FILEOVERWRITE_MSG), - filename.c_str()); + filename.length() + 126, + "%s\n%s", + g_Locale->getText(LOCALE_AUDIOPLAYER_PLAYLIST_FILEOVERWRITE_MSG), + filename.c_str()); bool res = (ShowMsgUTF(LOCALE_AUDIOPLAYER_PLAYLIST_FILEOVERWRITE_TITLE, - msg,CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo) - == CMessageBox::mbrYes); + msg,CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo) + == CMessageBox::mbrYes); this->paint(); return res; } @@ -2845,16 +2849,16 @@ 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 #include - +#include #include #include #include @@ -71,8 +71,8 @@ int CBookmarkManager::addBookmark (CBookmark inBookmark) { bookmarksmodified = true; return 0; } - // TODO:show dialog to delete old bookmark - return -1; + // TODO:show dialog to delete old bookmark + return -1; } //------------------------------------------------------------------------ @@ -81,12 +81,12 @@ inline int CBookmarkManager::createBookmark (const std::string & name, const std } int CBookmarkManager::createBookmark (const std::string & url, const std::string & time) { - char bookmarkname[26]=""; - 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; - return createBookmark(std::string(bookmarkname), url, time); + char bookmarkname[26]=""; + 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; + return createBookmark(std::string(bookmarkname), url, time); } //------------------------------------------------------------------------ @@ -126,7 +126,7 @@ void CBookmarkManager::readBookmarkFile() { { char bookmarkstring[BOOKMARKSTRINGLENGTH]; strcpy(bookmarkstring, BOOKMARKSTRING); - + bookmarksmodified = false; bookmarks.clear(); @@ -146,7 +146,7 @@ void CBookmarkManager::readBookmarkFile() { tmp = bookmarkstring; tmp += "time"; std::string bookmarktime = bookmarkfile.getString(tmp, ""); - + bookmarks.push_back(CBookmark(bookmarkname, bookmarkurl, bookmarktime)); bookmarkstring[BOOKMARKSTRINGMODIFICATIONPOINT]++; @@ -162,7 +162,7 @@ void CBookmarkManager::writeBookmarkFile() { strcpy(bookmarkstring, BOOKMARKSTRING); printf("CBookmarkManager: Writing bookmark file\n"); - + for (std::vector::const_iterator it = bookmarks.begin(); it != bookmarks.end(); it++) { std::string tmp = bookmarkstring; @@ -191,7 +191,7 @@ CBookmarkManager::CBookmarkManager() : bookmarkfile ('\t') //------------------------------------------------------------------------ CBookmarkManager::~CBookmarkManager () { - flush(); + flush(); } //------------------------------------------------------------------------ @@ -203,68 +203,65 @@ int CBookmarkManager::getBookmarkCount(void) const { //------------------------------------------------------------------------ int CBookmarkManager::getMaxBookmarkCount(void) const { - return MAXBOOKMARKS; + return MAXBOOKMARKS; } //------------------------------------------------------------------------ void CBookmarkManager::flush() { - if (bookmarksmodified) { - writeBookmarkFile(); - } + if (bookmarksmodified) { + writeBookmarkFile(); + } } //------------------------------------------------------------------------ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) { - if(parent) + if (parent) { parent->hide(); } - + frameBuffer = CFrameBuffer::getInstance(); 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; - + 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,11 +269,11 @@ 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 ) || - ( msg == CRCInput::RC_home) ) + if ( ( msg == CRCInput::RC_timeout ) || + ( msg == CRCInput::RC_home) ) { //Exit after timeout or cancel key res = -1; loop=false; @@ -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(); } @@ -320,36 +317,36 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) } else if ((msg == CRCInput::RC_ok) && !(bookmarks.empty())) { - res = selected; - loop=false; + 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)|| - (CRCInput::isNumeric(msg)) ) + 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; @@ -368,7 +365,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) void CBookmarkManager::paintItem(int pos) { int ypos = y+ theight+0 + pos*fheight*2; - + uint8_t color; fb_pixel_t bgcolor; @@ -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+posRenderString(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; @@ -424,7 +421,7 @@ void CBookmarkManager::hide() //------------------------------------------------------------------------ void CBookmarkManager::paintHead() -{ +{ frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0); frameBuffer->paintIcon("bookmarkmanager.raw",x+5,y+4); g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+35,y+theight+0, width- 45, g_Locale->getText(LOCALE_BOOKMARKMANAGER_NAME), COL_MENUHEAD, 0, true); // UTF-8 @@ -447,7 +444,7 @@ void CBookmarkManager::paintFoot() if (bookmarks.empty()) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 1* ButtonWidth + 10, y+height); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width-1 * ButtonWidth + 38, y+height+24 - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR, 0, true); // UTF-8 - } + } else { ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y + height + 4, ButtonWidth, 2, BookmarkmanagerButtons); @@ -466,12 +463,12 @@ void CBookmarkManager::paint() CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, g_Locale->getText(LOCALE_BOOKMARKMANAGER_NAME)); paintHead(); - - for(unsigned int count=0;countlistmaxshow) + if (bookmarks.size()>listmaxshow) { int ypos = y+ theight; int sb = 2*fheight* listmaxshow; diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index e68ec9182..ad3d38f98 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -61,10 +61,9 @@ CDBoxInfoWidget::CDBoxInfoWidget() // height = hheight+13*mheight+ 10; 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 ); } @@ -104,16 +103,16 @@ void CDBoxInfoWidget::paint() int power = 0; int is_val = 0xdeadbabe; 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); - } + } else is_val = 0; #endif char buf[256]; @@ -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); @@ -152,9 +151,9 @@ void CDBoxInfoWidget::paint() sysinfo(&info); - sprintf( ubuf, "%2d:%02d%s up ", - current_time->tm_hour%12 ? current_time->tm_hour%12 : 12, - current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am"); + sprintf( ubuf, "%2d:%02d%s up ", + current_time->tm_hour%12 ? current_time->tm_hour%12 : 12, + current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am"); strcat(sbuf, ubuf); updays = (int) info.uptime / (60*60*24); if (updays) { @@ -164,16 +163,16 @@ 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); strcat(sbuf, ubuf); - sprintf(ubuf, "load: %ld.%02ld, %ld.%02ld, %ld.%02ld\n", - LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]), - LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]), - LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2])); + sprintf(ubuf, "load: %ld.%02ld, %ld.%02ld, %ld.%02ld\n", + LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]), + LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]), + LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2])); strcat(sbuf, ubuf); ypos+= mheight/2; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, sbuf, COL_MENUCONTENT); @@ -184,24 +183,24 @@ void CDBoxInfoWidget::paint() g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, ubuf, COL_MENUCONTENT); ypos+= mheight; - struct statfs s; - //long blocks_used; - //long blocks_percent_used; + struct statfs s; + //long blocks_used; + //long blocks_percent_used; - if (::statfs("/var", &s) == 0) { - //printf("/var filesystem total %ldKb, free %ldKb\n", (long)s.f_blocks*s.f_bsize/1024, (long)s.f_bfree*s.f_bsize/1024); - sprintf(ubuf, "/var filesystem total %ldKb, free %ldKb", (long)s.f_blocks*s.f_bsize/1024, (long)s.f_bfree*s.f_bsize/1024); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, ubuf, COL_MENUCONTENT); - ypos+= mheight; - } - else - perror("/var statfs"); - if (::statfs("/hdd", &s) == 0) { + if (::statfs("/var", &s) == 0) { + //printf("/var filesystem total %ldKb, free %ldKb\n", (long)s.f_blocks*s.f_bsize/1024, (long)s.f_bfree*s.f_bsize/1024); + sprintf(ubuf, "/var filesystem total %ldKb, free %ldKb", (long)s.f_blocks*s.f_bsize/1024, (long)s.f_bfree*s.f_bsize/1024); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, ubuf, COL_MENUCONTENT); + ypos+= mheight; + } + else + 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) ) - 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); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, ubuf, COL_MENUCONTENT); - } + 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); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width, ubuf, COL_MENUCONTENT); + } } diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 2c3a32fed..394eaf812 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -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,29 +174,29 @@ 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 + // 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 = ""; aktWidth= 0; - } + } aktWord = ""; } else @@ -205,9 +205,9 @@ void CEpgData::processTextToArray(std::string text) // UTF-8 aktLine = aktWord; aktWidth = aktWordWidth; aktWord = ""; - // Houdini: in this case where we skipped \n and space is too low, exec newline and rescan \n + // 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; iRenderString(sx+10, y+medlineheight, ox- 15- 15, epgText[i], COL_MENUCONTENT, 0, true); // UTF-8 @@ -393,13 +393,13 @@ const neutrino_locale_t * genre_sub_classes_list[10] = bool CEpgData::hasFollowScreenings(const t_channel_id channel_id, const std::string & title) { time_t curtime = time(NULL); - + for (CChannelEventList::iterator e = evtlist.begin(); e != evtlist.end(); ++e ) { if (e->startTime > curtime && e->eventID && e->description == title) return true; } - return false; + return false; } const char * GetGenre(const unsigned char contentClassification) // UTF-8 @@ -468,8 +468,8 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ int res = menu_return::RETURN_REPAINT; 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)); } @@ -495,7 +495,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ evtlist.clear(); sectionsd_getEventsServiceKey(channel_id&0xFFFFFFFFFFFFULL, evtlist); // Houdini added for Private Premiere EPG start sorted by start date/time 2005-08-15 - sort(evtlist.begin(),evtlist.end(),sortByDateTime); + sort(evtlist.begin(),evtlist.end(),sortByDateTime); frameBuffer->paintBackgroundBoxRel(g_settings.screen_StartX, g_settings.screen_StartY, 50, height+5); } @@ -516,10 +516,10 @@ 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) - 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 + /* 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 if (0 == epgData.info2.find(epgData.info1.substr(nPosDot, epgData.info1.length() - nPosDot))) { @@ -528,7 +528,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ } } } - // Compare strings normally if not positively found to be equal before + // Compare strings normally if not positively found to be equal before if (false == bHide && false == (std::string::npos == epgData.info2.find(epgData.info1))) { bHide = true; } @@ -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::iterator description; std::vector::iterator item; @@ -606,23 +606,23 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ // show Timer Event Buttons showTimerEventBar (true); - //show Content&Component for Dolby & 16:9 - CSectionsdClient::ComponentTagList tags; + //show Content&Component for Dolby & 16:9 + CSectionsdClient::ComponentTagList tags; //if ( g_Sectionsd->getComponentTagsUniqueKey( epgData.eventID, tags ) ) if ( sectionsd_getComponentTagsUniqueKey( epgData.eventID, tags ) ) - { - for (unsigned int i=0; i< tags.size(); i++) - { - 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 ) - { - frameBuffer->paintIcon("dd.raw", ox+sx-(ICON_LARGE_WIDTH+2), sy + oy+5); - } - } - } + { + for (unsigned int i=0; i< tags.size(); i++) + { + 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 ) + { + frameBuffer->paintIcon("dd.raw", ox+sx-(ICON_LARGE_WIDTH+2), sy + oy+5); + } + } + } //show progressbar if ( epg_done!= -1 ) @@ -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 ); @@ -664,192 +664,192 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ switch ( msg ) { - case NeutrinoMessages::EVT_TIMER: - if (data == g_InfoViewer->lcdUpdateTimer) { - GetEPGData(channel_id, id, &startzeit ); - if ( epg_done!= -1 ) { - int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); - timescale->reset(); - timescale->paint(pbx+2, sy+oy-height+2, epg_done); - } + case NeutrinoMessages::EVT_TIMER: + if (data == g_InfoViewer->lcdUpdateTimer) { + GetEPGData(channel_id, id, &startzeit ); + if ( epg_done!= -1 ) { + int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); + timescale->reset(); + timescale->paint(pbx+2, sy+oy-height+2, epg_done); } - CNeutrinoApp::getInstance()->handleMsg(msg, data); - break; - case NeutrinoMessages::EVT_CURRENTNEXT_EPG: - if (/*!id && */ ((*(t_channel_id *) data) == (channel_id & 0xFFFFFFFFFFFFULL))) { - show(channel_id); - showPos=0; - } - CNeutrinoApp::getInstance()->handleMsg(msg, data); - break; - case CRCInput::RC_left: - if (prev_id != 0) - { - frameBuffer->paintBoxRel(sx+ 5, sy+ oy- botboxheight+ 4, botboxheight- 8, botboxheight- 8, COL_MENUCONTENT_PLUS_1); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ 10, sy+ oy- 3, widthr, "<", COL_MENUCONTENT + 1); + } + CNeutrinoApp::getInstance()->handleMsg(msg, data); + break; + case NeutrinoMessages::EVT_CURRENTNEXT_EPG: + if (/*!id && */ ((*(t_channel_id *) data) == (channel_id & 0xFFFFFFFFFFFFULL))) { + show(channel_id); + showPos=0; + } + CNeutrinoApp::getInstance()->handleMsg(msg, data); + break; + case CRCInput::RC_left: + if (prev_id != 0) + { + frameBuffer->paintBoxRel(sx+ 5, sy+ oy- botboxheight+ 4, botboxheight- 8, botboxheight- 8, COL_MENUCONTENT_PLUS_1); + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ 10, sy+ oy- 3, widthr, "<", COL_MENUCONTENT + 1); - show(channel_id, prev_id, &prev_zeit, false); - showPos=0; - } - break; + show(channel_id, prev_id, &prev_zeit, false); + showPos=0; + } + break; - case CRCInput::RC_right: - if (next_id != 0) - { - frameBuffer->paintBoxRel(sx+ ox- botboxheight+ 8- 5, sy+ oy- botboxheight+ 4, botboxheight- 8, botboxheight- 8, COL_MENUCONTENT_PLUS_1); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ ox- botboxheight+ 8, sy+ oy- 3, widthr, ">", COL_MENUCONTENT + 1); + case CRCInput::RC_right: + if (next_id != 0) + { + frameBuffer->paintBoxRel(sx+ ox- botboxheight+ 8- 5, sy+ oy- botboxheight+ 4, botboxheight- 8, botboxheight- 8, COL_MENUCONTENT_PLUS_1); + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ ox- botboxheight+ 8, sy+ oy- 3, widthr, ">", COL_MENUCONTENT + 1); - show(channel_id, next_id, &next_zeit, false); - showPos=0; - } - break; + show(channel_id, next_id, &next_zeit, false); + showPos=0; + } + break; - case CRCInput::RC_down: - if(showPos+scrollCountisTimerdAvailable()) - { - bool doRecord = true; - //char *recDir = g_settings.network_nfs_recordingdir; - strcpy(recDir, g_settings.network_nfs_recordingdir); - if (g_settings.recording_choose_direct_rec_dir == 2) { - CFileBrowser b; - b.Dir_Mode=true; - hide(); - if (b.exec(g_settings.network_nfs_recordingdir)) { - strcpy(recDir, b.getSelectedFile()->Name.c_str()); - } else - doRecord = false; - show(channel_id,epgData.eventID,&epgData.epg_times.startzeit,false); - } - else if (g_settings.recording_choose_direct_rec_dir == 1) - { - int id = -1; - CMountChooser recDirs(LOCALE_TIMERLIST_RECORDING_DIR,NEUTRINO_ICON_SETTINGS,&id,NULL,g_settings.network_nfs_recordingdir); - if (recDirs.hasItem()) - { - hide(); - recDirs.exec(NULL,""); - show(channel_id,epgData.eventID,&epgData.epg_times.startzeit,false); - } else - { - printf("no network devices available\n"); - } - if (id != -1) - strcpy(recDir, g_settings.network_nfs_local_dir[id]); - //recDir = g_settings.network_nfs_local_dir[id]; - //else - //recDir = NULL; - } - //if (recDir != NULL) - if (doRecord) - { - if (g_Timerd->addRecordTimerEvent(channel_id, - epgData.epg_times.startzeit, - epgData.epg_times.startzeit + epgData.epg_times.dauer, - epgData.eventID, epgData.epg_times.startzeit, - epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), - TIMERD_APIDS_CONF, true, recDir,false) == -1) - { - if(askUserOnTimerConflict(epgData.epg_times.startzeit - (ANNOUNCETIME + 120), - epgData.epg_times.startzeit + epgData.epg_times.dauer)) - { - g_Timerd->addRecordTimerEvent(channel_id, - epgData.epg_times.startzeit, - epgData.epg_times.startzeit + epgData.epg_times.dauer, - epgData.eventID, epgData.epg_times.startzeit, - epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), - TIMERD_APIDS_CONF, true, recDir,true); - ShowLocalizedMessage(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw"); - } - } else { - ShowLocalizedMessage(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw"); - } - } - } - else - printf("timerd not available\n"); - } - break; - - // 31.05.2002 dirch zapto timer - case CRCInput::RC_yellow: + case CRCInput::RC_red: + if (!g_settings.minimode && (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF)) { //CTimerdClient timerdclient; - if(g_Timerd->isTimerdAvailable()) + if (g_Timerd->isTimerdAvailable()) { - g_Timerd->addZaptoTimerEvent(channel_id, - epgData.epg_times.startzeit, - epgData.epg_times.startzeit - ANNOUNCETIME, 0, - epgData.eventID, epgData.epg_times.startzeit, 0); - ShowLocalizedMessage(LOCALE_TIMER_EVENTTIMED_TITLE, LOCALE_TIMER_EVENTTIMED_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw"); + bool doRecord = true; + //char *recDir = g_settings.network_nfs_recordingdir; + strcpy(recDir, g_settings.network_nfs_recordingdir); + if (g_settings.recording_choose_direct_rec_dir == 2) { + CFileBrowser b; + b.Dir_Mode=true; + hide(); + if (b.exec(g_settings.network_nfs_recordingdir)) { + strcpy(recDir, b.getSelectedFile()->Name.c_str()); + } else + doRecord = false; + show(channel_id,epgData.eventID,&epgData.epg_times.startzeit,false); + } + else if (g_settings.recording_choose_direct_rec_dir == 1) + { + int id = -1; + CMountChooser recDirs(LOCALE_TIMERLIST_RECORDING_DIR,NEUTRINO_ICON_SETTINGS,&id,NULL,g_settings.network_nfs_recordingdir); + if (recDirs.hasItem()) + { + hide(); + recDirs.exec(NULL,""); + show(channel_id,epgData.eventID,&epgData.epg_times.startzeit,false); + } else + { + printf("no network devices available\n"); + } + if (id != -1) + strcpy(recDir, g_settings.network_nfs_local_dir[id]); + //recDir = g_settings.network_nfs_local_dir[id]; + //else + //recDir = NULL; + } + //if (recDir != NULL) + if (doRecord) + { + if (g_Timerd->addRecordTimerEvent(channel_id, + epgData.epg_times.startzeit, + epgData.epg_times.startzeit + epgData.epg_times.dauer, + epgData.eventID, epgData.epg_times.startzeit, + epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), + TIMERD_APIDS_CONF, true, recDir,false) == -1) + { + if (askUserOnTimerConflict(epgData.epg_times.startzeit - (ANNOUNCETIME + 120), + epgData.epg_times.startzeit + epgData.epg_times.dauer)) + { + g_Timerd->addRecordTimerEvent(channel_id, + epgData.epg_times.startzeit, + epgData.epg_times.startzeit + epgData.epg_times.dauer, + epgData.eventID, epgData.epg_times.startzeit, + epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), + TIMERD_APIDS_CONF, true, recDir,true); + ShowLocalizedMessage(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw"); + } + } else { + ShowLocalizedMessage(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw"); + } + } } else printf("timerd not available\n"); - break; } + break; - case CRCInput::RC_info: - case CRCInput::RC_help: - bigFonts = bigFonts ? false : true; - frameBuffer->paintBackgroundBox (sx, sy- toph, sx+ ox, sy+ oy); - showTimerEventBar (false); - start(); + // 31.05.2002 dirch zapto timer + case CRCInput::RC_yellow: + { + //CTimerdClient timerdclient; + if (g_Timerd->isTimerdAvailable()) + { + g_Timerd->addZaptoTimerEvent(channel_id, + epgData.epg_times.startzeit, + epgData.epg_times.startzeit - ANNOUNCETIME, 0, + epgData.eventID, epgData.epg_times.startzeit, 0); + ShowLocalizedMessage(LOCALE_TIMER_EVENTTIMED_TITLE, LOCALE_TIMER_EVENTTIMED_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw"); + } + else + printf("timerd not available\n"); + break; + } + + case CRCInput::RC_info: + case CRCInput::RC_help: + bigFonts = bigFonts ? false : true; + frameBuffer->paintBackgroundBox (sx, sy- toph, sx+ ox, sy+ oy); + showTimerEventBar (false); + start(); //printf("bigFonts %d\n", 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 - { - 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)); - } - g_settings.bigFonts = bigFonts; - show(channel_id, id, &startzeit, false); - showPos=0; - break; + 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 + { + 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)); + } + g_settings.bigFonts = bigFonts; + show(channel_id, id, &startzeit, false); + showPos=0; + break; - case CRCInput::RC_ok: - case CRCInput::RC_timeout: - loop = false; - break; - case CRCInput::RC_favorites: - case CRCInput::RC_sat: - g_RCInput->postMsg (msg, 0); - loop = false; - break; + case CRCInput::RC_ok: + case CRCInput::RC_timeout: + loop = false; + break; + case CRCInput::RC_favorites: + case CRCInput::RC_sat: + g_RCInput->postMsg (msg, 0); + loop = false; + break; - default: - // konfigurierbare Keys handlen... - if (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) + default: + // konfigurierbare Keys handlen... + if (msg == (neutrino_msg_t)g_settings.key_channelList_cancel) + loop = false; + else + { + if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) + { loop = false; - else - { - if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) - { - loop = false; - res = menu_return::RETURN_EXIT_ALL; - } + res = menu_return::RETURN_EXIT_ALL; } + } } } hide(); @@ -859,7 +859,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ void CEpgData::hide() { - // 2004-09-10 rasc (bugfix, scale large font settings back to normal) + // 2004-09-10 rasc (bugfix, scale large font settings back to normal) if (bigFonts) { bigFonts = false; g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getSize() / BIG_FONT_FAKTOR)); @@ -867,7 +867,7 @@ void CEpgData::hide() } frameBuffer->paintBackgroundBox (sx, sy- toph, sx+ ox, sy+ oy); - showTimerEventBar (false); + showTimerEventBar (false); } bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata); @@ -898,7 +898,7 @@ void CEpgData::GetEPGData(const t_channel_id channel_id, unsigned long long id, reformatExtendedEvents("Guests", g_Locale->getText(LOCALE_EPGEXTENDED_GUESTS), false, epgData); reformatExtendedEvents("Presenter", g_Locale->getText(LOCALE_EPGEXTENDED_PRESENTER), false, epgData); } - + struct tm *pStartZeit = localtime(&(epgData.epg_times).startzeit); char temp[11]; strftime( temp, sizeof(temp), "%d.%m.%Y", pStartZeit); @@ -924,39 +924,39 @@ void CEpgData::GetEPGData(const t_channel_id channel_id, unsigned long long id, void CEpgData::GetPrevNextEPGData( unsigned long long id, time_t* startzeit ) { - prev_id= 0; - next_id= 0; - unsigned int i; + prev_id= 0; + next_id= 0; + unsigned int i; - for ( i= 0; i< evtlist.size(); i++ ) - { - //printf("%d %llx/%llx - %x %x\n", i, evtlist[i].eventID, id, evtlist[i].startTime, *startzeit); - if ( ( evtlist[i].eventID == id ) && ( evtlist[i].startTime == *startzeit ) ) - { - if ( i > 0 ) - { - prev_id= evtlist[i- 1].eventID; - prev_zeit= evtlist[i- 1].startTime; - } - if ( i < ( evtlist.size()- 1 ) ) - { - next_id= evtlist[i+ 1].eventID; - next_zeit= evtlist[i+ 1].startTime; - } - break; - } - } - /* Houdini: dirty RTL double event workaround, if prev/next event has same starttime as actual event skip it */ - if ((prev_zeit == *startzeit) && ((i-1) > 0)) - { - prev_id = evtlist[i- 2].eventID; - prev_zeit = evtlist[i- 2].startTime; - } - if ((next_zeit == *startzeit) && ((i+1) < (evtlist.size()- 1))) - { - next_id = evtlist[i+ 2].eventID; - next_zeit = evtlist[i+ 2].startTime; - } + for ( i= 0; i< evtlist.size(); i++ ) + { + //printf("%d %llx/%llx - %x %x\n", i, evtlist[i].eventID, id, evtlist[i].startTime, *startzeit); + if ( ( evtlist[i].eventID == id ) && ( evtlist[i].startTime == *startzeit ) ) + { + if ( i > 0 ) + { + prev_id= evtlist[i- 1].eventID; + prev_zeit= evtlist[i- 1].startTime; + } + if ( i < ( evtlist.size()- 1 ) ) + { + next_id= evtlist[i+ 1].eventID; + next_zeit= evtlist[i+ 1].startTime; + } + break; + } + } + /* Houdini: dirty RTL double event workaround, if prev/next event has same starttime as actual event skip it */ + if ((prev_zeit == *startzeit) && ((i-1) > 0)) + { + prev_id = evtlist[i- 2].eventID; + prev_zeit = evtlist[i- 2].startTime; + } + if ((next_zeit == *startzeit) && ((i+1) < (evtlist.size()- 1))) + { + next_id = evtlist[i+ 2].eventID; + next_zeit = evtlist[i+ 2].startTime; + } } @@ -971,22 +971,22 @@ void CEpgData::GetPrevNextEPGData( unsigned long long id, time_t* startzeit ) int CEpgData::FollowScreenings (const t_channel_id channel_id, const std::string & title) { - CChannelEventList::iterator e; - time_t curtime; - struct tm *tmStartZeit; - std::string screening_dates,screening_nodual; - int count; - char tmpstr[256]; + CChannelEventList::iterator e; + time_t curtime; + struct tm *tmStartZeit; + std::string screening_dates,screening_nodual; + int count; + char tmpstr[256]; - count = 0; + count = 0; screening_dates = screening_nodual = ""; // alredy read: evtlist = g_Sectionsd->getEventsServiceKey( channel_id&0xFFFFFFFFFFFFULL ); - curtime = time(NULL); + curtime = time(NULL); for ( e= evtlist.begin(); e != evtlist.end(); ++e ) { - if (e->startTime <= curtime) continue; + if (e->startTime <= curtime) continue; if (! e->eventID) continue; if (e->description == title) { count++; @@ -1004,9 +1004,9 @@ 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){ - screening_nodual=screening_dates; - processTextToArray(screening_dates ); // UTF-8 + if (screening_dates != screening_nodual) { + screening_nodual=screening_dates; + processTextToArray(screening_dates ); // UTF-8 } } } diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 9298f9eb0..fe2655497 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -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() @@ -78,7 +78,7 @@ CImageInfo::~CImageInfo() int CImageInfo::exec(CMenuTarget* parent, const std::string &) { if (parent) - parent->hide(); + parent->hide(); width = frameBuffer->getScreenWidth() - 10; height = frameBuffer->getScreenHeight() - 10; @@ -87,8 +87,8 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) paint(); - //paint_pig( width-170, y, 215, 170); - paint_pig (width - width/3 - 10, y + 10, width/3, height/3); + //paint_pig( width-170, y, 215, 170); + paint_pig (width - width/3 - 10, y + 10, width/3, height/3); neutrino_msg_t msg; @@ -123,8 +123,8 @@ void CImageInfo::hide() void CImageInfo::paint_pig(int x, int y, int w, int h) { - //frameBuffer->paintBoxRel(x,y,w,h, COL_BACKGROUND); - frameBuffer->paintBackgroundBoxRel(x,y,w,h); + //frameBuffer->paintBoxRel(x,y,w,h, COL_BACKGROUND); + frameBuffer->paintBackgroundBoxRel(x,y,w,h); videoDecoder->Pig(x, y, w, h, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); } @@ -140,7 +140,7 @@ void CImageInfo::paint() { const char * head_string; char imagedate[18] = ""; - int xpos = x+10; + int xpos = x+10; ypos = y+5; diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index f4470a890..440f98c28 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -2,7 +2,7 @@ Neutrino-GUI - DBoxII-Project MP3Player by Dirch - + Homepage: http://dbox.cyberphoria.org/ Kommentar: @@ -56,6 +56,7 @@ #include #include +#include #include @@ -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 @@ -146,7 +142,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) // remember last mode m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); - g_Sectionsd->setPauseScanning(true); + g_Sectionsd->setPauseScanning(true); show(); @@ -159,7 +155,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) // Restore last mode CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode ); - // always exit all + // always exit all return menu_return::RETURN_REPAINT; } @@ -179,29 +175,29 @@ 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,12 +293,12 @@ int CPictureViewerGui::show() paintItem(prevselected - liststart); unsigned int oldliststart = liststart; liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) + if (oldliststart!=liststart) { update=true; } else - { + { paintItem(selected - liststart); } } @@ -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,31 +395,31 @@ int CPictureViewerGui::show() paint(); } } - else if( msg == CRCInput::RC_1 ) - { + else if ( msg == CRCInput::RC_1 ) + { if (m_state != MENU) { m_viewer->Zoom(2.0/3); } } - 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) { m_viewer->Zoom(1.5); } } - else if( msg == CRCInput::RC_4 ) - { + else if ( msg == CRCInput::RC_4 ) + { if (m_state != MENU) { m_viewer->Move(-50,0); @@ -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,19 +474,19 @@ 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 || - msg == NeutrinoMessages::ZAPTO || - msg == NeutrinoMessages::STANDBY_ON || - msg == NeutrinoMessages::SHUTDOWN || - msg == NeutrinoMessages::SLEEPTIMER) + else if (msg == NeutrinoMessages::RECORD_START || + msg == NeutrinoMessages::ZAPTO || + msg == NeutrinoMessages::STANDBY_ON || + msg == NeutrinoMessages::SHUTDOWN || + msg == NeutrinoMessages::SLEEPTIMER) { // Exit for Record/Zapto Timers if (m_state != MENU) @@ -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+pospaintIcon("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;countshowMenuText(0, playlist[index].Name.c_str()); char timestring[19]; 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; } diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index ff30c1cdb..7ee563a83 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include @@ -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; diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 60e188769..c796d427b 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -52,13 +52,13 @@ #include -/* for alexW images with old drivers: +/* for alexW images with old drivers: * #define USE_VBI_INTERFACE 1 */ #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 @@ -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; @@ -130,13 +130,13 @@ void CPlugins::scanDir(const char *dir) } // We do not check if new_plugin.pluginfile exists since .cfg in // PLUGINDIR_VAR can overwrite settings in read only dir - // PLUGINDIR. This needs PLUGINDIR_VAR to be scanned at + // PLUGINDIR. This needs PLUGINDIR_VAR to be scanned at // first -> .cfg in PLUGINDIR will be skipped since plugin // already exists in the list. // 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; @@ -244,9 +244,9 @@ bool CPlugins::parseCfg(plugin *plugin_data) plugin_data->hide = ((parm == "1")?true:false); } else if (cmd == "needenigma") - { - reject = ((parm == "1")?true:false); - } + { + reject = ((parm == "1")?true: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; @@ -291,7 +291,7 @@ void CPlugins::startPlugin(const char * const name) int pluginnr = find_plugin(name); if (pluginnr > -1) startPlugin(pluginnr,0); - else + else printf("[CPlugins] could not find %s\n", name); } @@ -303,7 +303,7 @@ void CPlugins::startScriptPlugin(int number) if (!pluginfile_exists(plugin_list[number].pluginfile)) { printf("[CPlugins] could not find %s,\nperhaps wrong plugin type in %s\n", - script, plugin_list[number].cfgfile.c_str()); + script, plugin_list[number].cfgfile.c_str()); return; } @@ -313,12 +313,12 @@ void CPlugins::startScriptPlugin(int number) char output[1024]; while (fgets(output,1024,f)) { - scriptOutput += output; + scriptOutput += output; } pclose(f); - } - else - { + } + else + { printf("[CPlugins] can't execute %s\n",script); } } @@ -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) { @@ -342,7 +342,7 @@ void CPlugins::startPlugin(int number,int param) if (!pluginfile_exists(plugin_list[number].pluginfile)) { printf("[CPlugins] could not find %s,\nperhaps wrong plugin type in %s\n", - plugin_list[number].pluginfile.c_str(), plugin_list[number].cfgfile.c_str()); + plugin_list[number].pluginfile.c_str(), plugin_list[number].cfgfile.c_str()); return; } @@ -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,13 +434,13 @@ void CPlugins::startPlugin(int number,int param) break; } } - for( i=0; isetPauseScanning (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 */ @@ -496,15 +496,15 @@ void CPlugins::startPlugin(int number,int param) //#endif //if (!plugin_list[number].rc) - g_RCInput->restartInput(); + g_RCInput->restartInput(); g_RCInput->clearRCMsg(); if (plugin_list[number].lcd) - { - if(lcd_fd != -1) + { + if (lcd_fd != -1) close(lcd_fd); CLCD::getInstance()->resume(); - } + } if (plugin_list[number].fb) { @@ -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; iid, since it is the original */ free(par->val); @@ -565,19 +565,19 @@ 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(); g_RCInput->restartInput(); g_RCInput->clearRCMsg(); -#endif +#endif } bool CPlugins::hasPlugin(CPlugins::p_type_t type) { for (std::vector::iterator it=plugin_list.begin(); - it!=plugin_list.end();it++) + it!=plugin_list.end(); it++) { if (it->type == type && !it->hide) return true; @@ -599,20 +599,20 @@ CPlugins::p_type_t CPlugins::getPluginType(int type) { switch (type) { - case PLUGIN_TYPE_DISABLED: - return P_TYPE_DISABLED; - break; - case PLUGIN_TYPE_GAME: - return P_TYPE_GAME; - break; - case PLUGIN_TYPE_TOOL: - return P_TYPE_TOOL; - break; - case PLUGIN_TYPE_SCRIPT: - return P_TYPE_SCRIPT; - break; - default: - return P_TYPE_DISABLED; + case PLUGIN_TYPE_DISABLED: + return P_TYPE_DISABLED; + break; + case PLUGIN_TYPE_GAME: + return P_TYPE_GAME; + break; + case PLUGIN_TYPE_TOOL: + return P_TYPE_TOOL; + break; + case PLUGIN_TYPE_SCRIPT: + return P_TYPE_SCRIPT; + break; + default: + return P_TYPE_DISABLED; } } diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 3b4ee7943..cfc16ccfc 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -106,13 +106,13 @@ 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); sprintf( display, "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1, - tmTime2->tm_year+1900, - tmTime2->tm_hour, tmTime2->tm_min); + tmTime2->tm_year+1900, + tmTime2->tm_hour, tmTime2->tm_min); m1->setActive(true); m6->setActive((g_settings.recording_type == RECORDING_FILE)); } @@ -123,9 +123,9 @@ public: m1->setActive (false); m6->setActive(false); } - if(type == CTimerd::TIMER_RECORD || - type == CTimerd::TIMER_ZAPTO || - type == CTimerd::TIMER_NEXTPROGRAM) + if (type == CTimerd::TIMER_RECORD || + type == CTimerd::TIMER_ZAPTO || + type == CTimerd::TIMER_NEXTPROGRAM) { m2->setActive(true); } @@ -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,8 +228,8 @@ public: } else { - if(*o_std || *o_alt || *o_ac3) - *o_dflt=0; + if (*o_std || *o_alt || *o_ac3) + *o_dflt=0; } return true; } @@ -260,16 +260,16 @@ 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) timerlist[selected].apids = TIMERD_APIDS_CONF; else timerlist[selected].apids = (timer_apids_std * TIMERD_APIDS_STD) | (timer_apids_ac3 * TIMERD_APIDS_AC3) | - (timer_apids_alt * TIMERD_APIDS_ALT); + (timer_apids_alt * TIMERD_APIDS_ALT); Timer->modifyTimerAPid(timerlist[selected].eventID,timerlist[selected].apids); Timer->modifyRecordTimerEvent(timerlist[selected].eventID, timerlist[selected].announceTime, timerlist[selected].alarmTime, @@ -296,11 +296,11 @@ 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 || - timerNew.eventType==CTimerd::TIMER_ZAPTO || - timerNew.eventType==CTimerd::TIMER_RECORD) + else if (timerNew.eventType==CTimerd::TIMER_NEXTPROGRAM || + timerNew.eventType==CTimerd::TIMER_ZAPTO || + timerNew.eventType==CTimerd::TIMER_RECORD) { if (strcmp(timerNew_channel_name, "---")==0) return menu_return::RETURN_REPAINT; @@ -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,21 +364,21 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) int ret = show(); return ret; -/* - if( ret > -1) - { - return menu_return::RETURN_REPAINT; - } - else if( ret == -1) - { - // -1 bedeutet nur REPAINT - return menu_return::RETURN_REPAINT; - } - else - { - // -2 bedeutet EXIT_ALL - return menu_return::RETURN_EXIT_ALL; - }*/ + /* + if( ret > -1) + { + return menu_return::RETURN_REPAINT; + } + else if( ret == -1) + { + // -1 bedeutet nur REPAINT + return menu_return::RETURN_REPAINT; + } + else + { + // -2 bedeutet EXIT_ALL + return menu_return::RETURN_EXIT_ALL; + }*/ } void CTimerList::updateEvents(void) @@ -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,18 +405,18 @@ 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; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 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,19 +443,19 @@ 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 ) || - ( msg == CRCInput::RC_home) ) + if ( ( msg == CRCInput::RC_timeout ) || + ( msg == CRCInput::RC_home) ) { //Exit after timeout or cancel key loop=false; } 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)|| - (CRCInput::isNumeric(msg)) ) + 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+posRenderString(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,102 +637,103 @@ 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) - { - std::string sep = ""; - zAddData += " ("; - if(timer.apids & TIMERD_APIDS_STD) - { - zAddData += "STD"; - sep = "/"; - } - if(timer.apids & TIMERD_APIDS_ALT) - { - zAddData += sep; - zAddData += "ALT"; - sep = "/"; - } - if(timer.apids & TIMERD_APIDS_AC3) - { - zAddData += sep; - zAddData += "AC3"; - sep = "/"; - } - zAddData += ')'; - } - if(timer.epgID!=0) - { - CEPGData epgdata; - //if (g_Sectionsd->getEPGid(timer.epgID, timer.epg_starttime, &epgdata)) - if (sectionsd_getEPGid(timer.epgID, timer.epg_starttime, &epgdata)) - { - zAddData += " : "; - zAddData += epgdata.title; - } - else if(strlen(timer.epgTitle)!=0) - { - zAddData += " : "; - zAddData += timer.epgTitle; - } - } - else if(strlen(timer.epgTitle)!=0) - { - zAddData += " : "; - zAddData += timer.epgTitle; - } - } - break; - case CTimerd::TIMER_STANDBY: - { - zAddData = g_Locale->getText(timer.standby_on ? LOCALE_TIMERLIST_STANDBY_ON : LOCALE_TIMERLIST_STANDBY_OFF); - break; - } - case CTimerd::TIMER_REMIND : - { - zAddData = timer.message; // must be UTF-8 encoded ! - } - break; - case CTimerd::TIMER_EXEC_PLUGIN : + 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) { - zAddData = timer.pluginName; + std::string sep = ""; + zAddData += " ("; + if (timer.apids & TIMERD_APIDS_STD) + { + zAddData += "STD"; + sep = "/"; + } + if (timer.apids & TIMERD_APIDS_ALT) + { + zAddData += sep; + zAddData += "ALT"; + sep = "/"; + } + if (timer.apids & TIMERD_APIDS_AC3) + { + zAddData += sep; + zAddData += "AC3"; + sep = "/"; + } + zAddData += ')'; } + if (timer.epgID!=0) + { + CEPGData epgdata; + //if (g_Sectionsd->getEPGid(timer.epgID, timer.epg_starttime, &epgdata)) + if (sectionsd_getEPGid(timer.epgID, timer.epg_starttime, &epgdata)) + { + zAddData += " : "; + zAddData += epgdata.title; + } + else if (strlen(timer.epgTitle)!=0) + { + zAddData += " : "; + zAddData += timer.epgTitle; + } + } + else if (strlen(timer.epgTitle)!=0) + { + zAddData += " : "; + zAddData += timer.epgTitle; + } + } + break; + case CTimerd::TIMER_STANDBY: + { + zAddData = g_Locale->getText(timer.standby_on ? LOCALE_TIMERLIST_STANDBY_ON : LOCALE_TIMERLIST_STANDBY_OFF); break; - default:{} + } + case CTimerd::TIMER_REMIND : + { + zAddData = timer.message; // must be UTF-8 encoded ! + } + break; + case CTimerd::TIMER_EXEC_PLUGIN : + { + zAddData = timer.pluginName; + } + break; + 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+= " -"; - line2+= zStopTime+6; - case CTimerd::TIMER_NEXTPROGRAM : - case CTimerd::TIMER_ZAPTO : - { - line1 += ' '; - line1 += convertChannelId2String(timer.channel_id); // UTF-8 - } - break; - case CTimerd::TIMER_STANDBY : - { - if(timer.standby_on) - line1+=" ON"; - else - line1+=" OFF"; - } - break; - default:; + case CTimerd::TIMER_RECORD : + line2+= " -"; + line2+= zStopTime+6; + case CTimerd::TIMER_NEXTPROGRAM : + case CTimerd::TIMER_ZAPTO : + { + line1 += ' '; + line1 += convertChannelId2String(timer.channel_id); // UTF-8 + } + break; + case CTimerd::TIMER_STANDBY : + { + if (timer.standby_on) + line1+=" ON"; + else + line1+=" OFF"; + } + break; + default: + ; } CVFD::getInstance()->showMenuText(0, line1.c_str(), -1, true); // UTF-8 //CVFD::getInstance()->showMenuText(1, line2.c_str(), -1, true); // UTF-8 @@ -747,8 +748,8 @@ 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) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, x+ width- 60, y+ 5 );*/ + /* if (bouquetList!=NULL) + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DBOX, x+ width- 60, y+ 5 );*/ } const struct button_label TimerListButtons[3] = @@ -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;countlistmaxshow) + if (timerlist.size()>listmaxshow) { int ypos = y+ theight; int sb = 2*fheight* listmaxshow; @@ -806,60 +807,76 @@ 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); - default: - if(rep >=CTimerd::TIMERREPEAT_WEEKDAYS) - { - int weekdays = (((int)rep) >> 9); - std::string weekdayStr=""; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONDAY); - weekdays >>= 1; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_TUESDAY); - weekdays >>= 1; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEDNESDAY); - weekdays >>= 1; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_THURSDAY); - weekdays >>= 1; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FRIDAY); - weekdays >>= 1; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_SATURDAY); - weekdays >>= 1; - if(weekdays & 1) - weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_SUNDAY); - return weekdayStr; - } - else - return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_UNKNOWN); + 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) + { + int weekdays = (((int)rep) >> 9); + std::string weekdayStr=""; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_MONDAY); + weekdays >>= 1; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_TUESDAY); + weekdays >>= 1; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_WEDNESDAY); + weekdays >>= 1; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_THURSDAY); + weekdays >>= 1; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_FRIDAY); + weekdays >>= 1; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_SATURDAY); + weekdays >>= 1; + if (weekdays & 1) + weekdayStr+= g_Locale->getText(LOCALE_TIMERLIST_REPEAT_SUNDAY); + return weekdayStr; + } + else + return g_Locale->getText(LOCALE_TIMERLIST_REPEAT_UNKNOWN); } } @@ -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,11 +974,11 @@ 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, - timer->recordingDir, g_settings.network_nfs_recordingdir); + timer->recordingDir, g_settings.network_nfs_recordingdir); if (!recDirs.hasItem()) { printf("[CTimerList] warning: no network devices available\n"); @@ -994,8 +1011,8 @@ 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 )); } @@ -1045,28 +1062,28 @@ int CTimerList::newTimer() CMenuWidget mcradio(LOCALE_TIMERLIST_BOUQUETSELECT, NEUTRINO_ICON_SETTINGS); for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) { - if (!g_bouquetManager->Bouquets[i]->bHidden) { + if (!g_bouquetManager->Bouquets[i]->bHidden) { CMenuWidget* mwtv = new CMenuWidget(LOCALE_TIMERLIST_CHANNELSELECT, NEUTRINO_ICON_SETTINGS); toDelete.push_back(mwtv); CMenuWidget* mwradio = new CMenuWidget(LOCALE_TIMERLIST_CHANNELSELECT, NEUTRINO_ICON_SETTINGS); 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())); - } + } if (!channels->empty()) mctv.addItem(new CMenuForwarderNonLocalized(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwtv)); 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())); - } + } if (!channels->empty()) mcradio.addItem(new CMenuForwarderNonLocalized(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwtv)); } @@ -1117,7 +1134,7 @@ int CTimerList::newTimer() int ret=timerSettings.exec(this,""); // delete dynamic created objects - for(unsigned int count=0;countgetText(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;