summaryrefslogtreecommitdiff
path: root/src/gui/models
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-02-11 03:54:47 +0000
committerJesusalva Jesusalva <jesusalva@themanaworld.org>2024-02-11 03:54:47 +0000
commitca03d2741ee3c5976b548870f3a844c7fe62e85f (patch)
tree11419e69431b9db78c9deba13492bfa8f35fb083 /src/gui/models
parent9e076e849643a8decd8125ad3576a31c806206c4 (diff)
downloadManaVerse-ca03d2741ee3c5976b548870f3a844c7fe62e85f.tar.gz
ManaVerse-ca03d2741ee3c5976b548870f3a844c7fe62e85f.tar.bz2
ManaVerse-ca03d2741ee3c5976b548870f3a844c7fe62e85f.tar.xz
ManaVerse-ca03d2741ee3c5976b548870f3a844c7fe62e85f.zip
Total weight sorting
Diffstat (limited to 'src/gui/models')
-rw-r--r--src/gui/models/sortlistmodelbuy.h8
-rw-r--r--src/gui/models/sortlistmodelinv.h8
2 files changed, 12 insertions, 4 deletions
diff --git a/src/gui/models/sortlistmodelbuy.h b/src/gui/models/sortlistmodelbuy.h
index 2b2f56d12..19ef70cc6 100644
--- a/src/gui/models/sortlistmodelbuy.h
+++ b/src/gui/models/sortlistmodelbuy.h
@@ -28,7 +28,9 @@
#include "utils/gettext.h"
-static const char *const SORT_NAME_BUY[7] =
+#define NUM_ELEMENTS(a) sizeof(a) / sizeof(a[0])
+
+static const char *const SORT_NAME_BUY[8] =
{
// TRANSLATORS: buy dialog sort type.
N_("unsorted"),
@@ -40,6 +42,8 @@ static const char *const SORT_NAME_BUY[7] =
N_("by id"),
// TRANSLATORS: buy dialog sort type.
N_("by weight"),
+ // TRANSLATORS: inventory sort mode
+ N_("by total weight"),
// TRANSLATORS: buy dialog sort type.
N_("by amount"),
// TRANSLATORS: buy dialog sort type.
@@ -56,7 +60,7 @@ class SortListModelBuy final : public ListModel
A_DELETE_COPY(SortListModelBuy)
int getNumberOfElements() override final
- { return 7; }
+ { return NUM_ELEMENTS(SORT_NAME_BUY); }
std::string getElementAt(int i) override final
{
diff --git a/src/gui/models/sortlistmodelinv.h b/src/gui/models/sortlistmodelinv.h
index e3cd7e9ad..f89e21a8d 100644
--- a/src/gui/models/sortlistmodelinv.h
+++ b/src/gui/models/sortlistmodelinv.h
@@ -27,7 +27,9 @@
#include "utils/gettext.h"
-static const char *const SORT_NAME_INVENTORY[6] =
+#define NUM_ELEMENTS(a) sizeof(a) / sizeof(a[0])
+
+static const char *const SORT_NAME_INVENTORY[7] =
{
// TRANSLATORS: inventory sort mode
N_("default"),
@@ -38,6 +40,8 @@ static const char *const SORT_NAME_INVENTORY[6] =
// TRANSLATORS: inventory sort mode
N_("by weight"),
// TRANSLATORS: inventory sort mode
+ N_("by total weight"),
+ // TRANSLATORS: inventory sort mode
N_("by amount"),
// TRANSLATORS: inventory sort mode
N_("by type")
@@ -53,7 +57,7 @@ class SortListModelInv final : public ListModel
A_DELETE_COPY(SortListModelInv)
int getNumberOfElements() override final
- { return 6; }
+ { return NUM_ELEMENTS(SORT_NAME_INVENTORY); }
std::string getElementAt(int i) override final
{