Rosalie241 / RMG

Rosalie's Mupen GUI
GNU General Public License v3.0
612 stars 52 forks source link

Disable Actions in RomBrowser ContextMenu when not needed #24

Closed JakobDev closed 2 years ago

JakobDev commented 2 years ago

If no ROM is selected, the Actions that refer to a selected ROM are disabled now. This also fixes a Crash when Play Game is clicked without a ROM selected.

Rosalie241 commented 2 years ago

Wouldn't code like this work better and make more sense? As-in just don't show the popup when there's nothing selected.

void RomBrowserWidget::customContextMenuRequested(QPoint position)
{
    if (this->selectedIndexes().count() > 0)
    {
        this->contextMenu->popup(this->viewport()->mapToGlobal(position));
    }
}
JakobDev commented 2 years ago
  1. The context menu contains 2 Actions (Refresh and choose ROM Directory) which doesn't depends on a selected Game.
  2. Showing a context menu with disabled Actions, is what most programs do, so it's the behavior that a User expects.
Rosalie241 commented 2 years ago
  1. The context menu contains 2 Actions (Refresh and choose ROM Directory) which doesn't depends on a selected Game.

  2. Showing a context menu with disabled Actions, is what most programs do, so it's the behavior that a User expects.

Fair, if you fix my nitpick, I'll merge it, thank you ❤️

Rosalie241 commented 2 years ago

Thank you :heart: