aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-11-07 01:01:28 +0100
committerdec05eba <dec05eba@protonmail.com>2022-11-07 14:24:32 +0100
commitede1a8476acd54941c20b809455ba62b30302a4e (patch)
tree82160da56025e47484c23e8496f1d59b8ddc084f /src/plugins
parent8025d1075db0779bde635148f6e38303eb29d6c8 (diff)
Add option to limit number of lines of text drawn in Text class
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Fourchan.cpp13
-rw-r--r--src/plugins/Matrix.cpp2
2 files changed, 3 insertions, 12 deletions
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 051acc3..4cfaeaa 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -527,20 +527,9 @@ namespace QuickMedia {
title_text.back() = ' ';
std::string comment_text = html_to_text(comment_begin, comment_end - comment_begin, comment_by_postno, result_items, 0);
- // TODO: Do the same when wrapping is implemented
- // TODO: Remove this
- int num_lines = 0;
- for(size_t i = 0; i < comment_text.size(); ++i) {
- if(comment_text[i] == '\n') {
- ++num_lines;
- if(num_lines == 6) {
- comment_text = comment_text.substr(0, i) + " (...)";
- break;
- }
- }
- }
auto body_item = BodyItem::create(std::move(comment_text));
+ body_item->set_title_max_lines(6);
body_item->set_author(std::move(title_text));
body_item->url = std::to_string(thread_num.asInt64());
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index e4a7bd1..14a5bbe 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -678,6 +678,7 @@ namespace QuickMedia {
room->body_item->set_description_color(get_theme().faded_text_color);
}
room->body_item->set_description(std::move(room_desc));
+ room->body_item->set_description_max_lines(3);
if(set_room_as_unread)
room->body_item->set_title_color(get_theme().attention_alert_text_color, true);
room->last_message_read = false;
@@ -687,6 +688,7 @@ namespace QuickMedia {
} else if(last_new_message) {
room->body_item->set_description(extract_first_line_remove_newline_elipses(matrix->message_get_author_displayname(last_new_message.get()), AUTHOR_MAX_LENGTH) + ": " + message_to_room_description_text(last_new_message.get()));
room->body_item->set_description_color(get_theme().faded_text_color);
+ room->body_item->set_description_max_lines(3);
rooms_page->move_room_to_top(room);
room_tags_page->move_room_to_top(room);