VirtualBox

Changeset 85634 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 6, 2020 10:37:12 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139744
Message:

FE/Qt: bugref:9609: A bit of cleanup for action-pool stuff: Move virtual state handler for UIAction class to separate method, previously was absent and inherited classes had to use retranslateUi for that.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp

    r85632 r85634  
    130130    updateIcon();
    131131    retranslateUi();
     132    handleStateChange();
    132133}
    133134
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r85632 r85634  
    5454    UIActionType_Simple,
    5555    UIActionType_Toggle,
    56     UIActionType_Polymorphic,
    5756    UIActionType_PolymorphicMenu
    5857};
     
    267266    UIAction(UIActionPool *pParent, UIActionType enmType, bool fMachineMenuAction = false);
    268267
     268    /** Handles state change. */
     269    virtual void handleStateChange() {}
     270
    269271    /** Returns current action name in menu. */
    270272    QString nameInMenu() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp

    r85633 r85634  
    951951            case 0:
    952952            {
    953                 showMenu();
    954953                setName(QApplication::translate("UIActionPool", "S&tart"));
    955954                setStatusTip(QApplication::translate("UIActionPool", "Start selected virtual machines"));
     
    959958            case 1:
    960959            {
    961                 hideMenu();
    962960                setName(QApplication::translate("UIActionPool", "S&how"));
    963961                setStatusTip(QApplication::translate("UIActionPool", "Switch to the windows of selected virtual machines"));
     
    967965            default:
    968966                break;
     967        }
     968    }
     969
     970    /** Handles state change. */
     971    virtual void handleStateChange() /* override */
     972    {
     973        switch (state())
     974        {
     975            case 0: showMenu(); break;
     976            case 1: hideMenu(); break;
     977            default: break;
    969978        }
    970979    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette