summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-18 00:06:56 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-04-18 01:14:12 +0200
commit88934303761ba950be56eac8b60de2dede88a29f (patch)
tree30ee10cfdd540a4b1af6e880778540954119a88f /src/client.h
parent76188096f64b8cc600d2f18cbf7a4d0c7ae87136 (diff)
downloadmana-88934303761ba950be56eac8b60de2dede88a29f.tar.gz
mana-88934303761ba950be56eac8b60de2dede88a29f.tar.bz2
mana-88934303761ba950be56eac8b60de2dede88a29f.tar.xz
mana-88934303761ba950be56eac8b60de2dede88a29f.zip
A bit of cleanup in the way the Client pops up error dialogs
No point in using mCurrentDialog for the OkDialog, since it will clean up after itself, as was pointed out in many places throughout the code. Now there are two convenience functions for popping up the OkDialog and having it change to a specified state afterwards. This also gets rid of the 4 different ActionListener classes that existed solely for this purpose. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/client.h b/src/client.h
index 85fb7d37..4a0bc750 100644
--- a/src/client.h
+++ b/src/client.h
@@ -52,14 +52,7 @@ extern volatile int fps;
extern volatile int tick_time;
extern volatile int cur_time;
-class ErrorListener : public gcn::ActionListener
-{
- public:
- void action(const gcn::ActionEvent &event);
-};
-
extern std::string errorMessage;
-extern ErrorListener errorListener;
extern LoginData loginData;
/**
@@ -167,6 +160,20 @@ public:
int exec();
+ /**
+ * Pops up an OkDialog with the given \a title and \a message, and
+ * switches to the given \a state when Ok is pressed.
+ */
+ void showOkDialog(const std::string &title,
+ const std::string &message,
+ State state);
+
+ /**
+ * Pops up an error dialog with the given \a message, and switches to the
+ * given \a state when Ok is pressed.
+ */
+ void showErrorDialog(const std::string &message, State state);
+
static void setState(State state)
{ instance()->mState = state; }
@@ -218,6 +225,7 @@ private:
State mState;
State mOldState;
+ State mStateAfterOkDialog;
SDL_Surface *mIcon;