summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/client.h b/src/client.h
index f44d8bf2..8b6af127 100644
--- a/src/client.h
+++ b/src/client.h
@@ -22,7 +22,7 @@
#ifndef CLIENT_H
#define CLIENT_H
-#include "configlistener.h"
+#include "eventlistener.h"
#include "net/serverinfo.h"
@@ -52,20 +52,26 @@ 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;
/**
- * Returns elapsed time. (Warning: supposes the delay is always < 100 seconds)
+ * @param startTime The value to check in client ticks.
+ *
+ * @return the elapsed time in milliseconds.
+ * between startTime and the current client tick value.
+ *
+ * @warning This function can't handle delays > 100 seconds.
+ * @see MILLISECONDS_IN_A_TICK
+ * @see tick_time
+ */
+int get_elapsed_time(int startTime);
+
+/**
+ * Returns whether this call and the last call were done for the same
+ * selected index and within a short time.
*/
-int get_elapsed_time(int start_time);
+bool isDoubleClick(int selected);
/**
* All client states.
@@ -113,7 +119,7 @@ enum State {
* The core part of the client. This class initializes all subsystems, runs
* the event loop, and shuts everything down again.
*/
-class Client : public ConfigListener, public gcn::ActionListener
+class Client : public EventListener, public gcn::ActionListener
{
public:
/**
@@ -142,6 +148,7 @@ public:
std::string brandingPath;
std::string updateHost;
std::string dataPath;
+ std::string chatLogDir;
std::string configDir;
std::string localDataDir;
std::string screenshotDir;
@@ -160,6 +167,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; }
@@ -178,7 +199,7 @@ public:
static const std::string &getScreenshotDirectory()
{ return instance()->mScreenshotDir; }
- void optionChanged(const std::string &name);
+ void event(Event::Channel channel, const Event &event);
void action(const gcn::ActionEvent &event);
private:
@@ -211,6 +232,7 @@ private:
State mState;
State mOldState;
+ State mStateAfterOkDialog;
SDL_Surface *mIcon;