diff --git a/data/cables.xml b/data/cables.xml index da8b4e0ef..3ef2d5188 100644 --- a/data/cables.xml +++ b/data/cables.xml @@ -2,7 +2,8 @@ - + + @@ -13,29 +14,27 @@ - + - + - + - - - + + - diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 10416b093..b7278678f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -745,7 +745,8 @@ miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_res Auflösung anzeigen miscsettings.infobar_show_res_simple einfach -miscsettings.infobar_show_var_hdd Füllstandanzeige (var & hdd) +miscsettings.infobar_show_sysfs_hdd Füllstandanzeige (sysFS & hdd) +miscsettings.infobar_show_tuner Aktiven Tuner anzeigen miscsettings.radiotext Radiotext miscsettings.shutdown_count Komplett ausschalten nach miscsettings.shutdown_count_hint1 Zeit (in Minuten), nach der vom Standby in diff --git a/data/locale/english.locale b/data/locale/english.locale index 578bfe820..89999174d 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -745,7 +745,8 @@ miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_res show resolution on infobar miscsettings.infobar_show_res_simple simple -miscsettings.infobar_show_var_hdd Fill level (var & hdd ) +miscsettings.infobar_show_sysfs_hdd Fill level (sysFS & hdd) +miscsettings.infobar_show_tuner Display active tuner miscsettings.radiotext Radiotext miscsettings.shutdown_count In standby, switch off after miscsettings.shutdown_count_hint1 time (in minutes) to switch from standby diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index ae2beb8a0..0ccfcfd1a 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1166,14 +1166,12 @@ static void commandWriteSI2XML(int connfd, char *data, const unsigned dataLength sendEmptyResponse(connfd, NULL, 0); if ((!reader_ready) || (dataLength > 100)){ eventServer->sendEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, CEventServer::INITID_SECTIONSD); - return; + return; } - char epgdir[100] = ""; - strncpy(epgdir, data, dataLength); - epgdir[dataLength] = '\0'; + data[dataLength] = '\0'; - writeEventsToFile(epgdir); + writeEventsToFile(data); eventServer->sendEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, CEventServer::INITID_SECTIONSD); } diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index 5d6963a51..c57cfa023 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -455,24 +455,23 @@ static void write_indexxml_footer(FILE *fd) void writeEventsToFile(char *epgdir) { FILE * indexfile = NULL; - FILE * eventfile =NULL; - char filename[100] = ""; - char tmpname[100] = ""; + FILE * eventfile = NULL; + std::string filename(""); + std::string tmpname(""); char eventname[17] = ""; t_original_network_id onid = 0; t_transport_stream_id tsid = 0; t_service_id sid = 0; deleteOldfileEvents(epgdir); + tmpname = (std::string)epgdir + "/index.tmp"; - sprintf(tmpname, "%s/index.tmp", epgdir); - - if (!(indexfile = fopen(tmpname, "w"))) { - printf("[sectionsd] unable to open %s for writing\n", tmpname); + if (!(indexfile = fopen(tmpname.c_str(), "w"))) { + printf("[sectionsd] unable to open %s for writing\n", tmpname.c_str()); return; } - printf("[sectionsd] Writing Information to file: %s\n", tmpname); + printf("[sectionsd] Writing Information to file: %s\n", tmpname.c_str()); write_index_xml_header(indexfile); @@ -490,8 +489,8 @@ void writeEventsToFile(char *epgdir) tsid = (*e)->transport_stream_id; sid = (*e)->service_id; snprintf(eventname, 17, "%04x%04x%04x.xml", onid, tsid, sid); - sprintf(filename, "%s/%s", epgdir, eventname); - if (!(eventfile = fopen(filename, "w"))) { + filename = (std::string)epgdir + "/" + (std::string)eventname; + if (!(eventfile = fopen(filename.c_str(), "w"))) { goto _done; } fprintf(indexfile, "\t\n", eventname); @@ -508,9 +507,9 @@ _done: printf("[sectionsd] Writing Information finished\n"); - sprintf(filename, "%s/index.xml", epgdir); + filename = (std::string)epgdir + "/index.xml"; - rename(tmpname, filename); + rename(tmpname.c_str(), filename.c_str()); return ; } diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index c6862876f..bbe3d6174 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -55,6 +55,7 @@ libneutrino_gui_a_SOURCES = \ imageinfo.cpp \ info_menue.cpp \ infoviewer.cpp \ + infoviewer_bb.cpp \ keybind_setup.cpp \ mediaplayer.cpp \ mediaplayer_setup.cpp \ diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index bb19b7183..7be0f7c5b 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -71,9 +71,6 @@ extern CBouquetList * bouquetList; /* neutrino.cpp */ extern CPictureViewer * g_PicViewer; extern cVideo * videoDecoder; -#define COL_INFOBAR_BUTTONS (COL_INFOBAR_SHADOW + 1) -#define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) - #define LEFT_OFFSET 5 @@ -91,25 +88,23 @@ CInfoViewer::CInfoViewer () { sigscale = NULL; snrscale = NULL; - hddscale = NULL; - varscale = NULL; timescale = NULL; + frameBuffer = CFrameBuffer::getInstance(); + infoViewerBB = CInfoViewerBB::getInstance(); + Init(); + infoViewerBB->Init(); } CInfoViewer::~CInfoViewer() { delete sigscale; delete snrscale; - delete hddscale; - delete varscale; delete timescale; } void CInfoViewer::Init() { - frameBuffer = CFrameBuffer::getInstance (); - BoxStartX = BoxStartY = BoxEndX = BoxEndY = 0; recordModeActive = false; is_visible = false; @@ -123,10 +118,7 @@ void CInfoViewer::Init() SDT_freq_update = false; /* maybe we should not tie this to the blinkenlights settings? */ - if (g_settings.casystem_display < 2) - bottom_bar_offset = 22; - else - bottom_bar_offset = 0; + infoViewerBB->setBBOffset(); /* after font size changes, Init() might be called multiple times */ changePB(); @@ -138,26 +130,6 @@ void CInfoViewer::Init() channel_id = CZapit::getInstance()->GetCurrentChannelID();; lcdUpdateTimer = 0; - - int dummy_h; - frameBuffer->getIconSize(NEUTRINO_ICON_16_9_GREY, &icon_large_width, &dummy_h); - if (icon_large_width == 0) - icon_large_width = 26; - - frameBuffer->getIconSize(NEUTRINO_ICON_VTXT_GREY, &icon_small_width, &dummy_h); - if (icon_small_width == 0) - icon_small_width = 16; - - frameBuffer->getIconSize(NEUTRINO_ICON_RESOLUTION_000, &icon_xres_width, &dummy_h); - if (icon_xres_width == 0) - icon_xres_width = 28; - - if (g_settings.infobar_show_res >= 2) - icon_xres_width = 0; - - frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED2_GREY, &icon_crypt_width, &dummy_h); - if (icon_crypt_width == 0) - icon_crypt_width = 24; } /* @@ -186,10 +158,9 @@ void CInfoViewer::Init() */ void CInfoViewer::start () { - InfoHeightY = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight()*9/8 + - 2*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + - 25; - InfoHeightY_Info = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+ 5; + InfoHeightY = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight() * 9/8 + + 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + 25; + infoViewerBB->Init(); if ( g_settings.infobar_show_channellogo != 3 && g_settings.infobar_show_channellogo != 5 && g_settings.infobar_show_channellogo != 6) /* 3 & 5 & 6 is "default" with sigscales etc. */ { @@ -212,19 +183,11 @@ void CInfoViewer::start () BoxStartX = g_settings.screen_StartX + 10; BoxEndX = g_settings.screen_EndX - 10; - BoxEndY = g_settings.screen_EndY - 10 - InfoHeightY_Info - bottom_bar_offset; + BoxEndY = g_settings.screen_EndY - 10 - infoViewerBB->InfoHeightY_Info - infoViewerBB->bottom_bar_offset; BoxStartY = BoxEndY - InfoHeightY - ChanHeight / 2; - BBarY = BoxEndY + bottom_bar_offset; - BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()) / 2; /* center in buttonbar */ - ChanNameY = BoxStartY + (ChanHeight / 2) + SHADOW_OFFSET; //oberkante schatten? ChanInfoX = BoxStartX + (ChanWidth / 3); - /* assuming all color icons must have same size */ - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - asize = (BoxEndX - (2*icon_large_width + 2*icon_small_width + 4*2) - 102) - ChanInfoX; - asize = asize - (icol_w+6)*4; - asize = asize / 4; time_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight()+5; time_left_width = 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getWidth(); /* still a kludge */ @@ -241,30 +204,13 @@ void CInfoViewer::changePB() const short red_bar = 40; const short yellow_bar = 70; const short green_bar = 100; - int w = 0, h = 0; - frameBuffer->getIconSize(NEUTRINO_ICON_16_9, &w, &h); - if (w > 26) { // larger icons - if (g_settings.screen_preset == 1) - w = (g_settings.casystem_display == 2) ? 6 : 10; // LCD - else - w = (g_settings.casystem_display == 2) ? 4 : 7; // CRT - } - else // org. icons - w = 10; - hddwidth = frameBuffer->getScreenWidth(true) * w / 128; /* 40...100 pix if screen is 1280 wide */ if (sigscale != NULL) delete sigscale; sigscale = new CProgressBar(true, bar_width, 10, red_bar, green_bar, yellow_bar); if (snrscale != NULL) delete snrscale; snrscale = new CProgressBar(true, bar_width, 10, red_bar, green_bar, yellow_bar); - if (hddscale != NULL) - delete hddscale; - hddscale = new CProgressBar(true, hddwidth, 6, 50, green_bar, 75, true); - if (varscale != NULL) - delete varscale; - varscale = new CProgressBar(true, hddwidth, 6, 50, green_bar, 75, true); if (timescale != NULL) delete timescale; timescale = new CProgressBar(true, -1, -1, 30, green_bar, yellow_bar, true); @@ -399,7 +345,7 @@ void CInfoViewer::paintBackground(int col_NumBox) int c_rad_mid = RADIUS_MID; int BoxEndInfoY = BoxEndY; if (showButtonBar) // add button bar and blinkenlights - BoxEndInfoY += InfoHeightY_Info + bottom_bar_offset; + BoxEndInfoY += infoViewerBB->InfoHeightY_Info + infoViewerBB->bottom_bar_offset; // kill left side frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY + ChanHeight - 6, @@ -431,78 +377,6 @@ void CInfoViewer::paintBackground(int col_NumBox) col_NumBox, c_rad_mid); } -void CInfoViewer::paintCA_bar(int left, int right) -{ - int xcnt = (BoxEndX - ChanInfoX) / 4; - int ycnt = bottom_bar_offset / 4; - if (right) - right = xcnt - ((right/4)+1); - if (left) - left = xcnt - ((left/4)-1); - - frameBuffer->paintBox(ChanInfoX + (right*4), BoxEndY, BoxEndX - (left*4), BoxEndY + bottom_bar_offset, COL_BLACK); - - if (left) - left -= 1; - - for (int i = 0 + right; i < xcnt - left; i++) { - for (int j = 0; j < ycnt; j++) { - /* BoxEndY + 2 is the magic number that also appears in paint_ca_icons */ - frameBuffer->paintBoxRel((ChanInfoX + 2) + i*4, BoxEndY + 2 + j*4, 2, 2, COL_INFOBAR_PLUS_1); - } - } -} - -void CInfoViewer::paintshowButtonBar() -{ - sec_timer_id = g_RCInput->addTimer (1*1000*1000, false); - - if (g_settings.casystem_display < 2) { - paintCA_bar(0,0); - } - frameBuffer->paintBoxRel(ChanInfoX, BBarY, BoxEndX - ChanInfoX, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND, RADIUS_SMALL, CORNER_BOTTOM); //round - - showSNR(); - //frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_BLUE, ChanInfoX + 16*3 + asize * 3 + 2*6, - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_BLUE, ChanInfoX + 10 + (icol_w + 4 + asize + 2) * 3, - BBarY, InfoHeightY_Info); - - std::string txt = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_BLUE]; - if (txt.empty()) - txt = g_Locale->getText(LOCALE_INFOVIEWER_STREAMINFO); - - int icons_offset = (2*(icon_large_width + 2)) + icon_small_width +2 +2; - ButtonWidth = (BoxEndX - ChanInfoX - icons_offset) >> 2; - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX + 10 + (icol_w + 4 + asize + 2) * 3 + icol_w + 4, - BBarFontY, ButtonWidth - (2 + icol_w + 4 + 2), txt, COL_INFOBAR_BUTTONS, 0, true); // UTF-8 - - showButton_Audio (); - showButton_SubServices (); - showIcon_CA_Status(0); - showIcon_16_9 (); - showIcon_VTXT (); - showIcon_SubT(); - showIcon_Resolution(); - showIcon_Tuner(); -} - -void CInfoViewer::showIcon_Tuner() const -{ - int tuner_x = BoxEndX - 2 - (((g_settings.casystem_display !=2) ? 0:icon_crypt_width )+ icon_xres_width + 2*icon_large_width + 3*icon_small_width + ((g_settings.casystem_display !=2) ?5:6)*2); - int tuner = 1 + CFEManager::getInstance()->getLiveFE()->getNumber(); - const char *icon_name = NULL; - switch (tuner) { - case 2: - icon_name = NEUTRINO_ICON_TUNER_2; - break; - case 1: - default: - icon_name = NEUTRINO_ICON_TUNER_1; - break; - } - frameBuffer->paintIcon(icon_name, tuner_x, BBarY, InfoHeightY_Info); -} - void CInfoViewer::show_current_next(bool new_chan, int epgpos) { //info_CurrentNext = getEPG (channel_id); @@ -594,6 +468,7 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel fader.StartFadeIn(); is_visible = true; + infoViewerBB->is_visible = true; ChannelName = Channel; channel_id = 0; @@ -608,7 +483,7 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel showRecordIcon (show_dot); show_dot = !show_dot; showInfoFile(); - paintshowButtonBar(); + infoViewerBB->paintshowButtonBar(); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + time_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 ,ChannelName, COL_INFOBAR, 0, true); // UTF-8 @@ -657,9 +532,8 @@ void CInfoViewer::reset_allScala() sigscale->reset(); snrscale->reset(); timescale->reset(); - hddscale->reset(); - varscale->reset(); - lastsig = lastsnr = lasthdd = lastvar = -1; + lastsig = lastsnr = -1; + infoViewerBB->reset_allScala(); } void CInfoViewer::check_channellogo_ca_SettingsChange() @@ -667,11 +541,7 @@ void CInfoViewer::check_channellogo_ca_SettingsChange() if (casysChange != g_settings.casystem_display || channellogoChange != g_settings.infobar_show_channellogo) { casysChange = g_settings.casystem_display; channellogoChange = g_settings.infobar_show_channellogo; - - if (g_settings.casystem_display < 2) - bottom_bar_offset = 22; - else - bottom_bar_offset = 0; + infoViewerBB->setBBOffset(); start(); } } @@ -711,6 +581,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con fader.StartFadeIn(); is_visible = true; + infoViewerBB->is_visible = true; int col_NumBoxText = COL_INFOBAR; int col_NumBox = COL_INFOBAR_PLUS_0; @@ -751,7 +622,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con showInfoFile(); if (showButtonBar) { - paintshowButtonBar(); + infoViewerBB->paintshowButtonBar(); } int ChanNumWidth = 0; @@ -844,7 +715,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con if ((g_settings.radiotext_enable) && (!recordModeActive) && (!calledFromNumZap)) showRadiotext(); else - showIcon_RadioText(false); + infoViewerBB->showIcon_RadioText(false); } if (!calledFromNumZap) { @@ -915,8 +786,9 @@ void CInfoViewer::loop(bool show_dot) if ((g_settings.radiotext_enable) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio)) showRadiotext(); - showIcon_16_9(); - showIcon_Resolution(); + infoViewerBB->showIcon_16_9(); + infoViewerBB->showIcon_CA_Status(0); + infoViewerBB->showIcon_Resolution(); } else if ((g_settings.mode_left_right_key_tv == SNeutrinoSettings::VZAP) && ((msg == CRCInput::RC_right) || (msg == CRCInput::RC_left ))) { virtual_zap_mode = true; res = messages_return::cancel_all; @@ -1102,142 +974,6 @@ void CInfoViewer::showSubchan () } } -void CInfoViewer::showIcon_RadioText(bool /*rt_available*/) const -// painting the icon for radiotext mode -{ -#if 0 - if (showButtonBar) - { - int mode = CNeutrinoApp::getInstance()->getMode(); - std::string rt_icon = "radiotextoff.raw"; - if ((!virtual_zap_mode) && (!recordModeActive) && (mode == NeutrinoMessages::mode_radio)) - { - if (g_settings.radiotext_enable){ - rt_icon = rt_available ? "radiotextget.raw" : "radiotextwait.raw"; - } - } - frameBuffer->paintIcon(rt_icon, BoxEndX - (ICON_LARGE_WIDTH + 2 + ICON_LARGE_WIDTH + 2 + ICON_SMALL_WIDTH + 2 + ICON_SMALL_WIDTH + 6),BoxEndY + (InfoHeightY_Info - ICON_HEIGHT) / 2); - } -#endif -} - -void CInfoViewer::showIcon_16_9 () -{ - if ((aspectRatio == 0) || ( g_RemoteControl->current_PIDs.PIDs.vpid == 0 ) || (aspectRatio != videoDecoder->getAspectRatio())) { - if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ) { - aspectRatio = videoDecoder->getAspectRatio(); - } - else { - aspectRatio = 0; - } - frameBuffer->paintIcon((aspectRatio > 2) ? NEUTRINO_ICON_16_9 : NEUTRINO_ICON_16_9_GREY, - BoxEndX - (2*icon_large_width + 2*icon_small_width + 4*2), BBarY, - InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); - } -} - -void CInfoViewer::showIcon_VTXT () const -{ - frameBuffer->paintIcon((g_RemoteControl->current_PIDs.PIDs.vtxtpid != 0) ? NEUTRINO_ICON_VTXT : NEUTRINO_ICON_VTXT_GREY, - BoxEndX - (2*icon_small_width + 2*2), BBarY, InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); -} - -void CInfoViewer::showIcon_Resolution() const -{ - int xres, yres, framerate; - const char *icon_name = NULL; - if (videoDecoder->getBlank()) { - icon_name = NEUTRINO_ICON_RESOLUTION_000; - } else { - if (g_settings.infobar_show_res == 0) {//show resolution icon on infobar - videoDecoder->getPictureInfo(xres, yres, framerate); - switch (yres) { - case 1920: - icon_name = NEUTRINO_ICON_RESOLUTION_1920; - break; - case 1088: - icon_name = NEUTRINO_ICON_RESOLUTION_1080; - break; - case 1440: - icon_name = NEUTRINO_ICON_RESOLUTION_1440; - break; - case 1280: - icon_name = NEUTRINO_ICON_RESOLUTION_1280; - break; - case 720: - icon_name = NEUTRINO_ICON_RESOLUTION_720; - break; - case 704: - icon_name = NEUTRINO_ICON_RESOLUTION_704; - break; - case 576: - icon_name = NEUTRINO_ICON_RESOLUTION_576; - break; - case 544: - icon_name = NEUTRINO_ICON_RESOLUTION_544; - break; - case 528: - icon_name = NEUTRINO_ICON_RESOLUTION_528; - break; - case 480: - icon_name = NEUTRINO_ICON_RESOLUTION_480; - break; - case 382: - icon_name = NEUTRINO_ICON_RESOLUTION_382; - break; - case 352: - icon_name = NEUTRINO_ICON_RESOLUTION_352; - break; - case 288: - icon_name = NEUTRINO_ICON_RESOLUTION_288; - break; - default: - icon_name = NEUTRINO_ICON_RESOLUTION_000; - break; - } - } - if (g_settings.infobar_show_res == 1) {//show simple resolution icon on infobar - videoDecoder->getPictureInfo(xres, yres, framerate); - switch (yres) { - case 1920: - case 1440: - case 1280: - case 1088: - case 720: - icon_name = NEUTRINO_ICON_RESOLUTION_HD; - break; - case 704: - case 576: - case 544: - case 528: - case 480: - case 382: - case 352: - case 288: - icon_name = NEUTRINO_ICON_RESOLUTION_SD; - break; - default: - icon_name = NEUTRINO_ICON_RESOLUTION_000; - break; - } - } - } - if (g_settings.infobar_show_res < 2) - frameBuffer->paintIcon(icon_name, BoxEndX - (icon_xres_width + 2*icon_large_width + 2*icon_small_width + 5*2), BBarY, - InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); -} - -void CInfoViewer::showIcon_SubT() const -{ - bool have_sub = false; - CZapitChannel * cc = CNeutrinoApp::getInstance()->channelList->getChannel(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()); - if (cc && cc->getSubtitleCount()) - have_sub = true; - - frameBuffer->paintIcon(have_sub ? NEUTRINO_ICON_SUBT : NEUTRINO_ICON_SUBT_GREY, BoxEndX - (icon_small_width + 2), - BBarY, InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); -} - void CInfoViewer::showFailure () { ShowHintUTF (LOCALE_MESSAGEBOX_ERROR, g_Locale->getText (LOCALE_INFOVIEWER_NOTAVAILABLE), 430); // UTF-8 @@ -1260,15 +996,14 @@ void CInfoViewer::killRadiotext() void CInfoViewer::showRadiotext() { char stext[3][100]; -// int yoff = 8; - int ii = 0; bool RTisIsUTF = false; if (g_Radiotext == NULL) return; - showIcon_RadioText(g_Radiotext->haveRadiotext()); + infoViewerBB->showIcon_RadioText(g_Radiotext->haveRadiotext()); if (g_Radiotext->S_RtOsd) { // dimensions of radiotext window + int /*yoff = 8,*/ ii = 0; rt_dx = BoxEndX - BoxStartX; rt_dy = 25; rt_x = BoxStartX; @@ -1406,11 +1141,11 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::EVT_ZAP_GOTPIDS) { if ((*(t_channel_id *) data) == channel_id) { if (is_visible && showButtonBar) { - showIcon_VTXT (); - showIcon_SubT(); - showIcon_CA_Status (0); - showIcon_Resolution(); - showIcon_Tuner(); + infoViewerBB->showIcon_VTXT(); + infoViewerBB->showIcon_SubT(); + infoViewerBB->showIcon_CA_Status(0); + infoViewerBB->showIcon_Resolution(); + infoViewerBB->showIcon_Tuner(); } } return messages_return::handled; @@ -1444,7 +1179,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::EVT_ZAP_GOTAPIDS) { if ((*(t_channel_id *) data) == channel_id) { if (is_visible && showButtonBar) - showButton_Audio (); + infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_AUDIO); if (g_settings.radiotext_enable && g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio)) g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid); } @@ -1452,7 +1187,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::EVT_ZAP_GOT_SUBSERVICES) { if ((*(t_channel_id *) data) == channel_id) { if (is_visible && showButtonBar) - showButton_SubServices (); + infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_SUBS); } return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_ZAP_SUB_COMPLETE) { @@ -1496,7 +1231,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) } else if (msg == NeutrinoMessages::EVT_MODECHANGED) { aspectRatio = data; if (is_visible && showButtonBar) - showIcon_16_9 (); + infoViewerBB->showIcon_16_9 (); return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_TIMESET) { gotTime = true; @@ -1515,23 +1250,6 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) return messages_return::unhandled; } -void CInfoViewer::showButton_SubServices () -{ - if (!(g_RemoteControl->subChannels.empty ())) { - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, - ChanInfoX + 10 + (icol_w + 4 + asize + 2) * 2, BBarY, InfoHeightY_Info); - /*ChanInfoX + 10 + NEUTRINO_ICON_BUTTON_RED_WIDTH + 4 + asize + 2 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 4 + asize + 2, BBarY, InfoHeightY_Info);*/ - std::string txt = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_YELLOW]; - if (txt.empty()) - txt = g_Locale->getText((g_RemoteControl->are_subchannels) ? LOCALE_INFOVIEWER_SUBSERVICE : LOCALE_INFOVIEWER_SELECTTIME); - - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString( - ChanInfoX + 10 + (icol_w + 4 + asize + 2) * 2 + icol_w + 4, - /*ChanInfoX + 10 + NEUTRINO_ICON_BUTTON_RED_WIDTH + 4 + asize + 2 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 4 + asize + 2 + NEUTRINO_ICON_BUTTON_YELLOW_WIDTH + 4,*/ - BBarFontY, asize, txt, COL_INFOBAR_BUTTONS, 0, true); // UTF-8 - } -} - CSectionsdClient::CurrentNextInfo CInfoViewer::getEPG (const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info) { static CSectionsdClient::CurrentNextInfo oldinfo; @@ -1630,27 +1348,7 @@ void CInfoViewer::showSNR () g_SignalFont->RenderString (posx, posy + height, sw, percent, COL_INFOBAR); } } - if (g_settings.infobar_show_var_hdd) { - struct statfs s; - int per = 0; - if (::statfs("/var", &s) == 0) { - per = (s.f_blocks - s.f_bfree) / (s.f_blocks/100); - } - /* center the scales in the button bar. BBarY + InfoHeightY_Info / 2 is middle, - scales are 6 pixels high, icons are 16 pixels, so keep 4 pixels free between - the scales */ - int scale_x = BoxEndX - (((g_settings.casystem_display !=2) ? 0:icon_crypt_width )+ icon_xres_width + 2*icon_large_width + 3*icon_small_width + ((g_settings.casystem_display !=2) ?5:6)*2) - hddwidth - 2; - varscale->paintProgressBar(scale_x, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth , 6, per, 100); - per = 0; - //HD info - if(!check_dir(g_settings.network_nfs_recordingdir)) { - if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0 && s.f_blocks) { - long blocks_used = s.f_blocks - s.f_bfree; - per = (blocks_used * 100ULL) / s.f_blocks; - } - } - hddscale->paintProgressBar(scale_x, BBarY + InfoHeightY_Info / 2 + 2, hddwidth, 6, per, 100); - } + infoViewerBB->showSysfsHdd(); } void CInfoViewer::display_Info(const char *current, const char *next, @@ -1822,13 +1520,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) frameBuffer->paintBackgroundBoxRel (BoxEndX - 108, posy, 112, height2); } #endif - if (info_CurrentNext.flags & CSectionsdClient::epgflags::has_anything) { - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RED, ChanInfoX + 10, BBarY, InfoHeightY_Info); - std::string txt = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_RED]; - if (txt.empty()) - txt = g_Locale->getText(LOCALE_INFOVIEWER_EVENTLIST); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX + (10 + icol_w + 4), BBarFontY, asize, txt, COL_INFOBAR_BUTTONS, 0, true); // UTF-8 - } + infoViewerBB->showBBButtons(CInfoViewerBB::BUTTON_EPG); } if ((info_CurrentNext.flags & CSectionsdClient::epgflags::not_broadcast) || @@ -1996,49 +1688,15 @@ void CInfoViewer::showInfoFile() xStart + xOffset + tIndent, yStart + height, width - xOffset, (std::string)infotext, COL_INFOBAR, height, false); } - -void CInfoViewer::showButton_Audio () -{ - // green, in case of several APIDs - uint32_t count = g_RemoteControl->current_PIDs.APIDs.size (); - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, - ChanInfoX + 10 + icol_w + 4 + asize + 2, - BBarY, InfoHeightY_Info); - - std::string txt = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_GREEN]; - if (count > 0) { - int selected = g_RemoteControl->current_PIDs.PIDs.selected_apid; - /*int sx = ChanInfoX + 10 + NEUTRINO_ICON_BUTTON_RED_WIDTH + 4 + asize + 2 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 4;*/ - int sx = ChanInfoX + 10 + (icol_w + 4)*2 + asize + 2; - - frameBuffer->paintBoxRel(sx, BBarY, asize, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND); - - if (txt.empty() || (txt == g_Locale->getText(LOCALE_AUDIOSELECTMENUE_HEAD))) - txt = g_RemoteControl->current_PIDs.APIDs[selected].desc; - - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(sx, BBarFontY, asize, - txt, COL_INFOBAR_BUTTONS, 0, true); // UTF-8 - } - const char *dd_icon; - if ((g_RemoteControl->current_PIDs.PIDs.selected_apid < count) && (g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].is_ac3)) - dd_icon = NEUTRINO_ICON_DD; - else if (g_RemoteControl->has_ac3) - dd_icon = NEUTRINO_ICON_DD_AVAIL; - else - dd_icon = NEUTRINO_ICON_DD_GREY; - - frameBuffer->paintIcon(dd_icon, BoxEndX - (icon_large_width + 2*icon_small_width + 3*2), - BBarY, InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); -} - void CInfoViewer::killTitle() { if (is_visible) { is_visible = false; - int bottom = BoxEndY + SHADOW_OFFSET + bottom_bar_offset; + infoViewerBB->is_visible = false; + int bottom = BoxEndY + SHADOW_OFFSET + infoViewerBB->bottom_bar_offset; if (showButtonBar) - bottom += InfoHeightY_Info; + bottom += infoViewerBB->InfoHeightY_Info; //printf("killTitle(%d, %d, %d, %d)\n", BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET-BoxStartX, bottom-BoxStartY); frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET, bottom); if (g_settings.radiotext_enable && g_Radiotext) { @@ -2052,7 +1710,7 @@ void CInfoViewer::killTitle() void CInfoViewer::Set_CA_Status (int /*Status*/) { if (is_visible && showButtonBar) - showIcon_CA_Status (1); + infoViewerBB->showIcon_CA_Status(1); } /****************************************************************************** @@ -2240,108 +1898,3 @@ int CInfoViewerHandler::exec (CMenuTarget * parent, const std::string & /*action return res; } - -void CInfoViewer::paint_ca_icons(int caid, char * icon, int &icon_space_offset) -{ - char buf[20]; - int endx = BoxEndX -3; - int py = BoxEndY + 2; /* hand-crafted, should be automatic */ - int px = 0; - static map > icon_map; - const int icon_space = 10, icon_number = 10; - - static int icon_offset[icon_number] = {0,0,0,0,0,0,0,0,0,0}; - static int icon_sizeW [icon_number] = {0,0,0,0,0,0,0,0,0,0}; - static bool init_flag = false; - - if (!init_flag) { - init_flag = true; - int icon_sizeH = 0, index = 0; - map >::const_iterator it; - - icon_map[0x0E00] = std::make_pair(index++,"powervu"); - icon_map[0x4A00] = std::make_pair(index++,"d"); - icon_map[0x2600] = std::make_pair(index++,"biss"); - icon_map[0x0600] = std::make_pair(index++,"ird"); - icon_map[0x0100] = std::make_pair(index++,"seca"); - icon_map[0x0500] = std::make_pair(index++,"via"); - icon_map[0x1800] = std::make_pair(index++,"nagra"); - icon_map[0x0B00] = std::make_pair(index++,"conax"); - icon_map[0x0D00] = std::make_pair(index++,"cw"); - icon_map[0x0900] = std::make_pair(index ,"nds"); - - for (it=icon_map.begin(); it!=icon_map.end(); ++it) { - snprintf(buf, sizeof(buf), "%s_%s", (*it).second.second, icon); - frameBuffer->getIconSize(buf, &icon_sizeW[(*it).second.first], &icon_sizeH); - } - - for (int j = 0; j < icon_number; j++) { - for (int i = j; i < icon_number; i++) { - icon_offset[j] += icon_sizeW[i] + icon_space; - } - } - } - - if (g_settings.casystem_display == 0) { - px = endx - (icon_offset[icon_map[( caid & 0xFF00 )].first] - icon_space ); - } else { - icon_space_offset += icon_sizeW[icon_map[( caid & 0xFF00 )].first]; - px = endx - icon_space_offset; - icon_space_offset += 4; - } - - if (px) { - snprintf(buf, sizeof(buf), "%s_%s", icon_map[( caid & 0xFF00 )].second, icon); - frameBuffer->paintIcon(buf, px, py ); - } -} - -void CInfoViewer::showOne_CAIcon(bool fta) -{ - frameBuffer->paintIcon(fta ? NEUTRINO_ICON_SCRAMBLED2_GREY : NEUTRINO_ICON_SCRAMBLED2, BoxEndX - (icon_xres_width + icon_crypt_width + 2*icon_large_width + 2*icon_small_width + 6*2), BBarY, - InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); -} - -void CInfoViewer::showIcon_CA_Status (int notfirst) -{ - int caids[] = { 0x600, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 }; - int i = 0; - - if (g_settings.casystem_display == 3) - return; - - CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); - if(!channel) - return; - - if (g_settings.casystem_display == 2) { - bool fta = (channel->camap.size() == 0); - showOne_CAIcon(fta); - return; - } - - const char * white = (char *) "white"; - const char * yellow = (char *) "yellow"; - static int icon_space_offset = 0; - - if(!notfirst) { - if ((g_settings.casystem_display == 1) && (icon_space_offset)) { - paintCA_bar(0,icon_space_offset); - icon_space_offset = 0; - } - for (i = 0; i < (int)(sizeof(caids)/sizeof(int)); i++) { - bool found = false; - for(casys_map_iterator_t it = channel->camap.begin(); it != channel->camap.end(); ++it) { - int caid = (*it) & 0xFF00; - if (caid == 0x1700) - caid = 0x0600; - if((found = (caid == caids[i]))) - break; - } - if(g_settings.casystem_display == 0) - paint_ca_icons(caids[i], (char *) (found ? yellow : white), icon_space_offset); - else if(found) - paint_ca_icons(caids[i], (char *) yellow, icon_space_offset); - } - } -} diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 93c2a3a04..34c759c66 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -41,6 +41,7 @@ #include #include #include "widget/menue.h" +#include #include #include #include @@ -48,9 +49,10 @@ class CInfoViewer { private: - void Init(void); + CFrameBuffer * frameBuffer; - + CInfoViewerBB* infoViewerBB; + bool gotTime; bool recordModeActive; #ifndef SKIP_CA_STATUS @@ -58,12 +60,8 @@ class CInfoViewer #endif int InfoHeightY; - int InfoHeightY_Info; - bool showButtonBar; bool fileplay; - int BoxEndX; - int BoxEndY; int BoxStartX; int BoxStartY; int ButtonWidth; @@ -82,22 +80,10 @@ class CInfoViewer int ChanNameY; int ChanWidth; int ChanHeight; - int ChanInfoX; - /* the position of the button bar */ - int BBarY; - int BBarIconY; - int BBarFontY; - - int asize; - int icol_w, icol_h; - int icon_large_width, icon_small_width, icon_xres_width, icon_crypt_width; CSectionsdClient::CurrentNextInfo info_CurrentNext; t_channel_id channel_id; - char aspectRatio; - - uint32_t sec_timer_id; //uint32_t fadeTimer; COSDFader fader; @@ -106,7 +92,6 @@ class CInfoViewer int time_width; int time_height; int info_time_width; - int bottom_bar_offset; bool newfreq ; char old_timestr[10]; @@ -118,9 +103,8 @@ class CInfoViewer CChannelEventList evtlist; CChannelEventList::iterator eli; - int lastsnr, lastsig, lasthdd, lastvar, lasttime; - CProgressBar *snrscale, *sigscale, *hddscale, *varscale, *timescale; - int hddwidth; + int lastsnr, lastsig, lasttime; + CProgressBar *snrscale, *sigscale, *timescale; bool casysChange; bool channellogoChange; void paintBackground(int col_Numbox); @@ -132,45 +116,38 @@ class CInfoViewer bool update_current = true, bool update_next = true); void paintTime( bool show_dot, bool firstPaint ); - void showButton_Audio(); - void showButton_SubServices(); - - void showIcon_16_9(); - void showIcon_RadioText(bool rt_available) const; - void showIcon_CA_Status(int); - void paint_ca_icons(int, char*, int&); - void paintCA_bar(int,int); - void showOne_CAIcon(bool); - - void showIcon_VTXT() const; void showRecordIcon(const bool show); - void showIcon_SubT() const; - void showIcon_Resolution() const; void showIcon_Tuner() const; void showFailure(); void showMotorMoving(int duration); void showLcdPercentOver(); int showChannelLogo(const t_channel_id logo_channel_id, const int channel_number_width); - void showSNR(); void showRadiotext(); void killRadiotext(); void showInfoFile(); //void loop(int fadeValue, bool show_dot ,bool fadeIn); void loop(bool show_dot); std::string eventname; - void paintshowButtonBar(); void show_current_next(bool new_chan, int epgpos); void reset_allScala(); void check_channellogo_ca_SettingsChange(); public: - bool chanready; - bool is_visible; - bool virtual_zap_mode; - uint32_t lcdUpdateTimer; + bool chanready; + bool is_visible; + bool virtual_zap_mode; + uint32_t lcdUpdateTimer; + char aspectRatio; + uint32_t sec_timer_id; + + int BoxEndX; + int BoxEndY; + int ChanInfoX; + bool showButtonBar; CInfoViewer(); ~CInfoViewer(); + void showMovieTitle(const int playState, const std::string &title, const std::string &g_file_epg, const std::string &g_file_epg1, const int duration, const int curr_pos); @@ -189,8 +166,10 @@ class CInfoViewer int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data); void clearVirtualZapMode() {virtual_zap_mode = false;} - void changePB(); - bool SDT_freq_update; + void changePB(); + void showSNR(); + void Init(void); + bool SDT_freq_update; }; class CInfoViewerHandler : public CMenuTarget diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp new file mode 100644 index 000000000..4a9eefcf9 --- /dev/null +++ b/src/gui/infoviewer_bb.cpp @@ -0,0 +1,778 @@ +/* + Neutrino-GUI - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + Kommentar: + + Diese GUI wurde von Grund auf neu programmiert und sollte nun vom + Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert + auf der Client-Server Idee, diese GUI ist also von der direkten DBox- + Steuerung getrennt. Diese wird dann von Daemons uebernommen. + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ +extern cVideo * videoDecoder; + +//#define SHOW_RADIOTEXT_ICON +#define COL_INFOBAR_BUTTONS (COL_INFOBAR_SHADOW + 1) +#define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) + +CInfoViewerBB::CInfoViewerBB() +{ + frameBuffer = CFrameBuffer::getInstance(); + + is_visible = false; + scrambledErr = false; + scrambledErrSave = false; + scrambledNoSig = false; + scrambledNoSigSave = false; + scrambledT = 0; + if(!scrambledT) { + pthread_create(&scrambledT, NULL, scrambledThread, (void*) this) ; + pthread_detach(scrambledT); + } + Init(); +} + +void CInfoViewerBB::Init() +{ + hddscale = NULL; + varscale = NULL; + hddwidth = 0; + bbIconMaxH = 0; + bbButtonMaxH = 0; + bbIconMinX = 0; + bbButtonMaxX = 0; + fta = true; + minX = 0; + + for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + tmp_bbButtonInfoText[i] = ""; + } + + InfoHeightY_Info = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() + 5; + setBBOffset(); + + changePB(); +} + +CInfoViewerBB::~CInfoViewerBB() +{ + if(scrambledT) { + pthread_cancel(scrambledT); + scrambledT = 0; + } +} + +CInfoViewerBB* CInfoViewerBB::getInstance() +{ + static CInfoViewerBB* InfoViewerBB = NULL; + + if(!InfoViewerBB) { + InfoViewerBB = new CInfoViewerBB(); + } + return InfoViewerBB; +} + +bool CInfoViewerBB::checkBBIcon(const char * const icon, int *w, int *h) +{ + frameBuffer->getIconSize(icon, w, h); + if ((*w != 0) && (*h != 0)) + return true; + return false; +} + +void CInfoViewerBB::getBBIconInfo() +{ + bbIconMaxH = 0; + BBarY = g_InfoViewer->BoxEndY + bottom_bar_offset; + BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()) / 2; /* center in buttonbar */ + bbIconMinX = g_InfoViewer->BoxEndX; + CNeutrinoApp* neutrino = CNeutrinoApp::getInstance(); + + for (int i = 0; i < CInfoViewerBB::ICON_MAX; i++) { + int w = 0, h = 0; + bool iconView = false; + switch (i) { + case CInfoViewerBB::ICON_SUBT: //no radio + if (neutrino->getMode() != NeutrinoMessages::mode_radio) + iconView = checkBBIcon(NEUTRINO_ICON_SUBT, &w, &h); + break; + case CInfoViewerBB::ICON_VTXT: //no radio + if (neutrino->getMode() != NeutrinoMessages::mode_radio) + iconView = checkBBIcon(NEUTRINO_ICON_VTXT, &w, &h); + break; +#ifdef SHOW_RADIOTEXT_ICON + case CInfoViewerBB::ICON_RT: + if (neutrino->getMode() == NeutrinoMessages::mode_radio) + iconView = checkBBIcon(NEUTRINO_ICON_RT, &w, &h); + break; +#endif + case CInfoViewerBB::ICON_DD: + iconView = checkBBIcon(NEUTRINO_ICON_DD, &w, &h); + break; + case CInfoViewerBB::ICON_16_9: //no radio + if (neutrino->getMode() != NeutrinoMessages::mode_radio) + iconView = checkBBIcon(NEUTRINO_ICON_16_9, &w, &h); + break; + case CInfoViewerBB::ICON_RES: //no radio + if ((g_settings.infobar_show_res < 2) && (neutrino->getMode() != NeutrinoMessages::mode_radio)) + iconView = checkBBIcon(NEUTRINO_ICON_RESOLUTION_1280, &w, &h); + break; + case CInfoViewerBB::ICON_CA: + if (g_settings.casystem_display == 2) + iconView = checkBBIcon(NEUTRINO_ICON_SCRAMBLED2, &w, &h); + break; + case CInfoViewerBB::ICON_TUNER: + if (g_settings.infobar_show_tuner == 1) { + iconView = checkBBIcon(NEUTRINO_ICON_TUNER_1, &w, &h); + } + break; + default: + break; + } + if (iconView) { + bbIconMinX -= w + 2; + bbIconInfo[i].x = bbIconMinX; + bbIconInfo[i].h = h; + } + else + bbIconInfo[i].x = -1; + } + for (int i = 0; i < CInfoViewerBB::ICON_MAX; i++) { + if (bbIconInfo[i].x != -1) + bbIconMaxH = std::max(bbIconMaxH, bbIconInfo[i].h); + } + if (g_settings.infobar_show_sysfs_hdd) + bbIconMinX -= hddwidth + 2; +} + +void CInfoViewerBB::getBBButtonInfo() +{ + bbButtonMaxH = 0; + bbButtonMaxX = g_InfoViewer->ChanInfoX; + int bbButtonMaxW = 0; + for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + int w = 0, h = 0; + std::string text, icon; + switch (i) { + case CInfoViewerBB::BUTTON_EPG: + icon = NEUTRINO_ICON_BUTTON_RED; + frameBuffer->getIconSize(icon.c_str(), &w, &h); + text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_RED]; + if (text.empty()) + text = g_Locale->getText(LOCALE_INFOVIEWER_EVENTLIST); + break; + case CInfoViewerBB::BUTTON_AUDIO: + icon = NEUTRINO_ICON_BUTTON_GREEN; + frameBuffer->getIconSize(icon.c_str(), &w, &h); + text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_GREEN]; + if (text == g_Locale->getText(LOCALE_AUDIOSELECTMENUE_HEAD)) + text = ""; + if (g_RemoteControl->current_PIDs.APIDs.size() > 0) { + int selected = g_RemoteControl->current_PIDs.PIDs.selected_apid; + if (text.empty()) + text = g_RemoteControl->current_PIDs.APIDs[selected].desc; + } + break; + case CInfoViewerBB::BUTTON_SUBS: + icon = NEUTRINO_ICON_BUTTON_YELLOW; + frameBuffer->getIconSize(icon.c_str(), &w, &h); + text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_YELLOW]; + if (text.empty()) + text = g_Locale->getText((g_RemoteControl->are_subchannels) ? LOCALE_INFOVIEWER_SUBSERVICE : LOCALE_INFOVIEWER_SELECTTIME); + break; + case CInfoViewerBB::BUTTON_FEAT: + icon = NEUTRINO_ICON_BUTTON_BLUE; + frameBuffer->getIconSize(icon.c_str(), &w, &h); + text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_BLUE]; + if (text.empty()) + text = g_Locale->getText(LOCALE_INFOVIEWER_STREAMINFO); + break; + default: + break; + } + bbButtonInfo[i].w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(text) + w + 10; + bbButtonInfo[i].cx = w + 5; + bbButtonInfo[i].h = h; + bbButtonInfo[i].text = text; + bbButtonInfo[i].icon = icon; + } + // Calculate position/size of buttons + minX = std::min(bbIconMinX, g_InfoViewer->ChanInfoX + (((g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX) * 75) / 100)); + int MaxBr = minX - (g_InfoViewer->ChanInfoX + 10); + bbButtonMaxX = g_InfoViewer->ChanInfoX + 10; + int br = 0; + for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + if ((i == CInfoViewerBB::BUTTON_SUBS) && (g_RemoteControl->subChannels.empty())) { // no subchannels + bbButtonInfo[i].paint = false; +// bbButtonInfo[i].x = -1; +// continue; + } + else + bbButtonInfo[i].paint = true; + br += bbButtonInfo[i].w; + bbButtonInfo[i].x = bbButtonMaxX; + bbButtonMaxX += bbButtonInfo[i].w; + bbButtonMaxW = std::max(bbButtonMaxW, bbButtonInfo[i].w); + } + if (br > MaxBr) { // TODO: Cut to long strings + printf("[infoviewer.cpp - %s, line #%d] width ColorButtons (%d) > MaxBr (%d)\n", __FUNCTION__, __LINE__, br, MaxBr); + } +#if 0 + int Btns = 0; + // counting buttons + for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + if (bbButtonInfo[i].x != -1) { + Btns++; + } + } + bbButtonMaxX = g_InfoViewer->ChanInfoX + 10; + + bbButtonInfo[CInfoViewerBB::BUTTON_EPG].x = bbButtonMaxX; + bbButtonInfo[CInfoViewerBB::BUTTON_FEAT].x = minX - bbButtonInfo[CInfoViewerBB::BUTTON_FEAT].w; + + int x1 = bbButtonInfo[CInfoViewerBB::BUTTON_EPG].x + bbButtonInfo[CInfoViewerBB::BUTTON_EPG].w; + int rest = bbButtonInfo[CInfoViewerBB::BUTTON_FEAT].x - x1; + + if (Btns < 4) { + rest -= bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].w; + bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].x = x1 + rest / 2; + } + else { + rest -= bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].w + bbButtonInfo[CInfoViewerBB::BUTTON_SUBS].w; + rest = rest / 3; + bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].x = x1 + rest; + bbButtonInfo[CInfoViewerBB::BUTTON_SUBS].x = bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].x + + bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].w + rest; + } +#endif +#if 1 + bbButtonMaxX = g_InfoViewer->ChanInfoX + 10; + int step = MaxBr / 4; + bbButtonInfo[CInfoViewerBB::BUTTON_EPG].x = bbButtonMaxX; + bbButtonInfo[CInfoViewerBB::BUTTON_AUDIO].x = bbButtonMaxX + step; + bbButtonInfo[CInfoViewerBB::BUTTON_SUBS].x = bbButtonMaxX + 2*step; + bbButtonInfo[CInfoViewerBB::BUTTON_FEAT].x = bbButtonMaxX + 3*step; +#endif +} + +void CInfoViewerBB::showBBButtons(const int modus) +{ + if (!is_visible) + return; + int i; + bool paint = false; + + getBBButtonInfo(); + for (i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + if (tmp_bbButtonInfoText[i] != bbButtonInfo[i].text) { + paint = true; + break; + } + } + + if (paint) { + frameBuffer->paintBoxRel(g_InfoViewer->ChanInfoX, BBarY, minX - g_InfoViewer->ChanInfoX, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND, RADIUS_SMALL, CORNER_BOTTOM); //round + for (i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + if ((bbButtonInfo[i].x <= g_InfoViewer->ChanInfoX) || (bbButtonInfo[i].x >= g_InfoViewer->BoxEndX) || (!bbButtonInfo[i].paint)) + continue; + if ((bbButtonInfo[i].x > 0) && ((bbButtonInfo[i].x + bbButtonInfo[i].w) <= minX)) { + + frameBuffer->paintIcon(bbButtonInfo[i].icon, bbButtonInfo[i].x, BBarY, InfoHeightY_Info); + + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(bbButtonInfo[i].x + bbButtonInfo[i].cx, BBarFontY, + bbButtonInfo[i].w - bbButtonInfo[i].cx, bbButtonInfo[i].text, COL_INFOBAR_BUTTONS, 0, true); // UTF-8 + } + } + + if (modus == CInfoViewerBB::BUTTON_AUDIO) + showIcon_DD(); + + for (i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + tmp_bbButtonInfoText[i] = bbButtonInfo[i].text; + } + } +} + +void CInfoViewerBB::showBBIcons(const int modus, const std::string & icon) +{ + if ((bbIconInfo[modus].x <= g_InfoViewer->ChanInfoX) || (bbIconInfo[modus].x >= g_InfoViewer->BoxEndX)) + return; + if ((modus >= CInfoViewerBB::ICON_SUBT) && (modus < CInfoViewerBB::ICON_MAX) && (bbIconInfo[modus].x != -1) && (is_visible)) { + frameBuffer->paintIcon(icon, bbIconInfo[modus].x, BBarY, + InfoHeightY_Info, 1, true, true, COL_INFOBAR_BUTTONS_BACKGROUND); + } +} + +void CInfoViewerBB::paintshowButtonBar() +{ + if (!is_visible) + return; + getBBIconInfo(); + for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { + tmp_bbButtonInfoText[i] = ""; + } + g_InfoViewer->sec_timer_id = g_RCInput->addTimer(1*1000*1000, false); + if (g_settings.casystem_display < 2) + paintCA_bar(0,0); + + frameBuffer->paintBoxRel(g_InfoViewer->ChanInfoX, BBarY, g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND, RADIUS_SMALL, CORNER_BOTTOM); //round + + g_InfoViewer->showSNR(); + + // Buttons + showBBButtons(); + + // Icons, starting from right + showIcon_SubT(); + showIcon_VTXT(); + showIcon_DD(); + showIcon_16_9(); + scrambledCheck(true); + showIcon_Tuner(); + showSysfsHdd(); +} + +void CInfoViewerBB::showIcon_SubT() +{ + if (!is_visible) + return; + bool have_sub = false; + CZapitChannel * cc = CNeutrinoApp::getInstance()->channelList->getChannel(CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()); + if (cc && cc->getSubtitleCount()) + have_sub = true; + + showBBIcons(CInfoViewerBB::ICON_SUBT, (have_sub) ? NEUTRINO_ICON_SUBT : NEUTRINO_ICON_SUBT_GREY); +} + +void CInfoViewerBB::showIcon_VTXT() +{ + if (!is_visible) + return; + showBBIcons(CInfoViewerBB::ICON_VTXT, (g_RemoteControl->current_PIDs.PIDs.vtxtpid != 0) ? NEUTRINO_ICON_VTXT : NEUTRINO_ICON_VTXT_GREY); +} + +void CInfoViewerBB::showIcon_DD() +{ + if (!is_visible) + return; + std::string dd_icon; + if ((g_RemoteControl->current_PIDs.PIDs.selected_apid < g_RemoteControl->current_PIDs.APIDs.size()) && + (g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].is_ac3)) + dd_icon = NEUTRINO_ICON_DD; + else + dd_icon = (g_RemoteControl->has_ac3) ? NEUTRINO_ICON_DD_AVAIL : NEUTRINO_ICON_DD_GREY; + + showBBIcons(CInfoViewerBB::ICON_DD, dd_icon); +} + +#ifdef SHOW_RADIOTEXT_ICON +void CInfoViewerBB::showIcon_RadioText(bool rt_available) +{ + // TODO: display radiotext icon + if ((showButtonBar) && (is_visible)) + { + int mode = CNeutrinoApp::getInstance()->getMode(); + + showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); + } +} +#else +void CInfoViewerBB::showIcon_RadioText(bool /*rt_available*/) +{ +} +#endif + +void CInfoViewerBB::showIcon_16_9() +{ + if (!is_visible) + return; + if ((g_InfoViewer->aspectRatio == 0) || ( g_RemoteControl->current_PIDs.PIDs.vpid == 0 ) || (g_InfoViewer->aspectRatio != videoDecoder->getAspectRatio())) { + if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ) { + g_InfoViewer->aspectRatio = videoDecoder->getAspectRatio(); + } + else + g_InfoViewer->aspectRatio = 0; + + showBBIcons(CInfoViewerBB::ICON_16_9, (g_InfoViewer->aspectRatio > 2) ? NEUTRINO_ICON_16_9 : NEUTRINO_ICON_16_9_GREY); + } +} + +void CInfoViewerBB::showIcon_Resolution() +{ + if ((!is_visible) || (g_settings.infobar_show_res == 2)) //show resolution icon is off + return; + const char *icon_name = NULL; + if ((scrambledNoSig) || ((!fta) && (scrambledErr))) { + icon_name = NEUTRINO_ICON_RESOLUTION_000; + } else { + int xres, yres, framerate; + if (g_settings.infobar_show_res == 0) {//show resolution icon on infobar + videoDecoder->getPictureInfo(xres, yres, framerate); + switch (yres) { + case 1920: + icon_name = NEUTRINO_ICON_RESOLUTION_1920; + break; + case 1088: + icon_name = NEUTRINO_ICON_RESOLUTION_1080; + break; + case 1440: + icon_name = NEUTRINO_ICON_RESOLUTION_1440; + break; + case 1280: + icon_name = NEUTRINO_ICON_RESOLUTION_1280; + break; + case 720: + icon_name = NEUTRINO_ICON_RESOLUTION_720; + break; + case 704: + icon_name = NEUTRINO_ICON_RESOLUTION_704; + break; + case 576: + icon_name = NEUTRINO_ICON_RESOLUTION_576; + break; + case 544: + icon_name = NEUTRINO_ICON_RESOLUTION_544; + break; + case 528: + icon_name = NEUTRINO_ICON_RESOLUTION_528; + break; + case 480: + icon_name = NEUTRINO_ICON_RESOLUTION_480; + break; + case 382: + icon_name = NEUTRINO_ICON_RESOLUTION_382; + break; + case 352: + icon_name = NEUTRINO_ICON_RESOLUTION_352; + break; + case 288: + icon_name = NEUTRINO_ICON_RESOLUTION_288; + break; + default: + icon_name = NEUTRINO_ICON_RESOLUTION_000; + break; + } + } + if (g_settings.infobar_show_res == 1) {//show simple resolution icon on infobar + videoDecoder->getPictureInfo(xres, yres, framerate); + switch (yres) { + case 1920: + case 1440: + case 1280: + case 1088: + case 720: + icon_name = NEUTRINO_ICON_RESOLUTION_HD; + break; + case 704: + case 576: + case 544: + case 528: + case 480: + case 382: + case 352: + case 288: + icon_name = NEUTRINO_ICON_RESOLUTION_SD; + break; + default: + icon_name = NEUTRINO_ICON_RESOLUTION_000; + break; + } + } + } + showBBIcons(CInfoViewerBB::ICON_RES, icon_name); +} + +void CInfoViewerBB::showOne_CAIcon() +{ + std::string sIcon = ""; +#if 0 + if (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_radio) { + if (scrambledNoSig) + sIcon = NEUTRINO_ICON_SCRAMBLED2_BLANK; + else { + if (fta) + sIcon = NEUTRINO_ICON_SCRAMBLED2_GREY; + else + sIcon = (scrambledErr) ? NEUTRINO_ICON_SCRAMBLED2_RED : NEUTRINO_ICON_SCRAMBLED2; + } + } + else +#endif + sIcon = (fta) ? NEUTRINO_ICON_SCRAMBLED2_GREY : NEUTRINO_ICON_SCRAMBLED2; + showBBIcons(CInfoViewerBB::ICON_CA, sIcon); +} + +void CInfoViewerBB::showIcon_Tuner() +{ + std::string icon_name; + switch (CFEManager::getInstance()->getLiveFE()->getNumber()) { + case 1: + icon_name = NEUTRINO_ICON_TUNER_2; + break; + case 0: + default: + icon_name = NEUTRINO_ICON_TUNER_1; + break; + } + showBBIcons(CInfoViewerBB::ICON_TUNER, icon_name); +} + +void CInfoViewerBB::showSysfsHdd() +{ + if ((g_settings.infobar_show_sysfs_hdd) && (is_visible)) { + long blocks_used; + struct statfs s; + int per = 0; + if (::statfs("/", &s) == 0 && s.f_blocks) { +// per = (s.f_blocks - s.f_bfree) / (s.f_blocks/100); + blocks_used = s.f_blocks - s.f_bfree; + per = (blocks_used * 100ULL) / s.f_blocks; + } + varscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth , 6, per, 100); + per = 0; + //HD info + if(!check_dir(g_settings.network_nfs_recordingdir)){ + if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0 && s.f_blocks) { + blocks_used = s.f_blocks - s.f_bfree; + per = (blocks_used * 100ULL) / s.f_blocks; + } + } + hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2, hddwidth, 6, per, 100); + } +} + +void CInfoViewerBB::paint_ca_icons(int caid, char * icon, int &icon_space_offset) +{ + char buf[20]; + int endx = g_InfoViewer->BoxEndX -3; + int py = g_InfoViewer->BoxEndY + 2; /* hand-crafted, should be automatic */ + int px = 0; + static map > icon_map; + const int icon_space = 10, icon_number = 10; + + static int icon_offset[icon_number] = {0,0,0,0,0,0,0,0,0,0}; + static int icon_sizeW [icon_number] = {0,0,0,0,0,0,0,0,0,0}; + static bool init_flag = false; + + if (!init_flag) { + init_flag = true; + int icon_sizeH = 0, index = 0; + map >::const_iterator it; + + icon_map[0x0E00] = std::make_pair(index++,"powervu"); + icon_map[0x4A00] = std::make_pair(index++,"d"); + icon_map[0x2600] = std::make_pair(index++,"biss"); + icon_map[0x0600] = std::make_pair(index++,"ird"); + icon_map[0x0100] = std::make_pair(index++,"seca"); + icon_map[0x0500] = std::make_pair(index++,"via"); + icon_map[0x1800] = std::make_pair(index++,"nagra"); + icon_map[0x0B00] = std::make_pair(index++,"conax"); + icon_map[0x0D00] = std::make_pair(index++,"cw"); + icon_map[0x0900] = std::make_pair(index ,"nds"); + + for (it=icon_map.begin(); it!=icon_map.end(); ++it) { + snprintf(buf, sizeof(buf), "%s_%s", (*it).second.second, icon); + frameBuffer->getIconSize(buf, &icon_sizeW[(*it).second.first], &icon_sizeH); + } + + for (int j = 0; j < icon_number; j++) { + for (int i = j; i < icon_number; i++) { + icon_offset[j] += icon_sizeW[i] + icon_space; + } + } + } + if (( caid & 0xFF00 ) == 0x1700) + caid = 0x0600; + + if (icon_offset[icon_map[( caid & 0xFF00 )].first] == 0) + return; + + if (g_settings.casystem_display == 0) { + px = endx - (icon_offset[icon_map[( caid & 0xFF00 )].first] - icon_space ); + } else { + icon_space_offset += icon_sizeW[icon_map[( caid & 0xFF00 )].first]; + px = endx - icon_space_offset; + icon_space_offset += 4; + } + + if (px) { + snprintf(buf, sizeof(buf), "%s_%s", icon_map[( caid & 0xFF00 )].second, icon); + if ((px >= (endx-8)) || (px <= 0)) + printf("#####[%s:%d] Error paint icon %s, px: %d, py: %d, endx: %d, icon_offset: %d\n", + __FUNCTION__, __LINE__, buf, px, py, endx, icon_offset[icon_map[( caid & 0xFF00 )].first]); + else + frameBuffer->paintIcon(buf, px, py); + } +} + +void CInfoViewerBB::showIcon_CA_Status(int notfirst) +{ + int caids[] = { 0x600, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 }; + + if (g_settings.casystem_display == 3) + return; + + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + if(!channel) + return; + + if (g_settings.casystem_display == 2) { + fta = (channel->camap.size() == 0); + showOne_CAIcon(); + return; + } + + const char * white = (char *) "white"; + const char * yellow = (char *) "yellow"; + static int icon_space_offset = 0; + + if(!notfirst) { + if ((g_settings.casystem_display == 1) && (icon_space_offset)) { + paintCA_bar(0,icon_space_offset); + icon_space_offset = 0; + } + for (int i = 0; i < (int)(sizeof(caids)/sizeof(int)); i++) { + bool found = false; + for(casys_map_iterator_t it = channel->camap.begin(); it != channel->camap.end(); ++it) { + int caid = (*it) & 0xFF00; + if (caid == 0x1700) + caid = 0x0600; + if((found = (caid == caids[i]))) + break; + } + if(g_settings.casystem_display == 0) + paint_ca_icons(caids[i], (char *) (found ? yellow : white), icon_space_offset); + else if(found) + paint_ca_icons(caids[i], (char *) yellow, icon_space_offset); + } + } +} + +void CInfoViewerBB::paintCA_bar(int left, int right) +{ + int xcnt = (g_InfoViewer->BoxEndX - g_InfoViewer->ChanInfoX) / 4; + int ycnt = bottom_bar_offset / 4; + if (right) + right = xcnt - ((right/4)+1); + if (left) + left = xcnt - ((left/4)-1); + + frameBuffer->paintBox(g_InfoViewer->ChanInfoX + (right*4), g_InfoViewer->BoxEndY, g_InfoViewer->BoxEndX - (left*4), g_InfoViewer->BoxEndY + bottom_bar_offset, COL_BLACK); + + if (left) + left -= 1; + + for (int i = 0 + right; i < xcnt - left; i++) { + for (int j = 0; j < ycnt; j++) { + frameBuffer->paintBoxRel((g_InfoViewer->ChanInfoX + 2) + i*4, g_InfoViewer->BoxEndY + 2 + j*4, 2, 2, COL_INFOBAR_PLUS_1); + } + } +} + +void CInfoViewerBB::changePB() +{ + hddwidth = frameBuffer->getScreenWidth(true) * ((g_settings.screen_preset == 1) ? 10 : 8) / 128; /* 80(CRT)/100(LCD) pix if screen is 1280 wide */ + if (hddscale != NULL) + delete hddscale; + hddscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true); + if (varscale != NULL) + delete varscale; + varscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true); +} + +void CInfoViewerBB::reset_allScala() +{ + hddscale->reset(); + varscale->reset(); + lasthdd = lastvar = -1; +} + +void CInfoViewerBB::setBBOffset() +{ + bottom_bar_offset = (g_settings.casystem_display < 2) ? 22 : 0; +} + +void* CInfoViewerBB::scrambledThread(void *arg) +{ + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); + CInfoViewerBB *infoViewerBB = static_cast(arg); + while(1) { + if (infoViewerBB->is_visible) + infoViewerBB->scrambledCheck(); + usleep(500*1000); + } + return 0; +} + +void CInfoViewerBB::scrambledCheck(bool force) +{ + scrambledErr = false; + scrambledNoSig = false; + if (videoDecoder->getBlank()) { + if (videoDecoder->getPlayState()) + scrambledErr = true; + else + scrambledNoSig = true; + } + + if ((scrambledErr != scrambledErrSave) || (scrambledNoSig != scrambledNoSigSave) || force) { + showIcon_CA_Status(0); + showIcon_Resolution(); + scrambledErrSave = scrambledErr; + scrambledNoSigSave = scrambledNoSig; + } +} diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h new file mode 100644 index 000000000..b41c0afcd --- /dev/null +++ b/src/gui/infoviewer_bb.h @@ -0,0 +1,150 @@ +/* + Neutrino-GUI - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + Kommentar: + + Diese GUI wurde von Grund auf neu programmiert und sollte nun vom + Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert + auf der Client-Server Idee, diese GUI ist also von der direkten DBox- + Steuerung getrennt. Diese wird dann von Daemons uebernommen. + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#ifndef __infoview_bb__ +#define __infoview_bb__ + +#include + +#include +#include +#include +#include +#include +#include "widget/menue.h" +#include +#include +#include + +class CInfoViewerBB +{ + public: + enum + { + // The order of icons from left to right. Here nothing changes! + BUTTON_EPG = 0, + BUTTON_AUDIO = 1, + BUTTON_SUBS = 2, + BUTTON_FEAT = 3, + BUTTON_MAX = 4 + }; + + private: + CFrameBuffer * frameBuffer; + + enum + { + // The order of icons from right to left. Here nothing changes! + ICON_SUBT = 0, + ICON_VTXT = 1, + ICON_RT = 2, + ICON_DD = 3, + ICON_16_9 = 4, + ICON_RES = 5, + ICON_CA = 6, + ICON_TUNER = 7, + ICON_MAX = 8 + }; + + typedef struct + { + bool paint; + int w; + int x; + int cx; + int h; + std::string icon; + std::string text; + } bbButtonInfoStruct; + + typedef struct + { + int x; + int h; + } bbIconInfoStruct; + + bbIconInfoStruct bbIconInfo[CInfoViewerBB::ICON_MAX]; + bbButtonInfoStruct bbButtonInfo[CInfoViewerBB::BUTTON_MAX]; + std::string tmp_bbButtonInfoText[CInfoViewerBB::BUTTON_MAX]; + int bbIconMinX, bbButtonMaxX, bbIconMaxH, bbButtonMaxH; + + int BBarY, BBarFontY; + int hddwidth; + int lasthdd, lastvar; + bool fta; + int minX; + + bool scrambledErr, scrambledErrSave; + bool scrambledNoSig, scrambledNoSigSave; + pthread_t scrambledT; + + CProgressBar *hddscale, *varscale; + + void showBBIcons(const int modus, const std::string & icon); + void getBBIconInfo(void); + bool checkBBIcon(const char * const icon, int *w, int *h); + void showIcon_DD(void); + + void paint_ca_icons(int, char*, int&); + void paintCA_bar(int,int); + void showOne_CAIcon(); + void changePB(void); + + static void* scrambledThread(void *arg); + void scrambledCheck(bool force=false); + + public: + CInfoViewerBB(); + ~CInfoViewerBB(); + static CInfoViewerBB* getInstance(); + void Init(void); + + int bottom_bar_offset, InfoHeightY_Info; + bool is_visible; + + void showSysfsHdd(void); + void showIcon_CA_Status(int); + void showIcon_16_9(); + void showIcon_RadioText(bool rt_available); + void showIcon_VTXT(); + void showIcon_SubT(); + void showIcon_Resolution(); + void showIcon_Tuner(void); + void showBBButtons(const int modus=-1); + void paintshowButtonBar(); + void getBBButtonInfo(void); + void reset_allScala(void); + void setBBOffset(void); + +}; + +#endif // __infoview_bb__ diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index a7fff2928..e0526b61e 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -346,12 +346,12 @@ const CMenuOptionChooser::keyval MENU_DISP_POS_OPTIONS[MENU_DISP_POS_OPTIONS_CO { 4 , LOCALE_SETTINGS_POS_BOTTOM_RIGHT } }; -#define INFOBAR_SHOW_RES_MODE_OPTION_COUNT 2 +#define INFOBAR_SHOW_RES_MODE_OPTION_COUNT 3 const CMenuOptionChooser::keyval INFOBAR_SHOW_RES_MODE_OPTIONS[INFOBAR_SHOW_RES_MODE_OPTION_COUNT] = { { 0, LOCALE_OPTIONS_ON }, - { 1, LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE } -// { 2, LOCALE_OPTIONS_OFF } // OFF does not really work correctly yet (var/hdd bars not shifted etc) + { 1, LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE }, + { 2, LOCALE_OPTIONS_OFF } }; #define CHANNELLIST_FOOT_OPTIONS_COUNT 3 @@ -619,8 +619,9 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar) menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_DISP_LOG, &g_settings.infobar_show_channellogo, LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS_COUNT, true)); menu_infobar->addItem(new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR_LOGO_HDD_DIR, true, g_settings.logo_hdd_dir, this, "logo_dir")); menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, &g_settings.infobar_sat_display, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_VAR_HDD, &g_settings.infobar_show_var_hdd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); + menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, &g_settings.infobar_show_sysfs_hdd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES, &g_settings.infobar_show_res, INFOBAR_SHOW_RES_MODE_OPTIONS, INFOBAR_SHOW_RES_MODE_OPTION_COUNT, true)); + menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER, &g_settings.infobar_show_tuner, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW, &g_settings.infobar_show, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_COLORED_EVENTS, &g_settings.colored_events_infobar, OPTIONS_COLORED_EVENTS_OPTIONS, OPTIONS_COLORED_EVENTS_OPTION_COUNT, true)); menu_infobar->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_RADIOTEXT, &g_settings.radiotext_enable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, radiotextNotifier)); @@ -645,7 +646,8 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) osd_menu->hide(); return true; } - else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_DISPLAY)) { + else if((ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_DISPLAY)) || + (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER))) { if (g_InfoViewer == NULL) g_InfoViewer = new CInfoViewer; g_InfoViewer->changePB(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 2e2d64e67..dea2aac03 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -406,9 +406,10 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.scrambled_message = configfile.getBool("scrambled_message", true ); g_settings.volume_pos = configfile.getInt32("volume_pos", 0 ); g_settings.menu_pos = configfile.getInt32("menu_pos", CMenuWidget::MENU_POS_CENTER); - g_settings.infobar_show_var_hdd = configfile.getBool("infobar_show_var_hdd" , true ); + g_settings.infobar_show_sysfs_hdd = configfile.getBool("infobar_show_sysfs_hdd" , true ); g_settings.show_mute_icon = configfile.getInt32("show_mute_icon" ,0); g_settings.infobar_show_res = configfile.getInt32("infobar_show_res", 0 ); + g_settings.infobar_show_tuner = configfile.getInt32("infobar_show_tuner", 1 ); g_settings.radiotext_enable = configfile.getBool("radiotext_enable" , false); //audio g_settings.audio_AnalogMode = configfile.getInt32( "audio_AnalogMode", 0 ); @@ -848,9 +849,10 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("scrambled_message" , g_settings.scrambled_message ); configfile.setInt32("volume_pos" , g_settings.volume_pos ); configfile.setInt32("menu_pos" , g_settings.menu_pos); - configfile.setInt32("infobar_show_var_hdd" , g_settings.infobar_show_var_hdd ); + configfile.setInt32("infobar_show_sysfs_hdd" , g_settings.infobar_show_sysfs_hdd ); configfile.setInt32("show_mute_icon" , g_settings.show_mute_icon); configfile.setInt32("infobar_show_res" , g_settings.infobar_show_res ); + configfile.setInt32("infobar_show_tuner" , g_settings.infobar_show_tuner ); configfile.setBool("radiotext_enable" , g_settings.radiotext_enable); //audio configfile.setInt32( "audio_AnalogMode", g_settings.audio_AnalogMode ); diff --git a/src/system/locals.h b/src/system/locals.h index 47c5f0276..525ecb2de 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -772,7 +772,8 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES, LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE, - LOCALE_MISCSETTINGS_INFOBAR_SHOW_VAR_HDD, + LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, + LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER, LOCALE_MISCSETTINGS_RADIOTEXT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 07893b56e..5feec2f7c 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -772,7 +772,8 @@ const char * locale_real_names[] = "miscsettings.infobar_show", "miscsettings.infobar_show_res", "miscsettings.infobar_show_res_simple", - "miscsettings.infobar_show_var_hdd", + "miscsettings.infobar_show_sysfs_hdd", + "miscsettings.infobar_show_tuner", "miscsettings.radiotext", "miscsettings.shutdown_count", "miscsettings.shutdown_count_hint1", diff --git a/src/system/settings.h b/src/system/settings.h index 7d0bfdb6c..1516c2bbd 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -73,8 +73,9 @@ struct SNeutrinoSettings int volume_pos; int show_mute_icon; int menu_pos; - int infobar_show_var_hdd; + int infobar_show_sysfs_hdd; int infobar_show_res; + int infobar_show_tuner; //audio int audio_AnalogMode; int audio_DolbyDigital;