Game List: Added Ability to Manually Edit Play Time - #14085
Conversation
There was a problem hiding this comment.
Thank you for submitting a contribution to PCSX2
As this is your first pull request, please be aware of the contributing guidelines.
Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.
Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!
|
Could this not all be done in the same dialogue instead of having 3 separate ones? It seems a little cumbersome to have to go through so many different dialogues, you could easily put hours, minutes and seconds next to each other and reference them separately. |
I agree with you on that. The reason I did three separate dialogues is that it was the easiest way to implement this feature while forcing valid input (i.e., ensuring only valid inputs come in). I'll work on it a bit more to see if I can come up with a better solution. One way I'm thinking is to take a single string input and parse it into separate parts after (into hours, minutes, and seconds), and another way is to write a custom dialogue. If you have any suggestions or ideas, let me know. |
|
To be fair, editing the number of seconds of playtime is probably not needed either. We can reset the existing seconds component of the playtime to 0 when it's edited, and only ask for hours and minutes. If you want to simplify things further, you could only expose an hours field but allow floating-point values, so that minutes can be specified like |
That's actually a great solution. I'll work on it once I get the chance. |
| if (entry_played_time) | ||
| connect(menu.addAction(tr("Reset Play Time")), &QAction::triggered, [this, entry, entry_played_time]() { clearGameListEntryPlayTime(*entry, entry_played_time); }); | ||
| // Show this option whether play time exists or not. | ||
| connect(menu.addAction(tr("Edit Play Time")), &QAction::triggered, [this, entry, entry_played_time]() { editGameListEntryPlayTime(*entry, entry_played_time); }); |
There was a problem hiding this comment.
I would put this before "Reset Play Time"
|
|
||
| bool ok; | ||
| double new_hours_minutes = QInputDialog::getDouble(this, tr("Edit Play Time For %1").arg(entry.title.empty() ? tr("empty title") : QString::fromStdString(entry.title)), | ||
| tr("Enter Play Time in Hours (Min: 0.00, Max: 99999.99):"), hours_minutes, 0.00, 99999.99, 2, &ok, Qt::WindowFlags(), 0.01); |
There was a problem hiding this comment.
I don't think the user needs to see "Min: 0.00", it's obvious that the minimum value is zero. And personally I'd remove the whole "(Min: 0.00, Max: 99999.99)" part of the label.
| if (ok) | ||
| { | ||
| const int new_hours = static_cast<u32>(new_hours_minutes); | ||
| const int new_minutes = static_cast<u32>((new_hours_minutes - new_hours) * 60); |
There was a problem hiding this comment.
you can use std::modf() to separate integral and fractional parts.
| // Weird solution (i.e., to add the difference) to use the same function to update the file, but it works! | ||
| const PlayedTimeEntry pt(UpdatePlayedTimeFile(GetPlayedTimeFile(), serial, current_last, (new_time - current_time))); | ||
|
|
||
| for (GameList::Entry& entry : s_entries) |
There was a problem hiding this comment.
why do you need to iterate the game list twice? can you not do the update in a single pass?

Description of Changes
Added the option/ability to manually edit play time if needed in non Big Picture Mode (Qt).




Rationale behind Changes
If a user accidentally resets their play time, or if they would like to retain their play time on different devices (e.g., a desktop and a handheld PC), they can now manually edit the play time (Resolves #13007).
Suggested Testing Steps
playtime.datbefore, after, and at the same time as manually editing in the app, to see if anything breaks. I couldn't find any issues.Did you use AI to help find, test, or implement this issue or feature?
No.
I can try to add this feature to the Big Picture Mode (FSUI) as well, but I had a bit of trouble wrapping my head around getting things to work with ImGui, as I don't have any experience with it. If you would like me to try some more, let me know, but if someone else wants to do it, feel free to do so.