Skip to content

Commit

Permalink
Added the Multiplayer Games column (stub); header owned by ColumnWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 11, 2016
1 parent 2695e85 commit 40bbb0e
Show file tree
Hide file tree
Showing 9 changed files with 672 additions and 45 deletions.
2 changes: 2 additions & 0 deletions doomsday/apps/client/include/ui/home/columnwidget.h
Expand Up @@ -19,6 +19,7 @@
#ifndef DENG_CLIENT_UI_COLUMNWIDGET_H
#define DENG_CLIENT_UI_COLUMNWIDGET_H

#include "headerwidget.h"
#include <de/ScrollAreaWidget>

/**
Expand All @@ -37,6 +38,7 @@ class ColumnWidget : public de::GuiWidget
void setBackgroundImage(de::Image const &image);

de::ScrollAreaWidget &scrollArea();
HeaderWidget &header();
de::Rule const &maximumContentWidth() const;

virtual void setHighlighted(bool highlighted);
Expand Down
39 changes: 39 additions & 0 deletions doomsday/apps/client/include/ui/home/multiplayercolumnwidget.h
@@ -0,0 +1,39 @@
/** @file multiplayercolumnwidget.h
*
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_UI_HOME_MULTIPLAYERCOLUMNWIDGET_H
#define DENG_CLIENT_UI_HOME_MULTIPLAYERCOLUMNWIDGET_H

#include "columnwidget.h"

class MultiplayerColumnWidget : public ColumnWidget
{
public:
enum DiscoveryMode {
NoDiscovery,
DiscoverUsingMaster,
DirectDiscoveryOnly
};

MultiplayerColumnWidget();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_UI_HOME_MULTIPLAYERCOLUMNWIDGET_H
@@ -0,0 +1,33 @@
/** @file multiplayerpanelbuttonwidget.h
*
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_UI_HOME_MULTIPLAYERPANELBUTTONWIDGET_H
#define DENG_CLIENT_UI_HOME_MULTIPLAYERPANELBUTTONWIDGET_H

#include "panelbuttonwidget.h"

class MultiplayerPanelButtonWidget : public PanelButtonWidget
{
public:
MultiplayerPanelButtonWidget();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_UI_HOME_MULTIPLAYERPANELBUTTONWIDGET_H
14 changes: 14 additions & 0 deletions doomsday/apps/client/src/ui/home/columnwidget.cpp
Expand Up @@ -31,6 +31,7 @@ DENG_GUI_PIMPL(ColumnWidget)
bool highlighted;
LabelWidget *back;
ScrollAreaWidget *scrollArea;
HeaderWidget *header;
//Vector4f bgColor;
Rule const *maxContentWidth = nullptr;

Expand All @@ -42,6 +43,14 @@ DENG_GUI_PIMPL(ColumnWidget)
scrollArea = new ScrollAreaWidget;
scrollArea->enableIndicatorDraw(true);

header = new HeaderWidget;
scrollArea->add(header);

header->rule()
.setInput(Rule::Left, scrollArea->contentRule().left())
.setInput(Rule::Top, scrollArea->contentRule().top())
.setInput(Rule::Width, scrollArea->contentRule().width());

//QColor bg;
//bg.setHsvF(de::frand(), .9, .5);
//bgColor = Vector4f(bg.redF(), bg.greenF(), bg.blueF(), 1);
Expand Down Expand Up @@ -85,6 +94,11 @@ ScrollAreaWidget &ColumnWidget::scrollArea()
return *d->scrollArea;
}

HeaderWidget &ColumnWidget::header()
{
return *d->header;
}

Rule const &ColumnWidget::maximumContentWidth() const
{
return *d->maxContentWidth;
Expand Down
76 changes: 34 additions & 42 deletions doomsday/apps/client/src/ui/home/gamecolumnwidget.cpp
Expand Up @@ -46,7 +46,6 @@ DENG_GUI_PIMPL(GameColumnWidget)

String gameFamily;
SavedSessionListData const &savedItems;
HeaderWidget *header;
MenuWidget *menu;
Image bgImage;

Expand All @@ -59,13 +58,6 @@ DENG_GUI_PIMPL(GameColumnWidget)
{
ScrollAreaWidget &area = self.scrollArea();

area.add(header = new HeaderWidget);

header->rule()
.setInput(Rule::Left, area.contentRule().left())
.setInput(Rule::Top, area.contentRule().top())
.setInput(Rule::Width, area.contentRule().width());

area.add(menu = new MenuWidget);
menu->enableScrolling(false);
menu->enablePageKeys(false);
Expand All @@ -77,7 +69,7 @@ DENG_GUI_PIMPL(GameColumnWidget)
menu->rule()
.setInput(Rule::Width, area.contentRule().width())
.setInput(Rule::Left, area.contentRule().left())
.setInput(Rule::Top, header->rule().bottom() +
.setInput(Rule::Top, self.header().rule().bottom() +
style().rules().rule("gap")*2);

DoomsdayApp::games().audienceForReadiness() += this;
Expand Down Expand Up @@ -166,18 +158,18 @@ GameColumnWidget::GameColumnWidget(String const &gameFamily,
, d(new Instance(this, gameFamily.toLower(), savedItems))
{
scrollArea().setContentSize(maximumContentWidth(),
d->header->rule().height() +
header().rule().height() +
style().rules().rule("gap") +
d->menu->rule().height());

d->header->title().setText(String(_E(s) "%1\n" _E(.)_E(w) "%2")
.arg( gameFamily == "DOOM"? "id Software" :
!gameFamily.isEmpty()? "Raven Software" : "")
.arg(!gameFamily.isEmpty()? QString(gameFamily) : tr("Other Games")));
header().title().setText(String(_E(s) "%1\n" _E(.)_E(w) "%2")
.arg( gameFamily == "DOOM"? "id Software" :
!gameFamily.isEmpty()? "Raven Software" : "")
.arg(!gameFamily.isEmpty()? QString(gameFamily) : tr("Other Games")));
if(!gameFamily.isEmpty())
{
d->header->setLogoImage("logo.game." + gameFamily.toLower());
d->header->setLogoBackground("home.background." + d->gameFamily);
header().setLogoImage("logo.game." + gameFamily.toLower());
header().setLogoBackground("home.background." + d->gameFamily);
d->bgImage = style().images().image("home.background." + d->gameFamily);
setBackgroundImage(d->bgImage);
}
Expand All @@ -186,40 +178,40 @@ GameColumnWidget::GameColumnWidget(String const &gameFamily,
{
if(name() == "doom-column")
{
d->header->info().setText("id Software released DOOM for MS-DOS in 1993. "
"It soon became a massive hit and is regarded as "
"the game that popularized the first-person shooter "
"genre. Since then the franchise has been continued "
"in several sequels, starting with DOOM II: Hell on "
"Earth in 1994. DOOM and many of its follow-ups "
"have been ported to numerous other platforms, and "
"to this day remains a favorite among gamers.");
header().info().setText("id Software released DOOM for MS-DOS in 1993. "
"It soon became a massive hit and is regarded as "
"the game that popularized the first-person shooter "
"genre. Since then the franchise has been continued "
"in several sequels, starting with DOOM II: Hell on "
"Earth in 1994. DOOM and many of its follow-ups "
"have been ported to numerous other platforms, and "
"to this day remains a favorite among gamers.");
}
else if(name() == "heretic-column")
{
d->header->info().setText("Raven Software released Heretic in 1994. It used "
"a modified version of id Software's DOOM engine. "
"The game featured such enhancements as inventory "
"management and the ability to look up and down. "
"Ambient sound effects were used to improve the "
"atmosphere of the game world.");
header().info().setText("Raven Software released Heretic in 1994. It used "
"a modified version of id Software's DOOM engine. "
"The game featured such enhancements as inventory "
"management and the ability to look up and down. "
"Ambient sound effects were used to improve the "
"atmosphere of the game world.");
}
else if(name() == "hexen-column")
{
d->header->info().setText("Raven Software released Hexen in 1996. The "
"company had continued making heavy modifications "
"to the DOOM engine, and Hexen introduced such "
"sophisticated features as a scripting language "
"for game events. The maps were well-designed and "
"interconnected with each other, resulting in a "
"more intriguing game world and more complex "
"puzzles to solve.");
header().info().setText("Raven Software released Hexen in 1996. The "
"company had continued making heavy modifications "
"to the DOOM engine, and Hexen introduced such "
"sophisticated features as a scripting language "
"for game events. The maps were well-designed and "
"interconnected with each other, resulting in a "
"more intriguing game world and more complex "
"puzzles to solve.");
}
else
{
d->header->info().setText("Thanks to its excellent modding support, DOOM has "
"been used as a basis for many games and community "
"projects.");
header().info().setText("Thanks to its excellent modding support, DOOM has "
"been used as a basis for many games and community "
"projects.");
}
}
}
Expand All @@ -238,7 +230,7 @@ void GameColumnWidget::setHighlighted(bool highlighted)
Image::Size(4, 4)));
}*/

