ui: Refactored QtCodeSnippet and added view settings to ApplicationSettings
This change refactors parts of the QtCodeSnippet and places some settings into ApplicationSettings. Additionally Application- and ProjectSettings were abstracted to the common base class Settings, which takes care of the getting and setting values of the Configmanager member.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#include "Settings.h"
|
||||
|
||||
#include "utility/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
Settings::Settings()
|
||||
{
|
||||
}
|
||||
|
||||
Settings::~Settings()
|
||||
{
|
||||
}
|
||||
|
||||
bool Settings::load(const std::string& filePath)
|
||||
{
|
||||
m_config.reset();
|
||||
|
||||
if (FileSystem::exists(filePath))
|
||||
{
|
||||
m_config = ConfigManager::createAndLoad(TextAccess::createFromFile(filePath));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("File for Settings not found.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::save(const std::string& filePath)
|
||||
{
|
||||
if (m_config)
|
||||
{
|
||||
m_config->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Settings were not saved.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user