Skip to content

Commit

Permalink
UI|Multiplayer|Home: “No Servers Found” notice in Multiplayer tab
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 26, 2017
1 parent 238fe19 commit 6d2f9d8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
7 changes: 4 additions & 3 deletions doomsday/apps/client/src/ui/dialogs/packagesdialog.cpp
Expand Up @@ -23,6 +23,7 @@
#include "ui/dialogs/packageinfodialog.h"
#include "resource/idtech1image.h"
#include "ui/clientwindow.h"
#include "ui/clientstyle.h"
#include "clientapp.h"

#include <doomsday/Games>
Expand Down Expand Up @@ -167,9 +168,9 @@ DENG_GUI_PIMPL(PackagesDialog)

// Indicator that is only visible when no packages have been added to the profile.
nothingSelected = new LabelWidget;
nothingSelected->setText(_E(b) + tr("No Packages Selected"));
nothingSelected->setFont("heading");
nothingSelected->setOpacity(0.5f);

nothingSelected->setText(tr("No Packages Selected"));
style().as<ClientStyle>().emptyMenuLabelStylist().applyStyle(*nothingSelected);
nothingSelected->rule()
.setRect(self().leftArea().rule())
.setInput(Rule::Top, gameTitle->rule().bottom());
Expand Down
27 changes: 27 additions & 0 deletions doomsday/apps/client/src/ui/home/multiplayercolumnwidget.cpp
Expand Up @@ -21,6 +21,7 @@
#include "ui/widgets/taskbarwidget.h"
#include "ui/home/headerwidget.h"
#include "ui/clientwindow.h"
#include "ui/clientstyle.h"
#include "network/serverlink.h"

#include <doomsday/Games>
Expand All @@ -33,8 +34,11 @@
using namespace de;

DENG_GUI_PIMPL(MultiplayerColumnWidget)
, DENG2_OBSERVES(ui::Data, Addition)
, DENG2_OBSERVES(ui::Data, Removal)
{
MultiplayerServerMenuWidget *menu;
LabelWidget *noServers;

Impl(Public *i) : Base(i)
{
Expand All @@ -57,6 +61,29 @@ DENG_GUI_PIMPL(MultiplayerColumnWidget)
.setInput(Rule::Width, area.contentRule().width())
.setInput(Rule::Left, area.contentRule().left())
.setInput(Rule::Top, self().header().rule().bottom());

// Empty content label.
noServers = new LabelWidget;
noServers->setText(tr("No Servers Found"));
style().as<ClientStyle>().emptyMenuLabelStylist().applyStyle(*noServers);
noServers->rule().setRect(self().rule());
self().add(noServers);

menu->items().audienceForAddition() += this;
menu->items().audienceForRemoval() += this;
}

void dataItemAdded(ui::DataPos, ui::Item const &) override
{
noServers->hide();
}

void dataItemRemoved(ui::DataPos, ui::Item &) override
{
if (menu->items().isEmpty())
{
noServers->show();
}
}
};

Expand Down

0 comments on commit 6d2f9d8

Please sign in to comment.