ChanViewer: Show thread subjects in the catalog view

This commit is contained in:
Andreas Kling 2019-08-05 06:59:47 +02:00
parent 103c2749ce
commit a416390622
Notes: sideshowbarker 2024-07-19 12:53:07 +09:00
3 changed files with 9 additions and 2 deletions

View File

@ -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:

View File

@ -7,6 +7,7 @@ class ThreadCatalogModel final : public GModel {
public:
enum Column {
ThreadNumber,
Subject,
Text,
ReplyCount,
ImageCount,

View File

@ -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;