summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-20 19:02:40 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-20 19:02:40 +0300
commit2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4 (patch)
tree2f6157ee1268ea2ea978e8949126ef010ff682ff /src/gui/windows/inventorywindow.cpp
parentd7f5bf6c2ad9fdcf2308b1c9d3a70e0f17b30adf (diff)
downloadplus-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.tar.gz
plus-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.tar.bz2
plus-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.tar.xz
plus-2b0936e4eafee4da5e2ff3c0a7b7fd0df8a9f5c4.zip
Add ability for insert cards into items by dragging.
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r--src/gui/windows/inventorywindow.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index d4f27fd74..931acdf4a 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -40,11 +40,13 @@
#include "gui/popups/popupmenu.h"
#include "gui/popups/textpopup.h"
+#include "gui/windows/confirmdialog.h"
#include "gui/windows/itemamountwindow.h"
#include "gui/windows/setupwindow.h"
#include "gui/windows/tradewindow.h"
#include "gui/widgets/button.h"
+#include "gui/widgets/createwidget.h"
#include "gui/widgets/containerplacer.h"
#include "gui/widgets/dropdown.h"
#include "gui/widgets/itemcontainer.h"
@@ -56,6 +58,8 @@
#include "gui/widgets/textfield.h"
#include "gui/widgets/windowcontainer.h"
+#include "listeners/insertcardlistener.h"
+
#include "net/inventoryhandler.h"
#include "resources/iteminfo.h"
@@ -70,6 +74,7 @@ InventoryWindow *storageWindow = nullptr;
InventoryWindow *cartWindow = nullptr;
#endif
InventoryWindow::WindowList InventoryWindow::invInstances;
+InsertCardListener insertCardListener;
InventoryWindow::InventoryWindow(Inventory *const inventory) :
Window("Inventory", Modal_false, nullptr, "inventory.xml"),
@@ -1004,3 +1009,39 @@ void InventoryWindow::attributeChanged(const AttributesT id,
updateWeight();
}
}
+
+#ifdef EATHENA_SUPPORT
+void InventoryWindow::combineItems(const int index1,
+ const int index2)
+{
+ if (!mInventory)
+ return;
+ const Item *item1 = mInventory->getItem(index1);
+ if (!item1)
+ return;
+ const Item *item2 = mInventory->getItem(index2);
+ if (!item2)
+ return;
+
+ if (item1->getType() != ItemType::CARD)
+ {
+ const Item *tmpItem = item1;
+ item1 = item2;
+ item2 = tmpItem;
+ }
+
+ ConfirmDialog *const confirmDlg = CREATEWIDGETR(ConfirmDialog,
+ // TRANSLATORS: question dialog title
+ _("Insert card request"),
+ // TRANSLATORS: question dialog message
+ strprintf(_("Insert %s into %s?"),
+ item1->getName().c_str(),
+ item2->getName().c_str()),
+ SOUND_REQUEST,
+ false,
+ Modal_true);
+ insertCardListener.itemIndex = item2->getInvIndex();
+ insertCardListener.cardIndex = item1->getInvIndex();
+ confirmDlg->addActionListener(&insertCardListener);
+}
+#endif