Skip to content

Commit

Permalink
Merge pull request xbmc#8058 from BigNoid/listitemid
Browse files Browse the repository at this point in the history
[guilib] Add container.listitemabsolute.infolabel
  • Loading branch information
mkortstiege committed Oct 1, 2015
2 parents ff79bab + 3568379 commit ca8d08c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
39 changes: 17 additions & 22 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,34 +1203,24 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool
return AddMultiInfo(GUIInfo(CONTAINER_SORT_DIRECTION, order));
}
}
else if (cat.name == "listitem")
else if (cat.name == "listitem" || cat.name == "listitemposition"
|| cat.name == "listitemnowrap" || cat.name == "listitemabsolute")
{
int offset = atoi(cat.param().c_str());
int ret = TranslateListItem(prop);
if (ret)
listItemDependent = true;
if (offset)
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
return ret;
}
else if (cat.name == "listitemposition")
{
int offset = atoi(cat.param().c_str());
int ret = TranslateListItem(prop);
if (ret)
listItemDependent = true;
if (offset)
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
return ret;
}
else if (cat.name == "listitemnowrap")
{
int offset = atoi(cat.param().c_str());
int ret = TranslateListItem(prop);
if (ret)
listItemDependent = true;
if (offset)
return AddMultiInfo(GUIInfo(ret, 0, offset));
{
if (cat.name == "listitem")
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
else if (cat.name == "listitemposition")
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
else if (cat.name == "listitemabsolute")
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_ABSOLUTE));
else if (cat.name == "listitemnowrap")
return AddMultiInfo(GUIInfo(ret, 0, offset));
}
return ret;
}
else if (cat.name == "visualisation")
Expand Down Expand Up @@ -1420,6 +1410,11 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool
listItemDependent = true;
return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset, INFOFLAG_LISTITEM_WRAP));
}
else if (info[1].name == "listitemabsolute")
{
listItemDependent = true;
return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset, INFOFLAG_LISTITEM_ABSOLUTE));
}
}
else if (info[0].name == "control")
{
Expand Down
3 changes: 2 additions & 1 deletion xbmc/guiinfo/GUIInfoLabels.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,4 +736,5 @@
// Stored in the top 8 bits of GUIInfo::m_data1
// therefore we only have room for 8 flags
#define INFOFLAG_LISTITEM_WRAP ((uint32_t) (1 << 25)) // Wrap ListItem lookups
#define INFOFLAG_LISTITEM_POSITION ((uint32_t) (1 << 26)) // Absolute ListItem lookups
#define INFOFLAG_LISTITEM_POSITION ((uint32_t) (1 << 26)) // ListItem lookups based on cursor position
#define INFOFLAG_LISTITEM_ABSOLUTE ((uint32_t) (1 << 27)) // Absolute ListItem lookups
3 changes: 3 additions & 0 deletions xbmc/guilib/GUIBaseContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ CGUIListItemPtr CGUIBaseContainer::GetListItem(int offset, unsigned int flag) co
int item = GetSelectedItem() + offset;
if (flag & INFOFLAG_LISTITEM_POSITION) // use offset from the first item displayed, taking into account scrolling
item = CorrectOffset((int)(m_scroller.GetValue() / m_layout->Size(m_orientation)), offset);

if (flag & INFOFLAG_LISTITEM_ABSOLUTE) // use offset from the first item
item = CorrectOffset(0, offset);

if (flag & INFOFLAG_LISTITEM_WRAP)
{
Expand Down

0 comments on commit ca8d08c

Please sign in to comment.