Skip to content

Commit

Permalink
Merge pull request xbmc#5872 from mkortstiege/infomanager_currentitem
Browse files Browse the repository at this point in the history
[infomanager] added Container(id).CurrentItem
  • Loading branch information
MartijnKaijser committed Dec 20, 2014
2 parents 314764c + 31c151a commit bcb5b9f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ const infomap container_bools[] ={{ "onnext", CONTAINER_MOVE_NEXT },
const infomap container_ints[] = {{ "row", CONTAINER_ROW },
{ "column", CONTAINER_COLUMN },
{ "position", CONTAINER_POSITION },
{ "currentitem", CONTAINER_CURRENT_ITEM },
{ "subitem", CONTAINER_SUBITEM },
{ "hasfocus", CONTAINER_HAS_FOCUS }};

Expand Down Expand Up @@ -1786,6 +1787,7 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *f
break;
case CONTAINER_NUM_PAGES:
case CONTAINER_NUM_ITEMS:
case CONTAINER_CURRENT_ITEM:
case CONTAINER_CURRENT_PAGE:
return GetMultiInfoLabel(GUIInfo(info), contextWindow);
break;
Expand Down Expand Up @@ -3244,7 +3246,8 @@ CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWi
return time.GetAsLocalizedDate(m_stringParameters[info.GetData1()],false);
}
else if (info.m_info == CONTAINER_NUM_PAGES || info.m_info == CONTAINER_CURRENT_PAGE ||
info.m_info == CONTAINER_NUM_ITEMS || info.m_info == CONTAINER_POSITION)
info.m_info == CONTAINER_NUM_ITEMS || info.m_info == CONTAINER_POSITION ||
info.m_info == CONTAINER_CURRENT_ITEM)
{
const CGUIControl *control = NULL;
if (info.GetData1())
Expand Down
1 change: 1 addition & 0 deletions xbmc/GUIInfoManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ namespace INFO
#define CONTAINER_CONTENT 362
#define CONTAINER_HAS_THUMB 363
#define CONTAINER_SORT_METHOD 364
#define CONTAINER_CURRENT_ITEM 365

#define CONTAINER_HAS_FOCUS 367
#define CONTAINER_ROW 368
Expand Down
8 changes: 8 additions & 0 deletions xbmc/guilib/GUIBaseContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,14 @@ std::string CGUIBaseContainer::GetLabel(int info) const
case CONTAINER_POSITION:
label = StringUtils::Format("%i", GetCursor());
break;
case CONTAINER_CURRENT_ITEM:
{
if (m_items.size() && m_items[0]->IsFileItem() && (boost::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
label = StringUtils::Format("%i", GetSelectedItem());
else
label = StringUtils::Format("%i", GetSelectedItem() + 1);
}
break;
case CONTAINER_NUM_ITEMS:
{
unsigned int numItems = GetNumItems();
Expand Down

0 comments on commit bcb5b9f

Please sign in to comment.