1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Add const and ref for loops

This commit is contained in:
scribam 2017-11-30 21:55:26 +01:00 committed by Ivan
parent 3aefd14b3d
commit b4a97c99d8
5 changed files with 15 additions and 19 deletions

View File

@ -35,11 +35,9 @@ void gui_settings::ChangeToConfig(const QString& name)
Reset(false);
QSettings other(m_settingsDir.absoluteFilePath(name + ".ini"), QSettings::IniFormat);
QStringList keys = other.allKeys();
for (QStringList::iterator i = keys.begin(); i != keys.end(); i++)
for (const QString& key : other.allKeys())
{
m_settings.setValue(*i, other.value(*i));
m_settings.setValue(key, other.value(key));
}
m_settings.sync();
}
@ -315,7 +313,7 @@ QStringList gui_settings::GetConfigEntries()
nameFilter << "*.ini";
QFileInfoList entries = m_settingsDir.entryInfoList(nameFilter, QDir::Files);
QStringList res;
for (QFileInfo entry : entries)
for (const QFileInfo &entry : entries)
{
res.append(entry.baseName());
}
@ -326,12 +324,11 @@ QStringList gui_settings::GetConfigEntries()
void gui_settings::BackupSettingsToTarget(const QString& friendlyName)
{
QSettings target(ComputeSettingsDir() + friendlyName + ".ini", QSettings::Format::IniFormat);
QStringList keys = m_settings.allKeys();
for (QStringList::iterator i = keys.begin(); i != keys.end(); i++)
for (const QString& key : m_settings.allKeys())
{
if (!i->startsWith(gui::meta))
if (!key.startsWith(gui::meta))
{
target.setValue(*i, m_settings.value(*i));
target.setValue(key, m_settings.value(key));
}
}
target.sync();
@ -341,10 +338,9 @@ QStringList gui_settings::GetStylesheetEntries()
{
QStringList nameFilter;
nameFilter << "*.qss";
QString path = m_settingsDir.absolutePath();
QFileInfoList entries = m_settingsDir.entryInfoList(nameFilter, QDir::Files);
QStringList res;
for (QFileInfo entry : entries)
for (const QFileInfo &entry : entries)
{
res.append(entry.baseName());
}

View File

@ -484,7 +484,7 @@ void main_window::InstallPup(const QString& dropPath)
// Run asynchronously
scope_thread worker("Firmware Installer", [&]
{
for (auto updatefilename : updatefilenames)
for (const auto& updatefilename : updatefilenames)
{
if (progress == -1) break;
@ -566,7 +566,7 @@ void main_window::DecryptSPRXLibraries()
LOG_NOTICE(GENERAL, "Decrypting SPRX libraries...");
for (QString& module : modules)
for (const QString& module : modules)
{
std::string prx_path = sstr(module);
const std::string& prx_dir = fs::get_parent_dir(prx_path);

View File

@ -185,7 +185,7 @@ void save_data_list_dialog::UpdateList()
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
int row = 0;
for (SaveDataEntry entry: m_save_entries)
for (const SaveDataEntry& entry: m_save_entries)
{
QString title = qstr(entry.title);
QString subtitle = qstr(entry.subtitle);

View File

@ -55,7 +55,7 @@ namespace
save_entry2.size = 0;
for (const auto entry2 : fs::dir(base_dir + entry.name))
for (const auto& entry2 : fs::dir(base_dir + entry.name))
{
save_entry2.size += entry2.size;
}
@ -161,7 +161,7 @@ void save_manager_dialog::UpdateList()
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
int row = 0;
for (SaveDataEntry entry : m_save_entries)
for (const SaveDataEntry& entry : m_save_entries)
{
QString title = qstr(entry.title);
QString subtitle = qstr(entry.subtitle);

View File

@ -256,7 +256,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
sort_string_vector(loadedLibs);
for (auto lib : loadedLibs)
for (const auto& lib : loadedLibs)
{
QListWidgetItem* item = new QListWidgetItem(qstr(lib), ui->lleList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
@ -281,7 +281,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
sort_string_vector(lle_module_list_unselected);
for (auto lib : lle_module_list_unselected)
for (const auto& lib : lle_module_list_unselected)
{
QListWidgetItem* item = new QListWidgetItem(qstr(lib), ui->lleList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
@ -978,7 +978,7 @@ void settings_dialog::AddConfigs()
ui->combo_configs->addItem(gui::Default);
for (QString entry : xgui_settings->GetConfigEntries())
for (const QString& entry : xgui_settings->GetConfigEntries())
{
if (entry != gui::Default)
{