Config: Port remaining General settings to new config system.

This commit is contained in:
Admiral H. Curtiss
2022-01-01 17:53:12 +01:00
parent 8dd803bf2b
commit d590aa88a4
10 changed files with 102 additions and 113 deletions

View File

@ -216,7 +216,7 @@ void Settings::GetToolTipStyle(QColor& window_color, QColor& text_color,
QStringList Settings::GetPaths() const
{
QStringList list;
for (const auto& path : SConfig::GetInstance().m_ISOFolder)
for (const auto& path : Config::GetIsoPaths())
list << QString::fromStdString(path);
return list;
}
@ -224,25 +224,27 @@ QStringList Settings::GetPaths() const
void Settings::AddPath(const QString& qpath)
{
std::string path = qpath.toStdString();
std::vector<std::string> paths = Config::GetIsoPaths();
std::vector<std::string>& paths = SConfig::GetInstance().m_ISOFolder;
if (std::find(paths.begin(), paths.end(), path) != paths.end())
return;
paths.emplace_back(path);
Config::SetIsoPaths(paths);
emit PathAdded(qpath);
}
void Settings::RemovePath(const QString& qpath)
{
std::string path = qpath.toStdString();
std::vector<std::string>& paths = SConfig::GetInstance().m_ISOFolder;
std::vector<std::string> paths = Config::GetIsoPaths();
auto new_end = std::remove(paths.begin(), paths.end(), path);
if (new_end == paths.end())
return;
paths.erase(new_end, paths.end());
Config::SetIsoPaths(paths);
emit PathRemoved(qpath);
}