Skip to content

Commit

Permalink
Fixed|UI|Home: Crash during the Tutorial; missing MP game icons
Browse files Browse the repository at this point in the history
The Tutorial was still trying to access the removed "background"
widget.

The MP game icons would appear blank white if the IWADs were loaded
only after querying the MP games.
  • Loading branch information
skyjake committed Apr 3, 2016
1 parent 2130a1e commit 2f4f4a8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
16 changes: 16 additions & 0 deletions doomsday/apps/client/src/ui/home/multiplayerpanelbuttonwidget.cpp
Expand Up @@ -27,6 +27,7 @@
#include <doomsday/games.h>
#include <doomsday/console/exec.h>
#include <doomsday/LumpCatalog>
#include <doomsday/Games>
#include <de/charsymbols.h>
#include <de/CallbackAction>
#include <de/PopupButtonWidget>
Expand All @@ -37,6 +38,7 @@
using namespace de;

DENG_GUI_PIMPL(MultiplayerPanelButtonWidget)
, DENG2_OBSERVES(Games, Readiness)
{
serverinfo_t serverInfo;
ButtonWidget *joinButton;
Expand All @@ -48,6 +50,8 @@ DENG_GUI_PIMPL(MultiplayerPanelButtonWidget)

Instance(Public *i) : Base(i)
{
DoomsdayApp::games().audienceForReadiness() += this;

joinButton = new ButtonWidget;
joinButton->setText(tr("Join"));
joinButton->useInfoStyle();
Expand Down Expand Up @@ -78,6 +82,11 @@ DENG_GUI_PIMPL(MultiplayerPanelButtonWidget)
self.panel().open();
}

~Instance()
{
DoomsdayApp::games().audienceForReadiness() -= this;
}

void joinButtonPressed() const
{
// Switch locally to the game running on the server.
Expand All @@ -102,6 +111,13 @@ DENG_GUI_PIMPL(MultiplayerPanelButtonWidget)
{
return QRegExp("\\b" + token + "\\b").indexIn(gameConfig) >= 0;
}

void gameReadinessUpdated()
{
// Let's refresh the icons.
catalog.clear();
self.updateContent(serverInfo);
}
};

MultiplayerPanelButtonWidget::MultiplayerPanelButtonWidget()
Expand Down
9 changes: 5 additions & 4 deletions doomsday/apps/client/src/ui/widgets/tutorialwidget.cpp
Expand Up @@ -247,11 +247,12 @@ DENG_GUI_PIMPL(TutorialWidget)

case HomeScreen:
dlg->title().setText(tr("Home Screen"));
dlg->message().setText(tr("This is where you end up if no game gets loaded at startup. "
"Here you can browse all available games "
"and configure engine settings. You can unload the current game at "
dlg->message().setText(tr("Here you can browse the library of available games "
"and configure engine settings. You can also join ongoing "
"multiplayer games and manage your resource packages. "
"You can unload the current game at "
"any time to get back to the Home Screen."));
startHighlight(*root().guiFind("background"));
startHighlight(*root().guiFind("home"));
break;

case Notifications:
Expand Down
Expand Up @@ -37,6 +37,8 @@ class LIBDOOMSDAY_PUBLIC LumpCatalog
public:
LumpCatalog();

void clear();

/**
* Sets the list of packages where data lumps are to be read from. Only data bundle
* packages of Wad and Lump types are used.
Expand Down
11 changes: 11 additions & 0 deletions doomsday/apps/libdoomsday/src/resource/lumpcatalog.cpp
Expand Up @@ -38,6 +38,12 @@ DENG2_PIMPL(LumpCatalog)

Instance(Public *i) : Base(i) {}

void clear()
{
packageIds.clear();
bundles.clear();
}

void updateBundles()
{
bundles.clear();
Expand Down Expand Up @@ -79,6 +85,11 @@ LumpCatalog::LumpCatalog()
: d(new Instance(this))
{}

void LumpCatalog::clear()
{
d->clear();
}

bool LumpCatalog::setPackages(StringList const &packageIds)
{
if(packageIds != d->packageIds)
Expand Down

0 comments on commit 2f4f4a8

Please sign in to comment.