mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
CUpnpBrowserGui: rework image view
This commit is contained in:
@@ -89,15 +89,17 @@ CUpnpBrowserGui::CUpnpBrowserGui()
|
|||||||
timebox.enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_INFOBAR_SHADOW_PLUS_1, g_settings.theme.menu_Hint_gradient_direction);
|
timebox.enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_INFOBAR_SHADOW_PLUS_1, g_settings.theme.menu_Hint_gradient_direction);
|
||||||
|
|
||||||
dline = NULL;
|
dline = NULL;
|
||||||
|
image = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CUpnpBrowserGui::~CUpnpBrowserGui()
|
CUpnpBrowserGui::~CUpnpBrowserGui()
|
||||||
{
|
{
|
||||||
delete m_socket;
|
delete m_socket;
|
||||||
if (dline){
|
if (dline){
|
||||||
delete dline;
|
delete dline; dline = NULL;
|
||||||
dline = NULL;
|
|
||||||
}
|
}
|
||||||
|
if (image)
|
||||||
|
delete image, image = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
||||||
@@ -870,43 +872,24 @@ bool CUpnpBrowserGui::selectItem(std::string id)
|
|||||||
|
|
||||||
void CUpnpBrowserGui::paintDeviceInfo()
|
void CUpnpBrowserGui::paintDeviceInfo()
|
||||||
{
|
{
|
||||||
std::string tmp;
|
|
||||||
// int w, xstart;
|
|
||||||
|
|
||||||
CVFD::getInstance()->showMenuText(0, m_devices[m_selecteddevice].friendlyname.c_str(), -1, true);
|
CVFD::getInstance()->showMenuText(0, m_devices[m_selecteddevice].friendlyname.c_str(), -1, true);
|
||||||
|
|
||||||
topbox.setDimensionsAll(m_x, m_y, m_width, m_title_height-10);
|
|
||||||
// topbox.paint0();
|
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
// m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height - 10, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
|
std::string tmp;
|
||||||
// m_frameBuffer->paintBoxRel(m_x + 2, m_y + 2, m_width - 4, m_title_height - 14, COL_MENUCONTENTSELECTED_PLUS_0, RADIUS_MID);
|
|
||||||
|
|
||||||
// first line
|
// first line
|
||||||
tmp = m_devices[m_selecteddevice].manufacturer + " " +
|
tmp = m_devices[m_selecteddevice].manufacturer + " " +
|
||||||
m_devices[m_selecteddevice].manufacturerurl + "\n";
|
m_devices[m_selecteddevice].manufacturerurl + "\n";
|
||||||
// w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
||||||
// w = std::min(w, m_width - 20);
|
|
||||||
// xstart = (m_width - w) / 2;
|
|
||||||
// g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20,
|
|
||||||
// tmp, COL_MENUCONTENTSELECTED_TEXT);
|
|
||||||
|
|
||||||
// second line
|
// second line
|
||||||
tmp += m_devices[m_selecteddevice].modelname + " " +
|
tmp += m_devices[m_selecteddevice].modelname + " " +
|
||||||
m_devices[m_selecteddevice].modelnumber + " " +
|
m_devices[m_selecteddevice].modelnumber + " " +
|
||||||
m_devices[m_selecteddevice].modeldescription + "\n";
|
m_devices[m_selecteddevice].modeldescription + "\n";
|
||||||
// w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
||||||
// w = std::min(w, m_width - 20);
|
|
||||||
// xstart = (m_width - w) / 2;
|
|
||||||
// g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20,
|
|
||||||
// tmp, COL_MENUCONTENTSELECTED_TEXT);
|
|
||||||
// third line
|
// third line
|
||||||
tmp += m_devices[m_selecteddevice].modelurl;
|
tmp += m_devices[m_selecteddevice].modelurl;
|
||||||
// w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
||||||
// w = std::min(w, m_width - 20);
|
topbox.setDimensionsAll(m_x, m_y, m_width, m_title_height-10);
|
||||||
// xstart = (m_width - w) / 2;
|
|
||||||
// g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20,
|
|
||||||
// tmp, COL_MENUCONTENTSELECTED_TEXT);
|
|
||||||
topbox.setText(tmp, CTextBox::AUTO_WIDTH);
|
topbox.setText(tmp, CTextBox::AUTO_WIDTH);
|
||||||
topbox.paint0();
|
topbox.paint0();
|
||||||
}
|
}
|
||||||
@@ -1063,10 +1046,6 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
|
|||||||
// LCD
|
// LCD
|
||||||
CVFD::getInstance()->showMenuText(0, entry->title.c_str(), -1, true);
|
CVFD::getInstance()->showMenuText(0, entry->title.c_str(), -1, true);
|
||||||
|
|
||||||
// Info
|
|
||||||
// m_frameBuffer->paintBoxRel(m_x, m_y, m_width, m_title_height - 10, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
|
|
||||||
// m_frameBuffer->paintBoxRel(m_x + 2, m_y + 2, m_width - 4, m_title_height - 14, COL_MENUCONTENTSELECTED_PLUS_0, RADIUS_MID);
|
|
||||||
|
|
||||||
// first line
|
// first line
|
||||||
ts << "Resources: " << entry->resources.size() << " Selected: " << preferred+1 << " ";
|
ts << "Resources: " << entry->resources.size() << " Selected: " << preferred+1 << " ";
|
||||||
tmp = ts.str();
|
tmp = ts.str();
|
||||||
@@ -1077,12 +1056,6 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
|
|||||||
tmp = tmp + "No resource for Item";
|
tmp = tmp + "No resource for Item";
|
||||||
tmp += "\n";
|
tmp += "\n";
|
||||||
|
|
||||||
// w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
||||||
// w = std::min(w, m_width - 20);
|
|
||||||
// xstart = (m_width - w) / 2;
|
|
||||||
// g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 1*m_mheight, m_width - 20,
|
|
||||||
// tmp, COL_MENUCONTENTSELECTED_TEXT);
|
|
||||||
|
|
||||||
// second line
|
// second line
|
||||||
if (entry->isdir)
|
if (entry->isdir)
|
||||||
tmp += "Directory";
|
tmp += "Directory";
|
||||||
@@ -1093,39 +1066,34 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
|
|||||||
tmp += "Protocol: " + entry->proto + ", MIME-Type: " + entry->mime;
|
tmp += "Protocol: " + entry->proto + ", MIME-Type: " + entry->mime;
|
||||||
}
|
}
|
||||||
tmp += "\n";
|
tmp += "\n";
|
||||||
// w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
||||||
// w = std::min(w, m_width - 20);
|
|
||||||
// xstart = (m_width - w) / 2;
|
|
||||||
// g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 2*m_mheight, m_width - 20,
|
|
||||||
// tmp, COL_MENUCONTENTSELECTED_TEXT);
|
|
||||||
|
|
||||||
//third line
|
//third line
|
||||||
// tmp += "";
|
// tmp += "";
|
||||||
if (!entry->isdir && preferred != -1)
|
if (!entry->isdir && preferred != -1)
|
||||||
tmp += "URL: " + entry->resources[preferred].url;
|
tmp += "URL: " + entry->resources[preferred].url;
|
||||||
|
|
||||||
// w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
|
|
||||||
// w = std::min(w, m_width - 20);
|
|
||||||
// xstart = (m_width - w) / 2;
|
|
||||||
// g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20,
|
|
||||||
// tmp, COL_MENUCONTENTSELECTED_TEXT);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static std::string lastname = "", tmpname = "";
|
static std::string lastname = "", tmpname = "";
|
||||||
if(!entry->albumArtURI.empty()){
|
if(!entry->albumArtURI.empty()){
|
||||||
static int flogo_w = 0, flogo_h = 0;
|
static int flogo_w = 0, flogo_h = 0;
|
||||||
if(lastname != entry->albumArtURI){
|
if(lastname != entry->albumArtURI){
|
||||||
tmpname = lastname = entry->albumArtURI.c_str();
|
tmpname = lastname = entry->albumArtURI.c_str();
|
||||||
tmpname = g_PicViewer->DownloadImage(tmpname );
|
tmpname = g_PicViewer->DownloadImage(tmpname);
|
||||||
// flogo_w = 0, flogo_h = 0;
|
int h_image = ibox.getHeight()- SHADOW_OFFSET - ibox.getCornerRadius();
|
||||||
// g_PicViewer->getSize(tmpname.c_str(), &flogo_w, &flogo_h);
|
int y_image = ibox.getYPos() + ibox.getHeight()/2 - h_image/2;
|
||||||
// if((flogo_h > m_title_height-14) || (m_title_height*2 > flogo_h)){
|
if (!image){
|
||||||
// g_PicViewer->rescaleImageDimensions(&flogo_w, &flogo_h, m_title_height*2, m_title_height-14);
|
image = new CComponentsPicture(100, y_image, tmpname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTDARK_PLUS_0);
|
||||||
// }
|
}
|
||||||
|
image->setPicture(tmpname);
|
||||||
|
image->setHeight(h_image, true);
|
||||||
|
int x_image = ibox.getXPos() + ibox.getWidth()- image->getWidth()- SHADOW_OFFSET - ibox.getCornerRadius();
|
||||||
|
image->setXPos(x_image);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (image){
|
||||||
|
delete image; image = NULL;
|
||||||
}
|
}
|
||||||
//g_PicViewer->DisplayImage(tmpname.c_str(), m_x+m_width-flogo_w-2-RADIUS_MID, m_y + 2, flogo_w, flogo_h);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
topbox.setText(tmp, CTextBox::AUTO_WIDTH);
|
topbox.setText(tmp, CTextBox::AUTO_WIDTH);
|
||||||
topbox.paint0();
|
topbox.paint0();
|
||||||
}
|
}
|
||||||
@@ -1200,6 +1168,8 @@ void CUpnpBrowserGui::paintDetails(UPnPEntry *entry, bool use_playing)
|
|||||||
text += "\n" + entry->album;
|
text += "\n" + entry->album;
|
||||||
ibox.setText(text, CTextBox::AUTO_WIDTH);
|
ibox.setText(text, CTextBox::AUTO_WIDTH);
|
||||||
ibox.paint0();
|
ibox.paint0();
|
||||||
|
if (image)
|
||||||
|
image->paint0();
|
||||||
}
|
}
|
||||||
timebox.paint0();
|
timebox.paint0();
|
||||||
}
|
}
|
||||||
|
@@ -104,6 +104,7 @@ class CUpnpBrowserGui : public CMenuTarget, public CListHelpers
|
|||||||
CComponentsDetailLine * dline;
|
CComponentsDetailLine * dline;
|
||||||
CComponentsFooter footer;
|
CComponentsFooter footer;
|
||||||
CComponentsInfoBox ibox, timebox, topbox;
|
CComponentsInfoBox ibox, timebox, topbox;
|
||||||
|
CComponentsPicture *image;
|
||||||
|
|
||||||
bool discoverDevices();
|
bool discoverDevices();
|
||||||
void splitProtocol(std::string &protocol, std::string &prot, std::string &network, std::string &mime, std::string &additional);
|
void splitProtocol(std::string &protocol, std::string &prot, std::string &network, std::string &mime, std::string &additional);
|
||||||
|
Reference in New Issue
Block a user