Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCSX2-WX: Add clear list option to ISO Selector #2080

Merged
merged 1 commit into from
Oct 10, 2017

Conversation

RedPanda4552
Copy link
Sponsor Contributor

@RedPanda4552 RedPanda4552 commented Sep 28, 2017

Adds "Clear ISO List" option to ISO Selector (Issue #2071).

A look at the UI before clearing, with all my iso and bin files: https://i.imgur.com/YnPCAXQ.png
I was kind enough to give users an opportunity to change their mind: https://i.imgur.com/VUVo5l0.png
And after clearning: https://i.imgur.com/Wvsdzfn.png

Closes #2071

@lightningterror
Copy link
Contributor

Looks like you beat @ssakash to it 😆

Tested. Works properly.

@ssakash
Copy link
Member

ssakash commented Sep 28, 2017

I'm wondering if it might be a good idea to remove/gray out the menu item when there are no ISOs present in the list. Any opinion? (Personally I'd prefer destroying and appending the item over graying it out using Enable())

Turtleli was a bit faster than me on adding that Changes translatable strings label. :/

@lightningterror
Copy link
Contributor

I like your suggestion. If there are no isos then the button should disappear. Having it just grey out will make the list bigger for no reason when it's not needed.

@avih
Copy link
Contributor

avih commented Sep 28, 2017

The original intent with the grayed out items was that you could put your ISOs on an external drive and plug it in or out, and you'll know when they're available. They should get out of the list anyway when you open new ISOs. But feel free to remove it.

@pgert
Copy link
Contributor

pgert commented Sep 28, 2017

Please have the Separator lines between "Always ask when booting",
"Browse..." and "Clear ISO list" removed.
The one between these optons and the ISO-list is enough.

@RedPanda4552
Copy link
Sponsor Contributor Author

Latest commit makes the list item and separator generate in time with the ISO list itself instead of the entire sub menu.

One thing I would like to draw attention to is that doing so required MainFrame.h to be included in RecentIsoList.cpp, for the MenuIdentifiers enum to be visible. It feels dirty to include an entire header file for one enum. Is there a better way to go about this or is this an acceptable practice?

@MrCK1
Copy link
Member

MrCK1 commented Sep 28, 2017

@RedPanda4552 The recent ISO list is considered part of the mainframe. That's what all the Wx menu systems are based off of. Basically, it's necessary for compilation.

@RedPanda4552
Copy link
Sponsor Contributor Author

That helps but also raises another question. Is there a known reason RecentIsoList.cpp didn't include MainFrame.h before these changes?

@turtleli
Copy link
Member

I think you need to include App.h instead of MainFrame.h since that's where the enum actually is.

Anyway, the current behaviour isn't that nice if you clear the ISO list while a game is running. Test case:

  1. Boot game.
  2. Clear ISO list.
  3. Pause.
  4. Resume -> Cannot resume.

@lightningterror lightningterror changed the title Add clear list option to ISO Selector PCSX2-WX: Add clear list option to ISO Selector Sep 29, 2017
@RedPanda4552
Copy link
Sponsor Contributor Author

Latest commit should resolve. The CurrentIso field in the ini was being wiped regardless of running state, which when the CDVD plugin is pausing and resuming, would understandably cause problems.

@lightningterror
Copy link
Contributor

I think you can squash it if it's ready for merge.

@RedPanda4552
Copy link
Sponsor Contributor Author

And squashed.

{
if (!SysHasValidState())
SysUpdateIsoSrcFile("");

This comment was marked as spam.

@@ -35,6 +36,8 @@ RecentIsoManager::RecentIsoManager( wxMenu* menu, int firstIdForMenuItems_or_wxI
{
m_cursel = 0;
m_Separator = NULL;
m_ClearSeparator = NULL;
m_Clear = NULL;

This comment was marked as spam.

@@ -119,6 +134,9 @@ void RecentIsoManager::Repopulate()
// but the menu is composed in reverse order such that the most recent item appears at the top.
for( int i=cnt-1; i>=0; --i )
InsertIntoMenu( i );

m_ClearSeparator = m_Menu->AppendSeparator();
m_Clear = m_Menu->Append(MenuIdentifiers::MenuId_IsoClear, _("Clear ISO list"), _("Clear the ISO list to get rid of unwanted ISO files."));

This comment was marked as spam.

if (SysHasValidState())
dialog += dialog.Heading(_("(Your running ISO will remain in the list)"));

bool confirmed = (pxIssueConfirmation(dialog, MsgButtons().Yes().Cancel()) != wxID_CANCEL);

This comment was marked as spam.

dialog += dialog.Heading(_("This will clear your entire ISO list. Continue?"));

if (SysHasValidState())
dialog += dialog.Heading(_("(Your running ISO will remain in the list)"));

This comment was marked as spam.


if (confirmed)
{
if (!SysHasValidState())

This comment was marked as spam.

@RedPanda4552
Copy link
Sponsor Contributor Author

Review changes made and squashed.

@@ -99,6 +102,18 @@ void RecentIsoManager::RemoveAllFromMenu()
m_Menu->Destroy( m_Separator );
m_Separator = NULL;
}

if ( m_ClearSeparator != NULL )

This comment was marked as spam.

@turtleli
Copy link
Member

turtleli commented Oct 3, 2017

Code seems fine to me.

The buttons being Yes+Cancel feels slightly odd (I generally expect Yes+No or Ok+Cancel) but maybe that's just me.

wxDialogWithHelpers dialog(this, _("Confirm clearing ISO list"));
dialog += dialog.Heading(_("This will clear the ISO list. If an ISO is running it will remain in the list. Continue?"));

bool confirmed = pxIssueConfirmation(dialog, MsgButtons().YesNo()) != wxID_CANCEL;

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants