Skip to content

Commit

Permalink
UI|Client: Added a stub from the alerts dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 2, 2014
1 parent 7f14a83 commit 9b71259
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doomsday/client/client.pro
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ DENG_HEADERS += \
include/ui/dd_input.h \
include/ui/dd_ui.h \
include/ui/dialogs/aboutdialog.h \
include/ui/dialogs/alertdialog.h \
include/ui/dialogs/audiosettingsdialog.h \
include/ui/dialogs/coloradjustmentdialog.h \
include/ui/dialogs/inputdialog.h \
Expand Down Expand Up @@ -750,6 +751,7 @@ SOURCES += \
src/ui/clientwindow.cpp \
src/ui/dd_input.cpp \
src/ui/dialogs/aboutdialog.cpp \
src/ui/dialogs/alertdialog.cpp \
src/ui/dialogs/audiosettingsdialog.cpp \
src/ui/dialogs/coloradjustmentdialog.cpp \
src/ui/dialogs/inputdialog.cpp \
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doomsday/client/data/defaultstyle.pack/images.dei
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ group logo {
}
}

image alert { path = "graphics/alert.png" }
image gauge { path = "graphics/gauge.png" }
image gear { path = "graphics/gear.png" }
image display { path = "graphics/display.png" }
Expand Down
41 changes: 41 additions & 0 deletions doomsday/client/include/ui/dialogs/alertdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/** @file alertdialog.h Dialog for listing recent alerts.
*
* @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_ALERTDIALOG_H
#define DENG_CLIENT_ALERTDIALOG_H

#include "ui/widgets/dialogwidget.h"

/**
* Dialog for listing recent alerts.
*/
class AlertDialog : public DialogWidget
{
public:
AlertDialog(de::String const &name = "alerts");

/**
* Returns the notification area widget with which the dialog can be opened.
*/
GuiWidget &notification();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_ALERTDIALOG_H
2 changes: 1 addition & 1 deletion doomsday/client/include/ui/widgets/notificationwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Notification area.
*
* Children the widget are expected to size themselves and allow unrestricted,
* Children of the widget are expected to size themselves and allow unrestricted,
* automatical positioning inside the area. Children can be added and removed
* dynamically. The notification area is dismissed if there are no visible
* notifications.
Expand Down
7 changes: 7 additions & 0 deletions doomsday/client/src/ui/clientwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "ui/widgets/gameselectionwidget.h"
#include "ui/widgets/progresswidget.h"
#include "ui/dialogs/coloradjustmentdialog.h"
#include "ui/dialogs/alertdialog.h"
#include "CommandAction"
#include "ui/mouse_qt.h"

Expand Down Expand Up @@ -78,6 +79,7 @@ DENG2_OBSERVES(App, StartupComplete)
GameUIWidget *gameUI;
TaskBarWidget *taskBar;
NotificationWidget *notifications;
AlertDialog *alerts;
ColorAdjustmentDialog *colorAdjust;
LabelWidget *background;
GameSelectionWidget *gameSelMenu;
Expand Down Expand Up @@ -107,6 +109,7 @@ DENG2_OBSERVES(App, StartupComplete)
, gameUI(0)
, taskBar(0)
, notifications(0)
, alerts(0)
, colorAdjust(0)
, background(0)
, gameSelMenu(0)
Expand Down Expand Up @@ -202,6 +205,10 @@ DENG2_OBSERVES(App, StartupComplete)
.setInput(Rule::Right, game->rule().right() - style.rules().rule("gap"));
container().add(notifications);

// Alerts notification and popup.
alerts = new AlertDialog;
root.add(alerts);

// FPS counter for the notification area.
fpsCounter = new LabelWidget;
fpsCounter->setSizePolicy(ui::Expand, ui::Expand);
Expand Down
51 changes: 51 additions & 0 deletions doomsday/client/src/ui/dialogs/alertdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** @file alertdialog.cpp Dialog for listing recent alerts.
*
* @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/dialogs/alertdialog.h"
#include "ui/widgets/notificationwidget.h"
#include "ui/clientwindow.h"

using namespace de;

DENG_GUI_PIMPL(AlertDialog)
{
ButtonWidget *notification;

Instance(Public *i) : Base(i)
{
notification = new ButtonWidget;
notification->setSizePolicy(ui::Expand, ui::Expand);
notification->setImage(style().images().image("alert"));
notification->setOverrideImageSize(style().fonts().font("default").height().value());
}

NotificationWidget &notifs()
{
return ClientWindow::main().notifications();
}
};

AlertDialog::AlertDialog(String const &name) : d(new Instance(this))
{
d->notifs().showOrHide(d->notification, true);
}

GuiWidget &AlertDialog::notification()
{
return *d->notification;
}

0 comments on commit 9b71259

Please sign in to comment.