Skip to content

Commit

Permalink
UI|Client|Task Bar: Added an About dialog; "About Doomsday" in DE menu
Browse files Browse the repository at this point in the history
The "About Doomsday" menu item now opens a popup dialog showing
information about Doomsday.

Todo for later: I'm sure there's lots of more information we can
show here...
  • Loading branch information
skyjake committed Aug 17, 2013
1 parent ffafccc commit 06e51f3
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -344,6 +344,7 @@ DENG_HEADERS += \
include/ui/ui_panel.h \
include/ui/ui2_main.h \
include/ui/uidefs.h \
include/ui/widgets/aboutdialog.h \
include/ui/widgets/actionitem.h \
include/ui/widgets/atlasproceduralimage.h \
include/ui/widgets/blurwidget.h \
Expand Down Expand Up @@ -658,6 +659,7 @@ SOURCES += \
src/ui/ui2_main.cpp \
src/ui/ui_main.cpp \
src/ui/ui_panel.cpp \
src/ui/widgets/aboutdialog.cpp \
src/ui/widgets/blurwidget.cpp \
src/ui/widgets/busywidget.cpp \
src/ui/widgets/buttonwidget.cpp \
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/data/defaultstyle.pack/fonts.dei
Expand Up @@ -50,7 +50,7 @@ group {
}

font title inherits default {
size $: gui.scale(__this__.size, 1.5)
size $: gui.scale(__this__.size, 1.4)
weight: bold
}

Expand Down
4 changes: 4 additions & 0 deletions doomsday/client/data/defaultstyle.pack/rules.dei
Expand Up @@ -25,6 +25,10 @@ group progress {
rule textgap { constant $= gap.constant }
}

group about {
rule width { constant = 320 }
}

group console {
rule width { constant = 500 }
}
Expand Down
33 changes: 33 additions & 0 deletions doomsday/client/include/ui/widgets/aboutdialog.h
@@ -0,0 +1,33 @@
/** @file aboutdialog.h Information about the Doomsday Client.
*
* @authors Copyright (c) 2013 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_ABOUTDIALOG_H
#define DENG_CLIENT_ABOUTDIALOG_H

#include "dialogwidget.h"

/**
* Dialog that shows information about the client.
*/
class AboutDialog : public DialogWidget
{
public:
AboutDialog();
};

#endif // DENG_CLIENT_ABOUTDIALOG_H
1 change: 1 addition & 0 deletions doomsday/client/include/ui/widgets/taskbarwidget.h
Expand Up @@ -58,6 +58,7 @@ public slots:
void close();
void openMainMenu();
void unloadGame();
void showAbout();

signals:
void opened();
Expand Down
97 changes: 97 additions & 0 deletions doomsday/client/src/ui/widgets/aboutdialog.cpp
@@ -0,0 +1,97 @@
/** @file aboutdialog.cpp Information about the Doomsday Client.
*
* @authors Copyright (c) 2013 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>
*/

#include "ui/widgets/aboutdialog.h"
#include "ui/widgets/labelwidget.h"
#include "ui/signalaction.h"
#include "ui/style.h"
#include "ui/signalaction.h"
#include "clientapp.h"
#include "../../updater/versioninfo.h"

#include "dd_def.h"

#include <de/Version>

using namespace de;

