diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index cac819112..c873db44a 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1634,6 +1634,7 @@ moviebrowser.book_position Position: moviebrowser.book_type Sprung (<0 zurück, >0 vor): moviebrowser.book_type_backward Wiederholung moviebrowser.book_type_forward Überspringen +moviebrowser.browser_additional Zusätzliche Informationen moviebrowser.browser_frame_high Anzeigehöhe oberes Fenster [%] moviebrowser.browser_row_head Spalten Einstellungen moviebrowser.browser_row_item Spalteninfo diff --git a/data/locale/english.locale b/data/locale/english.locale index c2b581deb..9fc0c5efb 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1634,6 +1634,7 @@ moviebrowser.book_position Position: moviebrowser.book_type Jump (<0 back , >0 for): moviebrowser.book_type_backward Repeat moviebrowser.book_type_forward jump over +moviebrowser.browser_additional Additional informations moviebrowser.browser_frame_high Browser height [%] moviebrowser.browser_row_head Row settings moviebrowser.browser_row_item Row item diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 452463f25..06592472f 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -255,11 +255,14 @@ CMovieBrowser::~CMovieBrowser() clearListLines(); - if (CChannelLogo) - delete CChannelLogo; + if (m_detailsLine) + delete m_detailsLine; - if (pic) - delete pic; + if (m_channelLogo) + delete m_channelLogo; + + if (m_movieCover) + delete m_movieCover; } void CMovieBrowser::clearListLines() @@ -324,9 +327,9 @@ void CMovieBrowser::init(void) m_pcBrowser = NULL; m_pcLastPlay = NULL; m_pcLastRecord = NULL; - m_pcInfo = NULL; + m_pcInfo1 = NULL; + m_pcInfo2 = NULL; m_pcFilter = NULL; - pic = NULL; m_windowFocus = MB_FOCUS_BROWSER; m_textTitle = g_Locale->getText(LOCALE_MOVIEBROWSER_HEAD); @@ -406,7 +409,10 @@ void CMovieBrowser::init(void) filelist_it = filelist.end(); movielist.clear(); - CChannelLogo = NULL; + m_detailsLine = NULL; + m_channelLogo = NULL; + m_movieCover = NULL; + old_EpgId = 0; m_doRefresh = false; m_doLoadMovies = false; @@ -470,6 +476,8 @@ void CMovieBrowser::initGlobalSettings(void) m_settings.browserRowWidth[7] = m_defaultRowWidth[m_settings.browserRowItem[7]]; m_settings.browserRowWidth[8] = m_defaultRowWidth[m_settings.browserRowItem[8]]; + m_settings.browserAdditional = 0; + m_settings.ts_only = 1; m_settings.ytmode = cYTFeedParser::MOST_POPULAR; m_settings.ytorderby = cYTFeedParser::ORDERBY_PUBLISHED; @@ -503,33 +511,42 @@ void CMovieBrowser::initFrames(void) m_cBoxFrameBrowserList.iX = m_cBoxFrame.iX; m_cBoxFrameBrowserList.iY = m_cBoxFrame.iY + m_cBoxFrameTitleRel.iHeight; - m_cBoxFrameBrowserList.iWidth = m_cBoxFrame.iWidth; + if (m_settings.browserAdditional) + m_cBoxFrameBrowserList.iWidth = m_cBoxFrame.iWidth / 3 * 2; + else + m_cBoxFrameBrowserList.iWidth = m_cBoxFrame.iWidth; m_cBoxFrameBrowserList.iHeight = m_cBoxFrame.iHeight * m_settings.browserFrameHeight / 100; - m_cBoxFrameFootRel.iX = 0; + + m_cBoxFrameFootRel.iX = m_cBoxFrameBrowserList.iX; m_cBoxFrameFootRel.iHeight = refreshFoot(false); - m_cBoxFrameFootRel.iY = m_cBoxFrame.iHeight - m_cBoxFrameFootRel.iHeight; - m_cBoxFrameFootRel.iWidth = m_cBoxFrameBrowserList.iWidth; + m_cBoxFrameFootRel.iY = m_cBoxFrameBrowserList.iY + m_cBoxFrameBrowserList.iHeight; + m_cBoxFrameFootRel.iWidth = m_cBoxFrame.iWidth; m_cBoxFrameLastPlayList.iX = m_cBoxFrameBrowserList.iX; m_cBoxFrameLastPlayList.iY = m_cBoxFrameBrowserList.iY ; - m_cBoxFrameLastPlayList.iWidth = (m_cBoxFrameBrowserList.iWidth>>1) - (OFFSET_INTER>>1); + m_cBoxFrameLastPlayList.iWidth = m_cBoxFrame.iWidth / 2; m_cBoxFrameLastPlayList.iHeight = m_cBoxFrameBrowserList.iHeight; - m_cBoxFrameLastRecordList.iX = m_cBoxFrameLastPlayList.iX + m_cBoxFrameLastPlayList.iWidth + OFFSET_INTER; + m_cBoxFrameLastRecordList.iX = m_cBoxFrameLastPlayList.iX + m_cBoxFrameLastPlayList.iWidth; m_cBoxFrameLastRecordList.iY = m_cBoxFrameLastPlayList.iY; - m_cBoxFrameLastRecordList.iWidth = m_cBoxFrame.iWidth - m_cBoxFrameLastPlayList.iWidth - OFFSET_INTER; + m_cBoxFrameLastRecordList.iWidth = m_cBoxFrame.iWidth - m_cBoxFrameLastPlayList.iWidth; m_cBoxFrameLastRecordList.iHeight = m_cBoxFrameLastPlayList.iHeight; - m_cBoxFrameInfo.iX = m_cBoxFrameBrowserList.iX; - m_cBoxFrameInfo.iY = m_cBoxFrameBrowserList.iY + m_cBoxFrameBrowserList.iHeight + OFFSET_INTER; - m_cBoxFrameInfo.iWidth = m_cBoxFrameBrowserList.iWidth; - m_cBoxFrameInfo.iHeight = m_cBoxFrame.iHeight - m_cBoxFrameBrowserList.iHeight - OFFSET_INTER - m_cBoxFrameFootRel.iHeight - m_cBoxFrameTitleRel.iHeight; + m_cBoxFrameInfo1.iX = m_cBoxFrameBrowserList.iX; + m_cBoxFrameInfo1.iY = m_cBoxFrameFootRel.iY + m_cBoxFrameFootRel.iHeight + OFFSET_INTER; + m_cBoxFrameInfo1.iWidth = m_cBoxFrame.iWidth; + m_cBoxFrameInfo1.iHeight = m_cBoxFrame.iHeight - m_cBoxFrameBrowserList.iHeight - OFFSET_INTER - m_cBoxFrameFootRel.iHeight - m_cBoxFrameTitleRel.iHeight; - m_cBoxFrameFilter.iX = m_cBoxFrameInfo.iX; - m_cBoxFrameFilter.iY = m_cBoxFrameInfo.iY; - m_cBoxFrameFilter.iWidth = m_cBoxFrameInfo.iWidth; - m_cBoxFrameFilter.iHeight = m_cBoxFrameInfo.iHeight; + m_cBoxFrameInfo2.iX = m_cBoxFrameBrowserList.iX + m_cBoxFrameBrowserList.iWidth; + m_cBoxFrameInfo2.iY = m_cBoxFrameBrowserList.iY; + m_cBoxFrameInfo2.iWidth = m_cBoxFrame.iWidth - m_cBoxFrameBrowserList.iWidth; + m_cBoxFrameInfo2.iHeight = m_cBoxFrameBrowserList.iHeight; + + m_cBoxFrameFilter.iX = m_cBoxFrameBrowserList.iX; + m_cBoxFrameFilter.iY = m_cBoxFrameBrowserList.iY; + m_cBoxFrameFilter.iWidth = m_cBoxFrameBrowserList.iWidth; + m_cBoxFrameFilter.iHeight = m_cBoxFrameBrowserList.iHeight; } void CMovieBrowser::initRows(void) @@ -614,6 +631,8 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) settings->browserRowItem[i] = (MB_INFO_ITEM)configfile.getInt32("mb_browserRowItem_" + to_string(i), MB_INFO_MAX_NUMBER); settings->browserRowWidth[i] = configfile.getInt32("mb_browserRowWidth_" + to_string(i), 50); } + settings->browserAdditional = configfile.getInt32("mb_browserAdditional", 0); + settings->ytmode = configfile.getInt32("mb_ytmode", cYTFeedParser::MOST_POPULAR); settings->ytorderby = configfile.getInt32("mb_ytorderby", cYTFeedParser::ORDERBY_PUBLISHED); settings->ytresults = configfile.getInt32("mb_ytresults", 10); @@ -679,6 +698,8 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings) configfile.setInt32("mb_browserRowItem_" + to_string(i), settings->browserRowItem[i]); configfile.setInt32("mb_browserRowWidth_" + to_string(i), settings->browserRowWidth[i]); } + configfile.setInt32("mb_browserAdditional", settings->browserAdditional); + configfile.setInt32("mb_ytmode", settings->ytmode); configfile.setInt32("mb_ytorderby", settings->ytorderby); configfile.setInt32("mb_ytresults", settings->ytresults); @@ -1049,9 +1070,10 @@ int CMovieBrowser::exec(const char* path) void CMovieBrowser::hide(void) { //TRACE("[mb]->%s\n", __func__); - if (CChannelLogo){ - delete CChannelLogo; - CChannelLogo = NULL; + if (m_channelLogo) + { + delete m_channelLogo; + m_channelLogo = NULL; } old_EpgId = 0; framebuffer->paintBackground(); @@ -1078,8 +1100,10 @@ void CMovieBrowser::hide(void) delete m_pcLastRecord; m_pcLastRecord = NULL; - delete m_pcInfo; - m_pcInfo = NULL; + delete m_pcInfo1; + m_pcInfo1 = NULL; + delete m_pcInfo2; + m_pcInfo2 = NULL; } int CMovieBrowser::paint(void) @@ -1103,20 +1127,23 @@ int CMovieBrowser::paint(void) m_pcFilter = new CListFrame(&m_FilterLines, font, CListFrame::SCROLL | CListFrame::TITLE, &m_cBoxFrameFilter, g_Locale->getText(LOCALE_MOVIEBROWSER_HEAD_FILTER), g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_HEAD]); - m_pcInfo = new CTextBox(" ", g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_INFO], CTextBox::TOP | CTextBox::SCROLL, &m_cBoxFrameInfo); + m_pcInfo1 = new CTextBox(" ", g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_INFO], CTextBox::TOP | CTextBox::SCROLL, &m_cBoxFrameInfo1); + m_pcInfo2 = new CTextBox(" ", g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_INFO], CTextBox::TOP | CTextBox::SCROLL, &m_cBoxFrameInfo2); if (m_pcBrowser == NULL || m_pcLastPlay == NULL || - m_pcLastRecord == NULL || m_pcInfo == NULL || m_pcFilter == NULL) + m_pcLastRecord == NULL || m_pcInfo1 == NULL || m_pcInfo2 == NULL || m_pcFilter == NULL) { TRACE("[mb] paint, ERROR: not enought memory to allocate windows"); if (m_pcFilter != NULL)delete m_pcFilter; if (m_pcBrowser != NULL)delete m_pcBrowser; if (m_pcLastPlay != NULL) delete m_pcLastPlay; if (m_pcLastRecord != NULL)delete m_pcLastRecord; - if (m_pcInfo != NULL) delete m_pcInfo; + if (m_pcInfo1 != NULL) delete m_pcInfo1; + if (m_pcInfo2 != NULL) delete m_pcInfo2; - m_pcInfo = NULL; + m_pcInfo1 = NULL; + m_pcInfo2 = NULL; m_pcLastPlay = NULL; m_pcLastRecord = NULL; m_pcBrowser = NULL; @@ -1125,6 +1152,12 @@ int CMovieBrowser::paint(void) return (false); } + m_pcInfo1->setBackGroundColor(COL_MENUCONTENTDARK_PLUS_0); + m_pcInfo1->setTextColor(COL_MENUCONTENTDARK_TEXT); + m_pcInfo1->setBackGroundRadius(RADIUS_LARGE); + //m_pcInfo1->setTextBorderWidth(OFFSET_INNER_MID, OFFSET_INNER_SMALL); + m_pcInfo2->setTextBorderWidth(OFFSET_INNER_MID, OFFSET_INNER_SMALL); + clearSelection(); if (m_file_info_stale == true) { loadMovies(); @@ -1170,7 +1203,7 @@ void CMovieBrowser::refresh(void) m_pcLastPlay->refresh(); if (m_pcLastRecord != NULL && m_showLastRecordFiles == true) m_pcLastRecord->refresh(); - if (m_pcInfo != NULL && m_showMovieInfo == true) + if (m_pcInfo1 != NULL && m_pcInfo2 != NULL && m_showMovieInfo == true) refreshMovieInfo(); if (m_pcFilter != NULL && m_showFilter == true) m_pcFilter->refresh(); @@ -1242,113 +1275,261 @@ std::string CMovieBrowser::getScreenshotName(std::string movie, bool is_dir) return ""; } +void CMovieBrowser::refreshChannelLogo(void) +{ + TRACE("[mb]->%s:%d\n", __func__, __LINE__); + + int w_logo_max = m_cBoxFrameTitleRel.iWidth / 4; + short pb_hdd_offset = 100 + OFFSET_INNER_MID; + + if (show_mode == MB_SHOW_YT) + pb_hdd_offset = 0; + + if (m_channelLogo && (old_EpgId != m_movieSelectionHandler->epgId >> 16)) + { + if (newHeader) + m_channelLogo->clearFbData(); // reset logo screen data + else + m_channelLogo->hide(); + delete m_channelLogo; + m_channelLogo = NULL; + } + + if (old_EpgId != m_movieSelectionHandler->epgId >> 16) + { + if (m_channelLogo == NULL) + m_channelLogo = new CComponentsChannelLogoScalable(0, 0, m_movieSelectionHandler->channelName, m_movieSelectionHandler->epgId >>16); //TODO: add logo into header as item + old_EpgId = m_movieSelectionHandler->epgId >> 16; + } + + if (m_channelLogo && m_channelLogo->hasLogo()) + { + // scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object + int h_logo = m_channelLogo->getHeight(); + if (h_logo > m_cBoxFrameTitleRel.iHeight) + { + uint8_t ratio = m_cBoxFrameTitleRel.iHeight*100/h_logo; + m_channelLogo->setHeight(m_cBoxFrameTitleRel.iHeight); + int w_logo = ratio*m_channelLogo->getWidth()/100; + m_channelLogo->setWidth(min(w_logo, w_logo_max)); + } + + int x = m_cBoxFrame.iX + m_cBoxFrameTitleRel.iX + m_cBoxFrameTitleRel.iWidth - m_channelLogo->getWidth() - OFFSET_INNER_MID; + int y = m_cBoxFrame.iY + m_cBoxFrameTitleRel.iY + (m_cBoxFrameTitleRel.iHeight - m_channelLogo->getHeight())/2; + m_channelLogo->setXPos(x - pb_hdd_offset); + m_channelLogo->setYPos(y); + m_channelLogo->hide(); + m_channelLogo->paint(); + newHeader = false; + } +} + +void CMovieBrowser::initMovieCover(void) +{ + TRACE("[mb]->%s:%d\n", __func__, __LINE__); + + CBox movieCoverBox; + + int cover_w = 0; + int cover_h = 0; + + if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional) + { + movieCoverBox = m_cBoxFrameInfo2; + + // we have to align cover to box width + cover_w = movieCoverBox.iWidth - 2*OFFSET_INNER_MID - OFFSET_SHADOW; + + TRACE("[mb]->%s:%d m_windowFocus == MB_FOCUS_BROWSER\n", __func__, __LINE__); + + } + else + { + movieCoverBox = m_cBoxFrameInfo1; + + // we have to align cover to box height + cover_h = movieCoverBox.iHeight - 2*OFFSET_INNER_MID - OFFSET_SHADOW; + + TRACE("[mb]->%s:%d m_windowFocus != MB_FOCUS_BROWSER\n", __func__, __LINE__); + + } + + std::string cover_file; + if (show_mode == MB_SHOW_YT) + { + cover_file = m_movieSelectionHandler->tfile; + } + else + { + cover_file = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode)); + if ((cover_file.empty()) && (m_movieSelectionHandler->file.Name.length() > 18)) + { + std::string cover = m_movieSelectionHandler->file.Name; + cover.replace((cover.length()-18), 15, ""); //covername without yyyymmdd_hhmmss + cover_file = getScreenshotName(cover); + } + } + + bool got_cover = !cover_file.empty(); + + if (m_movieCover) + { + if (m_movieCover->getPictureName() != cover_file || !got_cover) + { + delete m_movieCover; + m_movieCover = NULL; + } + } + + if (m_settings.gui != MB_GUI_FILTER && got_cover) + { + if (m_movieCover == NULL) + { + m_movieCover = new CComponentsPicture(0, 0, cover_file, NULL, CC_SHADOW_ON, COL_MENUCONTENTDARK_PLUS_0); + + m_movieCover->enableFrame(true, 1); + m_movieCover->doPaintBg(false); + } + +TRACE("[mb]->%s:%d m_windowFocus: %d\n", __func__, __LINE__, m_windowFocus); + + // always align positions and dimensions + if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional) + { + if (m_movieCover->getWidth() < m_movieCover->getHeight()) + cover_w /= 2; // cover is upright, so we use just half width first + + m_movieCover->setHeight(0); // force recalculation + m_movieCover->setWidth(cover_w, true); + if (m_movieCover->getHeight() > movieCoverBox.iHeight/3) + m_movieCover->setHeight(movieCoverBox.iHeight/3, true); // use maximal one third of box height + + m_movieCover->setXPos(movieCoverBox.iX + (movieCoverBox.iWidth - m_movieCover->getWidth())/2); + m_movieCover->setYPos(movieCoverBox.iY + OFFSET_INNER_MID); + } + else + { + m_movieCover->setWidth(0); // force recalculation +TRACE("[mb]->%s:%d m_movieCover->getWidth(): %d\n", __func__, __LINE__, m_movieCover->getWidth()); + m_movieCover->setHeight(cover_h, true); + + m_movieCover->setXPos(movieCoverBox.iX + movieCoverBox.iWidth - m_movieCover->getWidth() - 2*OFFSET_INNER_MID - OFFSET_SHADOW); + m_movieCover->setYPos(movieCoverBox.iY + (movieCoverBox.iHeight - m_movieCover->getHeight())/2); + } + + if (!m_movieSelectionHandler->epgInfo2.empty()) + { + if (m_pcInfo1->OnAfterScrollPage.empty()) + { + //m_movieCover->enableCache(); + m_pcInfo1->OnAfterScrollPage.connect(sigc::mem_fun(m_movieCover, &CComponentsPicture::paint0)); + } + } + } +} + +void CMovieBrowser::refreshMovieCover(void) +{ + TRACE("[mb]->%s:%d\n", __func__, __LINE__); + + if (m_movieCover) + m_movieCover->paint(CC_SAVE_SCREEN_NO); +} + void CMovieBrowser::refreshMovieInfo(void) { TRACE("[mb]->%s m_vMovieInfo.size %d\n", __func__, m_vMovieInfo.size()); - //reset text before new init, m_pcInfo must be clean + + hideDetailsLine(); + + //reset text before new init, m_pcInfo1 must be clean std::string emptytext = " "; - m_pcInfo->setText(&emptytext); + m_pcInfo1->setText(&emptytext); + if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional) + { + m_pcInfo1->setTextFont(g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_LIST]); + + m_pcInfo2->setWindowMaxDimensions(m_cBoxFrameInfo2.iWidth, m_cBoxFrameInfo2.iHeight); + m_pcInfo2->setWindowMinDimensions(m_cBoxFrameInfo2.iWidth, m_cBoxFrameInfo2.iHeight); + m_pcInfo2->movePosition(m_cBoxFrameInfo2.iX, m_cBoxFrameInfo2.iY); + m_pcInfo2->setText(&emptytext); + } + else + m_pcInfo1->setTextFont(g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_INFO]); + if (m_vMovieInfo.empty() || m_movieSelectionHandler == NULL) return; - std::string fname; - if (show_mode == MB_SHOW_YT) { - fname = m_movieSelectionHandler->tfile; - } else { - fname = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode)); - if ((fname.empty()) && (m_movieSelectionHandler->file.Name.length() > 18)) { - std::string cover = m_movieSelectionHandler->file.Name; - cover.replace((cover.length()-18),15,""); //covername without yyyymmdd_hhmmss - fname = getScreenshotName(cover); - } - } - bool logo_ok = (!fname.empty()); - int flogo_w = 0, flogo_h = 0; - if (logo_ok) { - flogo_w = (int)(((float)16 / (float)9) * (float)m_cBoxFrameInfo.iHeight); - flogo_h = m_cBoxFrameInfo.iHeight*90/100; + refreshChannelLogo(); + + initMovieCover(); + int cover_x_offset = 0; + int cover_y_offset = 0; + if (m_movieCover) + { + cover_x_offset = m_movieCover->getWidth(); + cover_y_offset = m_movieCover->getHeight(); + if (cover_x_offset) + cover_x_offset += 2*OFFSET_INNER_MID; + if (cover_y_offset) + cover_y_offset += 2*OFFSET_INNER_MID; } -// static int logo_w = 0; -// static int logo_h = 0; - int logo_w_max = m_cBoxFrameTitleRel.iWidth / 4; - - //printf("refreshMovieInfo: EpgId %llx id %llx y %d\n", m_movieSelectionHandler->epgId, m_movieSelectionHandler->channelId, m_cBoxFrameTitleRel.iY); - int lx = 0;//never read m_cBoxFrame.iX+m_cBoxFrameTitleRel.iX+m_cBoxFrameTitleRel.iWidth-logo_w-10; - int ly = 0;//never read m_cBoxFrameTitleRel.iY+m_cBoxFrame.iY+ (m_cBoxFrameTitleRel.iHeight-logo_h)/2; - short pb_hdd_offset = 104; - if (show_mode == MB_SHOW_YT) - pb_hdd_offset = 0; - - if (CChannelLogo && (old_EpgId != m_movieSelectionHandler->epgId >>16)) { - if (newHeader) - CChannelLogo->clearFbData(); // reset logo screen data - else - CChannelLogo->hide(); - delete CChannelLogo; - CChannelLogo = NULL; + std::string pcInfo_content; + if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional) + { + m_pcInfo2->setWindowMaxDimensions(m_cBoxFrameInfo2.iWidth, m_cBoxFrameInfo2.iHeight - cover_y_offset); + m_pcInfo2->setWindowMinDimensions(m_cBoxFrameInfo2.iWidth, m_cBoxFrameInfo2.iHeight - cover_y_offset); + m_pcInfo2->movePosition(m_cBoxFrameInfo2.iX, m_cBoxFrameInfo2.iY + cover_y_offset); + m_pcInfo2->setText(&m_movieSelectionHandler->epgInfo2); + pcInfo_content = m_movieSelectionHandler->epgInfo1; + pcInfo_content += "\n"; + pcInfo_content += m_movieSelectionHandler->channelName; } - if (old_EpgId != m_movieSelectionHandler->epgId >>16) { - if (CChannelLogo == NULL) - CChannelLogo = new CComponentsChannelLogoScalable(0, 0, m_movieSelectionHandler->channelName, m_movieSelectionHandler->epgId >>16); //TODO: add logo into header as item - old_EpgId = m_movieSelectionHandler->epgId >>16; + else + { + pcInfo_content = m_movieSelectionHandler->epgInfo2; + } + m_pcInfo1->setText(&pcInfo_content, m_cBoxFrameInfo1.iWidth - cover_x_offset); + + updateInfoSelection(); + + refreshMovieCover(); + + if (m_windowFocus == MB_FOCUS_BROWSER) + refreshDetailsLine(m_pcBrowser->getSelectedLineRel()); +} + +void CMovieBrowser::hideDetailsLine() +{ + refreshDetailsLine(-1); +} + +void CMovieBrowser::refreshDetailsLine(int pos) +{ + if (m_detailsLine) + { + m_detailsLine->kill(); + delete m_detailsLine; + m_detailsLine = NULL; } - if (CChannelLogo && CChannelLogo->hasLogo()) { - //scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object - int h_logo = CChannelLogo->getHeight(); - if (h_logo > m_cBoxFrameTitleRel.iHeight){ - uint8_t ratio = m_cBoxFrameTitleRel.iHeight*100/h_logo; - CChannelLogo->setHeight(m_cBoxFrameTitleRel.iHeight); - int w_logo = ratio*CChannelLogo->getWidth()/100; - CChannelLogo->setWidth(min(w_logo, logo_w_max)); - } + if (pos >= 0) + { + int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_LIST]->getHeight(); + int hheight = m_pcBrowser->getHeaderListHeight(); + int theight = m_pcBrowser->getTitleHeight(); + int bheight = 8 /*TEXT_BORDER_WIDTH*/; - lx = m_cBoxFrame.iX+m_cBoxFrameTitleRel.iX+m_cBoxFrameTitleRel.iWidth-CChannelLogo->getWidth()-10; - ly = m_cBoxFrameTitleRel.iY+m_cBoxFrame.iY+ (m_cBoxFrameTitleRel.iHeight-CChannelLogo->getHeight())/2; - CChannelLogo->setXPos(lx - pb_hdd_offset); - CChannelLogo->setYPos(ly); - CChannelLogo->hide(); - CChannelLogo->paint(); - newHeader = false; + int xpos = m_cBoxFrameBrowserList.iX - ConnectLineBox_Width; + int ypos1 = m_cBoxFrameBrowserList.iY + hheight + theight + bheight + pos*fheight + (fheight/2); + int ypos2 = m_cBoxFrameInfo1.iY + (m_cBoxFrameInfo1.iHeight/2); + + if (m_detailsLine == NULL) + m_detailsLine = new CComponentsDetailLine(xpos, ypos1, ypos2, fheight/2, m_cBoxFrameInfo1.iHeight-2*RADIUS_LARGE); + m_detailsLine->paint(false); } - - if (pic){ - if (pic->getPictureName() != fname || !logo_ok){ - delete pic; pic = NULL; - } - } - - if (m_settings.gui != MB_GUI_FILTER && logo_ok) { - lx = m_cBoxFrameInfo.iX + m_cBoxFrameBrowserList.iWidth - flogo_w -14; - ly = m_cBoxFrameInfo.iY + (m_cBoxFrameInfo.iHeight-flogo_h)/2; - if (pic == NULL){ //TODO: paint custom covers with different ratio, currently only works with default ratio HD 16/9 - pic = new CComponentsPicture(lx, ly, fname, NULL, CC_SHADOW_ON, COL_MENUCONTENTDARK_PLUS_0); - if (pic->getHeight() < flogo_h/2){ - flogo_h = flogo_h/2; - pic->setYPos(m_cBoxFrameInfo.iY + (m_cBoxFrameInfo.iHeight-flogo_h)/2); - } - pic->setHeight(flogo_h, true); - pic->enableFrame(true, 2); - pic->doPaintBg(false); - flogo_w = pic->getWidth(); - pic->setXPos(m_cBoxFrameInfo.iX + m_cBoxFrameInfo.iWidth - flogo_w - 24); - } - - if (!m_movieSelectionHandler->epgInfo2.empty()){ - if (m_pcInfo->OnAfterScrollPage.empty()){ - pic->enableCache(); - m_pcInfo->OnAfterScrollPage.connect(sigc::mem_fun(pic, &CComponentsPicture::paint0)); - } - } - - } - if (pic) - flogo_w = pic->getWidth(); - m_pcInfo->setText(&m_movieSelectionHandler->epgInfo2, m_cBoxFrameInfo.iWidth - flogo_w - (flogo_w ? 24 : 0)); - if (pic) - pic->paint(CC_SAVE_SCREEN_NO); } void CMovieBrowser::info_hdd_level(bool paint_hdd) @@ -1694,7 +1875,7 @@ int CMovieBrowser::refreshFoot(bool show) int cnt = sizeof(footerButtons) / sizeof(button_label_ext); if (show) - return paintButtons(footerButtons + offset, cnt - offset, m_cBoxFrame.iX+m_cBoxFrameFootRel.iX, m_cBoxFrame.iY+m_cBoxFrameFootRel.iY, m_cBoxFrameFootRel.iWidth, m_cBoxFrameFootRel.iHeight, m_cBoxFrameFootRel.iWidth); + return paintButtons(footerButtons + offset, cnt - offset, m_cBoxFrameFootRel.iX, m_cBoxFrameFootRel.iY, m_cBoxFrameFootRel.iWidth, m_cBoxFrameFootRel.iHeight, m_cBoxFrameFootRel.iWidth); else return paintButtons(footerButtons, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); } @@ -1712,7 +1893,7 @@ bool CMovieBrowser::onButtonPress(neutrino_msg_t msg) result = onButtonPressLastPlayList(msg); else if (m_windowFocus == MB_FOCUS_LAST_RECORD) result = onButtonPressLastRecordList(msg); - else if (m_windowFocus == MB_FOCUS_MOVIE_INFO) + else if (m_windowFocus == MB_FOCUS_MOVIE_INFO1 || m_windowFocus == MB_FOCUS_MOVIE_INFO2) result = onButtonPressMovieInfoList(msg); else if (m_windowFocus == MB_FOCUS_FILTER) result = onButtonPressFilterList(msg); @@ -1751,32 +1932,32 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) else if (msg == (neutrino_msg_t) g_settings.mbkey_cover) { if (m_movieSelectionHandler != NULL) { - std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode)); - if (!fname.empty()) + std::string cover_file = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode)); + if (!cover_file.empty()) { //delete Cover if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DELETE_SCREENSHOT, CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) { - unlink(fname.c_str()); + unlink(cover_file.c_str()); refresh(); } } else if (g_settings.tmdb_enabled) { //add TMDB Cover - fname = m_movieSelectionHandler->file.Name.c_str(); + cover_file = m_movieSelectionHandler->file.Name.c_str(); int ext_pos = 0; - ext_pos = fname.rfind('.'); + ext_pos = cover_file.rfind('.'); if( ext_pos > 0) { std::string extension; - extension = fname.substr(ext_pos + 1, fname.length() - ext_pos); + extension = cover_file.substr(ext_pos + 1, cover_file.length() - ext_pos); extension = "." + extension; - str_replace(extension, ".jpg", fname); - printf("TMDB: %s : %s\n",m_movieSelectionHandler->file.Name.c_str(),fname.c_str()); + str_replace(extension, ".jpg", cover_file); + printf("TMDB: %s : %s\n",m_movieSelectionHandler->file.Name.c_str(),cover_file.c_str()); cTmdb* tmdb = new cTmdb(m_movieSelectionHandler->epgTitle); if ((tmdb->getResults() > 0) && (tmdb->hasCover())) { - if (!fname.empty()) - if (tmdb->getSmallCover(fname)) + if (!cover_file.empty()) + if (tmdb->getSmallCover(cover_file)) refresh(); } if (tmdb) @@ -1794,12 +1975,16 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) } else if (msg == CRCInput::RC_left) { - if (show_mode != MB_SHOW_YT) + if (m_windowFocus == MB_FOCUS_MOVIE_INFO2 && m_settings.browserAdditional) + onSetFocusNext(); + else if (show_mode != MB_SHOW_YT) onSetGUIWindowPrev(); } else if (msg == CRCInput::RC_right) { - if (show_mode != MB_SHOW_YT) + if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional) + onSetFocusNext(); + else if (show_mode != MB_SHOW_YT) onSetGUIWindowNext(); } else if (msg == CRCInput::RC_green) @@ -2115,12 +2300,20 @@ bool CMovieBrowser::onButtonPressMovieInfoList(neutrino_msg_t msg) bool result = true; if (msg == CRCInput::RC_up) - m_pcInfo->scrollPageUp(1); + if (m_windowFocus == MB_FOCUS_MOVIE_INFO2 && m_settings.browserAdditional) + m_pcInfo2->scrollPageUp(1); + else + m_pcInfo1->scrollPageUp(1); else if (msg == CRCInput::RC_down) - m_pcInfo->scrollPageDown(1); + if (m_windowFocus == MB_FOCUS_MOVIE_INFO2 && m_settings.browserAdditional) + m_pcInfo2->scrollPageDown(1); + else + m_pcInfo1->scrollPageDown(1); else result = false; + updateInfoSelection(); + return (result); } @@ -2185,9 +2378,9 @@ bool CMovieBrowser::onDeleteFile(MI_MOVIE_INFO *movieinfo, bool skipAsk) hintBox->paint(); delFile(movieinfo->file); - std::string fname = getScreenshotName(movieinfo->file.Name, S_ISDIR(movieinfo->file.Mode)); - if (!fname.empty()) - unlink(fname.c_str()); + std::string cover_file = getScreenshotName(movieinfo->file.Name, S_ISDIR(movieinfo->file.Mode)); + if (!cover_file.empty()) + unlink(cover_file.c_str()); CFile file_xml = movieinfo->file; if (m_movieInfo.convertTs2XmlName(file_xml.Name)) @@ -2313,6 +2506,7 @@ void CMovieBrowser::onSetGUIWindow(MB_GUI gui) m_pcBrowser->hide(); m_pcFilter->hide(); + m_pcInfo2->hide(); m_pcLastRecord->paint(); m_pcLastPlay->paint(); @@ -2328,6 +2522,7 @@ void CMovieBrowser::onSetGUIWindow(MB_GUI gui) m_pcBrowser->hide(); m_pcFilter->hide(); + m_pcInfo2->hide(); m_pcLastRecord->paint(); m_pcLastPlay->paint(); @@ -2337,13 +2532,16 @@ void CMovieBrowser::onSetGUIWindow(MB_GUI gui) m_showMovieInfo = false; - m_pcInfo->hide(); + m_pcInfo1->hide(); + m_pcInfo2->hide(); m_pcFilter->paint(); onSetFocus(MB_FOCUS_FILTER); } if (m_showMovieInfo) { - m_pcInfo->paint(); + m_pcInfo1->paint(); + if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional) + m_pcInfo2->paint(); refreshMovieInfo(); } } @@ -2389,6 +2587,7 @@ void CMovieBrowser::onSetFocus(MB_FOCUS new_focus) m_pcFilter->showSelection(true); updateMovieSelection(); + updateInfoSelection(); refreshFoot(); } @@ -2406,23 +2605,26 @@ void CMovieBrowser::onSetFocusNext(void) else if (m_settings.gui == MB_GUI_MOVIE_INFO) { if (m_windowFocus == MB_FOCUS_BROWSER) - onSetFocus(MB_FOCUS_MOVIE_INFO); + if (m_settings.browserAdditional) + onSetFocus(MB_FOCUS_MOVIE_INFO2); + else + onSetFocus(MB_FOCUS_MOVIE_INFO1); else onSetFocus(MB_FOCUS_BROWSER); } else if (m_settings.gui == MB_GUI_LAST_PLAY) { - if (m_windowFocus == MB_FOCUS_MOVIE_INFO) + if (m_windowFocus == MB_FOCUS_MOVIE_INFO1 || m_windowFocus == MB_FOCUS_MOVIE_INFO2) onSetFocus(MB_FOCUS_LAST_PLAY); else if (m_windowFocus == MB_FOCUS_LAST_PLAY) - onSetFocus(MB_FOCUS_MOVIE_INFO); + onSetFocus(MB_FOCUS_MOVIE_INFO1); } else if (m_settings.gui == MB_GUI_LAST_RECORD) { - if (m_windowFocus == MB_FOCUS_MOVIE_INFO) + if (m_windowFocus == MB_FOCUS_MOVIE_INFO1 || m_windowFocus == MB_FOCUS_MOVIE_INFO2) onSetFocus(MB_FOCUS_LAST_RECORD); else if (m_windowFocus == MB_FOCUS_LAST_RECORD) - onSetFocus(MB_FOCUS_MOVIE_INFO); + onSetFocus(MB_FOCUS_MOVIE_INFO1); } } @@ -2760,6 +2962,25 @@ void CMovieBrowser::updateMovieSelection(void) //TRACE("\n"); } +void CMovieBrowser::updateInfoSelection(void) +{ + int col_frame; + int thickness = 2; + int radius = m_pcInfo1->getBackGroundRadius(); + + /* + Maybe we should change background of box + instead of changing frame color. + */ + if (m_windowFocus == MB_FOCUS_MOVIE_INFO1) + col_frame = COL_MENUCONTENTSELECTED_PLUS_2; + else + col_frame = COL_FRAME_PLUS_0; + + // CTextBox can't paint frames, so let's do it "manually" + framebuffer->paintBoxFrame(m_cBoxFrameInfo1.iX, m_cBoxFrameInfo1.iY, m_cBoxFrameInfo1.iWidth, m_cBoxFrameInfo1.iHeight, thickness, col_frame, radius); +} + void CMovieBrowser::updateFilterSelection(void) { //TRACE("[mb]->updateFilterSelection \n"); @@ -3086,6 +3307,7 @@ bool CMovieBrowser::showMenu(bool calledExternally) /** optionsMenuBrowser **************************************************/ int oldRowNr = m_settings.browserRowNr; int oldFrameHeight = m_settings.browserFrameHeight; + int oldAdditional = m_settings.browserAdditional; CIntInput playMaxUserIntInput(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, (int *)&m_settings.lastPlayMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput recMaxUserIntInput(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, (int *)&m_settings.lastRecordMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput browserFrameUserIntInput(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int *)&m_settings.browserFrameHeight, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); @@ -3096,6 +3318,7 @@ bool CMovieBrowser::showMenu(bool calledExternally) optionsMenuBrowser.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, true, playMaxUserIntInput.getValue(), &playMaxUserIntInput)); optionsMenuBrowser.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, true, recMaxUserIntInput.getValue(), &recMaxUserIntInput)); optionsMenuBrowser.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, true, browserFrameUserIntInput.getValue(), &browserFrameUserIntInput)); + optionsMenuBrowser.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_BROWSER_ADDITIONAL, (int*)(&m_settings.browserAdditional), MESSAGEBOX_YES_NO_OPTIONS, MESSAGEBOX_YES_NO_OPTIONS_COUNT, true)); optionsMenuBrowser.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MOVIEBROWSER_BROWSER_ROW_HEAD)); optionsMenuBrowser.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_ROW_NR, true, browserRowNrIntInput.getValue(), &browserRowNrIntInput)); optionsMenuBrowser.addItem(GenericMenuSeparator); @@ -3179,7 +3402,24 @@ bool CMovieBrowser::showMenu(bool calledExternally) if (ts_only != m_settings.ts_only || dirMenu.isChanged()) loadMovies(false); - if (oldRowNr != m_settings.browserRowNr || oldFrameHeight != m_settings.browserFrameHeight) { + bool reInitFrames = ( + m_settings.browserRowNr != oldRowNr + || m_settings.browserFrameHeight != oldFrameHeight + || m_settings.browserAdditional != oldAdditional + ); + + if (reInitFrames) { +#if 1 + if (m_settings.browserAdditional && oldAdditional != m_settings.browserAdditional) + { + /* + Bad 'hack' to force a smaller m_pcInfo1 box. + This can be reconfigured by user later. + It's just to align view to channellist's view. + */ + m_settings.browserFrameHeight = 75; + } +#endif initFrames(); hide(); paint(); diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index aefffc146..d996f0d7c 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -96,6 +96,7 @@ typedef struct int browserRowNr; MB_INFO_ITEM browserRowItem[MB_MAX_ROWS]; int browserRowWidth[MB_MAX_ROWS]; + int browserAdditional; // to be added to config later int lastPlayMaxItems; @@ -144,23 +145,29 @@ class CMovieBrowser : public CMenuTarget private: // Variables CFrameBuffer * framebuffer; - CComponentsPicture *pic; + CListFrame* m_pcBrowser; CListFrame* m_pcLastPlay; CListFrame* m_pcLastRecord; - CTextBox* m_pcInfo; + CTextBox* m_pcInfo1; // bottom box + CTextBox* m_pcInfo2; // right box CListFrame* m_pcFilter; CBox m_cBoxFrame; CBox m_cBoxFrameLastPlayList; CBox m_cBoxFrameLastRecordList; CBox m_cBoxFrameBrowserList; - CBox m_cBoxFrameInfo; + CBox m_cBoxFrameInfo1; + CBox m_cBoxFrameInfo2; CBox m_cBoxFrameBookmarkList; CBox m_cBoxFrameFilter; CBox m_cBoxFrameFootRel; CBox m_cBoxFrameTitleRel; + CComponentsDetailLine *m_detailsLine; + CComponentsChannelLogo *m_channelLogo; + CComponentsPicture *m_movieCover; + LF_LINES m_browserListLines; LF_LINES m_recordListLines; LF_LINES m_playListLines; @@ -214,7 +221,6 @@ class CMovieBrowser : public CMenuTarget CFileList::iterator filelist_it; P_MI_MOVIE_LIST movielist; - CComponentsChannelLogo* CChannelLogo; uint64_t old_EpgId; int movieInfoUpdateAll[MB_INFO_MAX_NUMBER]; int movieInfoUpdateAllIfDestEmptyOnly; @@ -284,10 +290,15 @@ class CMovieBrowser : public CMenuTarget void refreshBrowserList(void); //P1 void refreshFilterList(void); //P1 void refreshMovieInfo(void); //P1 + void refreshChannelLogo(void); //P1 + void initMovieCover(void); //P1 + void refreshMovieCover(void); //P1 int refreshFoot(bool show = true); //P2 void refreshTitle(void); //P2 void refreshInfo(void); // P2 void refreshLCD(void); // P2 + void refreshDetailsLine(int pos); + void hideDetailsLine(); ///// Events /////////////////////////// bool onButtonPress(neutrino_msg_t msg); // P1 @@ -339,6 +350,7 @@ class CMovieBrowser : public CMenuTarget bool isParentalLock(MI_MOVIE_INFO& movie_info); bool getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM item, std::string* item_string); void updateMovieSelection(void); + void updateInfoSelection(void); void updateFilterSelection(void); void updateSerienames(void); void autoFindSerie(void); @@ -352,7 +364,6 @@ class CMovieBrowser : public CMenuTarget bool addFile(CFile &file, int dirItNr); }; - // I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage. //Might be replaced by somebody who is familiar with this stuff . @@ -365,7 +376,6 @@ class CSelectedMenu : public CMenuTarget inline int exec(CMenuTarget* /*parent*/, const std::string & /*actionKey*/){selected = true; return menu_return::RETURN_EXIT;}; }; - // This Class creates a menue item, which writes its caption to an given string (or an given int value to an given variable). // The programm could use this class to verify, what menu was selected. // A good listbox class might do the same. There might be better ways to do so. @@ -397,7 +407,6 @@ class CMenuWidgetSelection : public CMenuWidget int getSelectedLine(void){return exit_pressed ? -1 : selected;}; }; - class CFileChooser : public CMenuWidget { private: @@ -408,8 +417,6 @@ class CFileChooser : public CMenuWidget int exec(CMenuTarget* parent, const std::string & actionKey); }; - - class CDirMenu : public CMenuWidget { private: @@ -428,7 +435,4 @@ class CDirMenu : public CMenuWidget bool isChanged(){return changed;}; }; - - - #endif /*MOVIEBROWSER_H_*/ diff --git a/src/gui/moviebrowser/mb_types.h b/src/gui/moviebrowser/mb_types.h index b260d0ec7..30ba01b93 100644 --- a/src/gui/moviebrowser/mb_types.h +++ b/src/gui/moviebrowser/mb_types.h @@ -104,9 +104,10 @@ typedef enum MB_FOCUS_BROWSER = 0, MB_FOCUS_LAST_PLAY = 1, MB_FOCUS_LAST_RECORD = 2, - MB_FOCUS_MOVIE_INFO = 3, - MB_FOCUS_FILTER = 4, - MB_FOCUS_MAX_NUMBER = 5 // MUST be allways the last item in the list + MB_FOCUS_MOVIE_INFO1 = 3, + MB_FOCUS_MOVIE_INFO2 = 4, + MB_FOCUS_FILTER = 5, + MB_FOCUS_MAX_NUMBER = 6 // MUST be allways the last item in the list }MB_FOCUS; typedef enum diff --git a/src/system/locals.h b/src/system/locals.h index b705a9f65..7e3f48afa 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1661,6 +1661,7 @@ typedef enum LOCALE_MOVIEBROWSER_BOOK_TYPE, LOCALE_MOVIEBROWSER_BOOK_TYPE_BACKWARD, LOCALE_MOVIEBROWSER_BOOK_TYPE_FORWARD, + LOCALE_MOVIEBROWSER_BROWSER_ADDITIONAL, LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, LOCALE_MOVIEBROWSER_BROWSER_ROW_HEAD, LOCALE_MOVIEBROWSER_BROWSER_ROW_ITEM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b0e4ade50..66660b194 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1661,6 +1661,7 @@ const char * locale_real_names[] = "moviebrowser.book_type", "moviebrowser.book_type_backward", "moviebrowser.book_type_forward", + "moviebrowser.browser_additional", "moviebrowser.browser_frame_high", "moviebrowser.browser_row_head", "moviebrowser.browser_row_item",