Skip to content

Commit

Permalink
Fixed|UI|Client: Update singleplayer session menu when game changes
Browse files Browse the repository at this point in the history
The currently loaded game is disabled in the menu, so it has to be
enabled when returning to ring zero.
  • Loading branch information
skyjake committed Apr 13, 2014
1 parent 65faca6 commit 22f26f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doomsday/client/src/ui/widgets/gameselectionwidget.cpp
Expand Up @@ -231,6 +231,8 @@ DENG_GUI_PIMPL(GameSelectionWidget)

~Instance()
{
foreach(SubsetWidget *sub, subsets) sub->menu->setFilter(0);

App::app().audienceForGameChange() -= this;
}

Expand Down
5 changes: 4 additions & 1 deletion doomsday/client/src/ui/widgets/sessionmenuwidget.cpp
Expand Up @@ -113,7 +113,10 @@ void SessionMenuWidget::setColumns(int numberOfColumns)

void SessionMenuWidget::sort()
{
d->sortSessions();
if(d->filter)
{
d->sortSessions();
}
}

//--------------------------------------------------------------------------------------
Expand Down
Expand Up @@ -31,6 +31,7 @@ DENG_GUI_PIMPL(SingleplayerSessionMenuWidget)
, DENG2_OBSERVES(Games, Addition)
, DENG2_OBSERVES(Loop, Iteration) // deferred updates
, DENG2_OBSERVES(App, StartupComplete)
, DENG2_OBSERVES(App, GameChange)
{
/// ActionItem with a Game member, for loading a particular game.
struct GameItem : public ui::ImageItem,
Expand Down Expand Up @@ -71,6 +72,7 @@ DENG_GUI_PIMPL(SingleplayerSessionMenuWidget)
Instance(Public *i) : Base(i)
{
App_Games().audienceForAddition() += this;
App::app().audienceForGameChange() += this;
App::app().audienceForStartupComplete() += this;
}

Expand All @@ -79,6 +81,7 @@ DENG_GUI_PIMPL(SingleplayerSessionMenuWidget)
Loop::appLoop().audienceForIteration() -= this;

App_Games().audienceForAddition() -= this;
App::app().audienceForGameChange() -= this;
App::app().audienceForStartupComplete() -= this;
}

Expand Down Expand Up @@ -110,6 +113,7 @@ DENG_GUI_PIMPL(SingleplayerSessionMenuWidget)
{
Loop::appLoop().audienceForIteration() -= this;
addPendingGames();
updateGameAvailability();
}

void addPendingGames()
Expand Down Expand Up @@ -173,6 +177,11 @@ DENG_GUI_PIMPL(SingleplayerSessionMenuWidget)
{
updateGameAvailability();
}

void currentGameChanged(game::Game const &)
{
Loop::appLoop().audienceForIteration() += this;
}
};

SingleplayerSessionMenuWidget::SingleplayerSessionMenuWidget(Mode mode, String const &name)
Expand Down

0 comments on commit 22f26f1

Please sign in to comment.