diff --git a/doomsday/client/client.pro b/doomsday/client/client.pro index b9309076b5..49f03afe78 100644 --- a/doomsday/client/client.pro +++ b/doomsday/client/client.pro @@ -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 \ @@ -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 \ diff --git a/doomsday/client/data/defaultstyle.pack/fonts.dei b/doomsday/client/data/defaultstyle.pack/fonts.dei index 0a3cf3c452..245fd28660 100644 --- a/doomsday/client/data/defaultstyle.pack/fonts.dei +++ b/doomsday/client/data/defaultstyle.pack/fonts.dei @@ -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 } diff --git a/doomsday/client/data/defaultstyle.pack/rules.dei b/doomsday/client/data/defaultstyle.pack/rules.dei index ab907210a1..f6081e8d40 100644 --- a/doomsday/client/data/defaultstyle.pack/rules.dei +++ b/doomsday/client/data/defaultstyle.pack/rules.dei @@ -25,6 +25,10 @@ group progress { rule textgap { constant $= gap.constant } } +group about { + rule width { constant = 320 } +} + group console { rule width { constant = 500 } } diff --git a/doomsday/client/include/ui/widgets/aboutdialog.h b/doomsday/client/include/ui/widgets/aboutdialog.h new file mode 100644 index 0000000000..bf9c4a8ea0 --- /dev/null +++ b/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 + * + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html + * + * 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 + */ + +#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 diff --git a/doomsday/client/include/ui/widgets/taskbarwidget.h b/doomsday/client/include/ui/widgets/taskbarwidget.h index e28c193bcb..c23de369ae 100644 --- a/doomsday/client/include/ui/widgets/taskbarwidget.h +++ b/doomsday/client/include/ui/widgets/taskbarwidget.h @@ -58,6 +58,7 @@ public slots: void close(); void openMainMenu(); void unloadGame(); + void showAbout(); signals: void opened(); diff --git a/doomsday/client/src/ui/widgets/aboutdialog.cpp b/doomsday/client/src/ui/widgets/aboutdialog.cpp new file mode 100644 index 0000000000..f679db4491 --- /dev/null +++ b/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 + * + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html + * + * 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 + */ + +#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 + +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()))); +} diff --git a/doomsday/client/src/ui/widgets/taskbarwidget.cpp b/doomsday/client/src/ui/widgets/taskbarwidget.cpp index 061d1d7709..d71a5d2028 100644 --- a/doomsday/client/src/ui/widgets/taskbarwidget.cpp +++ b/doomsday/client/src/ui/widgets/taskbarwidget.cpp @@ -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" @@ -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 @@ -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); @@ -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()); +}