Changeset 85620 in vbox for trunk/src/VBox
- Timestamp:
- Aug 5, 2020 6:39:14 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139729
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r85619 r85620 125 125 } 126 126 127 UIActionPolymorphicMenu *UIAction::toActionPolymorphicMenu() 128 { 129 return qobject_cast<UIActionPolymorphicMenu*>(this); 127 void UIAction::setState(int iState) 128 { 129 m_iState = iState; 130 updateIcon(); 131 retranslateUi(); 130 132 } 131 133 … … 382 384 : UIAction(pParent, UIActionType_PolymorphicMenu) 383 385 , m_pMenu(0) 384 , m_iState(0)385 386 { 386 387 if (!strIcon.isNull()) … … 394 395 : UIAction(pParent, UIActionType_PolymorphicMenu) 395 396 , m_pMenu(0) 396 , m_iState(0)397 397 { 398 398 if (!strIconNormal.isNull()) … … 405 405 : UIAction(pParent, UIActionType_PolymorphicMenu) 406 406 , m_pMenu(0) 407 , m_iState(0)408 407 { 409 408 if (!icon.isNull()) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r85619 r85620 215 215 UIActionPool *actionPool() const { return m_pActionPool; } 216 216 217 /** Casts action to polymorphic-menu-action. */218 UIActionPolymorphicMenu *toActionPolymorphicMenu();219 220 217 /** Returns current action state. */ 221 218 int state() const { return m_iState; } 222 219 /** Defines current action @a iState. */ 223 void setState(int iState) { m_iState = iState; updateIcon(); retranslateUi(); }220 void setState(int iState); 224 221 225 222 /** Defines @a icon for certain @a iState. */ … … 282 279 * @note Used to simplify action names for tool-tip needs. */ 283 280 static QString simplifyText(QString strText); 284 285 private:286 281 287 282 /** Holds the action type. */ … … 434 429 Q_OBJECT; 435 430 436 public:437 438 /** Returns current action state. */439 int state() const { return m_iState; }440 /** Defines current action state. */441 void setState(int iState) { m_iState = iState; retranslateUi(); }442 443 431 protected: 444 432 … … 484 472 /** Holds the menu instance. */ 485 473 UIMenu *m_pMenu; 486 /** Holds current action state. */487 int m_iState;488 474 }; 489 475 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r85597 r85620 3028 3028 || pItem->itemType() == UIVirtualMachineItemType_CloudReal)) 3029 3029 { 3030 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)-> toActionPolymorphicMenu()->setState(1);3031 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)-> toActionPolymorphicMenu()->setState(1);3030 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setState(1); 3031 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setState(1); 3032 3032 } 3033 3033 else 3034 3034 { 3035 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)-> toActionPolymorphicMenu()->setState(0);3036 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)-> toActionPolymorphicMenu()->setState(0);3035 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setState(0); 3036 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setState(0); 3037 3037 } 3038 3038 … … 3040 3040 if (pItem && pItem->accessible()) 3041 3041 { 3042 actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)-> toActionPolymorphicMenu()->setState(pItem->isItemPoweredOff() ? 0 : 1);3043 actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)-> toActionPolymorphicMenu()->setState(pItem->isItemPoweredOff() ? 0 : 1);3042 actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)->setState(pItem->isItemPoweredOff() ? 0 : 1); 3043 actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)->setState(pItem->isItemPoweredOff() ? 0 : 1); 3044 3044 /// @todo Hmm, fix it? 3045 3045 // QToolButton *pButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow))); … … 3049 3049 else 3050 3050 { 3051 actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)-> toActionPolymorphicMenu()->setState(0);3052 actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)-> toActionPolymorphicMenu()->setState(0);3051 actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow)->setState(0); 3052 actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)->setState(0); 3053 3053 /// @todo Hmm, fix it? 3054 3054 // QToolButton *pButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow)));
Note:
See TracChangeset
for help on using the changeset viewer.