From a416390622b21f66caaa0e1353993d580b2b4a6d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 5 Aug 2019 06:59:47 +0200 Subject: [PATCH] ChanViewer: Show thread subjects in the catalog view --- Applications/ChanViewer/ThreadCatalogModel.cpp | 8 +++++++- Applications/ChanViewer/ThreadCatalogModel.h | 1 + Applications/ChanViewer/main.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Applications/ChanViewer/ThreadCatalogModel.cpp b/Applications/ChanViewer/ThreadCatalogModel.cpp index 328a3f8e98..264ac20760 100644 --- a/Applications/ChanViewer/ThreadCatalogModel.cpp +++ b/Applications/ChanViewer/ThreadCatalogModel.cpp @@ -66,6 +66,8 @@ String ThreadCatalogModel::column_name(int column) const switch (column) { case Column::ThreadNumber: return "#"; + case Column::Subject: + return "Subject"; case Column::Text: return "Text"; case Column::ReplyCount: @@ -84,8 +86,10 @@ GModel::ColumnMetadata ThreadCatalogModel::column_metadata(int column) const switch (column) { case Column::ThreadNumber: return { 70, TextAlignment::CenterRight }; + case Column::Subject: + return { 170, TextAlignment::CenterLeft }; case Column::Text: - return { 290, TextAlignment::CenterLeft }; + return { 270, TextAlignment::CenterLeft }; case Column::ReplyCount: return { 45, TextAlignment::CenterRight }; case Column::ImageCount: @@ -104,6 +108,8 @@ GVariant ThreadCatalogModel::data(const GModelIndex& index, Role role) const switch (index.column()) { case Column::ThreadNumber: return thread.get("no").to_u32(); + case Column::Subject: + return thread.get("sub").to_string(); case Column::Text: return thread.get("com").to_string(); case Column::ReplyCount: diff --git a/Applications/ChanViewer/ThreadCatalogModel.h b/Applications/ChanViewer/ThreadCatalogModel.h index 1e94b9db48..d39c232d06 100644 --- a/Applications/ChanViewer/ThreadCatalogModel.h +++ b/Applications/ChanViewer/ThreadCatalogModel.h @@ -7,6 +7,7 @@ class ThreadCatalogModel final : public GModel { public: enum Column { ThreadNumber, + Subject, Text, ReplyCount, ImageCount, diff --git a/Applications/ChanViewer/main.cpp b/Applications/ChanViewer/main.cpp index 8efa6c14ea..fe4a8bf422 100644 --- a/Applications/ChanViewer/main.cpp +++ b/Applications/ChanViewer/main.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) auto* window = new GWindow; window->set_title("ChanViewer"); - window->set_rect(100, 100, 640, 480); + window->set_rect(100, 100, 800, 500); window->set_icon(load_png("/res/icons/16x16/app-chanviewer.png")); auto* widget = new GWidget;