aboutsummaryrefslogtreecommitdiff
path: root/src/SearchBar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SearchBar.cpp')
-rw-r--r--src/SearchBar.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index a34b302..cc93169 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -2,6 +2,7 @@
#include "../include/Theme.hpp"
#include "../include/Scale.hpp"
#include "../include/ResourceLoader.hpp"
+#include "../include/Config.hpp"
#include "../include/Utils.hpp"
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Clipboard.hpp>
@@ -12,10 +13,10 @@
// TODO: Use a seperate placeholder sf::Text instead of switching the text to placeholder text....
namespace QuickMedia {
- static const float background_margin_horizontal = 10.0f + std::floor(5.0f * get_ui_scale());
- static const float padding_top_default = std::floor(10.0f * get_ui_scale());
- static const float padding_bottom_default = std::floor(15.0f * get_ui_scale());
- static const float background_margin_vertical = std::floor(4.0f * get_ui_scale());
+ 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);
SearchBar::SearchBar(sf::Texture *plugin_logo, sf::Shader *rounded_rectangle_shader, const std::string &placeholder, bool input_masked) :
onTextUpdateCallback(nullptr),
@@ -23,7 +24,7 @@ namespace QuickMedia {
onTextBeginTypingCallback(nullptr),
text_autosearch_delay(50),
caret_visible(true),
- text(placeholder, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale() * get_font_scale())),
+ text(placeholder, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(get_config().search.font_size * get_config().scale * get_config().font_scale)),
background(sf::Vector2f(1.0f, 1.0f), 10.0f, get_current_theme().selected_color, rounded_rectangle_shader),
placeholder_str(placeholder),
show_placeholder(true),
@@ -165,7 +166,7 @@ namespace QuickMedia {
background.set_size(sf::Vector2f(width, rect_height));
shade.setSize(sf::Vector2f(size.x, padding_top + rect_height + padding_bottom));
- caret.setSize(sf::Vector2f(std::floor(2.0f * get_ui_scale()), text.getCharacterSize() + std::floor(2.0f * get_ui_scale())));
+ caret.setSize(sf::Vector2f(std::floor(2.0f * get_config().scale), text.getCharacterSize() + std::floor(2.0f * get_config().scale)));
background.set_position(sf::Vector2f(pos.x + offset_x, pos.y + padding_top));
shade.setPosition(pos);