//d->header->setOpacity(highlighted? 1 : .7, .5);
//header().setOpacity(highlighted? 1 : .7, .5);
//d->menu->setOpacity (highlighted? 1 : .7, .5);

if(!highlighted)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/ui/home/gamepanelbuttonwidget.cpp
Expand Up @@ -116,12 +116,12 @@ void GamePanelButtonWidget::updateContent()
{
meta = tr("Restore saved game");
}
else if(d->saves->childCount() > 0)
/*else if(d->saves->childCount() > 0)
{
meta = tr("%1 saved game%2")
.arg(d->saves->childCount())
.arg(d->saves->childCount() != 1? "s" : "");
}
}*/
else
{
meta = tr("Start new session");
Expand Down
3 changes: 2 additions & 1 deletion doomsday/apps/client/src/ui/home/homewidget.cpp
Expand Up @@ -20,6 +20,7 @@
#include "ui/home/columnwidget.h"
#include "ui/home/nogamescolumnwidget.h"
#include "ui/home/gamecolumnwidget.h"
#include "ui/home/multiplayercolumnwidget.h"
#include "ui/savedsessionlistdata.h"

#include <doomsday/doomsdayapp.h>
Expand Down Expand Up @@ -245,7 +246,7 @@ HomeWidget::HomeWidget()
column = new GameColumnWidget("", d->savedItems);
d->addColumn(column);

column = new ColumnWidget("multiplayer-column");
column = new MultiplayerColumnWidget();
d->addColumn(column);

column = new ColumnWidget("packages-column");
Expand Down

0 comments on commit 40bbb0e

Please sign in to comment.