Qt: PCSX2 UI fix backports
This commit is contained in:
@ -1417,13 +1417,25 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
|
||||
|
||||
void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry)
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this, tr("Select Cover Image"), QString(),
|
||||
tr("All Cover Image Types (*.jpg *.jpeg *.png)"));
|
||||
const QString filename = QDir::toNativeSeparators(QFileDialog::getOpenFileName(
|
||||
this, tr("Select Cover Image"), QString(), tr("All Cover Image Types (*.jpg *.jpeg *.png *.webp)")));
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
|
||||
if (!GameList::GetCoverImagePathForEntry(entry).empty())
|
||||
const QString old_filename = QString::fromStdString(GameList::GetCoverImagePathForEntry(entry));
|
||||
const QString new_filename =
|
||||
QString::fromStdString(GameList::GetNewCoverImagePathForEntry(entry, filename.toUtf8().constData(), false));
|
||||
if (new_filename.isEmpty())
|
||||
return;
|
||||
|
||||
if (!old_filename.isEmpty())
|
||||
{
|
||||
if (QFileInfo(old_filename) == QFileInfo(filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("You must select a different file to the current cover image."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this, tr("Cover Already Exists"),
|
||||
tr("A cover image for this game already exists, do you wish to replace it?"),
|
||||
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
|
||||
@ -1432,23 +1444,21 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry)
|
||||
}
|
||||
}
|
||||
|
||||
QString new_filename =
|
||||
QString::fromStdString(GameList::GetNewCoverImagePathForEntry(entry, filename.toStdString().c_str(), false));
|
||||
if (new_filename.isEmpty())
|
||||
return;
|
||||
|
||||
if (QFile::exists(new_filename) && !QFile::remove(new_filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("Failed to remove existing cover '%1'").arg(new_filename));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QFile::copy(filename, new_filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("Failed to copy '%1' to '%2'").arg(filename).arg(new_filename));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!old_filename.isEmpty() && old_filename != new_filename && !QFile::remove(old_filename))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Copy Error"), tr("Failed to remove '%1'").arg(old_filename));
|
||||
return;
|
||||
}
|
||||
m_game_list_widget->refreshGridCovers();
|
||||
}
|
||||
|
||||
@ -2068,7 +2078,12 @@ void MainWindow::updateTheme()
|
||||
{
|
||||
updateApplicationTheme();
|
||||
updateMenuSelectedTheme();
|
||||
m_game_list_widget->reloadCommonImages();
|
||||
reloadThemeSpecificImages();
|
||||
}
|
||||
|
||||
void MainWindow::reloadThemeSpecificImages()
|
||||
{
|
||||
m_game_list_widget->reloadThemeSpecificImages();
|
||||
}
|
||||
|
||||
void MainWindow::setStyleFromSettings()
|
||||
@ -2405,6 +2420,12 @@ void MainWindow::changeEvent(QEvent* event)
|
||||
g_emu_thread->redrawDisplayWindow();
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::StyleChange)
|
||||
{
|
||||
setIconThemeFromSettings();
|
||||
reloadThemeSpecificImages();
|
||||
}
|
||||
|
||||
QMainWindow::changeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user