mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 08:51:28 +12:00
Qt: move some more settings to persistent_settings
This commit is contained in:
parent
70fb5712e5
commit
8799eebfe1
15 changed files with 176 additions and 88 deletions
|
@ -571,10 +571,10 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
|
|||
mutex_cat.lock();
|
||||
|
||||
const QString serial = qstr(game.serial);
|
||||
const QString note = m_gui_settings->GetValue(gui::notes, serial, "").toString();
|
||||
const QString title = m_gui_settings->GetValue(gui::titles, serial, "").toString().simplified();
|
||||
|
||||
// Read persistent_settings values
|
||||
QString note = m_persistent_settings->GetValue(gui::persistent::notes, serial, "").toString();
|
||||
QString title = m_persistent_settings->GetValue(gui::persistent::titles, serial, "").toString().simplified();
|
||||
QString last_played = m_persistent_settings->GetValue(gui::persistent::last_played, serial, "").toString();
|
||||
int playtime = m_persistent_settings->GetValue(gui::persistent::playtime, serial, 0).toInt();
|
||||
|
||||
|
@ -588,6 +588,27 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
|
|||
{
|
||||
playtime = m_gui_settings->GetValue(gui::persistent::playtime, serial, 0).toInt();
|
||||
}
|
||||
// Deprecated values older than August 2nd 2020
|
||||
if (note.isEmpty())
|
||||
{
|
||||
note = m_gui_settings->GetValue(gui::persistent::notes, serial, "").toString();
|
||||
|
||||
// Move to persistent settings
|
||||
if (!note.isEmpty())
|
||||
{
|
||||
m_persistent_settings->SetValue(gui::persistent::notes, serial, note);
|
||||
}
|
||||
}
|
||||
if (title.isEmpty())
|
||||
{
|
||||
title = m_gui_settings->GetValue(gui::persistent::titles, serial, "").toString().simplified();
|
||||
|
||||
// Move to persistent settings
|
||||
if (!title.isEmpty())
|
||||
{
|
||||
m_persistent_settings->SetValue(gui::persistent::titles, serial, title);
|
||||
}
|
||||
}
|
||||
|
||||
// Set persistent_settings values if values exist
|
||||
if (!last_played.isEmpty())
|
||||
|
@ -870,7 +891,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
? tr("&Reboot with custom configuration")
|
||||
: tr("&Boot with custom configuration"));
|
||||
boot_custom->setFont(font);
|
||||
connect(boot_custom, &QAction::triggered, [=, this]
|
||||
connect(boot_custom, &QAction::triggered, [this, gameinfo]
|
||||
{
|
||||
sys_log.notice("Booting from gamelist per context menu...");
|
||||
Q_EMIT RequestBoot(gameinfo);
|
||||
|
@ -902,7 +923,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
if (gameinfo->hasCustomConfig)
|
||||
{
|
||||
QAction* remove_custom_config = remove_menu->addAction(tr("&Remove Custom Configuration"));
|
||||
connect(remove_custom_config, &QAction::triggered, [=, this]()
|
||||
connect(remove_custom_config, &QAction::triggered, [this, current_game, gameinfo]()
|
||||
{
|
||||
if (RemoveCustomConfiguration(current_game.serial, gameinfo, true))
|
||||
{
|
||||
|
@ -913,7 +934,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
if (gameinfo->hasCustomPadConfig)
|
||||
{
|
||||
QAction* remove_custom_pad_config = remove_menu->addAction(tr("&Remove Custom Gamepad Configuration"));
|
||||
connect(remove_custom_pad_config, &QAction::triggered, [=, this]()
|
||||
connect(remove_custom_pad_config, &QAction::triggered, [this, current_game, gameinfo]()
|
||||
{
|
||||
if (RemoveCustomPadConfiguration(current_game.serial, gameinfo, true))
|
||||
{
|
||||
|
@ -925,22 +946,22 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
{
|
||||
remove_menu->addSeparator();
|
||||
QAction* remove_shaders_cache = remove_menu->addAction(tr("&Remove Shaders Cache"));
|
||||
connect(remove_shaders_cache, &QAction::triggered, [=, this]()
|
||||
connect(remove_shaders_cache, &QAction::triggered, [this, cache_base_dir]()
|
||||
{
|
||||
RemoveShadersCache(cache_base_dir, true);
|
||||
});
|
||||
QAction* remove_ppu_cache = remove_menu->addAction(tr("&Remove PPU Cache"));
|
||||
connect(remove_ppu_cache, &QAction::triggered, [=, this]()
|
||||
connect(remove_ppu_cache, &QAction::triggered, [this, cache_base_dir]()
|
||||
{
|
||||
RemovePPUCache(cache_base_dir, true);
|
||||
});
|
||||
QAction* remove_spu_cache = remove_menu->addAction(tr("&Remove SPU Cache"));
|
||||
connect(remove_spu_cache, &QAction::triggered, [=, this]()
|
||||
connect(remove_spu_cache, &QAction::triggered, [this, cache_base_dir]()
|
||||
{
|
||||
RemoveSPUCache(cache_base_dir, true);
|
||||
});
|
||||
QAction* remove_all_caches = remove_menu->addAction(tr("&Remove All Caches"));
|
||||
connect(remove_all_caches, &QAction::triggered, [=, this]()
|
||||
connect(remove_all_caches, &QAction::triggered, [this, cache_base_dir]()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove all caches?")) != QMessageBox::Yes)
|
||||
return;
|
||||
|
@ -955,7 +976,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
if (gameinfo->hasCustomConfig)
|
||||
{
|
||||
QAction* open_config_dir = menu.addAction(tr("&Open Custom Config Folder"));
|
||||
connect(open_config_dir, &QAction::triggered, [=, this]()
|
||||
connect(open_config_dir, &QAction::triggered, [current_game]()
|
||||
{
|
||||
const std::string new_config_path = Emulator::GetCustomConfigPath(current_game.serial);
|
||||
|
||||
|
@ -971,7 +992,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
if (fs::is_dir(data_base_dir))
|
||||
{
|
||||
QAction* open_data_dir = menu.addAction(tr("&Open Data Folder"));
|
||||
connect(open_data_dir, &QAction::triggered, [=, this]()
|
||||
connect(open_data_dir, &QAction::triggered, [data_base_dir]()
|
||||
{
|
||||
gui::utils::open_dir(data_base_dir);
|
||||
});
|
||||
|
@ -986,12 +1007,12 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
QAction* copy_name = info_menu->addAction(tr("&Copy Name"));
|
||||
QAction* copy_serial = info_menu->addAction(tr("&Copy Serial"));
|
||||
|
||||
connect(boot, &QAction::triggered, [=, this]()
|
||||
connect(boot, &QAction::triggered, [this, gameinfo]()
|
||||
{
|
||||
sys_log.notice("Booting from gamelist per context menu...");
|
||||
Q_EMIT RequestBoot(gameinfo, gameinfo->hasCustomConfig);
|
||||
});
|
||||
connect(configure, &QAction::triggered, [=, this]()
|
||||
connect(configure, &QAction::triggered, [this, current_game, gameinfo]()
|
||||
{
|
||||
settings_dialog dlg(m_gui_settings, m_emu_settings, 0, this, ¤t_game);
|
||||
connect(&dlg, &settings_dialog::EmuSettingsApplied, [this, gameinfo]()
|
||||
|
@ -1005,7 +1026,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
});
|
||||
dlg.exec();
|
||||
});
|
||||
connect(pad_configure, &QAction::triggered, [=, this]()
|
||||
connect(pad_configure, &QAction::triggered, [this, current_game, gameinfo]()
|
||||
{
|
||||
pad_settings_dialog dlg(m_gui_settings, this, ¤t_game);
|
||||
|
||||
|
@ -1032,7 +1053,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
CreatePPUCache(gameinfo);
|
||||
}
|
||||
});
|
||||
connect(remove_game, &QAction::triggered, [=, this]
|
||||
connect(remove_game, &QAction::triggered, [this, current_game, gameinfo, cache_base_dir, name]
|
||||
{
|
||||
if (current_game.path.empty())
|
||||
{
|
||||
|
@ -1069,22 +1090,22 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
}
|
||||
}
|
||||
});
|
||||
connect(open_game_folder, &QAction::triggered, [=, this]()
|
||||
connect(open_game_folder, &QAction::triggered, [current_game]()
|
||||
{
|
||||
gui::utils::open_dir(current_game.path);
|
||||
});
|
||||
connect(check_compat, &QAction::triggered, [=, this]
|
||||
connect(check_compat, &QAction::triggered, [serial]
|
||||
{
|
||||
const QString link = "https://rpcs3.net/compatibility?g=" + serial;
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
});
|
||||
connect(download_compat, &QAction::triggered, [=, this]
|
||||
connect(download_compat, &QAction::triggered, [this]
|
||||
{
|
||||
m_game_compat->RequestCompatibility(true);
|
||||
});
|
||||
connect(rename_title, &QAction::triggered, [=, this]
|
||||
connect(rename_title, &QAction::triggered, [this, name, serial, global_pos]
|
||||
{
|
||||
const QString custom_title = m_gui_settings->GetValue(gui::titles, serial, "").toString();
|
||||
const QString custom_title = m_persistent_settings->GetValue(gui::persistent::titles, serial, "").toString();
|
||||
const QString old_title = custom_title.isEmpty() ? name : custom_title;
|
||||
QString new_title;
|
||||
|
||||
|
@ -1100,20 +1121,20 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
if (new_title.isEmpty() || new_title == name)
|
||||
{
|
||||
m_titles.remove(serial);
|
||||
m_gui_settings->RemoveValue(gui::titles, serial);
|
||||
m_persistent_settings->RemoveValue(gui::persistent::titles, serial);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_titles.insert(serial, new_title);
|
||||
m_gui_settings->SetValue(gui::titles, serial, new_title);
|
||||
m_persistent_settings->SetValue(gui::persistent::titles, serial, new_title);
|
||||
}
|
||||
Refresh(true); // full refresh in order to reliably sort the list
|
||||
}
|
||||
});
|
||||
connect(edit_notes, &QAction::triggered, [=, this]
|
||||
connect(edit_notes, &QAction::triggered, [this, name, serial]
|
||||
{
|
||||
bool accepted;
|
||||
const QString old_notes = m_gui_settings->GetValue(gui::notes, serial, "").toString();
|
||||
const QString old_notes = m_persistent_settings->GetValue(gui::persistent::notes, serial, "").toString();
|
||||
const QString new_notes = QInputDialog::getMultiLineText(this, tr("Edit Tooltip Notes"), tr("%0\n%1").arg(name).arg(serial), old_notes, &accepted);
|
||||
|
||||
if (accepted)
|
||||
|
@ -1121,25 +1142,25 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
|||
if (new_notes.simplified().isEmpty())
|
||||
{
|
||||
m_notes.remove(serial);
|
||||
m_gui_settings->RemoveValue(gui::notes, serial);
|
||||
m_persistent_settings->RemoveValue(gui::persistent::notes, serial);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_notes.insert(serial, new_notes);
|
||||
m_gui_settings->SetValue(gui::notes, serial, new_notes);
|
||||
m_persistent_settings->SetValue(gui::persistent::notes, serial, new_notes);
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
});
|
||||
connect(copy_info, &QAction::triggered, [=, this]
|
||||
connect(copy_info, &QAction::triggered, [name, serial]
|
||||
{
|
||||
QApplication::clipboard()->setText(name % QStringLiteral(" [") % serial % QStringLiteral("]"));
|
||||
});
|
||||
connect(copy_name, &QAction::triggered, [=, this]
|
||||
connect(copy_name, &QAction::triggered, [name]
|
||||
{
|
||||
QApplication::clipboard()->setText(name);
|
||||
});
|
||||
connect(copy_serial, &QAction::triggered, [=, this]
|
||||
connect(copy_serial, &QAction::triggered, [serial]
|
||||
{
|
||||
QApplication::clipboard()->setText(serial);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue