summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
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,