mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-23 11:55:00 +00:00
Replace remaining uses of QDir::currentPath() / user with UserDir.
This commit is contained in:
parent
062ee9e092
commit
54b5900498
3 changed files with 34 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/path_util.h"
|
||||
#include "game_list_frame.h"
|
||||
|
||||
GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
||||
|
@ -98,12 +99,16 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
|
|||
}
|
||||
|
||||
QString pic1Path = QString::fromStdString(m_game_info->m_games[item->row()].pic_path);
|
||||
QString blurredPic1Path =
|
||||
QDir::currentPath() +
|
||||
QString::fromStdString("/user/game_data/" + m_game_info->m_games[item->row()].serial +
|
||||
"/pic1.png");
|
||||
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::UserDir) /
|
||||
"game_data" / m_game_info->m_games[item->row()].serial /
|
||||
"pic1.png";
|
||||
#ifdef _WIN32
|
||||
const auto blurredPic1PathQt = QString::fromStdWString(blurredPic1Path.wstring());
|
||||
#else
|
||||
const auto blurredPic1PathQt = QString::fromStdString(blurredPic1Path.string());
|
||||
#endif
|
||||
|
||||
backgroundImage = QImage(blurredPic1Path);
|
||||
backgroundImage = QImage(blurredPic1PathQt);
|
||||
if (backgroundImage.isNull()) {
|
||||
QImage image(pic1Path);
|
||||
backgroundImage = m_game_list_utils.BlurImage(image, image.rect(), 16);
|
||||
|
@ -111,7 +116,7 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
|
|||
std::filesystem::path img_path =
|
||||
std::filesystem::path("user/game_data/") / m_game_info->m_games[item->row()].serial;
|
||||
std::filesystem::create_directories(img_path);
|
||||
if (!backgroundImage.save(blurredPic1Path, "PNG")) {
|
||||
if (!backgroundImage.save(blurredPic1PathQt, "PNG")) {
|
||||
// qDebug() << "Error: Unable to save image.";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue