Skip to content

Commit

Permalink
gui: let gui dialog select return id of added items
Browse files Browse the repository at this point in the history
Simplifies usage when some options are optional
  • Loading branch information
elupus committed Aug 1, 2013
1 parent 7214532 commit 82702d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions xbmc/dialogs/GUIDialogSelect.cpp
Expand Up @@ -161,10 +161,11 @@ void CGUIDialogSelect::Reset()
m_selectedItems->Clear();
}

void CGUIDialogSelect::Add(const CStdString& strLabel)
int CGUIDialogSelect::Add(const CStdString& strLabel)
{
CFileItemPtr pItem(new CFileItem(strLabel));
m_vecList->Add(pItem);
return m_vecList->Size() - 1;
}

void CGUIDialogSelect::Add(const CFileItemList& items)
Expand All @@ -176,10 +177,11 @@ void CGUIDialogSelect::Add(const CFileItemList& items)
}
}

void CGUIDialogSelect::Add(const CFileItem* pItem)
int CGUIDialogSelect::Add(const CFileItem* pItem)
{
CFileItemPtr item(new CFileItem(*pItem));
m_vecList->Add(item);
return m_vecList->Size() - 1;
}

void CGUIDialogSelect::SetItems(CFileItemList* pList)
Expand Down
4 changes: 2 additions & 2 deletions xbmc/dialogs/GUIDialogSelect.h
Expand Up @@ -37,8 +37,8 @@ class CGUIDialogSelect :
virtual bool OnBack(int actionID);

void Reset();
void Add(const CStdString& strLabel);
void Add(const CFileItem* pItem);
int Add(const CStdString& strLabel);
int Add(const CFileItem* pItem);
void Add(const CFileItemList& items);
void SetItems(CFileItemList* items);
int GetSelectedLabel() const;
Expand Down

0 comments on commit 82702d7

Please sign in to comment.