CImageInfo: split function InitLicenseText()

InitInfoText() now handles only infotext via parameter text, so it is
possible to set different text into infobox item.
This commit is contained in:
2013-10-19 01:17:48 +02:00
parent 3438b23f68
commit 8e246f16a8
2 changed files with 18 additions and 8 deletions

View File

@@ -148,7 +148,7 @@ void CImageInfo::ShowWindow()
InitInfos(); InitInfos();
//prepare license text //prepare license text
InitLicenseText(); InitInfoText(getLicenseText());
//paint window //paint window
cc_win->paint(); cc_win->paint();
@@ -287,26 +287,34 @@ void CImageInfo::InitInfos()
cc_info->setHeight(h_tmp); cc_info->setHeight(h_tmp);
} }
//prepare license infos //get license
void CImageInfo::InitLicenseText() string CImageInfo::getLicenseText()
{ {
string file = LICENSEDIR; string file = LICENSEDIR;
file += g_settings.language; file += g_settings.language;
file += ".license"; file += ".license";
CComponentsText txt;
string res = txt.getTextFromFile(file);
return res;
}
//prepare info text
void CImageInfo::InitInfoText(const std::string& text)
{
//get window body object //get window body object
CComponentsForm *winbody = cc_win->getBodyObject(); CComponentsForm *winbody = cc_win->getBodyObject();
int h_body = winbody->getHeight(); int h_body = winbody->getHeight();
int w_body = winbody->getWidth(); int w_body = winbody->getWidth();
int y_lic = item_offset + cc_info->getHeight() + item_offset; int y_lic = item_offset + cc_info->getHeight() + item_offset;
int h_lic = h_body - y_lic - item_offset; int h_lic = h_body - y_lic - item_offset;
if (cc_lic == NULL) if (cc_lic == NULL)
cc_lic = new CComponentsInfoBox(item_offset, cc_info->getYPos()+cc_info->getHeight()+item_offset, w_body-2*item_offset, h_lic); cc_lic = new CComponentsInfoBox(item_offset, cc_info->getYPos()+cc_info->getHeight()+item_offset, w_body-2*item_offset, h_lic);
cc_lic->setSpaceOffset(0); cc_lic->setSpaceOffset(0);
cc_lic->setTextFromFile(file, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); cc_lic->setText(text, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]);
#if 0 #if 0
//calc y pos of license box to avoid an overlap with pip //calc y pos of license box to avoid an overlap with pip
@@ -321,6 +329,7 @@ void CImageInfo::InitLicenseText()
#endif #endif
//add text to container //add text to container
if (!cc_lic->isAdded())
cc_win->addWindowItem(cc_lic); cc_win->addWindowItem(cc_lic);
} }

View File

@@ -55,7 +55,8 @@ class CImageInfo : public CMenuTarget
void Init(); void Init();
void InitMinitv(); void InitMinitv();
void InitInfos(); void InitInfos();
void InitLicenseText(); void InitInfoText(const std::string& text);
std::string getLicenseText();
void ShowWindow(); void ShowWindow();
void ScrollLic(bool scrollDown); void ScrollLic(bool scrollDown);