Merge pull request #10332 from AdmiralCurtiss/config-port-general

Config: Port remaining General settings to new config system.
This commit is contained in:
Léo Lam
2022-01-03 01:40:37 +01:00
committed by GitHub
10 changed files with 102 additions and 113 deletions

View File

@ -758,15 +758,15 @@ void MenuBar::AddMovieMenu()
auto* lag_counter = movie_menu->addAction(tr("Show Lag Counter"));
lag_counter->setCheckable(true);
lag_counter->setChecked(SConfig::GetInstance().m_ShowLag);
lag_counter->setChecked(Config::Get(Config::MAIN_SHOW_LAG));
connect(lag_counter, &QAction::toggled,
[](bool value) { SConfig::GetInstance().m_ShowLag = value; });
[](bool value) { Config::SetBaseOrCurrent(Config::MAIN_SHOW_LAG, value); });
auto* frame_counter = movie_menu->addAction(tr("Show Frame Counter"));
frame_counter->setCheckable(true);
frame_counter->setChecked(SConfig::GetInstance().m_ShowFrameCount);
frame_counter->setChecked(Config::Get(Config::MAIN_SHOW_FRAME_COUNT));
connect(frame_counter, &QAction::toggled,
[](bool value) { SConfig::GetInstance().m_ShowFrameCount = value; });
[](bool value) { Config::SetBaseOrCurrent(Config::MAIN_SHOW_FRAME_COUNT, value); });
auto* input_display = movie_menu->addAction(tr("Show Input Display"));
input_display->setCheckable(true);

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);
}