summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-02 17:56:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-02 17:56:13 +0300
commit1003a7a74f72f17f59f4a74eacf95a1744a64506 (patch)
tree59e3dfae9c470426dea48b4b3aa221c40800072e /src/gui
parentce2e90b35291abe32c47e21569a58e9eb22cc87b (diff)
downloadplus-1003a7a74f72f17f59f4a74eacf95a1744a64506.tar.gz
plus-1003a7a74f72f17f59f4a74eacf95a1744a64506.tar.bz2
plus-1003a7a74f72f17f59f4a74eacf95a1744a64506.tar.xz
plus-1003a7a74f72f17f59f4a74eacf95a1744a64506.zip
Move death dialog showing from playerhandler.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogsmanager.cpp30
-rw-r--r--src/gui/dialogsmanager.h10
-rw-r--r--src/gui/windows/okdialog.cpp1
3 files changed, 38 insertions, 3 deletions
diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp
index 0b515c2f3..0ef8a1582 100644
--- a/src/gui/dialogsmanager.cpp
+++ b/src/gui/dialogsmanager.cpp
@@ -36,8 +36,12 @@
#include "gui/windows/okdialog.h"
#include "gui/windows/updaterwindow.h"
+#include "listeners/playerpostdeathlistener.h"
+
#include "net/inventoryhandler.h"
+#include "resources/db/deaddb.h"
+
#include "utils/gettext.h"
#include "debug.h"
@@ -46,7 +50,18 @@
#undef ERROR
#endif
-extern OkDialog *deathNotice;
+OkDialog *deathNotice;
+DialogsManager *dialogsManager = nullptr;
+
+namespace
+{
+ PlayerPostDeathListener postDeathListener;
+} // namespace
+
+DialogsManager::DialogsManager() :
+ PlayerDeathListener()
+{
+}
void DialogsManager::closeDialogs()
{
@@ -96,3 +111,16 @@ Window *DialogsManager::openErrorDialog(const std::string &header,
return dialog;
}
}
+
+void DialogsManager::playerDeath()
+{
+ logger->log("DialogsManager::playerDeath");
+ // TRANSLATORS: message header
+ deathNotice = new OkDialog(_("Message"),
+ DeadDB::getRandomString(),
+ // TRANSLATORS: ok dialog button
+ _("Revive"),
+ DialogType::OK,
+ false, true, nullptr, 260);
+ deathNotice->addActionListener(&postDeathListener);
+}
diff --git a/src/gui/dialogsmanager.h b/src/gui/dialogsmanager.h
index 9c7dc0d46..b9625ae07 100644
--- a/src/gui/dialogsmanager.h
+++ b/src/gui/dialogsmanager.h
@@ -23,15 +23,19 @@
#ifndef GUI_DIALOGSMANAGER_H
#define GUI_DIALOGSMANAGER_H
+#include "listeners/playerdeathlistener.h"
+
#include <string>
#include "localconsts.h"
class Window;
-class DialogsManager final
+class DialogsManager final : public PlayerDeathListener
{
public:
+ DialogsManager();
+
static void closeDialogs();
static void createUpdaterWindow();
@@ -39,6 +43,10 @@ class DialogsManager final
static Window *openErrorDialog(const std::string &header,
const std::string &message,
const bool modal);
+
+ void playerDeath() override final;
};
+extern DialogsManager *dialogsManager;
+
#endif // GUI_DIALOGSMANAGER_H
diff --git a/src/gui/windows/okdialog.cpp b/src/gui/windows/okdialog.cpp
index b6c3bfc41..37d0d018a 100644
--- a/src/gui/windows/okdialog.cpp
+++ b/src/gui/windows/okdialog.cpp
@@ -35,7 +35,6 @@
#include "debug.h"
OkDialog *weightNotice = nullptr;
-OkDialog *deathNotice = nullptr;
OkDialog::OkDialog(const std::string &restrict title,
const std::string &restrict msg,