aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/icons/globe.pngbin0 -> 737 bytes
-rw-r--r--res/icons/letter.pngbin0 -> 434 bytes
-rw-r--r--res/icons/padlock-locked.pngbin0 -> 546 bytes
-rw-r--r--res/icons/question.pngbin0 -> 529 bytes
-rw-r--r--res/icons/repeat.pngbin0 -> 759 bytes
-rw-r--r--res/icons/unlisted.pngbin0 -> 701 bytes
-rw-r--r--src/list_item.cpp24
7 files changed, 17 insertions, 7 deletions
diff --git a/res/icons/globe.png b/res/icons/globe.png
new file mode 100644
index 0000000..c369171
--- /dev/null
+++ b/res/icons/globe.png
Binary files differ
diff --git a/res/icons/letter.png b/res/icons/letter.png
new file mode 100644
index 0000000..4266531
--- /dev/null
+++ b/res/icons/letter.png
Binary files differ
diff --git a/res/icons/padlock-locked.png b/res/icons/padlock-locked.png
new file mode 100644
index 0000000..9d162b2
--- /dev/null
+++ b/res/icons/padlock-locked.png
Binary files differ
diff --git a/res/icons/question.png b/res/icons/question.png
new file mode 100644
index 0000000..2ab53c7
--- /dev/null
+++ b/res/icons/question.png
Binary files differ
diff --git a/res/icons/repeat.png b/res/icons/repeat.png
new file mode 100644
index 0000000..8e24121
--- /dev/null
+++ b/res/icons/repeat.png
Binary files differ
diff --git a/res/icons/unlisted.png b/res/icons/unlisted.png
new file mode 100644
index 0000000..69f9ff7
--- /dev/null
+++ b/res/icons/unlisted.png
Binary files differ
diff --git a/src/list_item.cpp b/src/list_item.cpp
index 020ccde..b235d2b 100644
--- a/src/list_item.cpp
+++ b/src/list_item.cpp
@@ -1,21 +1,31 @@
#include "list_item.h"
+#include "src/types.h"
-QIcon* choose_icon(StatusType status_type) {
+#define ICON_PATH_PREFIX "res/icons"
+QIcon& choose_icon(StatusType status_type) {
// via the use of `static' in the following switch block, the idea is to only initialize each QIcon type once in the program's lifetime.
-
switch (status_type) {
- // TODO: only null icon for the moment
- default:
- static QIcon* icon = new QIcon();
- return icon;
+ case StatusType::PUBLIC:
+ static QIcon public_icon(ICON_PATH_PREFIX"/globe.png"); return public_icon;
+ case StatusType::UNLISTED:
+ static QIcon unlisted_icon(ICON_PATH_PREFIX"/unlisted.png"); return unlisted_icon;
+ case StatusType::PRIVATE:
+ static QIcon private_icon(ICON_PATH_PREFIX"/padlock-locked.png"); return private_icon;
+ case StatusType::DIRECT:
+ static QIcon direct_icon(ICON_PATH_PREFIX"/letter.png"); return direct_icon;
+ case StatusType::REBLOG:
+ static QIcon reblog_icon(ICON_PATH_PREFIX"/repeat.png"); return reblog_icon;
+ case StatusType::UNKNOWN:
+ static QIcon unknown_icon(ICON_PATH_PREFIX"/question.png"); return unknown_icon;
}
}
+#undef ICON_PATH_PREFIX
StatusListItem::StatusListItem(const QString &text, StatusType status_type, bool has_attachement, Archive* data_archive, QListWidget *parent, int index) :
status_index(index), has_attachement(has_attachement), status_type(status_type), data_archive(data_archive)
{
setText(text);
- setIcon(*choose_icon(status_type));
+ setIcon(choose_icon(status_type));
parent->addItem(this);
#ifndef NDEBUG
QString tool_tip;