aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-01 21:03:59 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-01 21:04:17 +0100
commitb0a681964a5db50b970e59a90c89a09f568f5447 (patch)
tree08179fec8d70dd9c6a359de3c0d64a0dd77876d2 /src
parent4afa53a8bb6b02c07db8c54362311c21444a3ced (diff)
Add more texts to config font size, set colors for all text from theme, add dark and light theme, choose icons based on theme brightness
Remove matrix logo from matrix chat
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp4
-rw-r--r--src/Config.cpp3
-rw-r--r--src/Entry.cpp25
-rw-r--r--src/ImageViewer.cpp6
-rw-r--r--src/QuickMedia.cpp165
-rw-r--r--src/SearchBar.cpp1
-rw-r--r--src/Tabs.cpp1
-rw-r--r--src/Text.cpp1
-rw-r--r--src/Theme.cpp1
9 files changed, 123 insertions, 84 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index fedf25d..5384050 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -952,7 +952,7 @@ namespace QuickMedia {
reaction.text->setString(reaction.text_str);
reaction.text->setMaxWidth(width);
} else {
- reaction.text = std::make_unique<Text>(reaction.text_str, false, floor(get_config().body.reaction_font_size * get_config().scale * get_config().font_scale), width);
+ reaction.text = std::make_unique<Text>(reaction.text_str, false, floor(get_config().body.reaction_font_size * get_config().scale * get_config().font_scale), width);
}
reaction.text->set_color(reaction.text_color);
reaction.size = { 0.0f, 0.0f };
@@ -1677,7 +1677,7 @@ namespace QuickMedia {
}
if(reaction.text) {
- reaction.text->set_position(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, -6.0f + body_spacing[body_theme].reaction_background_padding_y));
+ reaction.text->set_position(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, 0.0f));
}
if(draw && reaction.text) {
diff --git a/src/Config.cpp b/src/Config.cpp
index dd7f7ad..6c921df 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -184,6 +184,7 @@ namespace QuickMedia {
get_json_value(body_json, "timestamp_font_size", config->body.timestamp_font_size);
get_json_value(body_json, "reaction_font_size", config->body.reaction_font_size);
get_json_value(body_json, "embedded_load_font_size", config->body.embedded_load_font_size);
+ get_json_value(body_json, "loading_text_font_size", config->body.loading_text_font_size);
}
const Json::Value &input_json = json_root["input"];
@@ -227,6 +228,8 @@ namespace QuickMedia {
}
}
get_json_value(matrix_json, "gpg_user_id", config->matrix.gpg_user_id);
+ get_json_value(matrix_json, "room_name_font_size", config->matrix.room_name_font_size);
+ get_json_value(matrix_json, "room_description_font_size", config->matrix.room_description_font_size);
}
if(!has_known_matrix_homeservers_config)
diff --git a/src/Entry.cpp b/src/Entry.cpp
index af35de0..8357216 100644
--- a/src/Entry.cpp
+++ b/src/Entry.cpp
@@ -13,20 +13,20 @@ namespace QuickMedia {
return (int)v;
}
- static const float background_margin_horizontal = floor(5.0f * get_config().scale * get_config().spacing_scale);
- static const float padding_vertical = floor(5.0f * get_config().scale * get_config().spacing_scale);
- static const float background_margin_vertical = floor(0.0f * get_config().scale * get_config().spacing_scale);
+ static const float background_margin_horizontal = 5.0f + floor(get_config().input.font_size * get_config().scale * get_config().font_scale * 0.6f);
+ static const float background_margin_vertical = 2.0f + floor(get_config().input.font_size * get_config().scale * get_config().font_scale * 0.25f);
Entry::Entry(const std::string &placeholder_text, mgl::Shader *rounded_rectangle_shader) :
on_submit_callback(nullptr),
draw_background(true),
text("", false, floor(get_config().input.font_size * get_config().scale * get_config().font_scale), 0.0f),
width(0.0f),
- background(mgl::vec2f(1.0f, 1.0f), 10.0f * get_config().scale, get_theme().selected_color, rounded_rectangle_shader),
+ background(mgl::vec2f(1.0f, 1.0f), 10.0f * get_config().scale, get_theme().shade_color, rounded_rectangle_shader),
placeholder(placeholder_text, *FontLoader::get_font(FontLoader::FontType::LATIN, get_config().input.font_size * get_config().scale * get_config().font_scale)),
mouse_left_inside(false)
{
text.setEditable(true);
+ text.set_color(get_theme().text_color);
placeholder.set_color(get_theme().placeholder_text_color);
}
@@ -109,13 +109,13 @@ namespace QuickMedia {
void Entry::set_position(const mgl::vec2f &pos) {
background.set_position(pos);
- text.set_position(pos + mgl::vec2f(background_margin_horizontal, background_margin_vertical));
- placeholder.set_position(pos + mgl::vec2f(background_margin_horizontal, background_margin_vertical + floor(3.0f * get_config().scale)));
+ text.set_position(pos + mgl::vec2f(background_margin_horizontal * padding_scale, background_margin_vertical * padding_scale - text.get_character_size() * 0.3f).floor());
+ placeholder.set_position(pos + mgl::vec2f(background_margin_horizontal * padding_scale, background_margin_vertical * padding_scale - text.get_character_size() * 0.005f).floor());
}
void Entry::set_max_width(float width) {
this->width = width;
- text.setMaxWidth(this->width - background_margin_horizontal * 2.0f);
+ text.setMaxWidth(this->width - background_margin_horizontal * padding_scale * 2.0f);
}
bool Entry::is_editable() const {
@@ -124,10 +124,19 @@ namespace QuickMedia {
float Entry::get_height() {
text.updateGeometry();
- return floor(text.getHeight() + background_margin_vertical * 2.0f + padding_vertical * 2.0f);
+ return floor(text.getHeight() + background_margin_vertical * padding_scale * 2.0f);
}
const std::string& Entry::get_text() const {
return text.getString();
}
+
+ void Entry::set_background_color(mgl::Color color) {
+ background.set_color(color);
+ }
+
+ void Entry::set_padding_scale(float scale) {
+ padding_scale = scale;
+ set_max_width(width);
+ }
} \ No newline at end of file
diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp
index e670d66..e8bc71d 100644
--- a/src/ImageViewer.cpp
+++ b/src/ImageViewer.cpp
@@ -50,7 +50,7 @@ namespace QuickMedia {
image_data[i] = nullptr;
page_size[i].loaded = false;
}
- page_text.set_color(mgl::Color(255, 255, 255, 255));
+ page_text.set_color(get_theme().text_color);
// TODO: Fix
//has_default_cursor = default_cursor.loadFromSystem(sf::Cursor::Arrow);
@@ -427,7 +427,9 @@ namespace QuickMedia {
const float background_height = font_height + 6.0f;
mgl::Rectangle page_text_background(mgl::vec2f(window_size.x, background_height));
- page_text_background.set_color(mgl::Color(0, 0, 0, 150));
+ mgl::Color text_background_color = get_theme().shade_color;
+ text_background_color.a = 225;
+ page_text_background.set_color(text_background_color);
page_text_background.set_position(mgl::vec2f(0.0f, window_size.y - background_height));
window->draw(page_text_background);
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 57b6162..0475964 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -73,46 +73,68 @@ static const double IDLE_TIMEOUT_SEC = 2.0;
static const mgl::vec2i AVATAR_THUMBNAIL_SIZE(std::floor(32), std::floor(32));
static const int FPS_SYNC_TO_VSYNC = 0;
-static const std::pair<const char*, const char*> valid_plugins[] = {
- std::make_pair("launcher", nullptr),
- std::make_pair("manganelo", "manganelo_logo.png"),
- std::make_pair("manganelos", "manganelos_logo.png"),
- std::make_pair("mangatown", "mangatown_logo.png"),
- std::make_pair("mangakatana", "mangakatana_logo.png"),
- std::make_pair("mangadex", "mangadex_logo.png"),
- std::make_pair("onimanga", nullptr),
- std::make_pair("readm", "readm_logo.png"),
- std::make_pair("local-manga", nullptr),
- std::make_pair("local-anime", nullptr),
- std::make_pair("manga", nullptr),
- std::make_pair("youtube", "yt_logo_rgb_dark_small.png"),
- std::make_pair("peertube", "peertube_logo.png"),
- std::make_pair("dramacool", "dramacool_logo.png"),
- std::make_pair("soundcloud", "soundcloud_logo.png"),
- std::make_pair("lbry", "lbry_logo.png"),
- std::make_pair("pornhub", "pornhub_logo.png"),
- std::make_pair("spankbang", "spankbang_logo.png"),
- std::make_pair("xvideos", "xvideos_logo.png"),
- std::make_pair("xhamster", "xhamster_logo.png"),
- std::make_pair("4chan", "4chan_logo.png"),
- std::make_pair("nyaa.si", "nyaa_si_logo.png"),
- std::make_pair("matrix", "matrix_logo.png"),
- std::make_pair("anilist", "anilist_logo.png"),
- std::make_pair("hotexamples", nullptr),
- std::make_pair("file-manager", nullptr),
- std::make_pair("stdin", nullptr),
- std::make_pair("saucenao", nullptr),
- std::make_pair("download", nullptr)
+struct Logo {
+ const char *dark_theme_path;
+ const char *light_theme_path;
+
+ Logo(const char *path) : dark_theme_path(path), light_theme_path(path) {
+
+ }
+
+ Logo(const char *dark_theme_path, const char *light_theme_path) : dark_theme_path(dark_theme_path), light_theme_path(light_theme_path) {
+
+ }
};
+static const std::pair<const char*, Logo> valid_plugins[] = {
+ std::make_pair<const char*, Logo>("launcher", nullptr),
+ std::make_pair<const char*, Logo>("manganelo", "manganelo_logo.png"),
+ std::make_pair<const char*, Logo>("manganelos", "manganelos_logo.png"),
+ std::make_pair<const char*, Logo>("mangatown", { "mangatown_logo.png", "mangatown_logo_light.png" }),
+ std::make_pair<const char*, Logo>("mangakatana", "mangakatana_logo.png"),
+ std::make_pair<const char*, Logo>("mangadex", { "mangadex_logo.png", "mangadex_logo_light.png" }),
+ std::make_pair<const char*, Logo>("onimanga", nullptr),
+ std::make_pair<const char*, Logo>("readm", { "readm_logo.png", "readm_logo_light.png" }),
+ std::make_pair<const char*, Logo>("local-manga", nullptr),
+ std::make_pair<const char*, Logo>("local-anime", nullptr),
+ std::make_pair<const char*, Logo>("manga", nullptr),
+ std::make_pair<const char*, Logo>("youtube", { "yt_logo_rgb_dark_small.png", "yt_logo_rgb_light_small.png" }),
+ std::make_pair<const char*, Logo>("peertube", "peertube_logo.png"),
+ std::make_pair<const char*, Logo>("dramacool", "dramacool_logo.png"),
+ std::make_pair<const char*, Logo>("soundcloud", "soundcloud_logo.png"),
+ std::make_pair<const char*, Logo>("lbry", "lbry_logo.png"),
+ std::make_pair<const char*, Logo>("pornhub", "pornhub_logo.png"),
+ std::make_pair<const char*, Logo>("spankbang", "spankbang_logo.png"),
+ std::make_pair<const char*, Logo>("xvideos", "xvideos_logo.png"),
+ std::make_pair<const char*, Logo>("xhamster", "xhamster_logo.png"),
+ std::make_pair<const char*, Logo>("4chan", "4chan_logo.png"),
+ std::make_pair<const char*, Logo>("nyaa.si", { "nyaa_si_logo.png", "nyaa_si_logo_light.png" }),
+ std::make_pair<const char*, Logo>("matrix", { "matrix_logo.png", "matrix_logo_light.png" }),
+ std::make_pair<const char*, Logo>("anilist", "anilist_logo.png"),
+ std::make_pair<const char*, Logo>("hotexamples", nullptr),
+ std::make_pair<const char*, Logo>("file-manager", nullptr),
+ std::make_pair<const char*, Logo>("stdin", nullptr),
+ std::make_pair<const char*, Logo>("saucenao", nullptr),
+ std::make_pair<const char*, Logo>("download", nullptr)
+};
+
+static bool is_color_scheme_dark() {
+ mgl::Color col = QuickMedia::get_theme().shade_color;
+ return (col.r + col.g + col.b) / 3 < 128;
+}
+
static const char* get_plugin_logo_name(const char *plugin_name) {
for(const auto &valid_plugin : valid_plugins) {
if(strcmp(plugin_name, valid_plugin.first) == 0)
- return valid_plugin.second;
+ return is_color_scheme_dark() ? valid_plugin.second.dark_theme_path : valid_plugin.second.light_theme_path;
}
return nullptr;
}
+static std::string get_no_avatar_image_path() {
+ return is_color_scheme_dark() ? "images/no_avatar.png" : "images/no_avatar_light.png";
+}
+
// Prevent writing to broken pipe from exiting the program
static void sigpipe_handler(int) {
@@ -347,11 +369,12 @@ namespace QuickMedia {
|| strcmp(plugin_name, "local-manga") == 0;
}
- static std::shared_ptr<BodyItem> create_launcher_body_item(const char *title, const char *plugin_name, const std::string &thumbnail_url) {
+ static std::shared_ptr<BodyItem> create_launcher_body_item(const char *title, const char *plugin_name, const std::string &dark_theme_thumbnail_url, const std::string &light_theme_thumbnail_url) {
auto body_item = BodyItem::create(title);
body_item->url = plugin_name;
+ std::string thumbnail_url = is_color_scheme_dark() ? dark_theme_thumbnail_url : light_theme_thumbnail_url;
if(!thumbnail_url.empty()) {
- body_item->thumbnail_url = thumbnail_url;
+ body_item->thumbnail_url = std::move(thumbnail_url);
body_item->thumbnail_is_local = true;
}
body_item->thumbnail_size.x = 32;
@@ -359,6 +382,10 @@ namespace QuickMedia {
return body_item;
}
+ static std::shared_ptr<BodyItem> create_launcher_body_item(const char *title, const char *plugin_name, const std::string &thumbnail_url) {
+ return create_launcher_body_item(title, plugin_name, thumbnail_url, thumbnail_url);
+ }
+
static bool convert_to_absolute_path(std::filesystem::path &path) {
char resolved[PATH_MAX];
if(!realpath(path.c_str(), resolved))
@@ -735,8 +762,9 @@ namespace QuickMedia {
}
}
- if(!loading_icon.load_from_file((resources_root + "images/loading_icon.png").c_str())) {
- show_notification("QuickMedia", "Failed to load " + resources_root + "/images/loading_icon.png", Urgency::CRITICAL);
+ const char *loading_icon_path = is_color_scheme_dark() ? "images/loading_icon.png" : "images/loading_icon_light.png";
+ if(!loading_icon.load_from_file((resources_root + loading_icon_path).c_str())) {
+ show_notification("QuickMedia", "Failed to load " + resources_root + loading_icon_path, Urgency::CRITICAL);
abort();
}
load_sprite.set_texture(&loading_icon);
@@ -1131,7 +1159,7 @@ namespace QuickMedia {
create_launcher_body_item("Mangakatana", "mangakatana", resources_root + "icons/mangakatana_launcher.png"),
create_launcher_body_item("Manganelo", "manganelo", resources_root + "icons/manganelo_launcher.png"),
create_launcher_body_item("Manganelos", "manganelos", resources_root + "icons/manganelos_launcher.png"),
- create_launcher_body_item("Mangatown", "mangatown", resources_root + "icons/mangatown_launcher.png"),
+ create_launcher_body_item("Mangatown", "mangatown", resources_root + "icons/mangatown_launcher.png", resources_root + "icons/mangatown_launcher_light.png"),
create_launcher_body_item("Onimanga", "onimanga", ""),
create_launcher_body_item("Readm", "readm", resources_root + "icons/readm_launcher.png"),
create_launcher_body_item("Matrix", "matrix", resources_root + "icons/matrix_launcher.png"),
@@ -2049,7 +2077,8 @@ namespace QuickMedia {
}
if(!tabs[selected_tab].page->is_ready()) {
- mgl::Text loading_text("Loading...", *FontLoader::get_font(FontLoader::FontType::LATIN, 30 * get_config().scale * get_config().font_scale));
+ mgl::Text loading_text("Loading...", *FontLoader::get_font(FontLoader::FontType::LATIN, get_config().body.loading_text_font_size * get_config().scale * get_config().font_scale));
+ loading_text.set_color(get_theme().text_color);
auto text_bounds = loading_text.get_bounds();
loading_text.set_position(mgl::vec2f(
std::floor(body_pos.x + body_size.x * 0.5f - text_bounds.size.x * 0.5f),
@@ -2135,7 +2164,8 @@ namespace QuickMedia {
std::vector<TabAssociatedData> tab_associated_data;
for(size_t i = 0; i < tabs.size(); ++i) {
TabAssociatedData data;
- data.search_result_text = mgl::Text("", *FontLoader::get_font(FontLoader::FontType::LATIN, 30 * get_config().scale * get_config().font_scale));
+ data.search_result_text = mgl::Text("", *FontLoader::get_font(FontLoader::FontType::LATIN, get_config().body.loading_text_font_size * get_config().scale * get_config().font_scale));
+ data.search_result_text.set_color(get_theme().text_color);
data.card_view = tabs[i].body ? tabs[i].body->card_view : false;
tab_associated_data.push_back(std::move(data));
}
@@ -4201,7 +4231,7 @@ namespace QuickMedia {
mgl::Texture image_texture;
mgl::Sprite image;
- mgl::Text error_message("", *FontLoader::get_font(FontLoader::FontType::LATIN, 30 * get_config().scale * get_config().font_scale));
+ mgl::Text error_message("", *FontLoader::get_font(FontLoader::FontType::LATIN, get_config().body.loading_text_font_size * get_config().scale * get_config().font_scale));
error_message.set_color(get_theme().text_color);
bool download_in_progress = false;
@@ -4242,9 +4272,9 @@ namespace QuickMedia {
mgl::Text chapter_text(images_page->manga_name + " | " + images_page->get_chapter_name() + " | Page " + std::to_string(image_index + 1) + "/" + std::to_string(num_manga_pages), *FontLoader::get_font(FontLoader::FontType::LATIN, chapter_text_character_size));
if(image_index == num_manga_pages)
chapter_text.set_string(images_page->manga_name + " | " + images_page->get_chapter_name() + " | End");
- chapter_text.set_color(mgl::Color(255, 255, 255, 255));
+ chapter_text.set_color(get_theme().text_color);
mgl::Rectangle chapter_text_background;
- chapter_text_background.set_color(mgl::Color(0, 0, 0, 150));
+ chapter_text_background.set_color(get_theme().shade_color);
mgl::vec2i texture_size;
mgl::vec2f texture_size_f;
@@ -4510,6 +4540,7 @@ namespace QuickMedia {
return;
}
+ thread_body->show_drop_shadow = false;
thread_body->set_items(std::move(result_items));
std::deque<int> comment_navigation_stack;
@@ -4596,6 +4627,7 @@ namespace QuickMedia {
std::string comment_to_post;
const int captcha_solution_text_height = 18 * get_config().scale * get_config().font_scale;
mgl::Text captcha_solution_text("", *FontLoader::get_font(FontLoader::FontType::LATIN_BOLD, captcha_solution_text_height));
+ captcha_solution_text.set_color(get_theme().text_color);
int solved_captcha_ttl = 0;
int64_t last_posted_time = time(nullptr);
int64_t seconds_until_post_again = 60; // TODO: Timeout for other imageboards
@@ -4617,8 +4649,8 @@ namespace QuickMedia {
bool redraw = true;
Entry comment_input("Press i to start writing a comment...", &rounded_rectangle_shader);
- comment_input.draw_background = false;
comment_input.set_editable(false);
+ comment_input.set_padding_scale(1.5f);
std::string selected_file_for_upload;
@@ -4692,9 +4724,6 @@ namespace QuickMedia {
return false;
};
- mgl::Rectangle comment_input_shade;
- comment_input_shade.set_color(get_theme().shade_color);
-
mgl::Sprite logo_sprite(&plugin_logo);
logo_sprite.set_scale(mgl::vec2f(0.8f * get_config().scale, 0.8f * get_config().scale));
mgl::vec2f logo_size(std::floor(plugin_logo.get_size().x * logo_sprite.get_scale().x), std::floor(plugin_logo.get_size().y * logo_sprite.get_scale().y));
@@ -5099,11 +5128,8 @@ namespace QuickMedia {
const float body_width = window_size.x;
- comment_input_shade.set_size(mgl::vec2f(window_size.x, chat_input_height_full));
- comment_input_shade.set_position(mgl::vec2f(0.0f, 0.0f));
-
- body_pos = mgl::vec2f(0.0f, comment_input_shade.get_size().y);
- body_size = mgl::vec2f(body_width, window_size.y - comment_input_shade.get_size().y);
+ body_pos = mgl::vec2f(0.0f, chat_input_height_full);
+ body_size = mgl::vec2f(body_width, window_size.y - chat_input_height_full);
logo_sprite.set_position(mgl::vec2f(logo_padding_x, chat_input_padding_y));
file_to_upload_sprite.set_position(logo_sprite.get_position() + mgl::vec2f(0.0f, logo_size.y + logo_file_to_upload_spacing));
@@ -5221,14 +5247,12 @@ namespace QuickMedia {
window.draw(load_sprite);
}
} else if(navigation_stage == NavigationStage::REPLYING) {
- window.draw(comment_input_shade);
window.draw(logo_sprite);
if(file_to_upload_thumbnail_data && file_to_upload_thumbnail_data->loading_state == LoadingState::APPLIED_TO_TEXTURE)
window.draw(file_to_upload_sprite);
comment_input.draw(window);
thread_body->draw(window, body_pos, body_size);
} else if(navigation_stage == NavigationStage::VIEWING_COMMENTS) {
- window.draw(comment_input_shade);
window.draw(logo_sprite);
if(file_to_upload_thumbnail_data && file_to_upload_thumbnail_data->loading_state == LoadingState::APPLIED_TO_TEXTURE)
window.draw(file_to_upload_sprite);
@@ -5239,12 +5263,12 @@ namespace QuickMedia {
if((navigation_stage == NavigationStage::REPLYING || navigation_stage == NavigationStage::VIEWING_COMMENTS) && has_post_timeout) {
int64_t time_left_until_post_again = seconds_until_post_again - (time(nullptr) - last_posted_time);
if(time_left_until_post_again > 0) {
- mgl::Rectangle time_left_bg(comment_input_shade.get_size());
- time_left_bg.set_position(comment_input_shade.get_position());
+ mgl::Rectangle time_left_bg(mgl::vec2f(window_size.x, chat_input_height_full));
time_left_bg.set_color(mgl::Color(0, 0, 0, 100));
window.draw(time_left_bg);
mgl::Text time_left_text("Wait " + std::to_string(time_left_until_post_again) + " second(s) before posting again", *FontLoader::get_font(FontLoader::FontType::LATIN, 18 * get_config().scale * get_config().font_scale));
+ time_left_text.set_color(get_theme().text_color);
time_left_text.set_position(time_left_bg.get_position() +
mgl::vec2f(
std::floor(time_left_bg.get_size().x * 0.5f - time_left_text.get_bounds().size.x * 0.5f),
@@ -5424,7 +5448,7 @@ namespace QuickMedia {
} else {
body_item->thumbnail_url = room->get_user_avatar_url(message->user);
if(body_item->thumbnail_url.empty()) {
- body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png");
+ body_item->thumbnail_url = get_resource_loader_root_path() + get_no_avatar_image_path();
body_item->thumbnail_is_local = true;
}
body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
@@ -5502,7 +5526,7 @@ namespace QuickMedia {
if(!is_visual_media_message_type(message->type)) {
body_item->thumbnail_url = room->get_user_avatar_url(message->user);
if(body_item->thumbnail_url.empty()) {
- body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png");
+ body_item->thumbnail_url = get_resource_loader_root_path() + get_no_avatar_image_path();
body_item->thumbnail_is_local = true;
}
body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
@@ -5527,17 +5551,19 @@ namespace QuickMedia {
// Year 2500.. The year that humanity is wiped out. Also we want our local message to appear at the bottom even if time is not synced with ntp, until it's replaced by the server
constexpr int64_t timestamp_provisional_event = 16755030000LL * 1000LL;
- const float room_name_text_height = std::floor(18.0f * get_config().scale * get_config().font_scale);
+ const float room_name_text_height = std::floor(get_config().matrix.room_name_font_size * get_config().scale * get_config().font_scale);
mgl::Text room_name_text("", *FontLoader::get_font(FontLoader::FontType::LATIN_BOLD, room_name_text_height));
+ room_name_text.set_color(get_theme().text_color);
const float room_name_text_padding_y = std::floor(10.0f * get_config().scale);
const float room_name_total_height = room_name_text_height + room_name_text_padding_y * 2.0f;
const float room_avatar_height = 32.0f;
- const float room_topic_text_height = std::floor(12.0f * get_config().scale * get_config().font_scale);
+ const float room_topic_text_height = std::floor(get_config().matrix.room_description_font_size * get_config().scale * get_config().font_scale);
mgl::Text room_topic_text("", *FontLoader::get_font(FontLoader::FontType::LATIN, room_topic_text_height));
room_topic_text.set_color(get_theme().faded_text_color);
- mgl::Text room_label(matrix_chat_page->rooms_page->get_title(), *FontLoader::get_font(FontLoader::FontType::LATIN_BOLD, 18 * get_config().scale * get_config().font_scale));
+ mgl::Text room_label(matrix_chat_page->rooms_page->get_title(), *FontLoader::get_font(FontLoader::FontType::LATIN_BOLD, get_config().matrix.room_name_font_size * get_config().scale * get_config().font_scale));
+ room_label.set_color(get_theme().text_color);
room_label.set_position(mgl::vec2f(15.0f, room_name_text_padding_y + 4.0f));
mgl::Sprite room_avatar_sprite;
@@ -5657,10 +5683,7 @@ namespace QuickMedia {
std::shared_ptr<BodyItem> currently_operating_on_item;
mgl::Text replying_to_text("Replying to:", *FontLoader::get_font(FontLoader::FontType::LATIN, 18 * get_config().scale * get_config().font_scale));
-
- mgl::Sprite logo_sprite(&plugin_logo);
- logo_sprite.set_scale(mgl::vec2f(0.8f * get_config().scale, 0.8f * get_config().scale));
- mgl::vec2f logo_size(plugin_logo.get_size().x * logo_sprite.get_scale().x, plugin_logo.get_size().y * logo_sprite.get_scale().y);
+ replying_to_text.set_color(get_theme().text_color);
bool draw_room_list = show_room_side_panel;
@@ -5677,7 +5700,7 @@ namespace QuickMedia {
if(original_message && !is_system_message_type(original_message->type)) {
body_item->thumbnail_url = current_room->get_user_avatar_url(original_message->user);
if(body_item->thumbnail_url.empty()) {
- body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png");
+ body_item->thumbnail_url = get_resource_loader_root_path() + get_no_avatar_image_path();
body_item->thumbnail_is_local = true;
}
body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
@@ -5917,8 +5940,8 @@ namespace QuickMedia {
redraw = true;
Entry chat_input("Press i to start writing a message...", &rounded_rectangle_shader);
- chat_input.draw_background = false;
chat_input.set_editable(false);
+ chat_input.set_padding_scale(1.5f);
struct ProvisionalMessage {
std::shared_ptr<BodyItem> body_item;
@@ -6482,7 +6505,6 @@ namespace QuickMedia {
float prev_chat_height = chat_input.get_height();
float chat_input_height_full = 0.0f;
- const float logo_padding_x = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
const float chat_input_padding_x = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
const float chat_input_padding_y = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
@@ -7524,13 +7546,11 @@ namespace QuickMedia {
chat_input_shade.set_size(mgl::vec2f(window_size.x - body_pos.x, chat_input_height_full));
chat_input_shade.set_position(mgl::vec2f(body_pos.x, window_size.y - chat_input_shade.get_size().y));
- chat_input.set_max_width(window_size.x - (logo_padding_x + logo_size.x + chat_input_padding_x + logo_padding_x + body_pos.x));
- chat_input.set_position(vec2f_floor(body_pos.x + logo_padding_x + logo_size.x + chat_input_padding_x, window_size.y - chat_height - chat_input_padding_y));
+ chat_input.set_max_width(window_size.x - body_pos.x - chat_input_padding_x * 2.0f);
+ chat_input.set_position(vec2f_floor(body_pos.x + chat_input_padding_x, window_size.y - chat_height - chat_input_padding_y));
more_messages_below_rect.set_size(mgl::vec2f(chat_input_shade.get_size().x, gradient_height));
more_messages_below_rect.set_position(mgl::vec2f(chat_input_shade.get_position().x, std::floor(window_size.y - chat_input_height_full - gradient_height)));
-
- logo_sprite.set_position(mgl::vec2f(body_pos.x + logo_padding_x, std::floor(window_size.y - chat_input_height_full * 0.5f - logo_size.y * 0.5f)));
}
sync_data.messages.clear();
@@ -7813,7 +7833,6 @@ namespace QuickMedia {
if(selected_tab == MESSAGES_TAB_INDEX) {
//window.draw(chat_input_shade);
chat_input.draw(window); //chat_input.draw(window, false);
- window.draw(logo_sprite);
}
if(matrix && !matrix->is_initial_sync_finished()) {
@@ -8206,7 +8225,9 @@ namespace QuickMedia {
const float loading_bar_height = std::floor(20.0f * get_config().scale);
mgl::Text progress_text("0kb/Unknown", *FontLoader::get_font(FontLoader::FontType::LATIN, 20.0f * get_config().scale * get_config().font_scale));
+ progress_text.set_color(get_theme().text_color);
mgl::Text status_text("Downloading", *FontLoader::get_font(FontLoader::FontType::LATIN, 20.0f * get_config().scale * get_config().font_scale));
+ status_text.set_color(get_theme().text_color);
mgl::Text filename_text(filename.c_str(), *FontLoader::get_font(FontLoader::FontType::LATIN, 14.0f * get_config().scale * get_config().font_scale));
filename_text.set_color(get_theme().faded_text_color);
mgl::Text download_speed_text("0 bytes/s", *FontLoader::get_font(FontLoader::FontType::LATIN, 14.0f * get_config().scale * get_config().font_scale));
@@ -8404,11 +8425,13 @@ namespace QuickMedia {
save_button.set_background_color(get_theme().confirm_button_background_color);
mgl::Text file_name_label("File name:", *FontLoader::get_font(FontLoader::FontType::LATIN, 16.0f * get_config().scale * get_config().font_scale));
+ file_name_label.set_color(get_theme().text_color);
Entry file_name_entry("", &rounded_rectangle_shader);
file_name_entry.set_text(filename);
file_name_entry.set_single_line(true);
file_name_entry.set_editable(false);
+ file_name_entry.set_background_color(get_theme().selected_color);
mgl::Rectangle bottom_panel_background;
bottom_panel_background.set_color(get_theme().shade_color);
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 1eff8a8..4d5cbef 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -50,6 +50,7 @@ namespace QuickMedia {
if(plugin_logo && plugin_logo->is_valid())
plugin_logo_sprite.set_texture(plugin_logo);
search_icon_sprite.set_color(get_theme().text_color);
+ caret.set_color(get_theme().text_color);
}
void SearchBar::draw(mgl::Window &window, mgl::vec2f size, bool draw_background) {
diff --git a/src/Tabs.cpp b/src/Tabs.cpp
index 41554fb..339e4db 100644
--- a/src/Tabs.cpp
+++ b/src/Tabs.cpp
@@ -40,6 +40,7 @@ namespace QuickMedia {
int Tabs::add_tab(std::string title, Body *body) {
assert(body);
tabs.push_back({ mgl::Text(std::move(title), *FontLoader::get_font(FontLoader::FontType::LATIN, tab_text_size)), body} );
+ tabs.back().text.set_color(get_theme().text_color);
return tabs.size() - 1;
}
diff --git a/src/Text.cpp b/src/Text.cpp
index 2a09336..0597080 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -1636,6 +1636,7 @@ namespace QuickMedia
const float caret_margin = floor(2.0f * get_config().scale);
mgl::Rectangle caretRect(mgl::vec2f(0.0f, 0.0f), mgl::vec2f(floor(2.0f * get_config().scale), floor(vspace - caret_margin * 2.0f)));
+ caretRect.set_color(color);
caretRect.set_position(mgl::vec2f(
floor(pos.x + caretPosition.x),
floor(pos.y + caretPosition.y + caret_margin + floor(4.0f * get_config().scale))
diff --git a/src/Theme.cpp b/src/Theme.cpp
index 2d5bfd4..4c4ff67 100644
--- a/src/Theme.cpp
+++ b/src/Theme.cpp
@@ -102,7 +102,6 @@ namespace QuickMedia {
parse_hex_set_color(json_root, "faded_text_color", theme->faded_text_color);
parse_hex_set_color(json_root, "shade_color", theme->shade_color);
parse_hex_set_color(json_root, "selected_color", theme->selected_color);
- parse_hex_set_color(json_root, "card_item_background_color", theme->card_item_background_color);
parse_hex_set_color(json_root, "replies_text_color", theme->replies_text_color);
parse_hex_set_color(json_root, "placeholder_text_color", theme->placeholder_text_color);
parse_hex_set_color(json_root, "image_loading_background_color", theme->image_loading_background_color);