AboutDialog::AboutDialog() : DialogWidget("about")
{
Rule const &width = style().rules().rule("about.width");

LabelWidget *logo = new LabelWidget;
logo->setImage(style().images().image("logo.px256"));
logo->setSizePolicy(ui::Fixed, ui::Expand);

// Set up the contents of the widget.
LabelWidget *title = new LabelWidget;
title->setMargin("");
title->setFont("title");
title->setText(DOOMSDAY_NICENAME);
title->setSizePolicy(ui::Fixed, ui::Expand);

VersionInfo version;
de::Version ver2;

LabelWidget *info = new LabelWidget;
String txt = String(_E(D)_E(b) "%1" _E(.) " #%2 %3\n" _E(.)_E(l) "%4-bit %5%6\n\n%7")
.arg(version.base())
.arg(ver2.build)
.arg(DOOMSDAY_RELEASE_TYPE)
.arg(ver2.cpuBits())
.arg(ver2.operatingSystem())
.arg(ver2.isDebugBuild()? " debug" : "")
.arg(__DATE__ " " __TIME__);
info->setText(txt);
info->setSizePolicy(ui::Fixed, ui::Expand);

ButtonWidget *homepage = new ButtonWidget;
homepage->setText(tr("Go to Homepage"));
homepage->setSizePolicy(ui::Expand, ui::Expand);
homepage->setAction(new SignalAction(&ClientApp::app(), SLOT(openHomepageInBrowser())));

content().add(logo);
content().add(title);
content().add(info);
content().add(homepage);

// Position inside the content.
RuleRectangle const &cont = content().contentRule();
logo->rule()
.setLeftTop(cont.left(), cont.top())
.setInput(Rule::Width, width);
title->rule()
.setLeftTop(cont.left(), logo->rule().bottom())
.setInput(Rule::Width, width);
info->rule()
.setLeftTop(cont.left(), title->rule().bottom())
.setInput(Rule::Width, width);
homepage->rule()
.setInput(Rule::AnchorX, cont.left() + width / 2)
.setInput(Rule::Top, info->rule().bottom())
.setAnchorPoint(Vector2f(.5f, 0));

// Total size of the dialog's content.
content().setContentWidth(width);
content().setContentHeight(logo->rule().height() + title->rule().height() +
info->rule().height() + homepage->rule().height());

// Just an OK button.
buttons().items()
<< new ui::ActionItem(tr("Close"), new SignalAction(this, SLOT(accept())));
}
12 changes: 11 additions & 1 deletion doomsday/client/src/ui/widgets/taskbarwidget.cpp
Expand Up @@ -23,6 +23,7 @@
#include "ui/widgets/consolecommandwidget.h"
#include "ui/widgets/popupmenuwidget.h"
#include "ui/widgets/blurwidget.h"
#include "ui/widgets/aboutdialog.h"
#include "ui/clientwindow.h"
#include "ui/commandaction.h"
#include "ui/signalaction.h"
Expand Down Expand Up @@ -239,7 +240,7 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))
unloadMenu->items()
<< new ui::Item(ui::Item::Separator, tr("Really unload the game?"))
<< new ui::ActionItem(tr("Unload") + " " _E(b) + tr("(discard progress)"), new SignalAction(this, SLOT(unloadGame())))
<< new ui::ActionItem(tr("Cancel"), new SignalAction(d->mainMenu, SLOT(dismissPopups())));
<< new ui::ActionItem(tr("Cancel"), new SignalAction(&d->mainMenu->menu(), SLOT(dismissPopups())));

/*
* Set up items for the DE menu. Some of these are shown/hidden
Expand All @@ -254,6 +255,8 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))
<< new ui::ActionItem(tr("Check for Updates..."), new CommandAction("updateandnotify"))
<< new ui::ActionItem(tr("Updater Settings..."), new CommandAction("updatesettings"))
<< new ui::Item(ui::Item::Separator)
<< new ui::ActionItem(tr("About Doomsday..."), new SignalAction(this, SLOT(showAbout())))
<< new ui::Item(ui::Item::Separator)
<< new ui::ActionItem(tr("Quit Doomsday"), new CommandAction("quit"));

add(d->mainMenu);
Expand Down Expand Up @@ -480,3 +483,10 @@ void TaskBarWidget::unloadGame()
Con_Execute(CMDS_DDAY, "unload", false, false);
d->mainMenu->close();
}

void TaskBarWidget::showAbout()
{
AboutDialog *about = new AboutDialog;
about->setDeleteAfterDismissed(true);
about->exec(root());
}

0 comments on commit 06e51f3

Please sign in to comment.