mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
gui: Add delete shader cache option in the context menu
This commit is contained in:
parent
6eb1786635
commit
0dc24799f1
2 changed files with 30 additions and 0 deletions
|
@ -617,6 +617,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
|
|||
myMenu.addSeparator();
|
||||
QAction* removeGame = myMenu.addAction(tr("&Remove"));
|
||||
QAction* removeConfig = myMenu.addAction(tr("&Remove Custom Configuration"));
|
||||
QAction* deleteShadersCache = myMenu.addAction(tr("&Delete Shaders Cache"));
|
||||
myMenu.addSeparator();
|
||||
QAction* openGameFolder = myMenu.addAction(tr("&Open Install Folder"));
|
||||
QAction* openConfig = myMenu.addAction(tr("&Open Config Folder"));
|
||||
|
@ -642,7 +643,9 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
|
|||
Refresh();
|
||||
}
|
||||
});
|
||||
|
||||
connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); Refresh(true, false); });
|
||||
connect(deleteShadersCache, &QAction::triggered, [=]() { DeleteShadersCache(row); });
|
||||
connect(openGameFolder, &QAction::triggered, [=]() {open_dir(currGame.path); });
|
||||
connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); });
|
||||
connect(checkCompat, &QAction::triggered, [=]() {
|
||||
|
@ -722,6 +725,32 @@ void game_list_frame::RemoveCustomConfiguration(int row)
|
|||
}
|
||||
}
|
||||
|
||||
void game_list_frame::DeleteShadersCache(int row)
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Confirm Delete"), tr("Delete shaders cache?")) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
const std::string config_base_dir = fs::get_config_dir() + "data/" + m_game_data[row].info.serial;
|
||||
|
||||
if (fs::is_dir(config_base_dir))
|
||||
{
|
||||
fs::dir root = fs::dir(config_base_dir);
|
||||
fs::dir_entry tmp;
|
||||
|
||||
while (root.read(tmp))
|
||||
{
|
||||
if (!fs::is_dir(config_base_dir + "/" + tmp.name))
|
||||
continue;
|
||||
|
||||
const std::string shader_cache_name = config_base_dir + "/" + tmp.name + "/shaders_cache";
|
||||
if (fs::is_dir(shader_cache_name))
|
||||
{
|
||||
fs::remove_all(shader_cache_name, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap game_list_frame::PaintedPixmap(const QImage& img, bool paintConfigIcon)
|
||||
{
|
||||
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
|
||||
|
|
|
@ -216,6 +216,7 @@ public Q_SLOTS:
|
|||
|
||||
private Q_SLOTS:
|
||||
void RemoveCustomConfiguration(int row);
|
||||
void DeleteShadersCache(int row);
|
||||
void OnColClicked(int col);
|
||||
void ShowContextMenu(const QPoint &pos);
|
||||
void ShowSpecifiedContextMenu(const QPoint &pos, int index); // Different name because the notation for overloaded connects is messy
|
||||
|
|
Loading…
Add table
Reference in a new issue