Changeset 85641 in vbox for trunk/src/VBox
- Timestamp:
- Aug 7, 2020 11:21:11 AM (4 years ago)
- 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 102 102 UIAction::UIAction(UIActionPool *pParent, UIActionType enmType, bool fMachineMenuAction /* = false */) 103 103 : QAction(pParent) 104 , m_pActionPool(pParent) 105 , m_enmActionPoolType(pParent->type()) 104 106 , m_enmType(enmType) 105 107 , m_fMachineMenuAction(fMachineMenuAction) 106 , m_pActionPool(pParent)107 , m_enmActionPoolType(pParent->type())108 108 , m_iState(0) 109 109 , m_fShortcutHidden(false) … … 228 228 case UIActionPoolType_Runtime: 229 229 { 230 if (m achineMenuAction())230 if (m_fMachineMenuAction) 231 231 setText(uiCommon().insertKeyToActionText(nameInMenu(), 232 232 gShortcutPool->shortcut(actionPool(), this).primaryToPortableText())); … … 513 513 }; 514 514 515 516 515 /** Simple action extension, used as 'Close' action class. */ 517 516 class UIActionSimplePerformClose : public UIActionSimple … … 609 608 }; 610 609 611 612 610 /** Simple action extension, used as 'Minimize' action class. */ 613 611 class UIActionSimpleMinimize : public UIActionSimple … … 655 653 #endif /* VBOX_WS_MAC */ 656 654 657 658 655 /** Menu action extension, used as 'Help' menu class. */ 659 656 class UIActionMenuHelp : public UIActionMenu … … 694 691 } 695 692 }; 696 697 693 698 694 /** Simple action extension, used as 'Contents' action class. */ … … 753 749 }; 754 750 755 756 751 /** Simple action extension, used as 'Web Site' action class. */ 757 752 class UIActionSimpleWebSite : public UIActionSimple … … 800 795 }; 801 796 802 803 797 /** Simple action extension, used as 'Bug Tracker' action class. */ 804 798 class UIActionSimpleBugTracker : public UIActionSimple … … 847 841 }; 848 842 849 850 843 /** Simple action extension, used as 'Forums' action class. */ 851 844 class UIActionSimpleForums : public UIActionSimple … … 894 887 }; 895 888 896 897 889 /** Simple action extension, used as 'Oracle' action class. */ 898 890 class UIActionSimpleOracle : public UIActionSimple … … 941 933 }; 942 934 943 944 935 /** Simple action extension, used as 'Reset Warnings' action class. */ 945 936 class UIActionSimpleResetWarnings : public UIActionSimple … … 988 979 } 989 980 }; 990 991 981 992 982 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER … … 1038 1028 }; 1039 1029 1040 1041 1030 /** Simple action extension, used as 'Check for Updates' action class. */ 1042 1031 class UIActionSimpleCheckForUpdates : public UIActionSimple … … 1086 1075 }; 1087 1076 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 1088 1089 1077 1090 1078 /** Simple action extension, used as 'About' action class. */ … … 1146 1134 } 1147 1135 }; 1148 1149 1136 1150 1137 /** Simple action extension, used as 'Preferences' action class. */ … … 1569 1556 }; 1570 1557 1571 1572 1558 /** Simple action extension, used as 'Copy to Guest' in file manager action class. */ 1573 1559 class UIActionMenuFileManagerCopyToGuest : public UIActionSimple … … 1849 1835 }; 1850 1836 1851 1852 1837 /** Simple action extension, used as 'Perform GoHome' in file manager action class. */ 1853 1838 class UIActionMenuFileManagerGoHome : public UIActionSimple … … 1889 1874 }; 1890 1875 1891 1892 1876 /** Simple action extension, used as 'Perform Delete' in file manager action class. */ 1893 1877 class UIActionMenuFileManagerDelete : public UIActionSimple … … 1968 1952 }; 1969 1953 1970 1971 1954 /** Simple action extension, used as 'Perform Rename' in file manager action class. */ 1972 1955 class UIActionMenuFileManagerRename : public UIActionSimple … … 2045 2028 }; 2046 2029 2047 2048 2030 /** Simple action extension, used as 'Perform Copy' in file manager action class. */ 2049 2031 class UIActionMenuFileManagerCopy : public UIActionSimple … … 2198 2180 }; 2199 2181 2200 2201 2182 /** Simple action extension, used as 'Invert Selection' in file manager action class. */ 2202 2183 class UIActionMenuFileManagerInvertSelection : public UIActionSimple … … 2237 2218 }; 2238 2219 2239 2240 2220 /** Simple action extension, used as 'Show Properties' in file manager action class. */ 2241 2221 class UIActionMenuFileManagerShowProperties : public UIActionSimple … … 2276 2256 }; 2277 2257 2278 2279 2258 /** Menu action extension, used as 'Performance' menu class. */ 2280 2259 class UIActionMenuSelectorPerformance : public UIActionMenu … … 2389 2368 } 2390 2369 2370 UIActionPoolManager *UIActionPool::toManager() 2371 { 2372 return qobject_cast<UIActionPoolManager*>(this); 2373 } 2374 2391 2375 UIActionPoolRuntime *UIActionPool::toRuntime() 2392 2376 { 2393 2377 return qobject_cast<UIActionPoolRuntime*>(this); 2394 }2395 2396 UIActionPoolManager *UIActionPool::toManager()2397 {2398 return qobject_cast<UIActionPoolManager*>(this);2399 2378 } 2400 2379 … … 2561 2540 m_pool[UIActionIndex_M_FileManager_S_CopyToGuest] = new UIActionMenuFileManagerCopyToGuest(this); 2562 2541 m_pool[UIActionIndex_M_FileManager_S_CopyToHost] = new UIActionMenuFileManagerCopyToHost(this); 2563 2564 2542 m_pool[UIActionIndex_M_FileManager_T_Options] = new UIActionMenuFileManagerOptions(this); 2565 2543 m_pool[UIActionIndex_M_FileManager_T_Log] = new UIActionMenuFileManagerLog(this); 2566 2544 m_pool[UIActionIndex_M_FileManager_T_Operations] = new UIActionMenuFileManagerOperations(this); 2567 2545 m_pool[UIActionIndex_M_FileManager_T_Session] = new UIActionMenuFileManagerSession(this); 2568 2569 2546 m_pool[UIActionIndex_M_FileManager_S_Host_GoUp] = new UIActionMenuFileManagerGoUp(this); 2570 2547 m_pool[UIActionIndex_M_FileManager_S_Guest_GoUp] = new UIActionMenuFileManagerGoUp(this); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r85634 r85641 35 35 class QKeySequence; 36 36 class QString; 37 class UIActionPolymorphicMenu;38 37 class UIActionPool; 39 38 class UIActionPoolRuntime; … … 203 202 public: 204 203 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; } 205 212 /** Returns action type. */ 206 213 UIActionType type() const { return m_enmType; } 207 /** Returns whether this is machine-menu action. */208 bool machineMenuAction() const { return m_fMachineMenuAction; }209 214 210 215 /** Returns menu contained by this action. */ 211 216 UIMenu *menu() const; 212 213 /** Returns action-pool this action belongs to. */214 UIActionPool *actionPool() const { return m_pActionPool; }215 217 216 218 /** Returns current action state. */ … … 225 227 226 228 /** Returns current action name. */ 227 const QString &name() const { return m_strName; }229 QString name() const { return m_strName; } 228 230 /** Defines current action name. */ 229 231 void setName(const QString &strName); 230 232 231 233 /** Returns action shortcut scope. */ 232 const QString &shortcutScope() const { return m_strShortcutScope; }234 QString shortcutScope() const { return m_strShortcutScope; } 233 235 /** Defines action @a strShortcutScope. */ 234 236 void setShortcutScope(const QString &strShortcutScope) { m_strShortcutScope = strShortcutScope; } … … 257 259 /** Retranslates action. */ 258 260 virtual void retranslateUi() = 0; 259 /** Destructs action. */260 virtual ~UIAction() /* override */ { delete menu(); }261 261 262 262 protected: 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);267 263 268 264 /** Handles state change. */ … … 274 270 /** Updates action icon. */ 275 271 void updateIcon(); 276 /** Updates action text accordingly. */272 /** Updates action text. */ 277 273 void updateText(); 278 274 … … 280 276 * @note Used to simplify action names for tool-tip needs. */ 281 277 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; 282 283 283 284 /** Holds the action type. */ … … 285 286 /** Holds whether this is machine-menu action. */ 286 287 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;292 288 293 289 /** Holds current action state. */ … … 338 334 private: 339 335 340 /** Prepare routine. */336 /** Prepares all. */ 341 337 void prepare(); 342 338 }; … … 417 413 private: 418 414 419 /** Prepare routine. */415 /** Prepares all. */ 420 416 void prepare(); 421 417 }; … … 448 444 449 445 /** Destructs polymorphic menu action. */ 450 ~UIActionPolymorphicMenu();446 virtual ~UIActionPolymorphicMenu() /* override */; 451 447 452 448 /** Defines whether tool-tip should be shown. */ 453 449 void setShowToolTip(bool fShowToolTip); 454 450 455 /** Show menu. */451 /** Shows menu. */ 456 452 void showMenu(); 457 /** Hide menu. */453 /** Hides menu. */ 458 454 void hideMenu(); 459 455 460 456 private: 461 457 462 /** Prepare routine. */458 /** Prepares all. */ 463 459 void prepare(); 464 460 … … 482 478 /** Pointer to menu update-handler for Runtime sub-class. */ 483 479 typedef void (UIActionPoolRuntime::*PTFActionPoolRuntime)(); 484 /** Union for t wodefines above. */480 /** Union for three defines above. */ 485 481 union PointerToFunction 486 482 { … … 511 507 static void createTemporary(UIActionPoolType enmType); 512 508 509 /** Cast action-pool to Manager one. */ 510 UIActionPoolManager *toManager(); 513 511 /** Cast action-pool to Runtime one. */ 514 512 UIActionPoolRuntime *toRuntime(); 515 /** Cast action-pool to Manager one. */516 UIActionPoolManager *toManager();517 513 518 514 /** Returns action-pool type. */
Note:
See TracChangeset
for help on using the changeset viewer.