diff options
author | ConfuSomu | 2022-12-27 03:58:29 -0500 |
---|---|---|
committer | ConfuSomu | 2022-12-27 03:58:29 -0500 |
commit | 006d3cec6779ee85337bbabe02a6ff859d71f656 (patch) | |
tree | d6e95bfcb0af314cdaf0f20a59f3d8545c6d9d5f /src/archive_parser.cpp | |
parent | 941bd57371360eb01a28899aa62ee6c9dcca33c8 (diff) | |
download | ActorViewer-006d3cec6779ee85337bbabe02a6ff859d71f656.tar ActorViewer-006d3cec6779ee85337bbabe02a6ff859d71f656.tar.gz ActorViewer-006d3cec6779ee85337bbabe02a6ff859d71f656.zip |
Store metadata of items that are in status list
There is more control and customizability of elements added to the
status list, which allows us to set the icon used and also to store
additional information about the status that has been selected, useful
when we have to display it with more detail.
Diffstat (limited to 'src/archive_parser.cpp')
-rw-r--r-- | src/archive_parser.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/archive_parser.cpp b/src/archive_parser.cpp index e370bcd..62edfd9 100644 --- a/src/archive_parser.cpp +++ b/src/archive_parser.cpp @@ -1,4 +1,5 @@ #include "archive_parser.h" +#include "src/list_item.h" #include "src/types.h" #include <QFile> @@ -47,14 +48,14 @@ Archive::~Archive() { delete outbox_items; outbox_items = nullptr; } -QStringList Archive::get_status_list(ViewStatusTypes types) { - QStringList statuses; - +void Archive::update_status_list(ViewStatusTypes allowed_types, QListWidget *parent) { + int i = 0; for (auto&& item : *outbox_items) { if (item.isObject()){ QJsonObject obj = item.toObject(); - // TODO: check the status type + // TODO: check the status type by looking at cc field + StatusType status_type = PUBLIC; if (obj.value("object").isObject()) { QJsonObject activity = obj.value("object").toObject(); @@ -63,11 +64,11 @@ QStringList Archive::get_status_list(ViewStatusTypes types) { // Strip HTML for display in list, according to https://stackoverflow.com/a/12157835 QTextDocument strip_html; strip_html.setHtml(activity.value("content").toString()); - statuses.append(strip_html.toPlainText()); + + ListItem *item = new ListItem(strip_html.toPlainText(), status_type, parent, i); } } } + ++i; } - - return statuses; } |