1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

Add cache removal to UI

This commit is contained in:
msuih 2019-09-07 17:39:40 +03:00 committed by Megamouse
parent 84867b0848
commit 5ed700db5d
4 changed files with 25 additions and 1 deletions

View File

@ -345,11 +345,11 @@ public:
private:
static std::string GetEmuDir();
static std::string GetHdd1Dir();
void LimitCacheSize();
public:
static std::string GetHddDir();
static std::string GetHdd1Dir();
static std::string GetSfoDirFromGamePath(const std::string& game_path, const std::string& user, const std::string& title_id = "");
static std::string GetCustomConfigDir();

View File

@ -1186,6 +1186,8 @@ void main_window::CreateConnects()
connect(ui->batchRemoveCustomConfigurationsAct, &QAction::triggered, m_gameListFrame, &game_list_frame::BatchRemoveCustomConfigurations);
connect(ui->batchRemoveCustomPadConfigurationsAct, &QAction::triggered, m_gameListFrame, &game_list_frame::BatchRemoveCustomPadConfigurations);
connect(ui->removeDiskCacheAct, &QAction::triggered, this, &main_window::RemoveDiskCache);
connect(ui->sysPauseAct, &QAction::triggered, this, &main_window::OnPlayOrPause);
connect(ui->sysStopAct, &QAction::triggered, [=]() { Emu.Stop(); });
connect(ui->sysRebootAct, &QAction::triggered, [=]() { Emu.Restart(); });
@ -1637,6 +1639,20 @@ void main_window::SetIconSizeActions(int idx)
ui->setIconSizeLargeAct->setChecked(true);
}
void main_window::RemoveDiskCache()
{
std::string cacheDir = Emulator::GetHdd1Dir() + "/cache";
if (fs::is_dir(cacheDir) && fs::remove_all(cacheDir, false))
{
QMessageBox::information(this, tr("Cache Cleared"), tr("Disk cache was cleared successfully"));
}
else
{
QMessageBox::warning(this, tr("Error"), tr("Could not remove disk cache"));
}
}
void main_window::keyPressEvent(QKeyEvent *keyEvent)
{
if (((keyEvent->modifiers() & Qt::AltModifier) && keyEvent->key() == Qt::Key_Return) || (isFullScreen() && keyEvent->key() == Qt::Key_Escape))

View File

@ -126,6 +126,7 @@ private:
QAction* CreateRecentAction(const q_string_pair& entry, const uint& sc_idx);
void BootRecentAction(const QAction* act);
void AddRecentAction(const q_string_pair& entry);
void RemoveDiskCache();
q_pair_list m_rg_entries;
QList<QAction*> m_recentGameActs;

View File

@ -176,6 +176,8 @@
<addaction name="batchRemovePPUCachesAct"/>
<addaction name="batchRemoveSPUCachesAct"/>
<addaction name="batchRemoveShaderCachesAct"/>
<addaction name="separator"/>
<addaction name="removeDiskCacheAct"/>
</widget>
<addaction name="bootElfAct"/>
<addaction name="bootGameAct"/>
@ -1001,6 +1003,11 @@
<string>Remove Custom Pad Configurations</string>
</property>
</action>
<action name="removeDiskCacheAct">
<property name="text">
<string>Remove Disk Cache</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>