儲存庫 vbox 的更動 50165
- 時間撮記:
- 2014-1-22 下午05:46:16 (11 年 以前)
- 位置:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- 檔案:
-
- 修改 7 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r49333 r50165 798 798 799 799 UIActionMenuNetworkAdapters(UIActionPool *pParent) 800 : UIActionMenu(pParent) 801 { 802 retranslateUi(); 803 } 804 805 protected: 806 807 void retranslateUi() {} 800 : UIActionMenu(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png") 801 { 802 retranslateUi(); 803 } 804 805 protected: 806 807 void retranslateUi() 808 { 809 setName(QApplication::translate("UIActionPool", "Network")); 810 } 808 811 }; 809 812 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r49779 r50165 74 74 #include "CHostVideoInputDevice.h" 75 75 #include "CEmulatedUSB.h" 76 #include "CNetworkAdapter.h" 76 77 #ifdef Q_WS_MAC 77 78 # include "CGuest.h" … … 882 883 connect(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->menu(), SIGNAL(aboutToShow()), 883 884 this, SLOT(sltPrepareDragAndDropMenu())); 885 connect(gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu(), SIGNAL(aboutToShow()), 886 this, SLOT(sltPrepareNetworkMenu())); 884 887 connect(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings), SIGNAL(triggered()), 885 888 this, SLOT(sltOpenNetworkAdaptersDialog())); … … 2050 2053 } 2051 2054 2055 /** Prepares menu content when user hovers <b>Network</b> submenu of the <b>Devices</b> menu. */ 2056 void UIMachineLogic::sltPrepareNetworkMenu() 2057 { 2058 /* Get and check 'the sender' menu object: */ 2059 QMenu *pMenu = qobject_cast<QMenu*>(sender()); 2060 QMenu *pNetworkMenu = gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu(); 2061 AssertReturnVoid(pMenu == pNetworkMenu); 2062 Q_UNUSED(pNetworkMenu); 2063 2064 /* Get and check current machine: */ 2065 const CMachine &machine = session().GetMachine(); 2066 AssertReturnVoid(!machine.isNull()); 2067 2068 /* Determine how many adapters we should display: */ 2069 KChipsetType chipsetType = machine.GetChipsetType(); 2070 ULONG uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType)); 2071 2072 /* Enumerate existing network adapters: */ 2073 QMap<int, bool> adapterData; 2074 for (ULONG uSlot = 0; uSlot < uCount; ++uSlot) 2075 { 2076 /* Get and check iterated adapter: */ 2077 const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot); 2078 AssertReturnVoid(machine.isOk()); 2079 Assert(!adapter.isNull()); 2080 if (adapter.isNull()) 2081 continue; 2082 2083 /* Remember adapter data if it is enabled: */ 2084 if (adapter.GetEnabled()) 2085 adapterData.insert((int)uSlot, (bool)adapter.GetCableConnected()); 2086 } 2087 AssertReturnVoid(!adapterData.isEmpty()); 2088 2089 /* Delete all "temporary" actions: */ 2090 QList<QAction*> actions = pMenu->actions(); 2091 foreach (QAction *pAction, actions) 2092 if (pAction->property("temporary").toBool()) 2093 delete pAction; 2094 2095 /* Add new "temporary" actions: */ 2096 foreach (int iSlot, adapterData.keys()) 2097 { 2098 QAction *pAction = pMenu->addAction(QIcon(adapterData[iSlot] ? ":/connect_16px.png": ":/disconnect_16px.png"), 2099 adapterData.size() == 1 ? tr("Connect Network Adapter") : tr("Connect Network Adapter %1").arg(iSlot + 1), 2100 this, SLOT(sltToggleNetworkAdapterConnection())); 2101 pAction->setProperty("temporary", true); 2102 pAction->setProperty("slot", iSlot); 2103 pAction->setCheckable(true); 2104 pAction->setChecked(adapterData[iSlot]); 2105 } 2106 } 2107 2108 /** Toggles network adapter's <i>Cable Connected</i> state. */ 2109 void UIMachineLogic::sltToggleNetworkAdapterConnection() 2110 { 2111 /* Get and check 'the sender' action object: */ 2112 QAction *pAction = qobject_cast<QAction*>(sender()); 2113 AssertReturnVoid(pAction); 2114 2115 /* Get and check current machine: */ 2116 CMachine machine = session().GetMachine(); 2117 AssertReturnVoid(!machine.isNull()); 2118 2119 /* Get operation target: */ 2120 CNetworkAdapter adapter = machine.GetNetworkAdapter((ULONG)pAction->property("slot").toInt()); 2121 AssertReturnVoid(machine.isOk() && !adapter.isNull()); 2122 2123 /* Connect/disconnect cable to/from target: */ 2124 adapter.SetCableConnected(!adapter.GetCableConnected()); 2125 machine.SaveSettings(); 2126 if (!machine.isOk()) 2127 msgCenter().cannotSaveMachineSettings(machine); 2128 } 2129 2052 2130 void UIMachineLogic::sltChangeDragAndDropType(QAction *pAction) 2053 2131 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r49779 r50165 209 209 void sltChangeSharedClipboardType(QAction *pAction); 210 210 void sltPrepareDragAndDropMenu(); 211 void sltPrepareNetworkMenu(); 212 void sltToggleNetworkAdapterConnection(); 211 213 void sltChangeDragAndDropType(QAction *pAction); 212 214 void sltToggleVRDE(bool fEnabled); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r50042 r50165 444 444 else 445 445 gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->setEnabled(false); 446 /* Network Settings action: */446 /* Network submenu: */ 447 447 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_NetworkSettings) 448 448 { 449 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)); 450 fSeparator1 = true; 451 } 452 else 449 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_Network)); 450 gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu()->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)); 451 fSeparator1 = true; 452 } 453 else 454 { 455 gActionPool->action(UIActionIndexRuntime_Menu_Network)->setEnabled(false); 453 456 gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)->setEnabled(false); 457 } 454 458 /* Shared Folders Settings action: */ 455 459 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedFoldersSettings) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r50042 r50165 1539 1539 } 1540 1540 1541 /* Show/Hide Network Adapters actiondepending on overall adapters activity status: */1542 gActionPool->action(UIActionIndexRuntime_ Simple_NetworkSettings)->setVisible(fAtLeastOneAdapterActive);1541 /* Show/Hide Network sub-menu depending on overall adapters activity status: */ 1542 gActionPool->action(UIActionIndexRuntime_Menu_Network)->setVisible(fAtLeastOneAdapterActive); 1543 1543 } 1544 1544 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r49596 r50165 67 67 } 68 68 69 void UIMachineLogicNormal::sltPrepareNetworkAdaptersMenu()70 {71 QMenu *menu = qobject_cast<QMenu*>(sender());72 AssertMsg(menu, ("This slot should be called only on Network Adapters menu show!\n"));73 menu->clear();74 menu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings));75 }76 77 69 void UIMachineLogicNormal::sltPrepareSharedFoldersMenu() 78 70 { … … 114 106 115 107 /* "Device" actions connections: */ 116 connect(gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu(), SIGNAL(aboutToShow()),117 this, SLOT(sltPrepareNetworkAdaptersMenu()));118 108 connect(gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->menu(), SIGNAL(aboutToShow()), 119 109 this, SLOT(sltPrepareSharedFoldersMenu())); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
r49506 r50165 40 40 41 41 /* Windowed mode functionality: */ 42 void sltPrepareNetworkAdaptersMenu();43 42 void sltPrepareSharedFoldersMenu(); 44 43 void sltPrepareVideoCaptureMenu();
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器