Merge branch 'master' into pu/msgbox

Conflicts:
	src/gui/moviebrowser/mb.cpp
This commit is contained in:
2016-11-10 10:27:22 +01:00
22 changed files with 707 additions and 319 deletions

View File

@@ -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;
@@ -428,7 +434,7 @@ void CMovieBrowser::initGlobalSettings(void)
m_settings.sorting.direction = MB_DIRECTION_DOWN;
m_settings.filter.item = MB_INFO_MAX_NUMBER;
m_settings.filter.optionString = "";
m_settings.filter.optionString = g_Locale->getText(LOCALE_OPTIONS_OFF);
m_settings.filter.optionVar = 0;
m_settings.parentalLockAge = MI_PARENTAL_OVER18;
@@ -447,7 +453,7 @@ void CMovieBrowser::initGlobalSettings(void)
}
/***** Browser List **************/
m_settings.browserFrameHeight = 50; /* percent */
m_settings.browserFrameHeight = 65; /* percent */
m_settings.browserRowNr = 6;
m_settings.browserRowItem[0] = MB_INFO_CHANNEL;
@@ -460,16 +466,18 @@ void CMovieBrowser::initGlobalSettings(void)
m_settings.browserRowItem[7] = MB_INFO_MAX_NUMBER;
m_settings.browserRowItem[8] = MB_INFO_MAX_NUMBER;
m_settings.browserRowWidth[0] = m_defaultRowWidth[m_settings.browserRowItem[0]]; //300;
m_settings.browserRowWidth[1] = m_defaultRowWidth[m_settings.browserRowItem[1]]; //100;
m_settings.browserRowWidth[2] = m_defaultRowWidth[m_settings.browserRowItem[2]]; //80;
m_settings.browserRowWidth[3] = m_defaultRowWidth[m_settings.browserRowItem[3]]; //50;
m_settings.browserRowWidth[4] = m_defaultRowWidth[m_settings.browserRowItem[4]]; //30;
m_settings.browserRowWidth[5] = m_defaultRowWidth[m_settings.browserRowItem[5]]; //30;
m_settings.browserRowWidth[0] = m_defaultRowWidth[m_settings.browserRowItem[0]];
m_settings.browserRowWidth[1] = m_defaultRowWidth[m_settings.browserRowItem[1]];
m_settings.browserRowWidth[2] = m_defaultRowWidth[m_settings.browserRowItem[2]];
m_settings.browserRowWidth[3] = m_defaultRowWidth[m_settings.browserRowItem[3]];
m_settings.browserRowWidth[4] = m_defaultRowWidth[m_settings.browserRowItem[4]];
m_settings.browserRowWidth[5] = m_defaultRowWidth[m_settings.browserRowItem[5]];
m_settings.browserRowWidth[6] = m_defaultRowWidth[m_settings.browserRowItem[6]];
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_cBoxFrameInfo1.iX;
m_cBoxFrameFilter.iY = m_cBoxFrameInfo1.iY;
m_cBoxFrameFilter.iWidth = m_cBoxFrameInfo1.iWidth;
m_cBoxFrameFilter.iHeight = m_cBoxFrameInfo1.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)
@@ -1100,23 +1124,26 @@ int CMovieBrowser::paint(void)
m_pcLastRecord = new CListFrame(&m_recordListLines, font, CListFrame::SCROLL | CListFrame::HEADER_LINE | CListFrame::TITLE,
&m_cBoxFrameLastRecordList, g_Locale->getText(LOCALE_MOVIEBROWSER_HEAD_RECORDLIST),
g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_HEAD]);
m_pcFilter = new CListFrame(&m_FilterLines, font, CListFrame::SCROLL | CListFrame::TITLE,
m_pcFilter = new CListFrame(&m_FilterLines, g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_INFO], 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,14 @@ int CMovieBrowser::paint(void)
return (false);
}
m_pcFilter->setBackGroundRadius(RADIUS_LARGE);
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 +1205,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,114 +1277,256 @@ 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;
int h_logo_max = m_cBoxFrameTitleRel.iHeight - 2*OFFSET_INNER_MIN;
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())
{
// TODO: move into an own handler, eg. header, so channel logo should be paint in header object
m_channelLogo->setWidth(min(m_channelLogo->getWidth(), w_logo_max), true);
if (m_channelLogo->getHeight() > h_logo_max)
m_channelLogo->setHeight(h_logo_max, true);
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;
}
else
{
movieCoverBox = m_cBoxFrameInfo1;
// we have to align cover to box height
cover_h = movieCoverBox.iHeight - 2*OFFSET_INNER_MID - OFFSET_SHADOW;
}
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);
}
// 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
TRACE("[mb]->%s:%d m_movieCover->getHeight(): %d\n", __func__, __LINE__, m_movieCover->getHeight());
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_YES);
}
void CMovieBrowser::hideMovieCover(void)
{
TRACE("[mb]->%s:%d\n", __func__, __LINE__);
if (m_movieCover)
m_movieCover->hide();
}
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
std::string emptytext = " ";
m_pcInfo->setText(&emptytext);
hideDetailsLine();
// clear m_pcInfo1 text before new init
m_pcInfo1->clear();
// clear m_pcInfo2 text, reset position and dimensions before new init
m_pcInfo2->movePosition(m_cBoxFrameInfo2.iX, m_cBoxFrameInfo2.iY);
m_pcInfo2->setWindowMaxDimensions(m_cBoxFrameInfo2.iWidth, m_cBoxFrameInfo2.iHeight);
m_pcInfo2->setWindowMinDimensions(m_cBoxFrameInfo2.iWidth, m_cBoxFrameInfo2.iHeight);
m_pcInfo2->clear();
if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional)
m_pcInfo1->setTextFont(g_Font[SNeutrinoSettings::FONT_TYPE_MOVIEBROWSER_LIST]);
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;
std::string pcInfo1_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);
//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;
pcInfo1_content = m_movieSelectionHandler->epgInfo1;
pcInfo1_content += "\n";
pcInfo1_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
{
pcInfo1_content = m_movieSelectionHandler->epgInfo2;
}
m_pcInfo1->setText(&pcInfo1_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();
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 + OFFSET_INNER_MID + 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, COL_MENUCONTENT_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)
@@ -1376,8 +1553,8 @@ void CMovieBrowser::info_hdd_level(bool paint_hdd)
pb.setValues(blocks_percent_used, 100);
pb.paint(false);
}
}
void CMovieBrowser::refreshLCD(void)
{
if (m_vMovieInfo.empty() || m_movieSelectionHandler == NULL)
@@ -1414,7 +1591,7 @@ void CMovieBrowser::refreshFilterList(void)
}
else
{
std::string tmp = g_Locale->getText(LOCALE_MENU_BACK);
std::string tmp = g_Locale->getText(LOCALE_MOVIEBROWSER_FILTER_OFF);
m_FilterLines.lineArray[0].push_back(tmp);
if (m_settings.filter.item == MB_INFO_FILEPATH)
@@ -1673,17 +1850,19 @@ int CMovieBrowser::refreshFoot(bool show)
int ok_loc_len = std::max(FOOT_FONT->getRenderWidth(g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), true),
FOOT_FONT->getRenderWidth(g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_PLAY), true));
std::string filter_text = g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_FILTER);
filter_text += " ";
filter_text += m_settings.filter.optionString;
std::string sort_text = g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_SORT);
sort_text += g_Locale->getText(m_localizedItemName[m_settings.sorting.item]);
int sort_text_len = FOOT_FONT->getRenderWidth(g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_SORT), true);
sort_text += " ";
int sort_text_len = FOOT_FONT->getRenderWidth(sort_text, true);
int len = 0;
for (int i = 0; m_localizedItemName[i] != NONEXISTANT_LOCALE; i++)
len = std::max(len, FOOT_FONT->getRenderWidth(g_Locale->getText(m_localizedItemName[i]), true));
sort_text_len += len;
sort_text += g_Locale->getText(m_localizedItemName[m_settings.sorting.item]);
button_label_ext footerButtons[] = {
{ NEUTRINO_ICON_BUTTON_RED, NONEXISTANT_LOCALE, sort_text.c_str(), sort_text_len, false },
{ NEUTRINO_ICON_BUTTON_RED, NONEXISTANT_LOCALE, sort_text.c_str(), sort_text_len, false },
{ NEUTRINO_ICON_BUTTON_GREEN, NONEXISTANT_LOCALE, filter_text.c_str(), 0, true },
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_MOVIEBROWSER_FOOT_FOCUS, NULL, 0, false },
{ NEUTRINO_ICON_BUTTON_BLUE, LOCALE_MOVIEBROWSER_FOOT_REFRESH, NULL, 0, false },
@@ -1695,7 +1874,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);
}
@@ -1713,7 +1892,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);
@@ -1752,32 +1931,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, CMsgBox::mbrNo, CMsgBox:: mbYes | CMsgBox::mbNo) == CMsgBox::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)
@@ -1795,12 +1974,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)
@@ -2086,7 +2269,7 @@ bool CMovieBrowser::onButtonPressFilterList(neutrino_msg_t msg)
if (selected_line == 0)
{
m_settings.filter.item = MB_INFO_MAX_NUMBER;
m_settings.filter.optionString = "";
m_settings.filter.optionString = g_Locale->getText(LOCALE_OPTIONS_OFF);
m_settings.filter.optionVar = 0;
refreshFilterList();
m_pcFilter->setSelectedLine(0);
@@ -2116,12 +2299,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);
}
@@ -2186,9 +2377,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))
@@ -2314,6 +2505,7 @@ void CMovieBrowser::onSetGUIWindow(MB_GUI gui)
m_pcBrowser->hide();
m_pcFilter->hide();
m_pcInfo2->hide();
m_pcLastRecord->paint();
m_pcLastPlay->paint();
@@ -2329,6 +2521,7 @@ void CMovieBrowser::onSetGUIWindow(MB_GUI gui)
m_pcBrowser->hide();
m_pcFilter->hide();
m_pcInfo2->hide();
m_pcLastRecord->paint();
m_pcLastPlay->paint();
@@ -2338,13 +2531,21 @@ void CMovieBrowser::onSetGUIWindow(MB_GUI gui)
m_showMovieInfo = false;
m_pcInfo->hide();
m_pcInfo1->hide();
if (m_windowFocus == MB_FOCUS_BROWSER && m_settings.browserAdditional)
{
hideMovieCover();
m_pcInfo2->clear();
}
hideDetailsLine();
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();
}
}
@@ -2390,6 +2591,8 @@ void CMovieBrowser::onSetFocus(MB_FOCUS new_focus)
m_pcFilter->showSelection(true);
updateMovieSelection();
if (m_windowFocus != MB_FOCUS_FILTER)
updateInfoSelection();
refreshFoot();
}
@@ -2407,23 +2610,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);
}
}
@@ -2761,6 +2967,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");
@@ -3087,6 +3312,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);
@@ -3097,6 +3323,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);
@@ -3180,7 +3407,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();