Added an 'ok' badge to the selected track.
This commit is contained in:
parent
da7a77963e
commit
b0cc2eb441
@ -529,6 +529,21 @@ void DynamicRibbonWidget::clearItems()
|
||||
m_max_label_width = 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void DynamicRibbonWidget::setBadge(const std::string &name, BadgeType badge)
|
||||
{
|
||||
for (unsigned int r = 0; r < m_rows.size(); r++)
|
||||
{
|
||||
for (unsigned int c = 0; c < m_rows[r].m_children.size(); c++)
|
||||
{
|
||||
if(m_rows[r].m_children[c].m_properties[PROP_ID]==name)
|
||||
m_rows[r].m_children[c].setBadge(badge);
|
||||
else
|
||||
m_rows[r].m_children[c].unsetBadge(badge);
|
||||
}
|
||||
}
|
||||
} // setBadge
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void DynamicRibbonWidget::elementRemoved()
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ namespace GUIEngine
|
||||
*/
|
||||
DynamicRibbonWidget(const bool combo, const bool multi_row);
|
||||
|
||||
/** Reference pointers only, the actual instances are owned by m_children. Used to create mtultiple-row
|
||||
/** Reference pointers only, the actual instances are owned by m_children. Used to create multiple-row
|
||||
ribbons (what appears to be a grid of icons is actually a vector of stacked basic ribbons) */
|
||||
PtrVector<RibbonWidget, REF> m_rows;
|
||||
|
||||
@ -238,6 +238,7 @@ namespace GUIEngine
|
||||
/** Clears all items added through 'addItem'. You can then add new items with 'addItem' and call
|
||||
'updateItemDisplay' to update the display. */
|
||||
void clearItems();
|
||||
void setBadge(const std::string &name, BadgeType badge);
|
||||
|
||||
/** Sort the list of items with a given comparator. */
|
||||
template<typename Compare>
|
||||
|
@ -103,6 +103,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
if (STKHost::existHost())
|
||||
{
|
||||
w2->setBadge(selection, OK_BADGE);
|
||||
voteForPlayer();
|
||||
}
|
||||
else
|
||||
@ -342,10 +343,12 @@ void TracksScreen::init()
|
||||
auto lp = LobbyProtocol::get<LobbyProtocol>();
|
||||
const LobbyProtocol::PeerVote *vote =
|
||||
lp ->getVote(STKHost::get()->getMyHostId());
|
||||
DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("tracks");
|
||||
if(vote)
|
||||
{
|
||||
m_reverse_checked = vote->m_reverse;
|
||||
m_selected_track = track_manager->getTrack(vote->m_track_name);
|
||||
w2->setBadge(vote->m_track_name, OK_BADGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ void VoteOverview::showVote(int host_id)
|
||||
host_id);
|
||||
assert(it!=m_index_to_hostid.end());
|
||||
|
||||
int index = *it;
|
||||
int index = it - m_index_to_hostid.begin();
|
||||
|
||||
auto lp = LobbyProtocol::get<LobbyProtocol>();
|
||||
const LobbyProtocol::PeerVote *vote = lp->getVote(host_id);
|
||||
|
Loading…
Reference in New Issue
Block a user