summaryrefslogtreecommitdiff
path: root/src/gui/customserverdialog.h
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-21 21:07:59 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-01-10 20:31:56 +0100
commit98be39a094cc20f513da1847c553513682e4eeae (patch)
treebf3ac3591cf80c14e484328d50d7b553d18244e2 /src/gui/customserverdialog.h
parent683da50e37fbbb2e3f70a4421a06dabd9bb912d8 (diff)
downloadMana-98be39a094cc20f513da1847c553513682e4eeae.tar.gz
Mana-98be39a094cc20f513da1847c553513682e4eeae.tar.bz2
Mana-98be39a094cc20f513da1847c553513682e4eeae.tar.xz
Mana-98be39a094cc20f513da1847c553513682e4eeae.zip
Made addition of custom servers be done in a separate window.
Now the first window the user can see is a list of servers which can double-clicked, making it all less cluttered. This commit also makes custom servers able to now have their own titles and their own description, just as the official ones. I also fixed the add entry button being registered twice to the action listener, and the fact that the description wasn't updated properly at windows loading and when adding/removing an entry. Resolves: Mana-Mantis #237. Reviewed-by: Ablu
Diffstat (limited to 'src/gui/customserverdialog.h')
-rw-r--r--src/gui/customserverdialog.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/gui/customserverdialog.h b/src/gui/customserverdialog.h
new file mode 100644
index 00000000..af19d9c7
--- /dev/null
+++ b/src/gui/customserverdialog.h
@@ -0,0 +1,96 @@
+/*
+ * The Mana Client
+ * Copyright (C) 2011 The Mana Developers
+ *
+ * This file is part of The Mana Client.
+ *
+ * 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
+ * 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/>.
+ */
+
+#ifndef CUSTOMSERVERDIALOG_H
+#define CUSTOMSERVERDIALOG_H
+
+class Button;
+class Label;
+class TextField;
+class DropDown;
+class ServerDialog;
+class TypeListModel;
+
+#include "gui/widgets/window.h"
+
+#include "net/serverinfo.h"
+
+#include <guichan/actionlistener.hpp>
+#include <guichan/keylistener.hpp>
+#include <guichan/listmodel.hpp>
+
+
+/**
+ * Server Type List Model
+ */
+class TypeListModel : public gcn::ListModel
+{
+ public:
+ TypeListModel() {}
+
+ /**
+ * Used to get number of line in the list
+ */
+ int getNumberOfElements() { return 2; }
+
+ /**
+ * Used to get an element from the list
+ */
+ std::string getElementAt(int elementIndex);
+};
+
+/**
+ * The custom server addition dialog.
+ *
+ * \ingroup Interface
+ */
+class CustomServerDialog : public Window,
+ public gcn::ActionListener,
+ public gcn::KeyListener
+{
+ public:
+ CustomServerDialog(ServerDialog *parent);
+
+ ~CustomServerDialog();
+
+ /**
+ * Called when receiving actions from the widgets.
+ */
+ void action(const gcn::ActionEvent &event);
+
+ void keyPressed(gcn::KeyEvent &keyEvent);
+
+ void logic();
+
+ private:
+ TextField *mServerAddressField;
+ TextField *mPortField;
+ TextField *mNameField;
+ TextField *mDescriptionField;
+ Button *mOkButton;
+ Button *mCancelButton;
+
+ DropDown *mTypeField;
+ TypeListModel *mTypeListModel;
+
+ ServerDialog *mServerDialog;
+};
+
+#endif // CUSTOMSERVERDIALOG_H