Skip to content

Commit

Permalink
Refactor|Games: Use a pimpl-friendly audience for GameAddition
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 27, 2014
1 parent f18d1fa commit d3062bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doomsday/client/include/games.h
Expand Up @@ -61,7 +61,7 @@ class Games
typedef QList<Game *> All;

/// Notified when a new game is added.
DENG2_DEFINE_AUDIENCE(Addition, void gameAdded(Game &game))
DENG2_DEFINE_AUDIENCE2(Addition, void gameAdded(Game &game))

public:
Games();
Expand Down
6 changes: 5 additions & 1 deletion doomsday/client/src/games.cpp
Expand Up @@ -67,8 +67,12 @@ DENG2_PIMPL(Games)
qDeleteAll(games);
games.clear();
}

DENG2_PIMPL_AUDIENCE(Addition)
};

DENG2_AUDIENCE_METHOD(Games, Addition)

Games::Games() : d(new Instance(this))
{}

Expand Down Expand Up @@ -172,7 +176,7 @@ void Games::add(Game &game)

d->games.push_back(&game);

DENG2_FOR_AUDIENCE(Addition, i)
DENG2_FOR_AUDIENCE2(Addition, i)
{
i->gameAdded(game);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/resource/resourcesystem.cpp
Expand Up @@ -378,7 +378,7 @@ DENG2_PIMPL(ResourceSystem)
#endif

#ifdef __CLIENT__
App_Games().audienceForAddition += this;
App_Games().audienceForAddition() += this;

// Determine the root directory of the saved session repository.
if(int arg = App::commandLine().check("-savedir", 1))
Expand All @@ -397,7 +397,7 @@ DENG2_PIMPL(ResourceSystem)
~Instance()
{
#ifdef __CLIENT__
App_Games().audienceForAddition -= this;
App_Games().audienceForAddition() -= this;
#endif

qDeleteAll(resClasses);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/ui/widgets/gameselectionwidget.cpp
Expand Up @@ -252,14 +252,14 @@ DENG_GUI_PIMPL(GameSelectionWidget)

updateSubsetLayout();

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

~Instance()
{
App_Games().audienceForAddition -= this;
App_Games().audienceForAddition() -= this;
App::app().audienceForStartupComplete() -= this;
App::app().audienceForGameChange() -= this;
}
Expand Down

0 comments on commit d3062bf

Please sign in to comment.