m_lst=0;
return;
}
- assert(m_service_center);
+ ASSERT(m_service_center);
if (m_service_center->list(m_root, m_lst))
eDebug("no list available!");
{
painter.clip(eRect(offset, m_itemsize));
- bool marked = m_current_marked || (cursorValid() && isMarked(*m_cursor));
+ int marked = 0;
- if (marked)
- style.setStyle(painter, selected ? eWindowStyle::styleListboxMarkedAndSelected : eWindowStyle::styleListboxMarked);
+ if (m_current_marked && selected)
+ marked = 2;
+ else if (cursorValid() && isMarked(*m_cursor))
+ {
+ if (selected)
+ marked = 2;
+ else
+ marked = 1;
+ }
else
style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
if (m_listbox)
local_style = m_listbox->getLocalStyle();
- if (marked)
+ if (marked == 1) // marked
{
- if (selected)
- {
- if (m_color_set[markedForegroundSelected])
- painter.setForegroundColor(m_color[markedForegroundSelected]);
- if (m_color_set[markedBackgroundSelected])
- painter.setBackgroundColor(m_color[markedBackgroundSelected]);
- }
- else
- {
- if (m_color_set[markedForeground])
- painter.setForegroundColor(m_color[markedForeground]);
- if (m_color_set[markedBackground])
- painter.setBackgroundColor(m_color[markedBackground]);
- }
+ style.setStyle(painter, eWindowStyle::styleListboxMarked);
+ if (m_color_set[markedForeground])
+ painter.setForegroundColor(m_color[markedForeground]);
+ if (m_color_set[markedBackground])
+ painter.setBackgroundColor(m_color[markedBackground]);
+ }
+ else if (marked == 2) // marked and selected
+ {
+ style.setStyle(painter, eWindowStyle::styleListboxMarkedAndSelected);
+ if (m_color_set[markedForegroundSelected])
+ painter.setForegroundColor(m_color[markedForegroundSelected]);
+ if (m_color_set[markedBackgroundSelected])
+ painter.setBackgroundColor(m_color[markedBackgroundSelected]);
}
else if (local_style)
{
painter.clear();
}
- painter.clear();
-
if (cursorValid())
{
/* get service information */
ePtr<iStaticServiceInformation> service_info;
m_service_center->info(*m_cursor, service_info);
eServiceReference ref = *m_cursor;
- bool isPlayable = !(ref.flags & eServiceReference::isDirectory || ref.flags & eServiceReference::isMarker);
+ bool isMarker = ref.flags & eServiceReference::isMarker;
+ bool isPlayable = !(ref.flags & eServiceReference::isDirectory || isMarker);
+ bool paintProgress = false;
+ ePtr<eServiceEvent> evt;
+
+ bool serviceAvail = true;
- if (!marked && isPlayable && service_info && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
+ if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
{
if (m_color_set[serviceNotAvail])
painter.setForegroundColor(m_color[serviceNotAvail]);
else
painter.setForegroundColor(gRGB(0xbbbbbb));
+ serviceAvail = false;
}
if (selected && local_style && local_style->m_selection)
painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);
- int xoffset=0; // used as offset when painting the folder/marker symbol
+ int xoffset=0; // used as offset when painting the folder/marker symbol or the serviceevent progress
for (int e = 0; e < celElements; ++e)
{
}
case celServiceInfo:
{
- ePtr<eServiceEvent> evt;
- if ( service_info && !service_info->getEvent(*m_cursor, evt) )
+ if ( isPlayable && !service_info->getEvent(*m_cursor, evt) )
{
std::string name = evt->getEventName();
if (!name.length())
continue;
text = '(' + evt->getEventName() + ')';
+ if (serviceAvail)
+ {
+ if (!selected && m_color_set[serviceDescriptionColor])
+ painter.setForegroundColor(m_color[serviceDescriptionColor]);
+ else if (selected && m_color_set[serviceDescriptionColorSelected])
+ painter.setForegroundColor(m_color[serviceDescriptionColorSelected]);
+ }
}
else
continue;
{
eRect bbox = para->getBoundBox();
int name_width = bbox.width()+8;
- m_element_position[celServiceInfo].setLeft(area.left()+name_width);
+ m_element_position[celServiceInfo].setLeft(area.left()+name_width+xoffs);
m_element_position[celServiceInfo].setTop(area.top());
- m_element_position[celServiceInfo].setWidth(area.width()-name_width);
+ m_element_position[celServiceInfo].setWidth(area.width()-(name_width+xoffs));
m_element_position[celServiceInfo].setHeight(area.height());
}
painter.clippop();
}
}
+ else if (e == celServiceEventProgressbar)
+ {
+ eRect area = m_element_position[celServiceEventProgressbar];
+ if (area.width() > 0 && (isPlayable || isMarker))
+ {
+ // we schedule it to paint it as last element.. so we dont need to reset fore/background color
+ paintProgress = isPlayable;
+ xoffset = area.width() + 10;
+ }
+ }
}
-
if (selected && (!local_style || !local_style->m_selection))
style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry);
+ if (paintProgress && evt)
+ {
+ eRect area = m_element_position[celServiceEventProgressbar];
+ if (!selected && m_color_set[serviceEventProgressbarBorderColor])
+ painter.setForegroundColor(m_color[serviceEventProgressbarBorderColor]);
+ else if (selected && m_color_set[serviceEventProgressbarBorderColorSelected])
+ painter.setForegroundColor(m_color[serviceEventProgressbarBorderColorSelected]);
+
+ int border = 1;
+ int progressH = 6;
+ int progressX = area.left() + offset.x();
+ int progressW = area.width() - 2 * border;
+ int progressT = offset.y() + (m_itemsize.height() - progressH - 2*border) / 2;
+
+ // paint progressbar frame
+ painter.fill(eRect(progressX, progressT, area.width(), border));
+ painter.fill(eRect(progressX, progressT + border, border, progressH));
+ painter.fill(eRect(progressX, progressT + progressH + border, area.width(), border));
+ painter.fill(eRect(progressX + area.width() - border, progressT + border, border, progressH));
+
+ // calculate value
+ time_t now = time(0);
+ int value = progressW * (now - evt->getBeginTime()) / evt->getDuration();
+
+ eRect tmp = eRect(progressX + border, progressT + border, value, progressH);
+ ePtr<gPixmap> &pixmap = m_pixmaps[picServiceEventProgressbar];
+ if (pixmap)
+ {
+ area.moveBy(offset);
+ painter.clip(area);
+ painter.blit(pixmap, ePoint(progressX + border, progressT + border), tmp, gPainter::BT_ALPHATEST);
+ painter.clippop();
+ }
+ else
+ {
+ if (!selected && m_color_set[serviceEventProgressbarColor])
+ painter.setForegroundColor(m_color[serviceEventProgressbarColor]);
+ else if (selected && m_color_set[serviceEventProgressbarColorSelected])
+ painter.setForegroundColor(m_color[serviceEventProgressbarColorSelected]);
+ painter.fill(tmp);
+ }
+ }
}
-
painter.clippop();
}
void eListboxServiceContent::setIgnoreService( const eServiceReference &service )
{
m_is_playable_ignore=service;
+ if (m_listbox && m_listbox->isVisible())
+ m_listbox->invalidate();
}
-int eListboxServiceContent::setItemHeight(int height)
+void eListboxServiceContent::setItemHeight(int height)
{
m_itemheight = height;
if (m_listbox)