From 75a48db1459d4c386b867ae6536ff481adf34f1f Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Thu, 6 Apr 2023 15:57:55 -0400 Subject: Move call to get status HTML info into ListItem This makes the code less of a mess and will allow moving more of the code that renders HTML status info into the ListItem class. --- src/list_item.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/list_item.cpp') diff --git a/src/list_item.cpp b/src/list_item.cpp index b7ee578..6f27ff0 100644 --- a/src/list_item.cpp +++ b/src/list_item.cpp @@ -1,5 +1,4 @@ #include "list_item.h" -#include "types.h" 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. @@ -12,8 +11,8 @@ QIcon* choose_icon(StatusType status_type) { } } -ListItem::ListItem(const QString &text, StatusType status_type, bool has_attachement, QListWidget *parent, int index) : - status_index(index), has_attachement(has_attachement), status_type(status_type) +ListItem::ListItem(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)); @@ -39,3 +38,7 @@ int ListItem::get_status_index() { StatusType ListItem::get_status_type() { return status_type; } + +QString ListItem::get_info_html(int text_zone_width, QLocale* locale) { + return data_archive->get_html_status_info(status_index, text_zone_width, status_type, locale); +} -- cgit v1.2.3-54-g00ecf