Skip to content

Commit

Permalink
Fixed|UI|Client: ChoiceWidget item order change vs. updating selected…
Browse files Browse the repository at this point in the history
… item
  • Loading branch information
skyjake committed Sep 12, 2013
1 parent 6142c07 commit db4c18c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doomsday/client/src/ui/widgets/choicewidget.cpp
Expand Up @@ -26,6 +26,7 @@ using namespace ui;
DENG_GUI_PIMPL(ChoiceWidget),
DENG2_OBSERVES(Data, Addition),
DENG2_OBSERVES(Data, Removal),
DENG2_OBSERVES(Data, OrderChange),
DENG2_OBSERVES(ContextWidgetOrganizer, WidgetCreation),
DENG2_OBSERVES(ContextWidgetOrganizer, WidgetUpdate)
{
Expand Down Expand Up @@ -68,6 +69,7 @@ DENG2_OBSERVES(ContextWidgetOrganizer, WidgetUpdate)
choices = new PopupMenuWidget;
choices->items().audienceForAddition += this;
choices->items().audienceForRemoval += this;
choices->items().audienceForOrderChange += this;
choices->menu().organizer().audienceForWidgetCreation += this;
choices->menu().organizer().audienceForWidgetUpdate += this;
self.add(choices);
Expand Down Expand Up @@ -141,6 +143,11 @@ DENG2_OBSERVES(ContextWidgetOrganizer, WidgetUpdate)
updateButtonWithSelection();
}

void contextItemOrderChanged()
{
updateButtonWithSelection();
}

void updateItemHighlight()
{
// Highlight the currently selected item.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/ui/widgets/profilepickerwidget.cpp
Expand Up @@ -198,6 +198,8 @@ void ProfilePickerWidget::duplicate()

items().append(new ChoiceItem(newName.left(MAX_VISIBLE_PROFILE_NAME), newName)).sort();
setSelected(items().findData(newName));

applySelectedProfile();
}
else
{
Expand Down

0 comments on commit db4c18c

Please sign in to comment.