mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 18:58:36 +12:00
Qt: add sanity check to remove game (prevent nasty system flush).
and minor code refactor
This commit is contained in:
parent
ff2c05da50
commit
29318803a6
1 changed files with 9 additions and 9 deletions
|
@ -591,7 +591,13 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
});
|
});
|
||||||
connect(removeGame, &QAction::triggered, [=]
|
connect(removeGame, &QAction::triggered, [=]
|
||||||
{
|
{
|
||||||
QMessageBox* mb = new QMessageBox(QMessageBox::Question, tr("Confirm %1 Removal").arg(qstr(currGame.category)), tr("Permanently remove %1 from drive?").arg(qstr(currGame.name)), QMessageBox::Yes | QMessageBox::No, this);
|
if (currGame.path.empty())
|
||||||
|
{
|
||||||
|
LOG_FATAL(GENERAL, "Cannot delete game. Path is empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox* mb = new QMessageBox(QMessageBox::Question, tr("Confirm %1 Removal").arg(qstr(currGame.category)), tr("Permanently remove %0 from drive?\nPath: %1").arg(qstr(currGame.name)).arg(qstr(currGame.path)), QMessageBox::Yes | QMessageBox::No, this);
|
||||||
mb->setCheckBox(new QCheckBox(tr("Remove caches and custom config")));
|
mb->setCheckBox(new QCheckBox(tr("Remove caches and custom config")));
|
||||||
mb->deleteLater();
|
mb->deleteLater();
|
||||||
if (mb->exec() == QMessageBox::Yes)
|
if (mb->exec() == QMessageBox::Yes)
|
||||||
|
@ -1020,14 +1026,8 @@ void game_list_frame::PopulateGameGrid(int maxCols, const QSize& image_size, con
|
||||||
{ // For whatever reason, 0%x is division by zero. Absolute nonsense by definition of modulus. But, I'll acquiesce.
|
{ // For whatever reason, 0%x is division by zero. Absolute nonsense by definition of modulus. But, I'll acquiesce.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (maxCols == 0)
|
|
||||||
{
|
maxCols = std::clamp(maxCols, 1, entries);
|
||||||
maxCols = 1;
|
|
||||||
}
|
|
||||||
if (maxCols > entries)
|
|
||||||
{
|
|
||||||
maxCols = entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
int needsExtraRow = (entries % maxCols) != 0;
|
int needsExtraRow = (entries % maxCols) != 0;
|
||||||
int maxRows = needsExtraRow + entries / maxCols;
|
int maxRows = needsExtraRow + entries / maxCols;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue