mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-16 18:03:37 +02:00
Merge branch 'ni/cst-next' into ni/mp/cst-next
Origin commit data
------------------
Commit: 23990764bf
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-10-13 (Thu, 13 Oct 2016)
This commit is contained in:
@@ -825,7 +825,7 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int
|
||||
return;
|
||||
|
||||
if (dx == 0 || dy == 0) {
|
||||
//NI dprintf(DEBUG_NORMAL, "[CFrameBuffer] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx, y+dy);
|
||||
dprintf(DEBUG_DEBUG, "[CFrameBuffer] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx, y+dy);
|
||||
return;
|
||||
}
|
||||
if (radius < 0)
|
||||
|
@@ -111,6 +111,7 @@ void CComponentsScrollBar::initTopNaviIcon()
|
||||
//initialize icon object
|
||||
if (sb_up_obj == NULL){
|
||||
sb_up_obj = new CComponentsPicture(CC_CENTERED, fr_thickness, sb_up_icon, this);
|
||||
sb_up_obj->SetTransparent(CFrameBuffer::TM_BLACK);
|
||||
sb_up_obj->doPaintBg(false);
|
||||
}
|
||||
sb_up_obj->setWidth(width-2*fr_thickness);
|
||||
@@ -121,6 +122,7 @@ void CComponentsScrollBar::initBottomNaviIcon()
|
||||
//initialize icon object
|
||||
if (sb_down_obj == NULL){
|
||||
sb_down_obj = new CComponentsPicture(CC_CENTERED, CC_APPEND, sb_down_icon, this);
|
||||
sb_down_obj->SetTransparent(CFrameBuffer::TM_BLACK);
|
||||
sb_down_obj->doPaintBg(false);
|
||||
}
|
||||
sb_down_obj->setWidth(width-2*fr_thickness);
|
||||
@@ -165,13 +167,17 @@ void CComponentsScrollBar::initSegments()
|
||||
|
||||
//set color for marked id
|
||||
if (sb_mark_id == id){
|
||||
item->setColorBody(COL_MENUCONTENTSELECTED_PLUS_0);
|
||||
item->setColorBody(COL_SCROLLBAR_ACTIVE);
|
||||
#if 0
|
||||
item->enableColBodyGradient(CC_COLGRAD_COL_A_2_COL_B);
|
||||
item->setColBodyGradient(CColorGradient::gradientDark2Light2Dark, CFrameBuffer::gradientHorizontal);
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
item->setColorBody(COL_SCROLLBAR_PASSIVE_PLUS_0);
|
||||
item->setColorBody(COL_SCROLLBAR_PASSIVE);
|
||||
#if 0
|
||||
item->disableColBodyGradient();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -70,7 +70,7 @@ CComponentsInfoBox::CComponentsInfoBox( const int& x_pos,
|
||||
pic = NULL;
|
||||
cctext = NULL;
|
||||
pic_name = "";
|
||||
x_offset = 10;
|
||||
x_offset = OFFSET_INNER_MID;
|
||||
initParent(parent);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ void CComponentsInfoBox::paint(bool do_save_bg)
|
||||
|
||||
//calculate vars for x-position and dimensions
|
||||
int tx = x_offset + x_text + pic_w;
|
||||
int tw = width - x_offset - pic_w - 2*fr_thickness;
|
||||
int tw = width - 2*x_offset - pic_w - 2*fr_thickness;
|
||||
int th = height-2*fr_thickness;
|
||||
cctext->setDimensionsAll(tx, y_text, tw, th);
|
||||
|
||||
|
@@ -173,6 +173,9 @@ class CComponentsText : public CCTextScreen, public CComponentsItem, public CBox
|
||||
///returns current text content of text/label object as std::string
|
||||
virtual std::string getText(){return ct_text;};
|
||||
|
||||
///return current font
|
||||
Font* getFont(){return ct_font;}
|
||||
|
||||
///set screen x-position, parameter as int
|
||||
virtual void setXPos(const int& xpos);
|
||||
///set screen y-position, parameter as int
|
||||
|
@@ -331,7 +331,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
bool dont_hide = false;
|
||||
paintHead(channel_id, channelname, channelname_prev, channelname_next);
|
||||
paint(channel_id);
|
||||
showFunctionBar(true, channel_id);
|
||||
showFunctionBar(channel_id);
|
||||
|
||||
int oldselected = selected;
|
||||
|
||||
@@ -363,14 +363,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup ||
|
||||
msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)
|
||||
{
|
||||
bool paint_buttonbar = false; //function bar
|
||||
int prev_selected = selected;
|
||||
// TODO: do we need this at all? Search button is always painted IIUC...
|
||||
if ((g_settings.key_channelList_addremind != (int)CRCInput::RC_nokey) ||
|
||||
(g_settings.key_channelList_sort != (int)CRCInput::RC_nokey) ||
|
||||
((g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) &&
|
||||
(g_settings.key_channelList_addrecord != (int)CRCInput::RC_nokey)))
|
||||
paint_buttonbar = true;
|
||||
int new_sel = UpDownKey(evtlist, msg, listmaxshow, selected);
|
||||
if (new_sel >= 0) {
|
||||
selected = new_sel;
|
||||
@@ -385,7 +378,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
else
|
||||
paintItem(selected - liststart, channel_id);
|
||||
|
||||
showFunctionBar(paint_buttonbar, channel_id);
|
||||
showFunctionBar(channel_id);
|
||||
}
|
||||
//sort
|
||||
else if (!showfollow && (msg == (neutrino_msg_t)g_settings.key_channelList_sort))
|
||||
@@ -443,7 +436,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
timerlist.clear();
|
||||
g_Timerd->getTimerList (timerlist);
|
||||
paint(evtlist[selected].channelID);
|
||||
showFunctionBar(true, evtlist[selected].channelID);
|
||||
showFunctionBar(evtlist[selected].channelID);
|
||||
continue;
|
||||
}
|
||||
std::string recDir = g_settings.network_nfs_recordingdir;
|
||||
@@ -498,7 +491,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
timerlist.clear();
|
||||
g_Timerd->getTimerList (timerlist);
|
||||
paint(used_id);
|
||||
showFunctionBar(true, used_id);
|
||||
showFunctionBar(used_id);
|
||||
}
|
||||
}
|
||||
else if ( msg == (neutrino_msg_t) g_settings.key_channelList_addremind )//add/remove zapto timer event
|
||||
@@ -510,7 +503,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
timerlist.clear();
|
||||
g_Timerd->getTimerList (timerlist);
|
||||
paint(evtlist[selected].channelID);
|
||||
showFunctionBar(true, evtlist[selected].channelID);
|
||||
showFunctionBar(evtlist[selected].channelID);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -522,7 +515,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
timerlist.clear();
|
||||
g_Timerd->getTimerList (timerlist);
|
||||
paint(evtlist[selected].channelID );
|
||||
showFunctionBar(true, evtlist[selected].channelID );
|
||||
showFunctionBar(evtlist[selected].channelID );
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);
|
||||
}
|
||||
else if (msg == (neutrino_msg_t)g_settings.key_channelList_cancel)
|
||||
@@ -533,7 +526,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
paintHead(channel_id, channelname);
|
||||
readEvents(epg_id);
|
||||
paint(channel_id);
|
||||
showFunctionBar(true, channel_id);
|
||||
showFunctionBar(channel_id);
|
||||
} else {
|
||||
selected = oldselected;
|
||||
if(fader.StartFadeOut()) {
|
||||
@@ -596,7 +589,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
oldEventID = -1;
|
||||
bgRightBoxPaint = false;
|
||||
paint(channel_id);
|
||||
showFunctionBar(true, channel_id);
|
||||
showFunctionBar(channel_id);
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);
|
||||
}
|
||||
else if (msg == CRCInput::RC_epg)
|
||||
@@ -639,7 +632,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
|
||||
oldEventID = -1;
|
||||
bgRightBoxPaint = false;
|
||||
paint(channel_id);
|
||||
showFunctionBar(true, channel_id);
|
||||
showFunctionBar(channel_id);
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);
|
||||
}
|
||||
}
|
||||
@@ -953,19 +946,13 @@ void CEventList::paint(t_channel_id channel_id)
|
||||
|
||||
}
|
||||
|
||||
void CEventList::showFunctionBar (bool show, t_channel_id channel_id)
|
||||
void CEventList::showFunctionBar(t_channel_id channel_id)
|
||||
{
|
||||
int bx = x;
|
||||
int bw = full_width;
|
||||
int bh = iheight;
|
||||
int by = y + height - bh;
|
||||
|
||||
if (! show) {
|
||||
// -- hide only?
|
||||
frameBuffer->paintBackgroundBoxRel(bx,by,bw,bh);
|
||||
return;
|
||||
}
|
||||
|
||||
CColorKeyHelper keyhelper; //user_menue.h
|
||||
neutrino_msg_t dummy = CRCInput::RC_nokey;
|
||||
const char * icon = NULL;
|
||||
@@ -1180,7 +1167,7 @@ bool CEventList::findEvents(t_channel_id channel_id, std::string channelname)
|
||||
else
|
||||
paintHead(channel_id, channelname);
|
||||
paint();
|
||||
showFunctionBar(true, channel_id);
|
||||
showFunctionBar(channel_id);
|
||||
return(res);
|
||||
}
|
||||
|
||||
|
@@ -114,7 +114,7 @@ class CEventList : public CListHelpers
|
||||
void paint(t_channel_id channel_id = 0);
|
||||
void paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev = "", std::string _channelname_next = "");
|
||||
void hide();
|
||||
void showFunctionBar(bool show, t_channel_id channel_id);
|
||||
void showFunctionBar(t_channel_id channel_id);
|
||||
|
||||
int timerPre;
|
||||
int timerPost;
|
||||
|
@@ -617,22 +617,93 @@ int COPKGManager::showMenu()
|
||||
|
||||
bool COPKGManager::hasOpkgSupport()
|
||||
{
|
||||
string deps[] = {"/var/lib/opkg", /*"/bin/opkg-check-config", "/bin/update-alternatives", "/share/opkg/intercept"*/};
|
||||
|
||||
if (find_executable(OPKG_CL).empty()) {
|
||||
dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d]" OPKG_CL " executable not found\n", __func__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* If directory /var/lib/opkg resp. /opt/opkg
|
||||
does not exist, it is created by opkg itself */
|
||||
string deps[] = {"/var/lib/opkg", /*"/bin/opkg-check-config", "/bin/update-alternatives", "/share/opkg/intercept"*/};
|
||||
for(size_t i=0; i<sizeof(deps)/sizeof(deps[0]) ;i++){
|
||||
if(access(deps[i].c_str(), R_OK) !=0) {
|
||||
dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] %s not found\n", __func__, __LINE__, deps[i].c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
string COPKGManager::getInfoDir()
|
||||
{
|
||||
/* /opt/opkg/... is path in patched opkg, /var/lib/opkg/... is original path */
|
||||
string dirs[] = {TARGET_PREFIX"/opt/opkg/info", TARGET_PREFIX"/var/lib/opkg/info"};
|
||||
for (size_t i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++) {
|
||||
if (access(dirs[i].c_str(), R_OK) == 0)
|
||||
return dirs[i];
|
||||
}
|
||||
dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] InfoDir not found\n", __func__, __LINE__);
|
||||
return "";
|
||||
}
|
||||
|
||||
string COPKGManager::getPkgDescription(std::string pkgName, std::string pkgDesc)
|
||||
{
|
||||
static string infoPath;
|
||||
if (infoPath.empty())
|
||||
infoPath = getInfoDir();
|
||||
if (infoPath.empty())
|
||||
return pkgDesc;
|
||||
|
||||
string infoFile = infoPath + "/" + pkgName + ".control";
|
||||
if (file_exists(infoFile.c_str())) {
|
||||
FILE* fd = fopen(infoFile.c_str(), "r");
|
||||
if (fd == NULL)
|
||||
return pkgDesc;
|
||||
|
||||
fpos_t fz;
|
||||
fseek(fd, 0, SEEK_END);
|
||||
fgetpos(fd, &fz);
|
||||
fseek(fd, 0, SEEK_SET);
|
||||
if (fz.__pos == 0)
|
||||
return pkgDesc;
|
||||
|
||||
char buf[512];
|
||||
string package, version, description;
|
||||
while (fgets(buf, sizeof(buf), fd)) {
|
||||
if (buf[0] == ' ')
|
||||
continue;
|
||||
string line(buf);
|
||||
trim(line, " ");
|
||||
string tmp;
|
||||
/* When pkgDesc is empty, return description only for OM_INFO */
|
||||
if (!pkgDesc.empty()) {
|
||||
tmp = getKeyInfo(line, "Package:", " ");
|
||||
if (!tmp.empty())
|
||||
package = tmp;
|
||||
tmp = getKeyInfo(line, "Version:", " ");
|
||||
if (!tmp.empty())
|
||||
version = tmp;
|
||||
}
|
||||
tmp = getKeyInfo(line, "Description:", " ");
|
||||
if (!tmp.empty())
|
||||
description = tmp;
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
if (pkgDesc.empty())
|
||||
return description;
|
||||
|
||||
string desc = package + " - " + version;
|
||||
if (!description.empty())
|
||||
desc += " - " + description;
|
||||
|
||||
return desc;
|
||||
}
|
||||
return pkgDesc;
|
||||
}
|
||||
|
||||
void COPKGManager::getPkgData(const int pkg_content_id)
|
||||
{
|
||||
dprintf(DEBUG_INFO, "[COPKGManager] [%s - %d] executing %s\n", __func__, __LINE__, pkg_types[pkg_content_id].c_str());
|
||||
@@ -680,12 +751,16 @@ void COPKGManager::getPkgData(const int pkg_content_id)
|
||||
continue;
|
||||
|
||||
switch (pkg_content_id) {
|
||||
case OM_LIST:
|
||||
case OM_LIST: {
|
||||
/* do not even put "bad" packages into the list to save memory */
|
||||
if (badpackage(name))
|
||||
continue;
|
||||
pkg_map[name] = pkg(name, line, line);
|
||||
map<string, struct pkg>::iterator it = pkg_map.find(name);
|
||||
if (it != pkg_map.end())
|
||||
it->second.desc = getPkgDescription(name, line);
|
||||
break;
|
||||
}
|
||||
case OM_LIST_INSTALLED: {
|
||||
map<string, struct pkg>::iterator it = pkg_map.find(name);
|
||||
if (it != pkg_map.end())
|
||||
@@ -730,8 +805,17 @@ string COPKGManager::getPkgInfo(const string& pkg_name, const string& pkg_key, b
|
||||
execCmd(pkg_types[current_status ? OM_STATUS : OM_INFO] + pkg_name, CShellWindow::QUIET);
|
||||
dprintf(DEBUG_INFO, "[COPKGManager] [%s - %d] [data: %s]\n", __func__, __LINE__, tmp_str.c_str());
|
||||
|
||||
if (pkg_key.empty())
|
||||
if (pkg_key.empty()) {
|
||||
/* When description is empty, read data from InfoDir */
|
||||
string tmp = getKeyInfo(tmp_str, "Description:", " ");
|
||||
if (tmp.empty()) {
|
||||
tmp = getPkgDescription(pkg_name);
|
||||
if (!tmp.empty()) {
|
||||
tmp_str += (string)"\nDescription: " + tmp + "\n";
|
||||
}
|
||||
}
|
||||
return tmp_str;
|
||||
}
|
||||
|
||||
return getKeyInfo(tmp_str, pkg_key, ":");
|
||||
}
|
||||
|
@@ -150,6 +150,9 @@ class COPKGManager : public CMenuTarget
|
||||
int doUpdate();
|
||||
void handleShellOutput(std::string* cur_line, int* res, bool* ok);
|
||||
|
||||
std::string getInfoDir();
|
||||
std::string getPkgDescription(std::string pkgName, std::string pkgDesc="");
|
||||
|
||||
struct pkg {
|
||||
std::string name;
|
||||
std::string version;
|
||||
|
@@ -4,6 +4,7 @@
|
||||
UPnP Browser (c) 2007 by Jochen Friedrich
|
||||
(c) 2009-2011,2016 Stefan Seyfried
|
||||
(c) 2016 Thilo Graf
|
||||
(c) 2016 Sven Hoefer
|
||||
|
||||
License: GPL
|
||||
|
||||
@@ -46,9 +47,10 @@
|
||||
#include <gui/components/cc.h>
|
||||
#include <gui/widget/messagebox.h>
|
||||
#include <gui/widget/hintbox.h>
|
||||
#include <system/settings.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/upnpbrowser.h>
|
||||
#include <system/settings.h>
|
||||
#include <system/helpers.h>
|
||||
#include <zapit/zapit.h>
|
||||
#include <video.h>
|
||||
|
||||
@@ -121,8 +123,8 @@ void CUpnpBrowserGui::Init()
|
||||
|
||||
m_header_height = _title_height;
|
||||
m_footer_height = _title_height;
|
||||
m_topbox_height = _top_height*3 + 10; // topbox: 3 lines + inner offset + shadow
|
||||
m_infobox_height = _info_height*2 + 20; // infobox/timebox: 2 lines + inner offset + shadow
|
||||
m_topbox_height = _top_height*3 + OFFSET_INNER_MID; // topbox: 3 lines + inner offset
|
||||
m_infobox_height = _info_height*2 + OFFSET_INNER_LARGE; // infobox/timebox: 2 lines + inner offset
|
||||
|
||||
/* From top to bottom we have:
|
||||
*
|
||||
@@ -192,8 +194,7 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/
|
||||
|
||||
selectDevice();
|
||||
|
||||
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
|
||||
CAudioPlayer::getInstance()->stop();
|
||||
stopAudio();
|
||||
|
||||
// Start Sectionsd
|
||||
//NI g_Sectionsd->setPauseScanning(false);
|
||||
@@ -860,9 +861,8 @@ bool CUpnpBrowserGui::selectItem(std::string id)
|
||||
m_playid++;
|
||||
}
|
||||
else if (msg == CRCInput::RC_yellow) {
|
||||
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
|
||||
CAudioPlayer::getInstance()->stop();
|
||||
m_folderplay = false;
|
||||
stopAudio();
|
||||
}
|
||||
else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_stop) {
|
||||
timeout = 0;
|
||||
@@ -878,8 +878,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
|
||||
}
|
||||
else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_next) {
|
||||
timeout = 0;
|
||||
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
|
||||
CAudioPlayer::getInstance()->stop();
|
||||
stopAudio();
|
||||
}
|
||||
else if (msg == NeutrinoMessages::RECORD_START ||
|
||||
msg == NeutrinoMessages::ZAPTO ||
|
||||
@@ -911,6 +910,17 @@ bool CUpnpBrowserGui::selectItem(std::string id)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
maybe it's better to stop audio here,
|
||||
because infobox and timebox will never been painted and updated
|
||||
*/
|
||||
if (endall)
|
||||
{
|
||||
stopAudio();
|
||||
}
|
||||
#endif
|
||||
|
||||
delete entries;
|
||||
timeout = 0;
|
||||
m_frameBuffer->Clear();
|
||||
@@ -951,8 +961,8 @@ void CUpnpBrowserGui::paintDevice(unsigned int _pos)
|
||||
unsigned int pos = m_deviceliststart + _pos;
|
||||
if (pos == m_selecteddevice)
|
||||
{
|
||||
color = COL_MENUCONTENT_TEXT_PLUS_2;
|
||||
bgcolor = COL_MENUCONTENT_PLUS_2;
|
||||
color = COL_MENUCONTENTSELECTED_TEXT;
|
||||
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
|
||||
paintDeviceInfo();
|
||||
}
|
||||
else
|
||||
@@ -965,17 +975,12 @@ void CUpnpBrowserGui::paintDevice(unsigned int _pos)
|
||||
if (pos >= m_devices.size())
|
||||
return;
|
||||
|
||||
char sNr[20];
|
||||
sprintf(sNr, "%2d", pos + 1);
|
||||
std::string num = sNr;
|
||||
|
||||
std::string num = to_string(pos + 1);
|
||||
std::string name = m_devices[pos].friendlyname;
|
||||
|
||||
int w = g_Font[font_item]->getRenderWidth(name) + 5;
|
||||
g_Font[font_item]->RenderString(m_x + 10, ypos + m_item_height, m_width - 30 - w,
|
||||
num, color, m_item_height);
|
||||
g_Font[font_item]->RenderString(m_x + m_width - 15 - w, ypos + m_item_height,
|
||||
w, name, color, m_item_height);
|
||||
int w = g_Font[font_item]->getRenderWidth(name);
|
||||
g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID, ypos + m_item_height, m_width - 15 - OFFSET_INNER_MID - w, num, color, m_item_height);
|
||||
g_Font[font_item]->RenderString(m_x + m_width - 15 - OFFSET_INNER_MID - w, ypos + m_item_height, w, name, color, m_item_height);
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::paintDevices()
|
||||
@@ -1013,7 +1018,7 @@ void CUpnpBrowserGui::paintDevices()
|
||||
// Foot
|
||||
footer.paintButtons(m_x, m_footer_y, m_width, m_footer_height, 1, &RescanButton, m_width/2);
|
||||
|
||||
paintItem2DetailsLine (-1); // clear it
|
||||
paintItem2DetailsLine(-1); // clear it
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entries, unsigned int pos, unsigned int selected)
|
||||
@@ -1044,9 +1049,9 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entries, unsigned int po
|
||||
paintItemInfo(entry);
|
||||
paintDetails(entry);
|
||||
if (entry->isdir)
|
||||
paintItem2DetailsLine (-1); // clear it
|
||||
paintItem2DetailsLine(-1); // clear it
|
||||
else
|
||||
paintItem2DetailsLine (pos);
|
||||
paintItem2DetailsLine(pos);
|
||||
}
|
||||
|
||||
int preferred=entry->preferred;
|
||||
@@ -1072,7 +1077,7 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entries, unsigned int po
|
||||
}
|
||||
|
||||
std::string name = entry->title;
|
||||
char tmp_time[] = "00:00:00.0";
|
||||
char tmp_time[] = "0:00:00.00";
|
||||
int w = g_Font[font_item]->getRenderWidth(tmp_time);
|
||||
|
||||
int icon_w = 0;
|
||||
@@ -1081,11 +1086,11 @@ void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entries, unsigned int po
|
||||
m_frameBuffer->getIconSize(fileicon.c_str(), &icon_w, &icon_h);
|
||||
if (icon_w && icon_h)
|
||||
{
|
||||
icon_o = icon_w + 10;
|
||||
m_frameBuffer->paintIcon(fileicon, m_x + 10, ypos + (m_item_height - icon_h) / 2);
|
||||
icon_o = icon_w + OFFSET_INNER_MID;
|
||||
m_frameBuffer->paintIcon(fileicon, m_x + OFFSET_INNER_MID, ypos + (m_item_height - icon_h)/2);
|
||||
}
|
||||
g_Font[font_item]->RenderString(m_x + m_width - 15 - 10 - w, ypos + m_item_height, w, info, color, m_item_height);
|
||||
g_Font[font_item]->RenderString(m_x + 10 + icon_o, ypos + m_item_height, m_width - icon_o - 15 - 2*10 - w, name, color, m_item_height);
|
||||
g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID + icon_o, ypos + m_item_height, m_width - 15 - OFFSET_INNER_MID - w, name, color, m_item_height);
|
||||
g_Font[font_item]->RenderString(m_x + m_width - 15 - OFFSET_INNER_MID - w, ypos + m_item_height, w, info, color, m_item_height);
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
|
||||
@@ -1131,7 +1136,7 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
|
||||
int h_image = infobox.getHeight() - OFFSET_INTER - infobox.getCornerRadius();
|
||||
int y_image = infobox.getYPos() + infobox.getHeight()/2 - h_image/2;
|
||||
if (!image){
|
||||
image = new CComponentsPicture(100, y_image, tmpname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTDARK_PLUS_0);
|
||||
image = new CComponentsPicture(0, y_image, tmpname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTDARK_PLUS_0);
|
||||
image->doPaintBg(false);
|
||||
image->SetTransparent(CFrameBuffer::TM_BLACK);
|
||||
}
|
||||
@@ -1167,7 +1172,6 @@ void CUpnpBrowserGui::paintItems(std::vector<UPnPEntry> *entry, unsigned int sel
|
||||
CComponentsHeader header(m_x, m_header_y, m_width, m_header_height, name, NEUTRINO_ICON_UPNP);
|
||||
if (CNeutrinoApp::getInstance()->isMuted())
|
||||
header.setContextButton(NEUTRINO_ICON_BUTTON_MUTE_SMALL);
|
||||
//header.enableShadow();
|
||||
header.paint(CC_SAVE_SCREEN_NO);
|
||||
|
||||
// Items
|
||||
@@ -1185,25 +1189,23 @@ void CUpnpBrowserGui::paintItems(std::vector<UPnPEntry> *entry, unsigned int sel
|
||||
sbh = 2;
|
||||
m_frameBuffer->paintBoxRel(m_x + m_width - 13, m_item_y + 2 + sbs*((sb-4)/sbc+sbh), 11, (sb-4)/sbc + sbh, COL_SCROLLBAR_ACTIVE_PLUS_0);
|
||||
|
||||
//shadow
|
||||
//m_frameBuffer->paintBoxRel(m_x + m_width, m_item_y + OFFSET_SHADOW, OFFSET_SHADOW, sb, COL_SHADOW_PLUS_0);
|
||||
|
||||
// Foot buttons
|
||||
size_t numbuttons = sizeof(BrowseButtons)/sizeof(BrowseButtons[0]);
|
||||
|
||||
footer.paintButtons(m_x, m_footer_y, m_width, m_footer_height, numbuttons, BrowseButtons, m_width/numbuttons);
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::paintDetails(UPnPEntry *entry, bool use_playing)
|
||||
{
|
||||
// Foot info
|
||||
int timebox_width = m_infobox_height; // maybe not enough
|
||||
char tmp_time[] = "000:00";
|
||||
int timebox_width = timebox.getFont()->getRenderWidth(tmp_time) + OFFSET_INNER_MID*2;
|
||||
infobox.setDimensionsAll(m_x, m_infobox_y, m_width - OFFSET_SHADOW - OFFSET_INTER - timebox_width, m_infobox_height);
|
||||
timebox.setDimensionsAll(m_x + m_width - timebox_width, infobox.getYPos(), m_infobox_height, timebox_width);
|
||||
timebox.setDimensionsAll(m_x + m_width - timebox_width, infobox.getYPos(), timebox_width, m_infobox_height);
|
||||
|
||||
printf("paintDetails: use_playing %d shown %d\n", use_playing, m_playing_entry_is_shown);
|
||||
if ((!use_playing) && entry->isdir){
|
||||
infobox.kill();
|
||||
timebox.kill();
|
||||
m_playing_entry_is_shown = false;
|
||||
}else{
|
||||
string text = "";
|
||||
@@ -1232,7 +1234,7 @@ void CUpnpBrowserGui::paintDetails(UPnPEntry *entry, bool use_playing)
|
||||
}
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::paintItem2DetailsLine (int pos)
|
||||
void CUpnpBrowserGui::paintItem2DetailsLine(int pos)
|
||||
{
|
||||
if (pos < 0)
|
||||
return;
|
||||
@@ -1245,7 +1247,7 @@ void CUpnpBrowserGui::paintItem2DetailsLine (int pos)
|
||||
|
||||
if (!dline)
|
||||
dline = new CComponentsDetailLine();
|
||||
dline->setDimensionsAll(xpos, ypos1a, ypos2, m_item_height/2, infobox.getHeight()-RADIUS_LARGE*2);
|
||||
dline->setDimensionsAll(xpos, ypos1a, ypos2, m_item_height/2, infobox.getHeight() - RADIUS_LARGE*2);
|
||||
dline->paint();
|
||||
}
|
||||
|
||||
@@ -1280,6 +1282,14 @@ void CUpnpBrowserGui::playAudio(std::string name, int type)
|
||||
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap);
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::stopAudio()
|
||||
{
|
||||
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
|
||||
{
|
||||
CAudioPlayer::getInstance()->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void CUpnpBrowserGui::showPicture(std::string name)
|
||||
{
|
||||
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_pic);
|
||||
|
@@ -119,13 +119,14 @@ class CUpnpBrowserGui : public CMenuTarget, public CListHelpers
|
||||
bool updateItemSelection(std::string id, std::vector<UPnPEntry> * &entries, int newpos, unsigned int &selected, unsigned int &liststart);
|
||||
bool selectItem(std::string);
|
||||
void paintItems(std::vector<UPnPEntry> *entry, unsigned int selected, unsigned int max, unsigned int offset);
|
||||
void paintItem (std::vector<UPnPEntry> *entry, unsigned int pos, unsigned int selected);
|
||||
void paintItem(std::vector<UPnPEntry> *entry, unsigned int pos, unsigned int selected);
|
||||
void paintItemInfo(UPnPEntry *entry);
|
||||
void paintDetails(UPnPEntry *entry, bool use_playing = false);
|
||||
void paintItem2DetailsLine (int pos);
|
||||
void paintItem2DetailsLine(int pos);
|
||||
|
||||
void updateTimes(const bool force = false);
|
||||
void playAudio(std::string name, int type);
|
||||
void stopAudio();
|
||||
void showPicture(std::string name);
|
||||
void playVideo(std::string name, std::string url);
|
||||
};
|
||||
|
@@ -51,6 +51,8 @@
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
//#define VISUAL_DEBUG
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -59,6 +61,9 @@
|
||||
#include <system/debug.h>
|
||||
#include "textbox.h"
|
||||
#include <gui/widget/icons.h>
|
||||
#ifdef VISUAL_DEBUG
|
||||
#include <gui/color_custom.h>
|
||||
#endif
|
||||
|
||||
#define SCROLL_FRAME_WIDTH 10
|
||||
#define SCROLL_MARKER_BORDER 2
|
||||
@@ -69,7 +74,6 @@
|
||||
#define MIN_WINDOW_WIDTH ((g_settings.screen_EndX - g_settings.screen_StartX)>>1)
|
||||
#define MIN_WINDOW_HEIGHT 40
|
||||
|
||||
|
||||
CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
|
||||
const CBox* position, CFBWindow::color_t textBackgroundColor)
|
||||
{
|
||||
@@ -160,8 +164,8 @@ void CTextBox::initVar(void)
|
||||
m_nLinesPerPage = 0;
|
||||
m_nCurrentLine = 0;
|
||||
m_nCurrentPage = 0;
|
||||
text_Hborder_width = 8; //border left and right
|
||||
text_Vborder_width = 8; //border top and buttom
|
||||
text_Hborder_width = OFFSET_INNER_MID; //border left and right
|
||||
text_Vborder_width = OFFSET_INNER_MID; //border top and buttom
|
||||
|
||||
m_cFrame.iX = m_old_x = g_settings.screen_StartX + ((g_settings.screen_EndX - g_settings.screen_StartX - MIN_WINDOW_WIDTH) >>1);
|
||||
m_cFrame.iWidth = m_old_dx = MIN_WINDOW_WIDTH;
|
||||
@@ -643,23 +647,33 @@ void CTextBox::refreshText(void)
|
||||
// fit into mid of frame space
|
||||
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * lines) >> 1);
|
||||
|
||||
#ifdef VISUAL_DEBUG
|
||||
frameBuffer->paintBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight, COL_GREEN);
|
||||
#endif
|
||||
|
||||
for(i = m_nCurrentLine; i < m_nNrOfLines && i < m_nCurrentLine + m_nLinesPerPage; i++)
|
||||
{
|
||||
//calculate centered xpos
|
||||
if( m_nMode & CENTER ){
|
||||
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded))>>1) - text_Hborder_width;
|
||||
}
|
||||
else if ( m_nMode & RIGHT ){
|
||||
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded)) - text_Hborder_width*2);
|
||||
if ( m_nMode & SCROLL )
|
||||
//calculate xpos
|
||||
if ((m_nMode & CENTER) || (m_nMode & RIGHT))
|
||||
{
|
||||
x_center = m_cFrameTextRel.iWidth - m_cFrameTextRel.iX - 2*text_Hborder_width - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded);
|
||||
if (m_nMode & CENTER)
|
||||
x_center /= 2;
|
||||
if (m_nMode & SCROLL)
|
||||
x_center -= SCROLL_FRAME_WIDTH;
|
||||
}
|
||||
x_center = std::max(x_center, 0);
|
||||
|
||||
int tx = m_cFrame.iX + m_cFrameTextRel.iX + text_Hborder_width + x_center;
|
||||
int ty = m_cFrame.iY + y;
|
||||
int tw = m_cFrameTextRel.iWidth - m_cFrameTextRel.iX - 2*text_Hborder_width - x_center;
|
||||
|
||||
#ifdef VISUAL_DEBUG
|
||||
int th = m_nFontTextHeight;
|
||||
frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED);
|
||||
#endif
|
||||
//TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX);
|
||||
m_pcFontText->RenderString(m_cFrame.iX + m_cFrameTextRel.iX + text_Hborder_width + x_center,
|
||||
y+m_cFrame.iY, m_cFrameTextRel.iWidth, m_cLineArray[i].c_str(),
|
||||
m_textColor, 0, m_renderMode | (m_utf8_encoded) ? Font::IS_UTF8 : 0);
|
||||
m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | (m_utf8_encoded) ? Font::IS_UTF8 : 0);
|
||||
m_old_cText = m_cText;
|
||||
y += m_nFontTextHeight;
|
||||
}
|
||||
|
@@ -950,9 +950,9 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO
|
||||
// offsets
|
||||
#define OFFSET_SHADOW 6
|
||||
#define OFFSET_INTER 6
|
||||
//#define OFFSET_INNER_LARGE 20
|
||||
//#define OFFSET_INNER_MID 10
|
||||
//#define OFFSET_INNER_SMALL 5
|
||||
#define OFFSET_INNER_LARGE 20
|
||||
#define OFFSET_INNER_MID 10
|
||||
#define OFFSET_INNER_SMALL 5
|
||||
|
||||
|
||||
struct SglobalInfo
|
||||
|
Reference in New Issue
Block a user