aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp60
-rw-r--r--src/Config.cpp26
-rw-r--r--src/Entry.cpp6
-rw-r--r--src/QuickMedia.cpp38
-rw-r--r--src/SearchBar.cpp10
-rw-r--r--src/Tabs.cpp4
6 files changed, 74 insertions, 70 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index cc0f66c..dbc13af 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -37,10 +37,10 @@ namespace QuickMedia {
static const int card_width = 250.0f * get_config().scale * get_config().font_scale;
static const int card_height = 350.0f * get_config().scale * get_config().font_scale;
- static const int min_column_spacing = 10 * get_config().scale;
- static const int card_padding_x = 20 * get_config().scale;
- static const int card_padding_y = 20 * get_config().scale;
- static const int card_image_text_padding = 10 * get_config().scale;
+ static const int min_column_spacing = 10 * get_config().scale * get_config().spacing_scale;
+ static const int card_padding_x = 20 * get_config().scale * get_config().spacing_scale;
+ static const int card_padding_y = 20 * get_config().scale * get_config().spacing_scale;
+ static const int card_image_text_padding = 10 * get_config().scale * get_config().spacing_scale;
static const mgl::vec2i card_max_image_size(card_width - card_padding_x * 2, (card_height - card_padding_y * 2) / 2);
static const int num_columns_switch_to_list = 1;
static const int embedded_item_border_width = 4;
@@ -49,36 +49,36 @@ namespace QuickMedia {
static bool themes_initialized = false;
static void init_body_theme_minimal() {
- body_spacing[BODY_THEME_MINIMAL].spacing_y = std::floor(10.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].padding_x = std::floor(10.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].image_padding_x = std::floor(5.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].padding_y = std::floor(5.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].padding_y_text_only = std::floor(5.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].embedded_item_padding_y = std::floor(0.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].body_padding_horizontal = std::floor(10.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].body_padding_vertical = std::floor(10.0f * get_config().scale);
-
- body_spacing[BODY_THEME_MINIMAL].reaction_background_padding_x = std::floor(7.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].reaction_background_padding_y = std::floor(3.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].reaction_spacing_x = std::floor(5.0f * get_config().scale);
- body_spacing[BODY_THEME_MINIMAL].reaction_padding_y = std::floor(7.0f * get_config().scale);
+ body_spacing[BODY_THEME_MINIMAL].spacing_y = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].padding_x = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].image_padding_x = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].padding_y = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].padding_y_text_only = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].embedded_item_padding_y = std::floor(0.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].body_padding_horizontal = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].body_padding_vertical = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
+
+ body_spacing[BODY_THEME_MINIMAL].reaction_background_padding_x = std::floor(7.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].reaction_background_padding_y = std::floor(3.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].reaction_spacing_x = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MINIMAL].reaction_padding_y = std::floor(7.0f * get_config().scale * get_config().spacing_scale);
body_spacing[BODY_THEME_MINIMAL].embedded_item_font_size = std::floor(get_config().body.embedded_load_font_size * get_config().scale * get_config().font_scale);
}
static void init_body_theme_modern_spacious() {
- body_spacing[BODY_THEME_MODERN_SPACIOUS].spacing_y = std::floor(20.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].padding_x = std::floor(20.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].image_padding_x = std::floor(15.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].padding_y = std::floor(15.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].padding_y_text_only = std::floor(7.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].embedded_item_padding_y = std::floor(0.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].body_padding_horizontal = std::floor(20.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].body_padding_vertical = std::floor(20.0f * get_config().scale);
-
- body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_background_padding_x = std::floor(7.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_background_padding_y = std::floor(3.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_spacing_x = std::floor(5.0f * get_config().scale);
- body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_padding_y = std::floor(7.0f * get_config().scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].spacing_y = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].padding_x = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].image_padding_x = std::floor(15.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].padding_y = std::floor(15.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].padding_y_text_only = std::floor(7.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].embedded_item_padding_y = std::floor(0.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].body_padding_horizontal = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].body_padding_vertical = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
+
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_background_padding_x = std::floor(7.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_background_padding_y = std::floor(3.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_spacing_x = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ body_spacing[BODY_THEME_MODERN_SPACIOUS].reaction_padding_y = std::floor(7.0f * get_config().scale * get_config().spacing_scale);
body_spacing[BODY_THEME_MODERN_SPACIOUS].embedded_item_font_size = std::floor(get_config().body.embedded_load_font_size * get_config().scale * get_config().font_scale);
}
diff --git a/src/Config.cpp b/src/Config.cpp
index f8dc3ed..159836f 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -74,48 +74,48 @@ namespace QuickMedia {
if(search_json.isObject()) {
const Json::Value &font_size_json = search_json["font_size"];
if(font_size_json.isNumeric())
- config->search.font_size = font_size_json.asDouble();
+ config->search.font_size = font_size_json.asInt();
}
const Json::Value &tab_json = json_root["tab"];
if(tab_json.isObject()) {
const Json::Value &font_size_json = tab_json["font_size"];
if(font_size_json.isNumeric())
- config->tab.font_size = font_size_json.asDouble();
+ config->tab.font_size = font_size_json.asInt();
}
const Json::Value &body_json = json_root["body"];
if(body_json.isObject()) {
const Json::Value &title_font_size = body_json["title_font_size"];
if(title_font_size.isNumeric())
- config->body.title_font_size = title_font_size.asDouble();
+ config->body.title_font_size = title_font_size.asInt();
const Json::Value &author_font_size = body_json["author_font_size"];
if(author_font_size.isNumeric())
- config->body.author_font_size = author_font_size.asDouble();
+ config->body.author_font_size = author_font_size.asInt();
const Json::Value &description_font_size = body_json["description_font_size"];
if(description_font_size.isNumeric())
- config->body.description_font_size = description_font_size.asDouble();
+ config->body.description_font_size = description_font_size.asInt();
const Json::Value &timestamp_font_size = body_json["timestamp_font_size"];
if(timestamp_font_size.isNumeric())
- config->body.timestamp_font_size = timestamp_font_size.asDouble();
+ config->body.timestamp_font_size = timestamp_font_size.asInt();
const Json::Value &reaction_font_size = body_json["reaction_font_size"];
if(reaction_font_size.isNumeric())
- config->body.reaction_font_size = reaction_font_size.asDouble();
+ config->body.reaction_font_size = reaction_font_size.asInt();
const Json::Value &embedded_load_font_size = body_json["embedded_load_font_size"];
if(embedded_load_font_size.isNumeric())
- config->body.embedded_load_font_size = embedded_load_font_size.asDouble();
+ config->body.embedded_load_font_size = embedded_load_font_size.asInt();
}
const Json::Value &input_json = json_root["input"];
if(input_json.isObject()) {
const Json::Value &font_size_json = input_json["font_size"];
if(font_size_json.isNumeric())
- config->input.font_size = font_size_json.asDouble();
+ config->input.font_size = font_size_json.asInt();
}
const Json::Value &video_json = json_root["video"];
@@ -139,11 +139,15 @@ namespace QuickMedia {
const Json::Value &scale_json = json_root["scale"];
if(scale_json.isNumeric())
- config->scale = scale_json.asDouble();
+ config->scale = scale_json.asFloat();
const Json::Value &font_scale = json_root["font_scale"];
if(font_scale.isNumeric())
- config->font_scale = font_scale.asDouble();
+ config->font_scale = font_scale.asFloat();
+
+ const Json::Value &spacing_scale = json_root["spacing_scale"];
+ if(spacing_scale.isNumeric())
+ config->spacing_scale = spacing_scale.asFloat();
}
const Config& get_config() {
diff --git a/src/Entry.cpp b/src/Entry.cpp
index 590eade..b196009 100644
--- a/src/Entry.cpp
+++ b/src/Entry.cpp
@@ -10,9 +10,9 @@
#include <math.h>
namespace QuickMedia {
- static const float background_margin_horizontal = std::floor(5.0f * get_config().scale);
- static const float padding_vertical = std::floor(5.0f * get_config().scale);
- static const float background_margin_vertical = std::floor(0.0f * get_config().scale);
+ static const float background_margin_horizontal = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ static const float padding_vertical = std::floor(5.0f * get_config().scale * get_config().spacing_scale);
+ static const float background_margin_vertical = std::floor(0.0f * get_config().scale * get_config().spacing_scale);
Entry::Entry(const std::string &placeholder_text, mgl::Shader *rounded_rectangle_shader) :
on_submit_callback(nullptr),
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5a3932e..1f7629e 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3875,8 +3875,8 @@ namespace QuickMedia {
ImageControl image_control;
- const float captcha_slide_padding_x = std::floor(4.0f * get_config().scale);
- const float captcha_slide_padding_y = std::floor(4.0f * get_config().scale);
+ const float captcha_slide_padding_x = std::floor(4.0f * get_config().scale * get_config().spacing_scale);
+ const float captcha_slide_padding_y = std::floor(4.0f * get_config().scale * get_config().spacing_scale);
mgl::Color background_color_darker = get_theme().background_color;
background_color_darker.r = std::max(0, (int)background_color_darker.r - 20);
background_color_darker.g = std::max(0, (int)background_color_darker.g - 20);
@@ -3999,13 +3999,13 @@ namespace QuickMedia {
bool sprite_applied_texture = false;
std::shared_ptr<ThumbnailData> file_to_upload_thumbnail_data;
- const float logo_file_to_upload_spacing = std::floor(10.0f * get_config().scale);
+ const float logo_file_to_upload_spacing = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
float prev_chat_height = comment_input.get_height();
float chat_input_height_full = 0.0f;
- const float logo_padding_x = std::floor(15.0f * get_config().scale);
- const float chat_input_padding_x = std::floor(10.0f * get_config().scale);
- const float chat_input_padding_y = std::floor(10.0f * get_config().scale);
+ const float logo_padding_x = std::floor(15.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);
mgl::vec2f body_pos;
mgl::vec2f body_size;
@@ -4598,9 +4598,9 @@ namespace QuickMedia {
inputs[i]->onTextSubmitCallback = text_submit_callback;
}
inputs[focused_input]->caret_visible = true;
- const float padding_x = std::floor(20.0f * get_config().scale);
- const float padding_y = std::floor(20.0f * get_config().scale);
- const float spacing_y = std::floor(20.0f * get_config().scale);
+ const float padding_x = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
+ const float padding_y = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
+ const float spacing_y = std::floor(20.0f * get_config().scale * get_config().spacing_scale);
mgl::vec2f body_pos;
mgl::vec2f body_size;
@@ -5745,9 +5745,9 @@ 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);
- const float chat_input_padding_x = std::floor(10.0f * get_config().scale);
- const float chat_input_padding_y = std::floor(10.0f * get_config().scale);
+ 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);
bool avatar_applied = false;
@@ -6798,7 +6798,7 @@ namespace QuickMedia {
overlay.set_color(mgl::Color(0, 0, 0, 240));
window.draw(overlay);
- const float padding_x = std::floor(10.0f * get_config().scale);
+ const float padding_x = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
mgl::vec2f body_item_pos(body_pos.x + padding_x, window_size.y - chat_input_height_full - item_height);
mgl::vec2f body_item_size(body_size.x - padding_x * 2.0f, item_height);
@@ -7274,13 +7274,13 @@ namespace QuickMedia {
window.clear(get_theme().background_color);
window.display();
- const float loading_bar_padding_x = std::floor(4.0f * get_config().scale);
- const float loading_bar_padding_y = std::floor(4.0f * get_config().scale);
+ const float loading_bar_padding_x = std::floor(4.0f * get_config().scale * get_config().spacing_scale);
+ const float loading_bar_padding_y = std::floor(4.0f * get_config().scale * get_config().spacing_scale);
RoundedRectangle loading_bar_background(mgl::vec2f(1.0f, 1.0f), std::floor(10.0f * get_config().scale), get_theme().background_color, &rounded_rectangle_shader);
RoundedRectangle loading_bar(mgl::vec2f(1.0f, 1.0f), std::floor(10.0f * get_config().scale - loading_bar_padding_y), get_theme().loading_bar_color, &rounded_rectangle_shader);
- const float padding_x = std::floor(30.0f * get_config().scale);
- const float spacing_y = std::floor(15.0f * get_config().scale);
+ const float padding_x = std::floor(30.0f * get_config().scale * get_config().spacing_scale);
+ const float spacing_y = std::floor(15.0f * get_config().scale * get_config().spacing_scale);
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));
@@ -7470,8 +7470,8 @@ namespace QuickMedia {
idle_active_handler();
};
- const float bottom_panel_padding = 10.0f;
- const float bottom_panel_spacing = 10.0f;
+ const float bottom_panel_padding = std::floor(10.0f * get_config().spacing_scale);
+ const float bottom_panel_spacing = std::floor(10.0f * get_config().spacing_scale);
Button cancel_button("Cancel", FontLoader::get_font(FontLoader::FontType::LATIN, 16 * get_config().scale), 100.0f, &rounded_rectangle_shader, get_config().scale * get_config().font_scale);
cancel_button.set_background_color(get_theme().cancel_button_background_color);
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index e6c51e9..6d790ad 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -14,10 +14,10 @@
// TODO: Use a seperate placeholder mgl::Text instead of switching the text to placeholder text....
namespace QuickMedia {
- static const float background_margin_horizontal = 10.0f + std::floor(5.0f * get_config().scale);
- static const float padding_top_default = std::floor(10.0f * get_config().scale);
- static const float padding_bottom_default = std::floor(15.0f * get_config().scale);
- static const float background_margin_vertical = std::floor(4.0f * get_config().scale);
+ static const float background_margin_horizontal = std::floor(15.0f * get_config().scale * get_config().spacing_scale);
+ static const float padding_top_default = std::floor(10.0f * get_config().scale * get_config().spacing_scale);
+ static const float padding_bottom_default = std::floor(15.0f * get_config().scale * get_config().spacing_scale);
+ static const float background_margin_vertical = std::floor(4.0f * get_config().scale * get_config().spacing_scale);
static const int character_size = get_config().search.font_size * get_config().scale * get_config().font_scale;
SearchBar::SearchBar(mgl::Texture *plugin_logo, mgl::Shader *rounded_rectangle_shader, const std::string &placeholder, bool input_masked) :
@@ -166,7 +166,7 @@ namespace QuickMedia {
mgl::vec2f new_size = wrap_to_size(texture_size_f, mgl::vec2f(200.0f, one_line_height));
plugin_logo_sprite.set_scale(get_ratio(texture_size_f, new_size));
plugin_logo_sprite.set_position(mgl::vec2f(pos.x + padding_x, pos.y + padding_top + rect_height * 0.5f - plugin_logo_sprite.get_texture()->get_size().y * plugin_logo_sprite.get_scale().y * 0.5f));
- offset_x = padding_x + new_size.x + 10.0f;
+ offset_x = padding_x + new_size.x + std::floor(10.0f * get_config().spacing_scale);
} else {
offset_x = padding_x;
}
diff --git a/src/Tabs.cpp b/src/Tabs.cpp
index 3d0dc76..6b33df1 100644
--- a/src/Tabs.cpp
+++ b/src/Tabs.cpp
@@ -14,7 +14,7 @@ namespace QuickMedia {
static const float tab_text_size = std::floor(get_config().tab.font_size * get_config().scale * get_config().font_scale);
static const float tab_height = tab_text_size + std::floor(10.0f * get_config().scale);
static const float tab_min_width = 250.0f;
- static const float tab_margin_x = 10.0f;
+ static const float tab_margin_x = std::floor(10.0f * get_config().spacing_scale);
// static
float Tabs::get_height() {
@@ -23,7 +23,7 @@ namespace QuickMedia {
// static
float Tabs::get_shade_height() {
- return tab_height + std::floor(10.0f * get_config().scale);
+ return tab_height + std::floor(10.0f * get_config().scale * get_config().spacing_scale);
}
Tabs::Tabs(mgl::Shader *rounded_rectangle_shader, mgl::Color shade_color) : background(mgl::vec2f(1.0f, 1.0f), 10.0f * get_config().scale, get_theme().selected_color, rounded_rectangle_shader), shade_color(shade_color) {