summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-20 23:31:01 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-20 23:31:01 +0300
commit39f265e503e11f2e48e7a54129f216b55e288ac3 (patch)
tree2fe197330ea77bed9f59b633c3dd1bffd63a9a17 /src
parentb43d3d71666161d9276440727082cc1508741280 (diff)
downloadmv-39f265e503e11f2e48e7a54129f216b55e288ac3.tar.gz
mv-39f265e503e11f2e48e7a54129f216b55e288ac3.tar.bz2
mv-39f265e503e11f2e48e7a54129f216b55e288ac3.tar.xz
mv-39f265e503e11f2e48e7a54129f216b55e288ac3.zip
Not allow close warp dialog until select warp target.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/simpletypes/allowquit.h33
-rw-r--r--src/gui/windows/textselectdialog.cpp24
-rw-r--r--src/gui/windows/textselectdialog.h6
-rw-r--r--src/net/eathena/skillrecv.cpp3
6 files changed, 60 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a4fb9bed4..114a793ad 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1163,6 +1163,7 @@ SET(SRCS
enums/state.h
enums/textcommandtype.h
enums/simpletypes/advanced.h
+ enums/simpletypes/allowquit.h
enums/simpletypes/allowsort.h
enums/simpletypes/allplayers.h
enums/simpletypes/append.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 1884936ea..bb54a285c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -612,6 +612,7 @@ SRC += events/actionevent.h \
enums/state.h \
enums/textcommandtype.h \
enums/simpletypes/advanced.h \
+ enums/simpletypes/allowquit.h \
enums/simpletypes/allowsort.h \
enums/simpletypes/allplayers.h \
enums/simpletypes/append.h \
diff --git a/src/enums/simpletypes/allowquit.h b/src/enums/simpletypes/allowquit.h
new file mode 100644
index 000000000..22663b1c4
--- /dev/null
+++ b/src/enums/simpletypes/allowquit.h
@@ -0,0 +1,33 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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 ENUMS_SIMPLETYPES_ALLOWQUIT_H
+#define ENUMS_SIMPLETYPES_ALLOWQUIT_H
+
+#include "enums/simpletypes/booldefines.h"
+
+PRAGMA6("GCC diagnostic push")
+PRAGMA6("GCC diagnostic ignored \"-Wunused-const-variable\"")
+
+defBoolEnum(AllowQuit);
+
+PRAGMA6("GCC diagnostic pop")
+
+#endif // ENUMS_SIMPLETYPES_ALLOWQUIT_H
diff --git a/src/gui/windows/textselectdialog.cpp b/src/gui/windows/textselectdialog.cpp
index dbc34bfaf..ebbee9528 100644
--- a/src/gui/windows/textselectdialog.cpp
+++ b/src/gui/windows/textselectdialog.cpp
@@ -40,7 +40,8 @@
#include "debug.h"
TextSelectDialog::TextSelectDialog(const std::string &name,
- const std::string &selectButton) :
+ const std::string &selectButton,
+ const AllowQuit allowQuit) :
// TRANSLATORS: sell dialog name
Window(name, Modal_false, nullptr, "sell.xml"),
ActionListener(),
@@ -52,6 +53,7 @@ TextSelectDialog::TextSelectDialog(const std::string &name,
mItemList(nullptr),
mScrollArea(nullptr),
mModel(nullptr),
+ mAllowQuit(allowQuit),
mTag(0)
{
}
@@ -60,7 +62,7 @@ void TextSelectDialog::postInit()
{
setWindowName("TextSelectDialog");
setResizable(true);
- setCloseButton(true);
+ setCloseButton(mAllowQuit == AllowQuit_true);
setStickyButtonLock(true);
setMinWidth(260);
setMinHeight(220);
@@ -83,8 +85,11 @@ void TextSelectDialog::postInit()
mSelectButtonName,
"select",
this);
- // TRANSLATORS: sell dialog button
- mQuitButton = new Button(this, _("Quit"), "quit", this);
+ if (mAllowQuit == AllowQuit_true)
+ {
+ // TRANSLATORS: sell dialog button
+ mQuitButton = new Button(this, _("Quit"), "quit", this);
+ }
mSelectButton->setEnabled(false);
@@ -97,8 +102,15 @@ void TextSelectDialog::postInit()
placer = getPlacer(0, 0);
placer(0, 0, mScrollArea, 8, 5).setPadding(3);
- placer(6, 5, mSelectButton);
- placer(7, 5, mQuitButton);
+ if (mQuitButton)
+ {
+ placer(6, 5, mSelectButton);
+ placer(7, 5, mQuitButton);
+ }
+ else
+ {
+ placer(7, 5, mSelectButton);
+ }
Layout &layout = getLayout();
layout.setRowHeight(0, LayoutType::SET);
diff --git a/src/gui/windows/textselectdialog.h b/src/gui/windows/textselectdialog.h
index 800f7cee4..70da4ad5e 100644
--- a/src/gui/windows/textselectdialog.h
+++ b/src/gui/windows/textselectdialog.h
@@ -25,6 +25,8 @@
#include "gui/widgets/window.h"
+#include "enums/simpletypes/allowquit.h"
+
#include "listeners/actionlistener.h"
#include "listeners/selectionlistener.h"
@@ -42,7 +44,8 @@ class TextSelectDialog notfinal : public Window,
* Constructor.
*/
TextSelectDialog(const std::string &name,
- const std::string &selectButton);
+ const std::string &selectButton,
+ const AllowQuit allowQuit);
A_DELETE_COPY(TextSelectDialog)
@@ -94,6 +97,7 @@ class TextSelectDialog notfinal : public Window,
ListBox *mItemList A_NONNULLPOINTER;
ScrollArea *mScrollArea A_NONNULLPOINTER;
NamesModel *mModel A_NONNULLPOINTER;
+ AllowQuit mAllowQuit;
int mTag;
};
diff --git a/src/net/eathena/skillrecv.cpp b/src/net/eathena/skillrecv.cpp
index 4aac4907e..35d36f866 100644
--- a/src/net/eathena/skillrecv.cpp
+++ b/src/net/eathena/skillrecv.cpp
@@ -361,7 +361,8 @@ void SkillRecv::processSkillWarpPoint(Net::MessageIn &msg)
// TRANSLATORS: warp select window name
_("Select warp target"),
// TRANSLATORS: warp select button
- _("Warp"));
+ _("Warp"),
+ AllowQuit_false);
skillWarpListener.setDialog(dialog);
skillWarpListener.setSkill(skillId);
dialog->addActionListener(&skillWarpListener);