From da2988c4356d2756e86037b1c7e859f49583c109 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 8 Sep 2021 17:04:31 +0200 Subject: Load theme from file (~/.config/quickmedia/themes/.json and /usr/share/quickmedia/themes/.json) --- src/plugins/AniList.cpp | 2 +- src/plugins/FileManager.cpp | 2 +- src/plugins/HotExamples.cpp | 4 ++-- src/plugins/MangaGeneric.cpp | 2 +- src/plugins/Mangadex.cpp | 4 ++-- src/plugins/Manganelo.cpp | 4 ++-- src/plugins/Matrix.cpp | 20 ++++++++++---------- src/plugins/MyAnimeList.cpp | 6 +++--- src/plugins/Page.cpp | 2 +- src/plugins/Soundcloud.cpp | 2 +- src/plugins/Youtube.cpp | 6 +++--- 11 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/AniList.cpp b/src/plugins/AniList.cpp index 1523129..0c7229f 100644 --- a/src/plugins/AniList.cpp +++ b/src/plugins/AniList.cpp @@ -385,7 +385,7 @@ query ($id: Int, $page: Int, $perPage: Int) { body_item->set_author(std::move(title)); if(!description.empty()) { body_item->set_description(std::move(description)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); } if(cover_image_json.isObject()) { const Json::Value &cover_img_sized_json = cover_image_json[thumbnail_size_to_cover_image_type(thumbnail_size)]; diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp index 295b962..289a382 100644 --- a/src/plugins/FileManager.cpp +++ b/src/plugins/FileManager.cpp @@ -140,7 +140,7 @@ namespace QuickMedia { description += "\nDirectory"; } body_item->set_description(std::move(description)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); result_items.push_back(std::move(body_item)); } diff --git a/src/plugins/HotExamples.cpp b/src/plugins/HotExamples.cpp index 29e0110..a049101 100644 --- a/src/plugins/HotExamples.cpp +++ b/src/plugins/HotExamples.cpp @@ -72,7 +72,7 @@ namespace QuickMedia { html_unescape_sequences(desc); (*item_data->body_items)[item_data->index]->set_description(std::move(desc)); - (*item_data->body_items)[item_data->index]->set_description_color(get_current_theme().faded_text_color); + (*item_data->body_items)[item_data->index]->set_description_color(get_theme().faded_text_color); item_data->index++; } return 0; @@ -122,7 +122,7 @@ namespace QuickMedia { html_unescape_sequences(desc); (*item_data->body_items)[item_data->index]->set_description(std::move(desc)); - (*item_data->body_items)[item_data->index]->set_description_color(get_current_theme().text_color); + (*item_data->body_items)[item_data->index]->set_description_color(get_theme().text_color); // TODO: Use monospace item_data->index++; } diff --git a/src/plugins/MangaGeneric.cpp b/src/plugins/MangaGeneric.cpp index 87b4f1d..78a2c39 100644 --- a/src/plugins/MangaGeneric.cpp +++ b/src/plugins/MangaGeneric.cpp @@ -111,7 +111,7 @@ namespace QuickMedia { } else if(merge_userdata->type == MergeType::DESCRIPTION) { const char *prefix = merge_userdata->desc_prefix ? merge_userdata->desc_prefix : ""; (*body_item_image_context.body_items)[body_item_image_context.index]->set_description(prefix + std::move(field_stripped)); - (*body_item_image_context.body_items)[body_item_image_context.index]->set_description_color(get_current_theme().faded_text_color); + (*body_item_image_context.body_items)[body_item_image_context.index]->set_description_color(get_theme().faded_text_color); } body_item_image_context.index++; } diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp index 1553d82..34bcfc7 100644 --- a/src/plugins/Mangadex.cpp +++ b/src/plugins/Mangadex.cpp @@ -216,7 +216,7 @@ namespace QuickMedia { const Json::Value &en_json = description_json["en"]; if(en_json.isString()) { body_item->set_description(en_json.asString()); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); } } @@ -306,7 +306,7 @@ namespace QuickMedia { time_t unix_time = iso_utc_to_unix_time(publish_at_json.asCString()); if(unix_time != 0) { body_item->set_description("Uploaded: " + unix_time_to_local_time_str(unix_time)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); } } diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index 90003cb..990a513 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -67,7 +67,7 @@ namespace QuickMedia { if(text.data && class_attr.data && string_view_contains(class_attr, "chapter-time") && item_data->index < item_data->body_items->size()) { std::string uploaded_date(text.data, text.size); (*item_data->body_items)[item_data->index]->set_description("Uploaded: " + std::move(uploaded_date)); - (*item_data->body_items)[item_data->index]->set_description_color(get_current_theme().faded_text_color); + (*item_data->body_items)[item_data->index]->set_description_color(get_theme().faded_text_color); item_data->index++; } return 0; @@ -134,7 +134,7 @@ namespace QuickMedia { item->url = "https://manganelo.com/manga/" + url_param_encode(nameunsigned.asString()); if(lastchapter.isString() && lastchapter.asCString()[0] != '\0') { item->set_description("Latest chapter: " + lastchapter.asString()); - item->set_description_color(get_current_theme().faded_text_color); + item->set_description_color(get_theme().faded_text_color); } Json::Value image = child.get("image", ""); if(image.isString() && image.asCString()[0] != '\0') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 6d8148d..3f42437 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -630,20 +630,20 @@ namespace QuickMedia { if(!room_desc.empty()) room_desc += '\n'; room_desc += "** " + std::to_string(unread_notification_count) + " unread mention(s) **"; // TODO: Better notification? - room->body_item->set_description_color(get_current_theme().attention_alert_text_color); + room->body_item->set_description_color(get_theme().attention_alert_text_color); } else { - room->body_item->set_description_color(get_current_theme().faded_text_color); + room->body_item->set_description_color(get_theme().faded_text_color); } room->body_item->set_description(std::move(room_desc)); if(set_room_as_unread) - room->body_item->set_title_color(get_current_theme().attention_alert_text_color); + room->body_item->set_title_color(get_theme().attention_alert_text_color); room->last_message_read = false; rooms_page->move_room_to_top(room); room_tags_page->move_room_to_top(room); } 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_current_theme().faded_text_color); + room->body_item->set_description_color(get_theme().faded_text_color); rooms_page->move_room_to_top(room); room_tags_page->move_room_to_top(room); @@ -904,7 +904,7 @@ namespace QuickMedia { body_item->set_author(extract_first_line_remove_newline_elipses(display_name, AUTHOR_MAX_LENGTH)); body_item->set_author_color(user_id_to_color(user_info.user_id)); body_item->set_description(user_info.user_id); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); if(user_info.avatar_url) body_item->thumbnail_url = user_info.avatar_url.value(); body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE; @@ -1035,8 +1035,8 @@ namespace QuickMedia { body_item->url = notification.event_id; if(!notification.read) { - body_item->set_author_color(get_current_theme().attention_alert_text_color); - body_item->set_description_color(get_current_theme().attention_alert_text_color); + body_item->set_author_color(get_theme().attention_alert_text_color); + body_item->set_description_color(get_theme().attention_alert_text_color); } body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE; @@ -1128,8 +1128,8 @@ namespace QuickMedia { NotificationsExtraData *extra_data = static_cast(room_notification.second->extra.get()); if(!extra_data->read) { extra_data->read = true; - room_notification.second->set_author_color(get_current_theme().text_color); - room_notification.second->set_description_color(get_current_theme().text_color); + room_notification.second->set_author_color(get_theme().text_color); + room_notification.second->set_description_color(get_theme().text_color); } } } @@ -4410,7 +4410,7 @@ namespace QuickMedia { auto body_item = BodyItem::create(""); body_item->url.assign(user_id_json.GetString(), user_id_json.GetStringLength()); body_item->set_description(body_item->url); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); if(display_name_json.IsString()) body_item->set_author(std::string(display_name_json.GetString(), display_name_json.GetStringLength())); else diff --git a/src/plugins/MyAnimeList.cpp b/src/plugins/MyAnimeList.cpp index 5f5ae40..16f07f9 100644 --- a/src/plugins/MyAnimeList.cpp +++ b/src/plugins/MyAnimeList.cpp @@ -85,7 +85,7 @@ namespace QuickMedia { if(!description.empty()) { body_item->set_description(std::move(description)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); } return body_item; @@ -284,7 +284,7 @@ namespace QuickMedia { std::string description(text.data, text.size); html_unescape_sequences(description); (*item_data->body_items)[item_data->index]->set_description(std::move(description)); - (*item_data->body_items)[item_data->index]->set_description_color(get_current_theme().faded_text_color); + (*item_data->body_items)[item_data->index]->set_description_color(get_theme().faded_text_color); item_data->index++; } return 0; @@ -302,7 +302,7 @@ namespace QuickMedia { auto body_item = BodyItem::create(""); body_item->set_description(std::move(description)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); result_items->push_back(std::move(body_item)); } return 0; diff --git a/src/plugins/Page.cpp b/src/plugins/Page.cpp index 5c64183..b7ef30c 100644 --- a/src/plugins/Page.cpp +++ b/src/plugins/Page.cpp @@ -74,7 +74,7 @@ namespace QuickMedia { body_item->url = url_json.asString(); if(timestamp_json.isInt64()) { body_item->set_description("Bookmarked " + seconds_to_relative_time_str(time_now - timestamp_json.asInt64())); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); } result_items.push_back(std::move(body_item)); } diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp index f20cf7d..a9b192e 100644 --- a/src/plugins/Soundcloud.cpp +++ b/src/plugins/Soundcloud.cpp @@ -204,7 +204,7 @@ namespace QuickMedia { } body_item->set_description(std::move(description)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); return body_item; } diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index d308346..b6dc2f7 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -504,7 +504,7 @@ namespace QuickMedia { desc += std::move(description_snippet_stripped); } body_item->set_description(std::move(desc)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); if(scheduled_text.empty()) body_item->url = "https://www.youtube.com/watch?v=" + video_id_str; @@ -563,7 +563,7 @@ namespace QuickMedia { desc += std::move(description_snippet_stripped); } body_item->set_description(std::move(desc)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); body_item->url = "https://www.youtube.com/channel/" + channel_id_json.asString(); if(thumbnail) { if(string_starts_with(thumbnail->url, "https:")) @@ -1745,7 +1745,7 @@ namespace QuickMedia { description += subscription_data.author; } body_item->set_description(std::move(description)); - body_item->set_description_color(get_current_theme().faded_text_color); + body_item->set_description_color(get_theme().faded_text_color); body_item->url = "https://www.youtube.com/watch?v=" + subscription_entry.video_id; body_item->thumbnail_url = "https://img.youtube.com/vi/" + subscription_entry.video_id + "/mqdefault.jpg"; body_item->thumbnail_size = sf::Vector2i(192, 108); -- cgit v1.2.3