summaryrefslogtreecommitdiff
path: root/src/itemshortcut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/itemshortcut.cpp')
-rw-r--r--src/itemshortcut.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 499b8e5b8..0ca90e9be 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -202,8 +202,6 @@ void ItemShortcut::setItemSelected(const Item *const item)
{
if (item)
{
-// logger->log("set selected id: %d", item->getId());
-// logger->log("set selected color: %d", item->getColor());
mItemSelected = item->getId();
mItemColorSelected = item->getColor();
}
@@ -220,3 +218,28 @@ void ItemShortcut::setItem(const int index)
mItemColors[index] = mItemColorSelected;
save();
}
+
+void ItemShortcut::setItem(const int index, const int item,
+ const unsigned char color)
+{
+ mItems[index] = item;
+ mItemColors[index] = color;
+ save();
+}
+
+void ItemShortcut::swap(const int index1, const int index2)
+{
+ if (index1 < 0 || index2 < 0 || (unsigned int)index1 >= SHORTCUT_ITEMS
+ || (unsigned int)index2 >= SHORTCUT_ITEMS)
+ {
+ return;
+ }
+
+ const int tmpItem = mItems[index1];
+ mItems[index1] = mItems[index2];
+ mItems[index2] = tmpItem;
+ const unsigned char tmpColor = mItemColors[index1];
+ mItemColors[index1] = mItemColors[index2];
+ mItemColors[index2] = tmpColor;
+ save();
+}