mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
Sort / Formatting
This commit is contained in:
parent
7af54db2f0
commit
5993a42908
@ -81,8 +81,8 @@ Emulator::Emulator() {
|
|||||||
// Load renderdoc module.
|
// Load renderdoc module.
|
||||||
VideoCore::LoadRenderDoc();
|
VideoCore::LoadRenderDoc();
|
||||||
|
|
||||||
#ifdef ENABLE_QT_GUI
|
|
||||||
// Start the timer (Play Time)
|
// Start the timer (Play Time)
|
||||||
|
#ifdef ENABLE_QT_GUI
|
||||||
start_time = std::chrono::steady_clock::now();
|
start_time = std::chrono::steady_clock::now();
|
||||||
const auto user_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
const auto user_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||||
QString filePath = QString::fromStdString((user_dir / "play_time.txt").string());
|
QString filePath = QString::fromStdString((user_dir / "play_time.txt").string());
|
||||||
|
@ -60,6 +60,9 @@ public:
|
|||||||
if (auto app_ver = psf.GetString("APP_VER"); app_ver.has_value()) {
|
if (auto app_ver = psf.GetString("APP_VER"); app_ver.has_value()) {
|
||||||
game.version = *app_ver;
|
game.version = *app_ver;
|
||||||
}
|
}
|
||||||
|
if (const auto play_time = psf.GetString("PLAY_TIME"); play_time.has_value()) {
|
||||||
|
game.play_time = *play_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidg
|
|||||||
this->setColumnWidth(5, 90); // Size
|
this->setColumnWidth(5, 90); // Size
|
||||||
this->setColumnWidth(6, 90); // Version
|
this->setColumnWidth(6, 90); // Version
|
||||||
this->setColumnWidth(7, 100); // Play Time
|
this->setColumnWidth(7, 100); // Play Time
|
||||||
this->setColumnWidth(8, 90); // Path
|
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
headers << tr("Icon") << tr("Name") << tr("Serial") << tr("Region") << tr("Firmware")
|
headers << tr("Icon") << tr("Name") << tr("Serial") << tr("Region") << tr("Firmware")
|
||||||
<< tr("Size") << tr("Version") << tr("Play Time") << tr("Path");
|
<< tr("Size") << tr("Version") << tr("Play Time") << tr("Path");
|
||||||
@ -104,7 +103,30 @@ void GameListFrame::PopulateGameList() {
|
|||||||
SetTableItem(i, 6, QString::fromStdString(m_game_info->m_games[i].version));
|
SetTableItem(i, 6, QString::fromStdString(m_game_info->m_games[i].version));
|
||||||
|
|
||||||
QString playTime = GetPlayTime(m_game_info->m_games[i].serial);
|
QString playTime = GetPlayTime(m_game_info->m_games[i].serial);
|
||||||
SetTableItem(i, 7, playTime);
|
if (playTime.isEmpty()) {
|
||||||
|
m_game_info->m_games[i].play_time = "0:00:00";
|
||||||
|
SetTableItem(i, 7, "0");
|
||||||
|
} else {
|
||||||
|
QStringList timeParts = playTime.split(':');
|
||||||
|
int hours = timeParts[0].toInt();
|
||||||
|
int minutes = timeParts[1].toInt();
|
||||||
|
int seconds = timeParts[2].toInt();
|
||||||
|
|
||||||
|
QString formattedPlayTime;
|
||||||
|
if (hours > 0) {
|
||||||
|
formattedPlayTime += QString("%1h ").arg(hours);
|
||||||
|
}
|
||||||
|
if (minutes > 0) {
|
||||||
|
formattedPlayTime += QString("%1m ").arg(minutes);
|
||||||
|
}
|
||||||
|
if (seconds > 0 || formattedPlayTime.isEmpty()) {
|
||||||
|
formattedPlayTime += QString("%1s").arg(seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
formattedPlayTime = formattedPlayTime.trimmed();
|
||||||
|
m_game_info->m_games[i].play_time = playTime.toStdString();
|
||||||
|
SetTableItem(i, 7, formattedPlayTime);
|
||||||
|
}
|
||||||
|
|
||||||
QString path;
|
QString path;
|
||||||
Common::FS::PathToQString(path, m_game_info->m_games[i].path);
|
Common::FS::PathToQString(path, m_game_info->m_games[i].path);
|
||||||
|
Loading…
Reference in New Issue
Block a user