Merge pull request #314 from squidbus/game-data-path
Replace remaining uses of `QDir::currentPath() / "user"` with `GetUserPath(UserDir)`.
This commit is contained in:
commit
7f990ea90d
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/path_util.h"
|
||||||
#include "game_grid_frame.h"
|
#include "game_grid_frame.h"
|
||||||
|
|
||||||
GameGridFrame::GameGridFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
GameGridFrame::GameGridFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
||||||
|
@ -113,12 +114,15 @@ void GameGridFrame::SetGridBackgroundImage(int row, int column) {
|
||||||
QWidget* item = this->cellWidget(row, column);
|
QWidget* item = this->cellWidget(row, column);
|
||||||
if (item) {
|
if (item) {
|
||||||
QString pic1Path = QString::fromStdString((*m_games_shared)[itemID].pic_path);
|
QString pic1Path = QString::fromStdString((*m_games_shared)[itemID].pic_path);
|
||||||
QString blurredPic1Path =
|
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::UserDir) /
|
||||||
QDir::currentPath() +
|
"game_data" / (*m_games_shared)[itemID].serial / "pic1.png";
|
||||||
QString::fromStdString("/user/game_data/" + (*m_games_shared)[itemID].serial +
|
#ifdef _WIN32
|
||||||
"/pic1.png");
|
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()) {
|
if (backgroundImage.isNull()) {
|
||||||
QImage image(pic1Path);
|
QImage image(pic1Path);
|
||||||
backgroundImage = m_game_list_utils.BlurImage(image, image.rect(), 16);
|
backgroundImage = m_game_list_utils.BlurImage(image, image.rect(), 16);
|
||||||
|
@ -126,7 +130,7 @@ void GameGridFrame::SetGridBackgroundImage(int row, int column) {
|
||||||
std::filesystem::path img_path =
|
std::filesystem::path img_path =
|
||||||
std::filesystem::path("user/game_data/") / (*m_games_shared)[itemID].serial;
|
std::filesystem::path("user/game_data/") / (*m_games_shared)[itemID].serial;
|
||||||
std::filesystem::create_directories(img_path);
|
std::filesystem::create_directories(img_path);
|
||||||
if (!backgroundImage.save(blurredPic1Path, "PNG")) {
|
if (!backgroundImage.save(blurredPic1PathQt, "PNG")) {
|
||||||
// qDebug() << "Error: Unable to save image.";
|
// qDebug() << "Error: Unable to save image.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/path_util.h"
|
||||||
#include "game_list_frame.h"
|
#include "game_list_frame.h"
|
||||||
|
|
||||||
GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
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 pic1Path = QString::fromStdString(m_game_info->m_games[item->row()].pic_path);
|
||||||
QString blurredPic1Path =
|
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::UserDir) /
|
||||||
QDir::currentPath() +
|
"game_data" / m_game_info->m_games[item->row()].serial /
|
||||||
QString::fromStdString("/user/game_data/" + m_game_info->m_games[item->row()].serial +
|
"pic1.png";
|
||||||
"/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()) {
|
if (backgroundImage.isNull()) {
|
||||||
QImage image(pic1Path);
|
QImage image(pic1Path);
|
||||||
backgroundImage = m_game_list_utils.BlurImage(image, image.rect(), 16);
|
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 img_path =
|
||||||
std::filesystem::path("user/game_data/") / m_game_info->m_games[item->row()].serial;
|
std::filesystem::path("user/game_data/") / m_game_info->m_games[item->row()].serial;
|
||||||
std::filesystem::create_directories(img_path);
|
std::filesystem::create_directories(img_path);
|
||||||
if (!backgroundImage.save(blurredPic1Path, "PNG")) {
|
if (!backgroundImage.save(blurredPic1PathQt, "PNG")) {
|
||||||
// qDebug() << "Error: Unable to save image.";
|
// qDebug() << "Error: Unable to save image.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/path_util.h"
|
||||||
#include "trophy_viewer.h"
|
#include "trophy_viewer.h"
|
||||||
|
|
||||||
TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindow() {
|
TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindow() {
|
||||||
|
@ -19,8 +20,17 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrophyViewer::PopulateTrophyWidget(QString title) {
|
void TrophyViewer::PopulateTrophyWidget(QString title) {
|
||||||
QString trophyDir = QDir::currentPath() + "/user/game_data/" + title + "/TrophyFiles";
|
#ifdef _WIN32
|
||||||
QDir dir(trophyDir);
|
const auto trophyDir = Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "game_data" /
|
||||||
|
title.toStdWString() / "TrophyFiles";
|
||||||
|
const auto trophyDirQt = QString::fromStdWString(trophyDir.wstring());
|
||||||
|
#else
|
||||||
|
const auto trophyDir = Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "game_data" /
|
||||||
|
title.toStdString() / "TrophyFiles";
|
||||||
|
const auto trophyDirQt = QString::fromStdString(trophyDir.string());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QDir dir(trophyDirQt);
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
std::filesystem::path path(gameTrpPath_.toStdString());
|
std::filesystem::path path(gameTrpPath_.toStdString());
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
@ -35,7 +45,7 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
||||||
|
|
||||||
for (const QFileInfo& dirInfo : dirList) {
|
for (const QFileInfo& dirInfo : dirList) {
|
||||||
QString tabName = dirInfo.fileName();
|
QString tabName = dirInfo.fileName();
|
||||||
QString trpDir = trophyDir + "/" + tabName;
|
QString trpDir = trophyDirQt + "/" + tabName;
|
||||||
|
|
||||||
QString iconsPath = trpDir + "/Icons";
|
QString iconsPath = trpDir + "/Icons";
|
||||||
QDir iconsDir(iconsPath);
|
QDir iconsDir(iconsPath);
|
||||||
|
|
Loading…
Reference in New Issue