diff options
author | ConfuSomu | 2023-08-16 19:40:47 -0400 |
---|---|---|
committer | ConfuSomu | 2023-08-16 19:40:47 -0400 |
commit | e625d3fcca7c735ed98570bc1acbcaa840541e61 (patch) | |
tree | 24606cd1ef4b0763836566025b042c8656eefa7c | |
parent | c45f6501f501a65f753604bfd2341035ae12fd30 (diff) | |
download | ActorViewer-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.
-rw-r--r-- | res/icons/globe.png | bin | 0 -> 737 bytes | |||
-rw-r--r-- | res/icons/letter.png | bin | 0 -> 434 bytes | |||
-rw-r--r-- | res/icons/padlock-locked.png | bin | 0 -> 546 bytes | |||
-rw-r--r-- | res/icons/question.png | bin | 0 -> 529 bytes | |||
-rw-r--r-- | res/icons/repeat.png | bin | 0 -> 759 bytes | |||
-rw-r--r-- | res/icons/unlisted.png | bin | 0 -> 701 bytes | |||
-rw-r--r-- | src/list_item.cpp | 24 |
7 files changed, 17 insertions, 7 deletions
diff --git a/res/icons/globe.png b/res/icons/globe.png Binary files differnew file mode 100644 index 0000000..c369171 --- /dev/null +++ b/res/icons/globe.png diff --git a/res/icons/letter.png b/res/icons/letter.png Binary files differnew file mode 100644 index 0000000..4266531 --- /dev/null +++ b/res/icons/letter.png diff --git a/res/icons/padlock-locked.png b/res/icons/padlock-locked.png Binary files differnew file mode 100644 index 0000000..9d162b2 --- /dev/null +++ b/res/icons/padlock-locked.png diff --git a/res/icons/question.png b/res/icons/question.png Binary files differnew file mode 100644 index 0000000..2ab53c7 --- /dev/null +++ b/res/icons/question.png diff --git a/res/icons/repeat.png b/res/icons/repeat.png Binary files differnew file mode 100644 index 0000000..8e24121 --- /dev/null +++ b/res/icons/repeat.png diff --git a/res/icons/unlisted.png b/res/icons/unlisted.png Binary files differnew file mode 100644 index 0000000..69f9ff7 --- /dev/null +++ b/res/icons/unlisted.png 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; |