- Timestamp:
- Mar 6, 2010 1:33:12 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp
r26919 r27132 26 26 #include "VBoxGlobal.h" 27 27 28 /* Global includes */ 29 #include <QtGlobal> 30 28 31 /* Action activation event */ 29 32 class ActivateActionEvent : public QEvent … … 957 960 }; 958 961 962 #ifdef Q_WS_MAC 963 class DockMenuAction : public UIMenuAction 964 { 965 Q_OBJECT; 966 967 public: 968 969 DockMenuAction(QObject *pParent) 970 : UIMenuAction(pParent) 971 { 972 retranslateUi(); 973 } 974 975 protected: 976 977 void retranslateUi() {} 978 }; 979 980 class DockSettingsMenuAction : public UIMenuAction 981 { 982 Q_OBJECT; 983 984 public: 985 986 DockSettingsMenuAction(QObject *pParent) 987 : UIMenuAction(pParent) 988 { 989 retranslateUi(); 990 } 991 992 protected: 993 994 void retranslateUi() 995 { 996 setText(UIActionsPool::tr("Dock Icon")); 997 } 998 }; 999 1000 class ToggleDockPreviewMonitorAction : public UIToggleAction 1001 { 1002 Q_OBJECT; 1003 1004 public: 1005 1006 ToggleDockPreviewMonitorAction(QObject *pParent) 1007 : UIToggleAction(pParent) 1008 { 1009 retranslateUi(); 1010 } 1011 1012 protected: 1013 1014 void retranslateUi() 1015 { 1016 setText(UIActionsPool::tr("Show Monitor Preview")); 1017 } 1018 }; 1019 1020 class ToggleDockDisableMonitorAction : public UIToggleAction 1021 { 1022 Q_OBJECT; 1023 1024 public: 1025 1026 ToggleDockDisableMonitorAction(QObject *pParent) 1027 : UIToggleAction(pParent) 1028 { 1029 retranslateUi(); 1030 } 1031 1032 protected: 1033 1034 void retranslateUi() 1035 { 1036 setText(UIActionsPool::tr("Show Application Icon")); 1037 } 1038 }; 1039 #endif /* Q_WS_MAC */ 959 1040 960 1041 UIActionsPool::UIActionsPool(QObject *pParent) … … 1003 1084 m_actionsPool[UIActionIndex_Simple_About] = new ShowAboutAction(this); 1004 1085 1086 #ifdef Q_WS_MAC 1087 /* "Dock" menu actions: */ 1088 m_actionsPool[UIActionIndex_Toggle_DockPreviewMonitor] = new ToggleDockPreviewMonitorAction(this); 1089 m_actionsPool[UIActionIndex_Toggle_DockDisableMonitor] = new ToggleDockDisableMonitorAction(this); 1090 #endif /* Q_WS_MAC */ 1091 1005 1092 /* Create all menus */ 1006 1093 createMenus(); … … 1064 1151 delete m_actionsPool[UIActionIndex_Menu_Help]; 1065 1152 m_actionsPool[UIActionIndex_Menu_Help] = new MenuHelpAction(this); 1153 1154 #ifdef Q_WS_MAC 1155 if (m_actionsPool[UIActionIndex_Menu_Dock]) 1156 delete m_actionsPool[UIActionIndex_Menu_Dock]; 1157 m_actionsPool[UIActionIndex_Menu_Dock] = new DockMenuAction(this); 1158 if (m_actionsPool[UIActionIndex_Menu_DockSettings]) 1159 delete m_actionsPool[UIActionIndex_Menu_DockSettings]; 1160 m_actionsPool[UIActionIndex_Menu_DockSettings] = new DockSettingsMenuAction(this); 1161 #endif /* Q_WS_MAC */ 1066 1162 } 1067 1163 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.h
r26919 r27132 106 106 UIActionIndex_Simple_About, 107 107 108 #ifdef Q_WS_MAC 109 UIActionIndex_Menu_Dock, 110 UIActionIndex_Menu_DockSettings, 111 UIActionIndex_Toggle_DockPreviewMonitor, 112 UIActionIndex_Toggle_DockDisableMonitor, 113 #endif /* Q_WS_MAC */ 114 108 115 UIActionIndex_End 109 116 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r27044 r27132 562 562 #endif 563 563 } 564 565 #ifdef Q_WS_MAC 566 void UIMachineLogic::prepareDock() 567 { 568 QMenu *pDockMenu = actionsPool()->action(UIActionIndex_Menu_Dock)->menu(); 569 570 /* Add all VM menu entries to the dock menu. Leave out close and stuff like 571 * this. */ 572 QList<QAction*> actions = actionsPool()->action(UIActionIndex_Menu_Machine)->menu()->actions(); 573 for (int i=0; i < actions.size(); ++i) 574 if (actions.at(i)->menuRole() == QAction::TextHeuristicRole) 575 pDockMenu->addAction(actions.at(i)); 576 pDockMenu->addSeparator(); 577 578 QMenu *pDockSettingsMenu = actionsPool()->action(UIActionIndex_Menu_DockSettings)->menu(); 579 QActionGroup *pDockPreviewModeGroup = new QActionGroup(this); 580 QAction *pDockEnablePreviewMonitor = actionsPool()->action(UIActionIndex_Toggle_DockPreviewMonitor); 581 pDockPreviewModeGroup->addAction(pDockEnablePreviewMonitor); 582 QAction *pDockDisablePreview = actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor); 583 pDockPreviewModeGroup->addAction(pDockDisablePreview); 584 pDockSettingsMenu->addActions(pDockPreviewModeGroup->actions()); 585 586 pDockMenu->addMenu(pDockSettingsMenu); 587 588 connect(pDockPreviewModeGroup, SIGNAL(triggered(QAction*)), 589 this, SLOT(sltDockPreviewModeChanged(QAction*))); 590 591 /* Add it to the dock. */ 592 extern void qt_mac_set_dock_menu(QMenu *); 593 qt_mac_set_dock_menu(pDockMenu); 594 } 595 #endif /* Q_WS_MAC */ 564 596 565 597 void UIMachineLogic::prepareRequiredFeatures() … … 1399 1431 #endif 1400 1432 1433 #ifdef Q_WS_MAC 1434 void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction) 1435 { 1436 // if (mConsole) 1437 { 1438 CMachine machine = m_pSession->session().GetMachine(); 1439 if (!machine.isNull()) 1440 { 1441 if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor)) 1442 machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "false"); 1443 else if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockPreviewMonitor)) 1444 machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "true"); 1445 // mConsole->updateDockOverlay(); 1446 } 1447 } 1448 } 1449 #endif /* Q_WS_MAC */ 1450 1401 1451 void UIMachineLogic::installGuestAdditionsFrom(const QString &strSource) 1402 1452 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r27044 r27132 34 34 35 35 /* Global forwards */ 36 class QAction; 36 37 class QActionGroup; 37 38 … … 101 102 virtual void prepareActionGroups(); 102 103 virtual void prepareActionConnections(); 104 #ifdef Q_WS_MAC 105 virtual void prepareDock(); 106 #endif /* Q_WS_MAC */ 103 107 virtual void prepareRequiredFeatures(); 104 108 virtual void prepareConsolePowerUp(); … … 153 157 #endif 154 158 159 #ifdef Q_WS_MAC 160 void sltDockPreviewModeChanged(QAction *pAction); 161 #endif /* Q_WS_MAC */ 162 155 163 private: 156 164 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r27081 r27132 144 144 prepareMachineWindows(); 145 145 146 #ifdef Q_WS_MAC 147 /* Prepare dock: */ 148 prepareDock(); 149 #endif /* Q_WS_MAC */ 150 151 146 152 /* Initialization: */ 147 153 sltMachineStateChanged(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r26950 r27132 69 69 prepareMachineWindows(); 70 70 71 #ifdef Q_WS_MAC 72 /* Prepare dock: */ 73 prepareDock(); 74 #endif /* Q_WS_MAC */ 75 71 76 /* Initialization: */ 72 77 sltMachineStateChanged(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r27032 r27132 134 134 prepareMachineWindows(); 135 135 136 #ifdef Q_WS_MAC 137 /* Prepare dock: */ 138 prepareDock(); 139 #endif /* Q_WS_MAC */ 140 136 141 /* Initialization: */ 137 142 sltMachineStateChanged();
Note:
See TracChangeset
for help on using the changeset viewer.