// // Created by versustune on 01.03.20. // #include "Config.h" std::shared_ptr Config::m_instance = nullptr; Config::Config() { // i want to load the m_config file here... initConfig(); m_theme = std::make_shared(m_config); m_theme->init(); } void Config::saveAll() { if (m_config != nullptr) { m_config->saveIfNeeded(); } } int Config::getCurrentLook() { if (m_currentLook > 1) { m_currentLook = 0; } return m_currentLook; } void Config::initConfig() { PropertiesFile::Options options; options.applicationName = "m_config"; options.folderName = "veno"; options.filenameSuffix = "xml"; m_config = std::make_unique(options); } std::shared_ptr Config::getCurrentTheme() { return m_theme; } double Config::getScale() { return 0; } void Config::setColourForIndex(Colour *colour, ThemeColour index) { if (m_theme) { m_theme->setColour(index, colour); } } Config::~Config() { m_config->save(); m_theme.reset(); m_config.reset(); } //LEAK DETECTOR FIX! void Config::registerEditor(AudioProcessorEditor *editor, const std::string &name) { m_editors[name] = editor; } void Config::removeEditor(const std::string &name) { m_editors.erase(name); if (m_editors.empty()) { m_instance = nullptr; } } //for LCD :P let's be a bit funny xD int Config::getEditorCount() { return m_editors.size(); } std::shared_ptr Config::getInstance() { if (!m_instance) m_instance = std::make_shared(); return m_instance; }