mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 21:20:04 +00:00
Refactor settings to be managed by singletons
This commit is contained in:
parent
acc782b2bc
commit
b66ca2cb09
21 changed files with 138 additions and 133 deletions
|
|
@ -5,8 +5,8 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <scwx/qt/util/font.hpp>
|
||||
#include <scwx/qt/manager/settings_manager.hpp>
|
||||
#include <scwx/qt/model/imgui_context_model.hpp>
|
||||
#include <scwx/qt/settings/general_settings.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <codecvt>
|
||||
|
|
@ -337,7 +337,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource)
|
|||
font->p->CreateImGuiFont(
|
||||
fontFile,
|
||||
fontData,
|
||||
manager::SettingsManager::general_settings().font_sizes().GetValue());
|
||||
settings::GeneralSettings::Instance().font_sizes().GetValue());
|
||||
|
||||
font->p->atlas_ = ftgl::texture_atlas_new(512, 512, 1);
|
||||
ftgl::texture_font_t* textureFont = ftgl::texture_font_new_from_memory(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <scwx/qt/util/imgui.hpp>
|
||||
#include <scwx/qt/manager/resource_manager.hpp>
|
||||
#include <scwx/qt/manager/settings_manager.hpp>
|
||||
#include <scwx/qt/settings/general_settings.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <mutex>
|
||||
|
|
@ -48,7 +48,7 @@ void ImGui::Impl::Initialize()
|
|||
|
||||
// Configure monospace font
|
||||
UpdateMonospaceFont();
|
||||
manager::SettingsManager::general_settings()
|
||||
settings::GeneralSettings::Instance()
|
||||
.font_sizes()
|
||||
.RegisterValueChangedCallback([this](const std::vector<std::int64_t>&)
|
||||
{ UpdateMonospaceFont(); });
|
||||
|
|
@ -61,7 +61,7 @@ void ImGui::Impl::UpdateMonospaceFont()
|
|||
// Get monospace font size
|
||||
std::size_t fontSize = 16;
|
||||
auto fontSizes =
|
||||
manager::SettingsManager::general_settings().font_sizes().GetValue();
|
||||
settings::GeneralSettings::Instance().font_sizes().GetValue();
|
||||
if (fontSizes.size() > 1)
|
||||
{
|
||||
fontSize = fontSizes[1];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <scwx/qt/util/tooltip.hpp>
|
||||
#include <scwx/qt/manager/settings_manager.hpp>
|
||||
#include <scwx/qt/settings/general_settings.hpp>
|
||||
#include <scwx/qt/settings/text_settings.hpp>
|
||||
#include <scwx/qt/types/font_types.hpp>
|
||||
#include <scwx/qt/types/text_types.hpp>
|
||||
|
|
@ -100,7 +100,7 @@ void Show(const std::string& text, const QPointF& mouseGlobalPos)
|
|||
// Get monospace font size
|
||||
units::font_size::pixels<double> fontSize {16};
|
||||
auto fontSizes =
|
||||
manager::SettingsManager::general_settings().font_sizes().GetValue();
|
||||
settings::GeneralSettings::Instance().font_sizes().GetValue();
|
||||
if (fontSizes.size() > 1)
|
||||
{
|
||||
fontSize = units::font_size::pixels<double> {fontSizes[1]};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue