aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConfuSomu2023-08-16 19:40:47 -0400
committerConfuSomu2023-08-16 19:40:47 -0400
commite625d3fcca7c735ed98570bc1acbcaa840541e61 (patch)
tree24606cd1ef4b0763836566025b042c8656eefa7c /src
parentc45f6501f501a65f753604bfd2341035ae12fd30 (diff)
downloadActorViewer-e625d3fcca7c735ed98570bc1acbcaa840541e61.tar
ActorViewer-e625d3fcca7c735ed98570bc1acbcaa840541e61.tar.gz
ActorViewer-e625d3fcca7c735ed98570bc1acbcaa840541e61.zip
Display status type icons in status list
These icons allow users to identify the type of status with ease. I had to make — hand draw — custom icons as I didn't find any suitable icons in the Free Desktop Icon Theme Specification. Note that these icons are currently suitable only for a light theme. Support for a dark theme shouldn't be too hard to add.
Diffstat (limited to 'src')
-rw-r--r--src/list_item.cpp24
1 files changed, 17 insertions, 7 deletions
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;