mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
More Qt stuff
This commit is contained in:
parent
9a4f57e4e6
commit
364078339a
@ -35,7 +35,7 @@ static bool vkMarkers = false;
|
|||||||
static bool vkCrashDiagnostic = false;
|
static bool vkCrashDiagnostic = false;
|
||||||
|
|
||||||
// Gui
|
// Gui
|
||||||
std::string settings_install_dir = "";
|
std::filesystem::path settings_install_dir = "";
|
||||||
u32 main_window_geometry_x = 400;
|
u32 main_window_geometry_x = 400;
|
||||||
u32 main_window_geometry_y = 400;
|
u32 main_window_geometry_y = 400;
|
||||||
u32 main_window_geometry_w = 1280;
|
u32 main_window_geometry_w = 1280;
|
||||||
@ -415,7 +415,8 @@ void load(const std::filesystem::path& path) {
|
|||||||
mw_themes = toml::find_or<int>(gui, "theme", 0);
|
mw_themes = toml::find_or<int>(gui, "theme", 0);
|
||||||
m_window_size_W = toml::find_or<int>(gui, "mw_width", 0);
|
m_window_size_W = toml::find_or<int>(gui, "mw_width", 0);
|
||||||
m_window_size_H = toml::find_or<int>(gui, "mw_height", 0);
|
m_window_size_H = toml::find_or<int>(gui, "mw_height", 0);
|
||||||
settings_install_dir = toml::find_or<std::string>(gui, "installDir", "");
|
settings_install_dir =
|
||||||
|
toml::find_or<std::filesystem::path::string_type>(gui, "installDir", {});
|
||||||
main_window_geometry_x = toml::find_or<int>(gui, "geometry_x", 0);
|
main_window_geometry_x = toml::find_or<int>(gui, "geometry_x", 0);
|
||||||
main_window_geometry_y = toml::find_or<int>(gui, "geometry_y", 0);
|
main_window_geometry_y = toml::find_or<int>(gui, "geometry_y", 0);
|
||||||
main_window_geometry_w = toml::find_or<int>(gui, "geometry_w", 0);
|
main_window_geometry_w = toml::find_or<int>(gui, "geometry_w", 0);
|
||||||
|
@ -113,7 +113,8 @@ void GameGridFrame::SetGridBackgroundImage(int row, int column) {
|
|||||||
int itemID = (row * this->columnCount()) + column;
|
int itemID = (row * this->columnCount()) + 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;
|
||||||
|
Common::FS::PathToQString(pic1Path, (*m_games_shared)[itemID].pic_path);
|
||||||
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) /
|
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) /
|
||||||
(*m_games_shared)[itemID].serial / "pic1.png";
|
(*m_games_shared)[itemID].serial / "pic1.png";
|
||||||
QString blurredPic1PathQt;
|
QString blurredPic1PathQt;
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
|
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
|
|
||||||
|
#include "common/path_util.h"
|
||||||
#include "game_info.h"
|
#include "game_info.h"
|
||||||
|
|
||||||
GameInfoClass::GameInfoClass() = default;
|
GameInfoClass::GameInfoClass() = default;
|
||||||
GameInfoClass::~GameInfoClass() = default;
|
GameInfoClass::~GameInfoClass() = default;
|
||||||
|
|
||||||
void GameInfoClass::GetGameInfo(QWidget* parent) {
|
void GameInfoClass::GetGameInfo(QWidget* parent) {
|
||||||
QString installDir = QString::fromStdString(Config::getGameInstallDir());
|
QString installDir;
|
||||||
|
Common::FS::PathToQString(installDir, Config::getGameInstallDir());
|
||||||
QStringList filePaths;
|
QStringList filePaths;
|
||||||
QDir parentFolder(installDir);
|
QDir parentFolder(installDir);
|
||||||
QFileInfoList fileList = parentFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
QFileInfoList fileList = parentFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
@ -28,10 +28,11 @@ public:
|
|||||||
|
|
||||||
PSF psf;
|
PSF psf;
|
||||||
if (psf.Open(std::filesystem::path(game.path) / "sce_sys" / "param.sfo")) {
|
if (psf.Open(std::filesystem::path(game.path) / "sce_sys" / "param.sfo")) {
|
||||||
game.icon_path = game.path + "/sce_sys/icon0.png";
|
game.icon_path = game.path / "sce_sys" / "icon0.png";
|
||||||
QString iconpath = QString::fromStdString(game.icon_path);
|
QString iconpath;
|
||||||
|
Common::FS::PathToQString(iconpath, game.icon_path);
|
||||||
game.icon = QImage(iconpath);
|
game.icon = QImage(iconpath);
|
||||||
game.pic_path = game.path + "/sce_sys/pic1.png";
|
game.pic_path = game.path / "sce_sys" / "pic1.png";
|
||||||
if (const auto title = psf.GetString("TITLE"); title.has_value()) {
|
if (const auto title = psf.GetString("TITLE"); title.has_value()) {
|
||||||
game.name = *title;
|
game.name = *title;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@ QWidget* GameInstallDialog::SetupGamesDirectory() {
|
|||||||
|
|
||||||
// Input.
|
// Input.
|
||||||
m_gamesDirectory = new QLineEdit();
|
m_gamesDirectory = new QLineEdit();
|
||||||
m_gamesDirectory->setText(QString::fromStdString(Config::getGameInstallDir()));
|
QString install_dir;
|
||||||
|
Common::FS::PathToQString(install_dir, Config::getGameInstallDir());
|
||||||
|
m_gamesDirectory->setText(install_dir);
|
||||||
m_gamesDirectory->setMinimumWidth(400);
|
m_gamesDirectory->setMinimumWidth(400);
|
||||||
|
|
||||||
layout->addWidget(m_gamesDirectory);
|
layout->addWidget(m_gamesDirectory);
|
||||||
|
@ -80,7 +80,9 @@ void GameListFrame::PopulateGameList() {
|
|||||||
SetTableItem(i, 4, QString::fromStdString(m_game_info->m_games[i].fw));
|
SetTableItem(i, 4, QString::fromStdString(m_game_info->m_games[i].fw));
|
||||||
SetTableItem(i, 5, QString::fromStdString(m_game_info->m_games[i].size));
|
SetTableItem(i, 5, QString::fromStdString(m_game_info->m_games[i].size));
|
||||||
SetTableItem(i, 6, QString::fromStdString(m_game_info->m_games[i].version));
|
SetTableItem(i, 6, QString::fromStdString(m_game_info->m_games[i].version));
|
||||||
SetTableItem(i, 7, QString::fromStdString(m_game_info->m_games[i].path));
|
QString path;
|
||||||
|
Common::FS::PathToQString(path, m_game_info->m_games[i].path);
|
||||||
|
SetTableItem(i, 7, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +92,8 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString pic1Path = QString::fromStdString(m_game_info->m_games[item->row()].pic_path);
|
QString pic1Path;
|
||||||
|
Common::FS::PathToQString(pic1Path, m_game_info->m_games[item->row()].pic_path);
|
||||||
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) /
|
const auto blurredPic1Path = Common::FS::GetUserPath(Common::FS::PathType::MetaDataDir) /
|
||||||
m_game_info->m_games[item->row()].serial / "pic1.png";
|
m_game_info->m_games[item->row()].serial / "pic1.png";
|
||||||
QString blurredPic1PathQt;
|
QString blurredPic1PathQt;
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/path_util.h"
|
||||||
|
|
||||||
struct GameInfo {
|
struct GameInfo {
|
||||||
std::string path; // root path of game directory (normally directory that contains eboot.bin)
|
std::filesystem::path path; // root path of game directory
|
||||||
std::string icon_path; // path of icon0.png
|
// (normally directory that contains eboot.bin)
|
||||||
std::string pic_path; // path of pic1.png
|
std::filesystem::path icon_path; // path of icon0.png
|
||||||
|
std::filesystem::path pic_path; // path of pic1.png
|
||||||
QImage icon;
|
QImage icon;
|
||||||
std::string size;
|
std::string size;
|
||||||
// variables extracted from param.sfo
|
// variables extracted from param.sfo
|
||||||
@ -43,7 +46,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void GetFolderSize(GameInfo& game) {
|
static void GetFolderSize(GameInfo& game) {
|
||||||
QDir dir(QString::fromStdString(game.path));
|
QString dirPath;
|
||||||
|
Common::FS::PathToQString(dirPath, game.path);
|
||||||
|
QDir dir(dirPath);
|
||||||
QDirIterator it(dir.absolutePath(), QDirIterator::Subdirectories);
|
QDirIterator it(dir.absolutePath(), QDirIterator::Subdirectories);
|
||||||
qint64 total = 0;
|
qint64 total = 0;
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -74,7 +74,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selected == &openFolder) {
|
if (selected == &openFolder) {
|
||||||
QString folderPath = QString::fromStdString(m_games[itemID].path);
|
QString folderPath;
|
||||||
|
Common::FS::PathToQString(folderPath, m_games[itemID].path);
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(folderPath));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(folderPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +158,9 @@ public:
|
|||||||
QString gameSerial = QString::fromStdString(m_games[itemID].serial);
|
QString gameSerial = QString::fromStdString(m_games[itemID].serial);
|
||||||
QString gameVersion = QString::fromStdString(m_games[itemID].version);
|
QString gameVersion = QString::fromStdString(m_games[itemID].version);
|
||||||
QString gameSize = QString::fromStdString(m_games[itemID].size);
|
QString gameSize = QString::fromStdString(m_games[itemID].size);
|
||||||
QPixmap gameImage(QString::fromStdString(m_games[itemID].icon_path));
|
QString iconPath;
|
||||||
|
Common::FS::PathToQString(iconPath, m_games[itemID].icon_path);
|
||||||
|
QPixmap gameImage(iconPath);
|
||||||
CheatsPatches* cheatsPatches =
|
CheatsPatches* cheatsPatches =
|
||||||
new CheatsPatches(gameName, gameSerial, gameVersion, gameSize, gameImage);
|
new CheatsPatches(gameName, gameSerial, gameVersion, gameSize, gameImage);
|
||||||
cheatsPatches->show();
|
cheatsPatches->show();
|
||||||
@ -166,8 +169,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selected == &openTrophyViewer) {
|
if (selected == &openTrophyViewer) {
|
||||||
QString trophyPath = QString::fromStdString(m_games[itemID].serial);
|
QString trophyPath, gameTrpPath;
|
||||||
QString gameTrpPath = QString::fromStdString(m_games[itemID].path);
|
Common::FS::PathToQString(trophyPath, m_games[itemID].serial);
|
||||||
|
Common::FS::PathToQString(gameTrpPath, m_games[itemID].path);
|
||||||
TrophyViewer* trophyViewer = new TrophyViewer(trophyPath, gameTrpPath);
|
TrophyViewer* trophyViewer = new TrophyViewer(trophyPath, gameTrpPath);
|
||||||
trophyViewer->show();
|
trophyViewer->show();
|
||||||
connect(widget->parent(), &QWidget::destroyed, trophyViewer,
|
connect(widget->parent(), &QWidget::destroyed, trophyViewer,
|
||||||
@ -175,11 +179,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selected == &createShortcut) {
|
if (selected == &createShortcut) {
|
||||||
QString targetPath = QString::fromStdString(m_games[itemID].path);
|
QString targetPath;
|
||||||
|
Common::FS::PathToQString(targetPath, m_games[itemID].path);
|
||||||
QString ebootPath = targetPath + "/eboot.bin";
|
QString ebootPath = targetPath + "/eboot.bin";
|
||||||
|
|
||||||
// Get the full path to the icon
|
// Get the full path to the icon
|
||||||
QString iconPath = QString::fromStdString(m_games[itemID].icon_path);
|
QString iconPath;
|
||||||
|
Common::FS::PathToQString(iconPath, m_games[itemID].icon_path);
|
||||||
QFileInfo iconFileInfo(iconPath);
|
QFileInfo iconFileInfo(iconPath);
|
||||||
QString icoPath = iconFileInfo.absolutePath() + "/" + iconFileInfo.baseName() + ".ico";
|
QString icoPath = iconFileInfo.absolutePath() + "/" + iconFileInfo.baseName() + ".ico";
|
||||||
|
|
||||||
|
@ -416,12 +416,14 @@ void MainWindow::CreateConnects() {
|
|||||||
.arg(" APP VERSION", -11)
|
.arg(" APP VERSION", -11)
|
||||||
.arg(" Path");
|
.arg(" Path");
|
||||||
for (const GameInfo& game : m_game_info->m_games) {
|
for (const GameInfo& game : m_game_info->m_games) {
|
||||||
|
QString game_path;
|
||||||
|
Common::FS::PathToQString(game_path, game.path);
|
||||||
out << QString("%1 %2 %3 %4 %5\n")
|
out << QString("%1 %2 %3 %4 %5\n")
|
||||||
.arg(QString::fromStdString(game.name), -50)
|
.arg(QString::fromStdString(game.name), -50)
|
||||||
.arg(QString::fromStdString(game.serial), -10)
|
.arg(QString::fromStdString(game.serial), -10)
|
||||||
.arg(QString::fromStdString(game.fw), -4)
|
.arg(QString::fromStdString(game.fw), -4)
|
||||||
.arg(QString::fromStdString(game.version), -11)
|
.arg(QString::fromStdString(game.version), -11)
|
||||||
.arg(QString::fromStdString(game.path));
|
.arg(game_path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -492,18 +494,18 @@ void MainWindow::StartGame() {
|
|||||||
if (table_mode == 0) {
|
if (table_mode == 0) {
|
||||||
if (m_game_list_frame->currentItem()) {
|
if (m_game_list_frame->currentItem()) {
|
||||||
int itemID = m_game_list_frame->currentItem()->row();
|
int itemID = m_game_list_frame->currentItem()->row();
|
||||||
gamePath = QString::fromStdString(m_game_info->m_games[itemID].path + "/eboot.bin");
|
Common::FS::PathToQString(gamePath, m_game_info->m_games[itemID].path / "eboot.bin");
|
||||||
}
|
}
|
||||||
} else if (table_mode == 1) {
|
} else if (table_mode == 1) {
|
||||||
if (m_game_grid_frame->cellClicked) {
|
if (m_game_grid_frame->cellClicked) {
|
||||||
int itemID = (m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt) +
|
int itemID = (m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt) +
|
||||||
m_game_grid_frame->crtColumn;
|
m_game_grid_frame->crtColumn;
|
||||||
gamePath = QString::fromStdString(m_game_info->m_games[itemID].path + "/eboot.bin");
|
Common::FS::PathToQString(gamePath, m_game_info->m_games[itemID].path / "eboot.bin");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_elf_viewer->currentItem()) {
|
if (m_elf_viewer->currentItem()) {
|
||||||
int itemID = m_elf_viewer->currentItem()->row();
|
int itemID = m_elf_viewer->currentItem()->row();
|
||||||
gamePath = QString::fromStdString(m_elf_viewer->m_elf_list[itemID].toStdString());
|
gamePath = m_elf_viewer->m_elf_list[itemID];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gamePath != "") {
|
if (gamePath != "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user