VirtualBox

Changeset 85641 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 7, 2020 11:21:11 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9609: A bit of cleanup for action-pool stuff: Mostly coding-style and reordering.

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

Legend:

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

    r85634 r85641  
    102102UIAction::UIAction(UIActionPool *pParent, UIActionType enmType, bool fMachineMenuAction /* = false */)
    103103    : QAction(pParent)
     104    , m_pActionPool(pParent)
     105    , m_enmActionPoolType(pParent->type())
    104106    , m_enmType(enmType)
    105107    , m_fMachineMenuAction(fMachineMenuAction)
    106     , m_pActionPool(pParent)
    107     , m_enmActionPoolType(pParent->type())
    108108    , m_iState(0)
    109109    , m_fShortcutHidden(false)
     
    228228                case UIActionPoolType_Runtime:
    229229                {
    230                     if (machineMenuAction())
     230                    if (m_fMachineMenuAction)
    231231                        setText(uiCommon().insertKeyToActionText(nameInMenu(),
    232232                                                                 gShortcutPool->shortcut(actionPool(), this).primaryToPortableText()));
     
    513513};
    514514
    515 
    516515/** Simple action extension, used as 'Close' action class. */
    517516class UIActionSimplePerformClose : public UIActionSimple
     
    609608};
    610609
    611 
    612610/** Simple action extension, used as 'Minimize' action class. */
    613611class UIActionSimpleMinimize : public UIActionSimple
     
    655653#endif /* VBOX_WS_MAC */
    656654
    657 
    658655/** Menu action extension, used as 'Help' menu class. */
    659656class UIActionMenuHelp : public UIActionMenu
     
    694691    }
    695692};
    696 
    697693
    698694/** Simple action extension, used as 'Contents' action class. */
     
    753749};
    754750
    755 
    756751/** Simple action extension, used as 'Web Site' action class. */
    757752class UIActionSimpleWebSite : public UIActionSimple
     
    800795};
    801796
    802 
    803797/** Simple action extension, used as 'Bug Tracker' action class. */
    804798class UIActionSimpleBugTracker : public UIActionSimple
     
    847841};
    848842
    849 
    850843/** Simple action extension, used as 'Forums' action class. */
    851844class UIActionSimpleForums : public UIActionSimple
     
    894887};
    895888
    896 
    897889/** Simple action extension, used as 'Oracle' action class. */
    898890class UIActionSimpleOracle : public UIActionSimple
     
    941933};
    942934
    943 
    944935/** Simple action extension, used as 'Reset Warnings' action class. */
    945936class UIActionSimpleResetWarnings : public UIActionSimple
     
    988979    }
    989980};
    990 
    991981
    992982#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     
    10381028};
    10391029
    1040 
    10411030/** Simple action extension, used as 'Check for Updates' action class. */
    10421031class UIActionSimpleCheckForUpdates : public UIActionSimple
     
    10861075};
    10871076#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    1088 
    10891077
    10901078/** Simple action extension, used as 'About' action class. */
     
    11461134    }
    11471135};
    1148 
    11491136
    11501137/** Simple action extension, used as 'Preferences' action class. */
     
    15691556};
    15701557
    1571 
    15721558/** Simple action extension, used as 'Copy to Guest' in file manager action class. */
    15731559class UIActionMenuFileManagerCopyToGuest : public UIActionSimple
     
    18491835};
    18501836
    1851 
    18521837/** Simple action extension, used as 'Perform GoHome' in file manager action class. */
    18531838class UIActionMenuFileManagerGoHome : public UIActionSimple
     
    18891874};
    18901875
    1891 
    18921876/** Simple action extension, used as 'Perform Delete' in file manager action class. */
    18931877class UIActionMenuFileManagerDelete : public UIActionSimple
     
    19681952};
    19691953
    1970 
    19711954/** Simple action extension, used as 'Perform Rename' in file manager action class. */
    19721955class UIActionMenuFileManagerRename : public UIActionSimple
     
    20452028};
    20462029
    2047 
    20482030/** Simple action extension, used as 'Perform Copy' in file manager action class. */
    20492031class UIActionMenuFileManagerCopy : public UIActionSimple
     
    21982180};
    21992181
    2200 
    22012182/** Simple action extension, used as 'Invert Selection' in file manager action class. */
    22022183class UIActionMenuFileManagerInvertSelection : public UIActionSimple
     
    22372218};
    22382219
    2239 
    22402220/** Simple action extension, used as 'Show Properties' in file manager action class. */
    22412221class UIActionMenuFileManagerShowProperties : public UIActionSimple
     
    22762256};
    22772257
    2278 
    22792258/** Menu action extension, used as 'Performance' menu class. */
    22802259class UIActionMenuSelectorPerformance : public UIActionMenu
     
    23892368}
    23902369
     2370UIActionPoolManager *UIActionPool::toManager()
     2371{
     2372    return qobject_cast<UIActionPoolManager*>(this);
     2373}
     2374
    23912375UIActionPoolRuntime *UIActionPool::toRuntime()
    23922376{
    23932377    return qobject_cast<UIActionPoolRuntime*>(this);
    2394 }
    2395 
    2396 UIActionPoolManager *UIActionPool::toManager()
    2397 {
    2398     return qobject_cast<UIActionPoolManager*>(this);
    23992378}
    24002379
     
    25612540    m_pool[UIActionIndex_M_FileManager_S_CopyToGuest] = new  UIActionMenuFileManagerCopyToGuest(this);
    25622541    m_pool[UIActionIndex_M_FileManager_S_CopyToHost] = new  UIActionMenuFileManagerCopyToHost(this);
    2563 
    25642542    m_pool[UIActionIndex_M_FileManager_T_Options] = new UIActionMenuFileManagerOptions(this);
    25652543    m_pool[UIActionIndex_M_FileManager_T_Log] = new UIActionMenuFileManagerLog(this);
    25662544    m_pool[UIActionIndex_M_FileManager_T_Operations] = new UIActionMenuFileManagerOperations(this);
    25672545    m_pool[UIActionIndex_M_FileManager_T_Session] = new UIActionMenuFileManagerSession(this);
    2568 
    25692546    m_pool[UIActionIndex_M_FileManager_S_Host_GoUp] = new UIActionMenuFileManagerGoUp(this);
    25702547    m_pool[UIActionIndex_M_FileManager_S_Guest_GoUp] = new UIActionMenuFileManagerGoUp(this);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r85634 r85641  
    3535class QKeySequence;
    3636class QString;
    37 class UIActionPolymorphicMenu;
    3837class UIActionPool;
    3938class UIActionPoolRuntime;
     
    203202public:
    204203
     204    /** Constructs action passing @a pParent to the base-class.
     205      * @param  enmType  Brings the action type. */
     206    UIAction(UIActionPool *pParent, UIActionType enmType, bool fMachineMenuAction = false);
     207    /** Destructs action. */
     208    virtual ~UIAction() /* override */ { delete menu(); }
     209
     210    /** Returns action-pool this action belongs to. */
     211    UIActionPool *actionPool() const { return m_pActionPool; }
    205212    /** Returns action type. */
    206213    UIActionType type() const { return m_enmType; }
    207     /** Returns whether this is machine-menu action. */
    208     bool machineMenuAction() const { return m_fMachineMenuAction; }
    209214
    210215    /** Returns menu contained by this action. */
    211216    UIMenu *menu() const;
    212 
    213     /** Returns action-pool this action belongs to. */
    214     UIActionPool *actionPool() const { return m_pActionPool; }
    215217
    216218    /** Returns current action state. */
     
    225227
    226228    /** Returns current action name. */
    227     const QString &name() const { return m_strName; }
     229    QString name() const { return m_strName; }
    228230    /** Defines current action name. */
    229231    void setName(const QString &strName);
    230232
    231233    /** Returns action shortcut scope. */
    232     const QString &shortcutScope() const { return m_strShortcutScope; }
     234    QString shortcutScope() const { return m_strShortcutScope; }
    233235    /** Defines action @a strShortcutScope. */
    234236    void setShortcutScope(const QString &strShortcutScope) { m_strShortcutScope = strShortcutScope; }
     
    257259    /** Retranslates action. */
    258260    virtual void retranslateUi() = 0;
    259     /** Destructs action. */
    260     virtual ~UIAction() /* override */ { delete menu(); }
    261261
    262262protected:
    263 
    264     /** Constructs action passing @a pParent to the base-class.
    265       * @param  enmType  Brings the action type. */
    266     UIAction(UIActionPool *pParent, UIActionType enmType, bool fMachineMenuAction = false);
    267263
    268264    /** Handles state change. */
     
    274270    /** Updates action icon. */
    275271    void updateIcon();
    276     /** Updates action text accordingly. */
     272    /** Updates action text. */
    277273    void updateText();
    278274
     
    280276      * @note Used to simplify action names for tool-tip needs. */
    281277    static QString simplifyText(QString strText);
     278
     279    /** Holds the reference to the action-pool this action belongs to. */
     280    UIActionPool           *m_pActionPool;
     281    /** Holds the type of the action-pool this action belongs to. */
     282    const UIActionPoolType  m_enmActionPoolType;
    282283
    283284    /** Holds the action type. */
     
    285286    /** Holds whether this is machine-menu action. */
    286287    const bool          m_fMachineMenuAction;
    287 
    288     /** Holds the reference to the action-pool this action belongs to. */
    289     UIActionPool           *m_pActionPool;
    290     /** Holds the type of the action-pool this action belongs to. */
    291     const UIActionPoolType  m_enmActionPoolType;
    292288
    293289    /** Holds current action state. */
     
    338334private:
    339335
    340     /** Prepare routine. */
     336    /** Prepares all. */
    341337    void prepare();
    342338};
     
    417413private:
    418414
    419     /** Prepare routine. */
     415    /** Prepares all. */
    420416    void prepare();
    421417};
     
    448444
    449445    /** Destructs polymorphic menu action. */
    450     ~UIActionPolymorphicMenu();
     446    virtual ~UIActionPolymorphicMenu() /* override */;
    451447
    452448    /** Defines whether tool-tip should be shown. */
    453449    void setShowToolTip(bool fShowToolTip);
    454450
    455     /** Show menu. */
     451    /** Shows menu. */
    456452    void showMenu();
    457     /** Hide menu. */
     453    /** Hides menu. */
    458454    void hideMenu();
    459455
    460456private:
    461457
    462     /** Prepare routine. */
     458    /** Prepares all. */
    463459    void prepare();
    464460
     
    482478    /** Pointer to menu update-handler for Runtime sub-class. */
    483479    typedef void (UIActionPoolRuntime::*PTFActionPoolRuntime)();
    484     /** Union for two defines above. */
     480    /** Union for three defines above. */
    485481    union PointerToFunction
    486482    {
     
    511507    static void createTemporary(UIActionPoolType enmType);
    512508
     509    /** Cast action-pool to Manager one. */
     510    UIActionPoolManager *toManager();
    513511    /** Cast action-pool to Runtime one. */
    514512    UIActionPoolRuntime *toRuntime();
    515     /** Cast action-pool to Manager one. */
    516     UIActionPoolManager *toManager();
    517513
    518514    /** Returns action-pool type. */
Note: See TracChangeset for help on using the changeset viewer.

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