Changeset 36519 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 4, 2011 10:44:58 AM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r36357 r36519 104 104 SettingsDialogType_Wrong, 105 105 SettingsDialogType_Offline, 106 SettingsDialogType_Saved, 106 107 SettingsDialogType_Runtime 107 108 }; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r36357 r36519 982 982 { 983 983 m_machine = machine; 984 m_fChangeable = m_machine.isNull() ? false : m_machine.GetState() != KMachineState_Stuck; 984 m_fChangeable = m_machine.isNull() ? false : 985 m_machine.GetState() != KMachineState_Stuck && 986 m_machine.GetState() != KMachineState_Saved /* for now! */; 985 987 986 988 sltUpdateGeneral(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
r36504 r36519 723 723 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 724 724 725 bool fMachineOffline = pItem->sessionState() == KSessionState_Unlocked && pItem->machineState() != KMachineState_Saved; 726 VBoxDefs::SettingsDialogType dialogType = fMachineOffline ? VBoxDefs::SettingsDialogType_Offline : VBoxDefs::SettingsDialogType_Runtime; 727 728 CSession session = vboxGlobal().openSession(pItem->id(), !fMachineOffline /* connect to existing? */); 725 VBoxDefs::SettingsDialogType dialogType = pItem->machineState() == KMachineState_Saved ? VBoxDefs::SettingsDialogType_Saved : 726 pItem->sessionState() == KSessionState_Unlocked ? VBoxDefs::SettingsDialogType_Offline : 727 VBoxDefs::SettingsDialogType_Runtime; 728 729 CSession session = vboxGlobal().openSession(pItem->id(), dialogType != VBoxDefs::SettingsDialogType_Offline /* connect to existing? */); 729 730 AssertMsgReturn(!session.isNull(), ("Session must not be null"), (void)0); 730 731 CMachine machine = session.GetMachine(); 731 732 AssertMsgReturn(!machine.isNull(), ("Machine must not be null"), (void)0); 732 CConsole console = fMachineOffline ? CConsole() : session.GetConsole();733 CConsole console = dialogType == VBoxDefs::SettingsDialogType_Offline ? CConsole() : session.GetConsole(); 733 734 734 735 /* Don't show the inaccessible warning if the user open the vm settings: */ … … 1326 1327 KMachineState state = item->machineState(); 1327 1328 bool running = item->sessionState() != KSessionState_Unlocked; 1328 bool modifyEnabled = state != KMachineState_Stuck ;1329 bool modifyEnabled = state != KMachineState_Stuck && state != KMachineState_Saved /* for now! */; 1329 1330 1330 1331 if ( aRefreshDetails -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r36357 r36519 98 98 VBoxDefs::SettingsDialogType dialogType() const { return m_dialogType; } 99 99 virtual void setDialogType(VBoxDefs::SettingsDialogType dialogType) { m_dialogType = dialogType; } 100 bool isMachineOffline() const { return dialogType() == VBoxDefs::SettingsDialogType_Offline; } 101 bool isMachineSaved() const { return dialogType() == VBoxDefs::SettingsDialogType_Saved; } 102 bool isMachineOnline() const { return dialogType() == VBoxDefs::SettingsDialogType_Runtime; } 103 bool isMachineInValidMode() const { return isMachineOffline() || isMachineSaved() || isMachineOnline(); } 100 104 101 105 /* Page 'ID' stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r36357 r36519 73 73 UISettingsPageMachine::fetchData(data); 74 74 75 /* Save settings depending on dialog type: */ 76 switch (dialogType()) 75 if (isMachineOffline()) 77 76 { 78 /* Here come the properties which could be changed only in offline state: */ 79 case VBoxDefs::SettingsDialogType_Offline: 80 { 81 CAudioAdapter audio = m_machine.GetAudioAdapter(); 82 audio.SetEnabled(m_cache.m_fAudioEnabled); 83 audio.SetAudioDriver(m_cache.m_audioDriverType); 84 audio.SetAudioController(m_cache.m_audioControllerType); 85 break; 86 } 87 /* Here come the properties which could be changed at runtime too: */ 88 case VBoxDefs::SettingsDialogType_Runtime: 89 break; 90 default: 91 break; 77 CAudioAdapter audio = m_machine.GetAudioAdapter(); 78 audio.SetEnabled(m_cache.m_fAudioEnabled); 79 audio.SetAudioDriver(m_cache.m_audioDriverType); 80 audio.SetAudioController(m_cache.m_audioControllerType); 92 81 } 93 82 … … 165 154 void UIMachineSettingsAudio::polishPage() 166 155 { 167 /* Polish page depending on dialog type: */ 168 switch (dialogType()) 169 { 170 case VBoxDefs::SettingsDialogType_Offline: 171 break; 172 case VBoxDefs::SettingsDialogType_Runtime: 173 mGbAudio->setEnabled(false); 174 mLbAudioDriver->setEnabled(false); 175 mCbAudioDriver->setEnabled(false); 176 mLbAudioController->setEnabled(false); 177 mCbAudioController->setEnabled(false); 178 break; 179 default: 180 break; 181 } 156 mGbAudio->setEnabled(isMachineOffline()); 157 mLbAudioDriver->setEnabled(isMachineOffline()); 158 mCbAudioDriver->setEnabled(isMachineOffline()); 159 mLbAudioController->setEnabled(isMachineOffline()); 160 mCbAudioController->setEnabled(isMachineOffline()); 182 161 } 183 162 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r36357 r36519 232 232 UISettingsPageMachine::fetchData(data); 233 233 234 /* Save settings depending on dialog type: */ 235 switch (dialogType()) 236 { 237 /* Here come the properties which could be changed only in offline state: */ 238 case VBoxDefs::SettingsDialogType_Offline: 234 if (isMachineOffline()) 235 { 236 /* Video tab: */ 237 m_machine.SetVRAMSize(m_cache.m_iCurrentVRAM); 238 m_machine.SetMonitorCount(m_cache.m_cMonitorCount); 239 m_machine.SetAccelerate3DEnabled(m_cache.m_f3dAccelerationEnabled); 240 #ifdef VBOX_WITH_VIDEOHWACCEL 241 m_machine.SetAccelerate2DVideoEnabled(m_cache.m_f2dAccelerationEnabled); 242 #endif /* VBOX_WITH_VIDEOHWACCEL */ 243 } 244 /* VRDE tab: */ 245 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 246 if (!vrdeServer.isNull()) 247 { 248 if (isMachineInValidMode()) 239 249 { 240 /* Video tab: */ 241 m_machine.SetVRAMSize(m_cache.m_iCurrentVRAM); 242 m_machine.SetMonitorCount(m_cache.m_cMonitorCount); 243 m_machine.SetAccelerate3DEnabled(m_cache.m_f3dAccelerationEnabled); 244 #ifdef VBOX_WITH_VIDEOHWACCEL 245 m_machine.SetAccelerate2DVideoEnabled(m_cache.m_f2dAccelerationEnabled); 246 #endif /* VBOX_WITH_VIDEOHWACCEL */ 247 /* After that come the properties which could be changed at runtime too: */ 250 vrdeServer.SetEnabled(m_cache.m_fVRDEServerEnabled); 251 vrdeServer.SetVRDEProperty("TCP/Ports", m_cache.m_strVRDEPort); 252 vrdeServer.SetAuthType(m_cache.m_iVRDEAuthType); 253 vrdeServer.SetAuthTimeout(m_cache.m_uVRDETimeout); 248 254 } 249 /* Here come the properties which could be changed at runtime too: */ 250 case VBoxDefs::SettingsDialogType_Runtime: 255 if (isMachineOffline() || isMachineSaved()) 251 256 { 252 /* VRDE tab: */ 253 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 254 if (!vrdeServer.isNull()) 255 { 256 vrdeServer.SetEnabled(m_cache.m_fVRDEServerEnabled); 257 vrdeServer.SetVRDEProperty("TCP/Ports", m_cache.m_strVRDEPort); 258 vrdeServer.SetAuthType(m_cache.m_iVRDEAuthType); 259 vrdeServer.SetAuthTimeout(m_cache.m_uVRDETimeout); 260 vrdeServer.SetAllowMultiConnection(m_cache.m_fMultipleConnectionsAllowed); 261 } 262 break; 257 vrdeServer.SetAllowMultiConnection(m_cache.m_fMultipleConnectionsAllowed); 263 258 } 264 default:265 break;266 259 } 267 260 … … 436 429 void UIMachineSettingsDisplay::polishPage() 437 430 { 438 /* Polish page depending on dialog type: */ 439 switch (dialogType()) 440 { 441 case VBoxDefs::SettingsDialogType_Offline: 442 break; 443 case VBoxDefs::SettingsDialogType_Runtime: 444 /* Video tab: */ 445 mLbMemory->setEnabled(false); 446 mLbMemoryMin->setEnabled(false); 447 mLbMemoryMax->setEnabled(false); 448 mLbMemoryUnit->setEnabled(false); 449 mSlMemory->setEnabled(false); 450 mLeMemory->setEnabled(false); 451 mLbMonitors->setEnabled(false); 452 mLbMonitorsMin->setEnabled(false); 453 mLbMonitorsMax->setEnabled(false); 454 mLbMonitorsUnit->setEnabled(false); 455 mSlMonitors->setEnabled(false); 456 mLeMonitors->setEnabled(false); 457 mLbOptions->setEnabled(false); 458 mCb3D->setEnabled(false); 459 #ifdef VBOX_WITH_VIDEOHWACCEL 460 mCb2DVideo->setEnabled(false); 431 /* Video tab: */ 432 mLbMemory->setEnabled(isMachineOffline()); 433 mLbMemoryMin->setEnabled(isMachineOffline()); 434 mLbMemoryMax->setEnabled(isMachineOffline()); 435 mLbMemoryUnit->setEnabled(isMachineOffline()); 436 mSlMemory->setEnabled(isMachineOffline()); 437 mLeMemory->setEnabled(isMachineOffline()); 438 mLbMonitors->setEnabled(isMachineOffline()); 439 mLbMonitorsMin->setEnabled(isMachineOffline()); 440 mLbMonitorsMax->setEnabled(isMachineOffline()); 441 mLbMonitorsUnit->setEnabled(isMachineOffline()); 442 mSlMonitors->setEnabled(isMachineOffline()); 443 mLeMonitors->setEnabled(isMachineOffline()); 444 mLbOptions->setEnabled(isMachineOffline()); 445 mCb3D->setEnabled(isMachineOffline()); 446 #ifdef VBOX_WITH_VIDEOHWACCEL 447 mCb2DVideo->setEnabled(isMachineOffline()); 461 448 #endif /* VBOX_WITH_VIDEOHWACCEL */ 462 break; 463 default: 464 break; 465 } 466 } 467 449 /* VRDE tab: */ 450 mCbVRDE->setEnabled(isMachineInValidMode()); 451 mLbVRDPPort->setEnabled(isMachineInValidMode()); 452 mLeVRDEPort->setEnabled(isMachineInValidMode()); 453 mLbVRDPMethod->setEnabled(isMachineInValidMode()); 454 mCbVRDEMethod->setEnabled(isMachineInValidMode()); 455 mLbVRDPTimeout->setEnabled(isMachineInValidMode()); 456 mLeVRDETimeout->setEnabled(isMachineInValidMode()); 457 mLbOptions2->setEnabled(isMachineOffline() || isMachineSaved()); 458 mCbMultipleConn->setEnabled(isMachineOffline() || isMachineSaved()); 459 } 460 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r36357 r36519 136 136 UISettingsPageMachine::fetchData(data); 137 137 138 /* Save settings depending on dialog type: */ 139 switch (dialogType()) 138 if (isMachineInValidMode()) 140 139 { 141 /* Here come the properties which could be changed only in offline state: */ 142 case VBoxDefs::SettingsDialogType_Offline: 143 { 144 /* Basic tab: */ 145 m_machine.SetOSTypeId(m_cache.m_strGuestOsTypeId); 146 /* Advanced tab: */ 147 m_machine.SetSnapshotFolder(m_cache.m_strSnapshotsFolder); 148 m_machine.SetClipboardMode(m_cache.m_clipboardMode); 149 m_machine.SetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime, m_cache.m_fSaveMountedAtRuntime ? "yes" : "no"); 150 m_machine.SetExtraData(VBoxDefs::GUI_ShowMiniToolBar, m_cache.m_fShowMiniToolBar ? "yes" : "no"); 151 m_machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAlignment, m_cache.m_fMiniToolBarAtTop ? "top" : "bottom"); 152 /* Description tab: */ 153 m_machine.SetDescription(m_cache.m_strDescription); 154 /* VM name must be last as otherwise its VM rename magic can collide with other settings in the config, 155 * especially with the snapshot folder: */ 156 m_machine.SetName(m_cache.m_strName); 157 break; 158 } 159 /* Here come the properties which could be changed at runtime too: */ 160 case VBoxDefs::SettingsDialogType_Runtime: 161 { 162 /* Advanced tab: */ 163 m_machine.SetClipboardMode(m_cache.m_clipboardMode); 164 m_machine.SetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime, m_cache.m_fSaveMountedAtRuntime ? "yes" : "no"); 165 m_machine.SetExtraData(VBoxDefs::GUI_ShowMiniToolBar, m_cache.m_fShowMiniToolBar ? "yes" : "no"); 166 m_machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAlignment, m_cache.m_fMiniToolBarAtTop ? "top" : "bottom"); 167 /* Description tab: */ 168 m_machine.SetDescription(m_cache.m_strDescription); 169 break; 170 } 171 default: 172 break; 140 /* Advanced tab: */ 141 m_machine.SetClipboardMode(m_cache.m_clipboardMode); 142 m_machine.SetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime, m_cache.m_fSaveMountedAtRuntime ? "yes" : "no"); 143 m_machine.SetExtraData(VBoxDefs::GUI_ShowMiniToolBar, m_cache.m_fShowMiniToolBar ? "yes" : "no"); 144 m_machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAlignment, m_cache.m_fMiniToolBarAtTop ? "top" : "bottom"); 145 /* Description tab: */ 146 m_machine.SetDescription(m_cache.m_strDescription); 147 } 148 if (isMachineOffline()) 149 { 150 /* Basic tab: */ 151 m_machine.SetOSTypeId(m_cache.m_strGuestOsTypeId); 152 /* Advanced tab: */ 153 m_machine.SetSnapshotFolder(m_cache.m_strSnapshotsFolder); 154 /* Basic (again) tab: */ 155 /* VM name must be last as otherwise its VM rename magic can collide with other settings in the config, 156 * especially with the snapshot folder: */ 157 m_machine.SetName(m_cache.m_strName); 173 158 } 174 159 … … 221 206 void UIMachineSettingsGeneral::polishPage() 222 207 { 223 /* Polish page depending on dialog type: */ 224 switch (dialogType()) 225 { 226 case VBoxDefs::SettingsDialogType_Offline: 227 break; 228 case VBoxDefs::SettingsDialogType_Runtime: 229 /* Basic tab: */ 230 mLbName->setEnabled(false); 231 mLeName->setEnabled(false); 232 mOSTypeSelector->setEnabled(false); 233 /* Advanced tab: */ 234 mLbSnapshot->setEnabled(false); 235 mPsSnapshot->setEnabled(false); 236 break; 237 default: 238 break; 239 } 240 } 241 208 /* Basic tab: */ 209 mLbName->setEnabled(isMachineOffline()); 210 mLeName->setEnabled(isMachineOffline()); 211 mOSTypeSelector->setEnabled(isMachineOffline()); 212 /* Advanced tab: */ 213 mLbSnapshot->setEnabled(isMachineOffline()); 214 mPsSnapshot->setEnabled(isMachineOffline()); 215 mLbClipboard->setEnabled(isMachineInValidMode()); 216 mCbClipboard->setEnabled(isMachineInValidMode()); 217 mLbMedia->setEnabled(isMachineInValidMode()); 218 mCbSaveMounted->setEnabled(isMachineInValidMode()); 219 mLbToolBar->setEnabled(isMachineInValidMode()); 220 mCbShowToolBar->setEnabled(isMachineInValidMode()); 221 mCbToolBarAlignment->setEnabled(isMachineInValidMode()); 222 } 223 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r36357 r36519 63 63 void UIMachineSettingsNetwork::polishTab() 64 64 { 65 /* Polish tab depending on dialog type: */ 66 switch (m_pParent->dialogType()) 67 { 68 case VBoxDefs::SettingsDialogType_Offline: 69 sltToggleAdvanced(); 70 break; 71 case VBoxDefs::SettingsDialogType_Runtime: 72 mCbEnableAdapter->setEnabled(false); 73 m_pAdapterTypeLabel->setEnabled(false); 74 m_pAdapterTypeCombo->setEnabled(false); 75 m_pMACLabel->setEnabled(false); 76 m_pMACEditor->setEnabled(false); 77 m_pMACButton->setEnabled(false); 78 m_pAdvancedArrow->animateClick(); 79 break; 80 default: 81 break; 82 } 65 /* Basic attributes: */ 66 mCbEnableAdapter->setEnabled(m_pParent->isMachineOffline()); 67 m_pAttachmentTypeLabel->setEnabled(m_pParent->isMachineInValidMode()); 68 m_pAttachmentTypeCombo->setEnabled(m_pParent->isMachineInValidMode()); 69 m_pAdapterNameLabel->setEnabled(m_pParent->isMachineInValidMode() && 70 attachmentType() != KNetworkAttachmentType_Null && 71 attachmentType() != KNetworkAttachmentType_NAT); 72 m_pAdapterNameCombo->setEnabled(m_pParent->isMachineInValidMode() && 73 attachmentType() != KNetworkAttachmentType_Null && 74 attachmentType() != KNetworkAttachmentType_NAT); 75 m_pAdvancedArrow->setEnabled(m_pParent->isMachineInValidMode()); 76 77 /* Advanced attributes: */ 78 m_pAdapterTypeLabel->setEnabled(m_pParent->isMachineOffline()); 79 m_pAdapterTypeCombo->setEnabled(m_pParent->isMachineOffline()); 80 m_pPromiscuousModeLabel->setEnabled(m_pParent->isMachineInValidMode() && 81 attachmentType() != KNetworkAttachmentType_Null && 82 attachmentType() != KNetworkAttachmentType_NAT); 83 m_pPromiscuousModeCombo->setEnabled(m_pParent->isMachineInValidMode() && 84 attachmentType() != KNetworkAttachmentType_Null && 85 attachmentType() != KNetworkAttachmentType_NAT); 86 m_pMACLabel->setEnabled(m_pParent->isMachineOffline()); 87 m_pMACEditor->setEnabled(m_pParent->isMachineOffline()); 88 m_pMACButton->setEnabled(m_pParent->isMachineOffline()); 89 90 /* Postprocessing: */ 91 if ((m_pParent->isMachineSaved() || m_pParent->isMachineOnline()) && !m_pAdvancedArrow->isExpanded()) 92 m_pAdvancedArrow->animateClick(); 93 sltToggleAdvanced(); 83 94 } 84 95 … … 867 878 const UINetworkAdapterData &data = m_cache.m_items[iSlot]; 868 879 869 /* Save settings depending on dialog type: */ 870 switch (dialogType()) 871 { 872 /* Here come the properties which could be changed only in offline state: */ 873 case VBoxDefs::SettingsDialogType_Offline: 880 if (isMachineOffline()) 881 { 882 /* Basic attributes: */ 883 adapter.SetEnabled(data.m_fAdapterEnabled); 884 adapter.SetAdapterType(data.m_adapterType); 885 adapter.SetMACAddress(data.m_strMACAddress); 886 } 887 if (isMachineInValidMode()) 888 { 889 /* Attachment type: */ 890 switch (data.m_attachmentType) 874 891 { 875 /* Basic attributes: */ 876 adapter.SetEnabled(data.m_fAdapterEnabled); 877 adapter.SetAdapterType(data.m_adapterType); 878 adapter.SetMACAddress(data.m_strMACAddress); 879 /* After that come the properties which could be changed at runtime too: */ 892 case KNetworkAttachmentType_Null: 893 adapter.Detach(); 894 break; 895 case KNetworkAttachmentType_NAT: 896 adapter.AttachToNAT(); 897 break; 898 case KNetworkAttachmentType_Bridged: 899 adapter.SetHostInterface(data.m_strBridgedAdapterName); 900 adapter.AttachToBridgedInterface(); 901 break; 902 case KNetworkAttachmentType_Internal: 903 adapter.SetInternalNetwork(data.m_strInternalNetworkName); 904 adapter.AttachToInternalNetwork(); 905 break; 906 case KNetworkAttachmentType_HostOnly: 907 adapter.SetHostInterface(data.m_strHostInterfaceName); 908 adapter.AttachToHostOnlyInterface(); 909 break; 910 #ifdef VBOX_WITH_VDE 911 case KNetworkAttachmentType_VDE: 912 adapter.SetVDENetwork(data.m_strVDENetworkName); 913 adapter.AttachToVDE(); 914 break; 915 #endif /* VBOX_WITH_VDE */ 916 default: 917 break; 880 918 } 881 /* Here come the properties which could be changed at runtime too: */ 882 case VBoxDefs::SettingsDialogType_Runtime: 919 /* Advanced attributes: */ 920 adapter.SetPromiscModePolicy(data.m_promiscuousMode); 921 /* Cable connected flag: */ 922 adapter.SetCableConnected(data.m_fCableConnected); 923 /* Redirect options: */ 924 QVector<QString> oldRedirects = adapter.GetNatDriver().GetRedirects(); 925 for (int i = 0; i < oldRedirects.size(); ++i) 926 adapter.GetNatDriver().RemoveRedirect(oldRedirects[i].section(',', 0, 0)); 927 UIPortForwardingDataList newRedirects = data.m_redirects; 928 for (int i = 0; i < newRedirects.size(); ++i) 883 929 { 884 /* Attachment type: */ 885 switch (data.m_attachmentType) 886 { 887 case KNetworkAttachmentType_Null: 888 adapter.Detach(); 889 break; 890 case KNetworkAttachmentType_NAT: 891 adapter.AttachToNAT(); 892 break; 893 case KNetworkAttachmentType_Bridged: 894 adapter.SetHostInterface(data.m_strBridgedAdapterName); 895 adapter.AttachToBridgedInterface(); 896 break; 897 case KNetworkAttachmentType_Internal: 898 adapter.SetInternalNetwork(data.m_strInternalNetworkName); 899 adapter.AttachToInternalNetwork(); 900 break; 901 case KNetworkAttachmentType_HostOnly: 902 adapter.SetHostInterface(data.m_strHostInterfaceName); 903 adapter.AttachToHostOnlyInterface(); 904 break; 905 #ifdef VBOX_WITH_VDE 906 case KNetworkAttachmentType_VDE: 907 adapter.SetVDENetwork(data.m_strVDENetworkName); 908 adapter.AttachToVDE(); 909 break; 910 #endif /* VBOX_WITH_VDE */ 911 default: 912 break; 913 } 914 /* Advanced attributes: */ 915 adapter.SetPromiscModePolicy(data.m_promiscuousMode); 916 /* Cable connected flag: */ 917 adapter.SetCableConnected(data.m_fCableConnected); 918 /* Redirect options: */ 919 QVector<QString> oldRedirects = adapter.GetNatDriver().GetRedirects(); 920 for (int i = 0; i < oldRedirects.size(); ++i) 921 adapter.GetNatDriver().RemoveRedirect(oldRedirects[i].section(',', 0, 0)); 922 UIPortForwardingDataList newRedirects = data.m_redirects; 923 for (int i = 0; i < newRedirects.size(); ++i) 924 { 925 UIPortForwardingData newRedirect = newRedirects[i]; 926 adapter.GetNatDriver().AddRedirect(newRedirect.name, newRedirect.protocol, 927 newRedirect.hostIp, newRedirect.hostPort.value(), 928 newRedirect.guestIp, newRedirect.guestPort.value()); 929 } 930 break; 930 UIPortForwardingData newRedirect = newRedirects[i]; 931 adapter.GetNatDriver().AddRedirect(newRedirect.name, newRedirect.protocol, 932 newRedirect.hostIp, newRedirect.hostPort.value(), 933 newRedirect.guestIp, newRedirect.guestPort.value()); 931 934 } 932 default:933 break;934 935 } 935 936 } … … 990 991 for (int iSlot = 0; iSlot < iCount; ++iSlot) 991 992 { 992 /* Polish iterated tab depending on dialog type: */ 993 switch (dialogType()) 994 { 995 case VBoxDefs::SettingsDialogType_Offline: 996 break; 997 case VBoxDefs::SettingsDialogType_Runtime: 998 { 999 if (!m_cache.m_items[iSlot].m_fAdapterEnabled) 1000 m_pTwAdapters->setTabEnabled(iSlot, false); 1001 break; 1002 } 1003 default: 1004 break; 1005 } 993 m_pTwAdapters->setTabEnabled(iSlot, 994 isMachineOffline() || 995 (isMachineInValidMode() && m_cache.m_items[iSlot].m_fAdapterEnabled)); 1006 996 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot)); 1007 997 Assert(pTab); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r36357 r36519 61 61 void UIMachineSettingsParallel::polishTab() 62 62 { 63 /* Polish tab depending on dialog type: */ 64 switch (m_pParent->dialogType()) 65 { 66 case VBoxDefs::SettingsDialogType_Offline: 67 break; 68 case VBoxDefs::SettingsDialogType_Runtime: 69 mGbParallel->setEnabled(false); 70 mLbNumber->setEnabled(false); 71 mCbNumber->setEnabled(false); 72 mLbIRQ->setEnabled(false); 73 mLeIRQ->setEnabled(false); 74 mLbIOPort->setEnabled(false); 75 mLeIOPort->setEnabled(false); 76 mLbPath->setEnabled(false); 77 mLePath->setEnabled(false); 78 break; 79 default: 80 break; 81 } 63 mGbParallel->setEnabled(m_pParent->isMachineOffline()); 64 mLbNumber->setEnabled(m_pParent->isMachineOffline()); 65 mCbNumber->setEnabled(m_pParent->isMachineOffline()); 66 mLbIRQ->setEnabled(m_pParent->isMachineOffline()); 67 mLeIRQ->setEnabled(m_pParent->isMachineOffline()); 68 mLbIOPort->setEnabled(m_pParent->isMachineOffline()); 69 mLeIOPort->setEnabled(m_pParent->isMachineOffline()); 70 mLbPath->setEnabled(m_pParent->isMachineOffline()); 71 mLePath->setEnabled(m_pParent->isMachineOffline()); 82 72 } 83 73 … … 272 262 UISettingsPageMachine::fetchData(data); 273 263 274 /* Save settings depending on dialog type: */ 275 switch (dialogType()) 276 { 277 /* Here come the properties which could be changed only in offline state: */ 278 case VBoxDefs::SettingsDialogType_Offline: 264 if (isMachineOffline()) 265 { 266 /* Gather corresponding values from internal variables: */ 267 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 279 268 { 280 /* Gather corresponding values from internal variables: */ 281 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 282 { 283 /* Get adapter: */ 284 CParallelPort port = m_machine.GetParallelPort(iSlot); 285 286 /* Get cached data for this slot: */ 287 const UIParallelPortData &data = m_cache.m_items[iSlot]; 288 289 /* Save options: */ 290 port.SetIRQ(data.m_uIRQ); 291 port.SetIOBase(data.m_uIOBase); 292 port.SetPath(data.m_strPath); 293 port.SetEnabled(data.m_fPortEnabled); 294 } 295 break; 269 /* Get adapter: */ 270 CParallelPort port = m_machine.GetParallelPort(iSlot); 271 272 /* Get cached data for this slot: */ 273 const UIParallelPortData &data = m_cache.m_items[iSlot]; 274 275 /* Save options: */ 276 port.SetIRQ(data.m_uIRQ); 277 port.SetIOBase(data.m_uIOBase); 278 port.SetPath(data.m_strPath); 279 port.SetEnabled(data.m_fPortEnabled); 296 280 } 297 /* Here come the properties which could be changed at runtime too: */298 case VBoxDefs::SettingsDialogType_Runtime:299 break;300 default:301 break;302 281 } 303 282 … … 375 354 for (int iTabIndex = 0; iTabIndex < mTabWidget->count(); ++iTabIndex) 376 355 { 377 /* Polish iterated tab depending on dialog type: */ 378 switch (dialogType()) 379 { 380 case VBoxDefs::SettingsDialogType_Offline: 381 break; 382 case VBoxDefs::SettingsDialogType_Runtime: 383 { 384 if (!m_cache.m_items[iTabIndex].m_fPortEnabled) 385 mTabWidget->setTabEnabled(iTabIndex, false); 386 break; 387 } 388 default: 389 break; 390 } 356 mTabWidget->setTabEnabled(iTabIndex, 357 isMachineOffline() || 358 (isMachineInValidMode() && m_cache.m_items[iTabIndex].m_fPortEnabled)); 391 359 UIMachineSettingsParallel *pTab = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iTabIndex)); 392 360 Assert(pTab); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r36357 r36519 704 704 { 705 705 UISettingsPageMachine::setDialogType(settingsDialogType); 706 m_type = dialogType() == VBoxDefs::SettingsDialogType_Runtime? ConsoleType : MachineType;707 } 708 706 m_type = isMachineSaved() || isMachineOnline() ? ConsoleType : MachineType; 707 } 708 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r36357 r36519 68 68 void UIMachineSettingsSerial::polishTab() 69 69 { 70 /* Polish tab depending on dialog type: */ 71 switch (m_pParent->dialogType()) 72 { 73 case VBoxDefs::SettingsDialogType_Offline: 74 break; 75 case VBoxDefs::SettingsDialogType_Runtime: 76 mGbSerial->setEnabled(false); 77 mLbNumber->setEnabled(false); 78 mCbNumber->setEnabled(false); 79 mLbIRQ->setEnabled(false); 80 mLeIRQ->setEnabled(false); 81 mLbIOPort->setEnabled(false); 82 mLeIOPort->setEnabled(false); 83 mLbMode->setEnabled(false); 84 mCbMode->setEnabled(false); 85 mCbPipe->setEnabled(false); 86 mLbPath->setEnabled(false); 87 mLePath->setEnabled(false); 88 break; 89 default: 90 break; 91 } 70 mGbSerial->setEnabled(m_pParent->isMachineOffline()); 71 mLbNumber->setEnabled(m_pParent->isMachineOffline()); 72 mCbNumber->setEnabled(m_pParent->isMachineOffline()); 73 mLbIRQ->setEnabled(m_pParent->isMachineOffline()); 74 mLeIRQ->setEnabled(m_pParent->isMachineOffline()); 75 mLbIOPort->setEnabled(m_pParent->isMachineOffline()); 76 mLeIOPort->setEnabled(m_pParent->isMachineOffline()); 77 mLbMode->setEnabled(m_pParent->isMachineOffline()); 78 mCbMode->setEnabled(m_pParent->isMachineOffline()); 79 mCbPipe->setEnabled(m_pParent->isMachineOffline()); 80 mLbPath->setEnabled(m_pParent->isMachineOffline()); 81 mLePath->setEnabled(m_pParent->isMachineOffline()); 92 82 } 93 83 … … 321 311 UISettingsPageMachine::fetchData(data); 322 312 323 /* Save settings depending on dialog type: */ 324 switch (dialogType()) 325 { 326 /* Here come the properties which could be changed only in offline state: */ 327 case VBoxDefs::SettingsDialogType_Offline: 313 if (isMachineOffline()) 314 { 315 /* Gather corresponding values from internal variables: */ 316 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 328 317 { 329 /* Gather corresponding values from internal variables: */ 330 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 331 { 332 /* Get adapter: */ 333 CSerialPort port = m_machine.GetSerialPort(iSlot); 334 335 /* Get cached data for this slot: */ 336 const UISerialPortData &data = m_cache.m_items[iSlot]; 337 338 /* Save options: */ 339 port.SetEnabled(data.m_fPortEnabled); 340 port.SetIRQ(data.m_uIRQ); 341 port.SetIOBase(data.m_uIOBase); 342 port.SetServer(data.m_fServer); 343 port.SetPath(data.m_strPath); 344 /* This *must* be last. The host mode will be changed to disconnected if 345 * some of the necessary settings above will not meet the requirements for 346 * the selected mode. */ 347 port.SetHostMode(data.m_hostMode); 348 } 349 break; 318 /* Get adapter: */ 319 CSerialPort port = m_machine.GetSerialPort(iSlot); 320 321 /* Get cached data for this slot: */ 322 const UISerialPortData &data = m_cache.m_items[iSlot]; 323 324 /* Save options: */ 325 port.SetEnabled(data.m_fPortEnabled); 326 port.SetIRQ(data.m_uIRQ); 327 port.SetIOBase(data.m_uIOBase); 328 port.SetServer(data.m_fServer); 329 port.SetPath(data.m_strPath); 330 /* This *must* be last. The host mode will be changed to disconnected if 331 * some of the necessary settings above will not meet the requirements for 332 * the selected mode. */ 333 port.SetHostMode(data.m_hostMode); 350 334 } 351 /* Here come the properties which could be changed at runtime too: */352 case VBoxDefs::SettingsDialogType_Runtime:353 break;354 default:355 break;356 335 } 357 336 … … 439 418 for (int iTabIndex = 0; iTabIndex < mTabWidget->count(); ++iTabIndex) 440 419 { 441 /* Polish iterated tab depending on dialog type: */ 442 switch (dialogType()) 443 { 444 case VBoxDefs::SettingsDialogType_Offline: 445 break; 446 case VBoxDefs::SettingsDialogType_Runtime: 447 { 448 if (!m_cache.m_items[iTabIndex].m_fPortEnabled) 449 mTabWidget->setTabEnabled(iTabIndex, false); 450 break; 451 } 452 default: 453 break; 454 } 420 mTabWidget->setTabEnabled(iTabIndex, 421 isMachineOffline() || 422 (isMachineInValidMode() && m_cache.m_items[iTabIndex].m_fPortEnabled)); 455 423 UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(mTabWidget->widget(iTabIndex)); 456 424 Assert(pTab); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r36357 r36519 2380 2380 m_pMediumIdHolder->setType(vboxGlobal().mediumTypeToLocal(device)); 2381 2381 m_pMediumIdHolder->setId(mStorageModel->data(index, StorageModel::R_AttMediumId).toString()); 2382 mLbMedium->setEnabled( dialogType() == VBoxDefs::SettingsDialogType_Offline || device != KDeviceType_HardDisk);2383 mTbOpen->setEnabled( dialogType() == VBoxDefs::SettingsDialogType_Offline || device != KDeviceType_HardDisk);2382 mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk)); 2383 mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk)); 2384 2384 2385 2385 /* Getting Passthrough state */ … … 2602 2602 mAddFDAttAction->setEnabled (isController && isAttachmentsPossible); 2603 2603 2604 mDelCtrAction->setEnabled ( dialogType() == VBoxDefs::SettingsDialogType_Offline&& isController);2605 mDelAttAction->setEnabled ( dialogType() == VBoxDefs::SettingsDialogType_Offline&& isAttachment);2604 mDelCtrAction->setEnabled (isMachineOffline() && isController); 2605 mDelAttAction->setEnabled (isMachineOffline() && isAttachment); 2606 2606 } 2607 2607 … … 3074 3074 void UIMachineSettingsStorage::polishPage() 3075 3075 { 3076 /* Polish page depending on dialog type: */ 3077 switch (dialogType()) 3078 { 3079 case VBoxDefs::SettingsDialogType_Offline: 3080 break; 3081 case VBoxDefs::SettingsDialogType_Runtime: 3082 /* Controller stuff: */ 3083 mLbName->setEnabled(false); 3084 mLeName->setEnabled(false); 3085 mLbType->setEnabled(false); 3086 mCbType->setEnabled(false); 3087 mCbIoCache->setEnabled(false); 3088 /* Attachment stuff: */ 3089 mCbSlot->setEnabled(false); 3090 mCbPassthrough->setEnabled(false); 3091 break; 3092 default: 3093 break; 3094 } 3076 /* Left pane: */ 3077 mLsLeftPane->setEnabled(isMachineInValidMode()); 3078 mTwStorageTree->setEnabled(isMachineInValidMode()); 3079 /* Empty information pane: */ 3080 mLsEmpty->setEnabled(isMachineInValidMode()); 3081 mLbInfo->setEnabled(isMachineInValidMode()); 3082 /* Controllers pane: */ 3083 mLsParameters->setEnabled(isMachineInValidMode()); 3084 mLbName->setEnabled(isMachineOffline()); 3085 mLeName->setEnabled(isMachineOffline()); 3086 mLbType->setEnabled(isMachineOffline()); 3087 mCbType->setEnabled(isMachineOffline()); 3088 mCbIoCache->setEnabled(isMachineOffline()); 3089 /* Attachments pane: */ 3090 mLsAttributes->setEnabled(isMachineInValidMode()); 3091 mLbMedium->setEnabled(isMachineInValidMode()); 3092 mCbSlot->setEnabled(isMachineOffline()); 3093 mTbOpen->setEnabled(isMachineInValidMode()); 3094 mCbPassthrough->setEnabled(isMachineOffline()); 3095 mLsInformation->setEnabled(isMachineInValidMode()); 3096 mLbHDFormat->setEnabled(isMachineInValidMode()); 3097 mLbHDFormatValue->setEnabled(isMachineInValidMode()); 3098 mLbCDFDType->setEnabled(isMachineInValidMode()); 3099 mLbCDFDTypeValue->setEnabled(isMachineInValidMode()); 3100 mLbHDVirtualSize->setEnabled(isMachineInValidMode()); 3101 mLbHDVirtualSizeValue->setEnabled(isMachineInValidMode()); 3102 mLbHDActualSize->setEnabled(isMachineInValidMode()); 3103 mLbHDActualSizeValue->setEnabled(isMachineInValidMode()); 3104 mLbSize->setEnabled(isMachineInValidMode()); 3105 mLbSizeValue->setEnabled(isMachineInValidMode()); 3106 mLbLocation->setEnabled(isMachineInValidMode()); 3107 mLbLocationValue->setEnabled(isMachineInValidMode()); 3108 mLbUsage->setEnabled(isMachineInValidMode()); 3109 mLbUsageValue->setEnabled(isMachineInValidMode()); 3095 3110 } 3096 3111 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r36357 r36519 286 286 UISettingsPageMachine::fetchData(data); 287 287 288 /* Save settings depending on dialog type: */ 289 switch (dialogType()) 290 { 291 /* Here come the properties which could be changed only in offline state: */ 292 case VBoxDefs::SettingsDialogType_Offline: 288 if (isMachineOffline()) 289 { 290 /* Motherboard tab: */ 291 m_machine.SetMemorySize(m_cache.m_iRAMSize); 292 int iBootIndex = 0; 293 /* Save boot-items of current VM: */ 294 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 293 295 { 294 /* Motherboard tab: */ 295 m_machine.SetMemorySize(m_cache.m_iRAMSize); 296 int iBootIndex = 0; 297 /* Save boot-items of current VM: */ 298 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 299 { 300 if (m_cache.m_bootItems[i].m_fEnabled) 301 m_machine.SetBootOrder(++iBootIndex, m_cache.m_bootItems[i].m_type); 302 } 303 /* Save other unique boot-items: */ 304 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 305 { 306 if (!m_cache.m_bootItems[i].m_fEnabled) 307 m_machine.SetBootOrder(++iBootIndex, KDeviceType_Null); 308 } 309 m_machine.SetChipsetType(m_cache.m_chipsetType); 310 m_machine.GetBIOSSettings().SetIOAPICEnabled(m_cache.m_fIoApicEnabled); 311 m_machine.SetFirmwareType(m_cache.m_fEFIEnabled ? KFirmwareType_EFI : KFirmwareType_BIOS); 312 m_machine.SetRTCUseUTC(m_cache.m_fUTCEnabled); 313 m_machine.SetPointingHidType(m_cache.m_fUseAbsHID ? KPointingHidType_USBTablet : KPointingHidType_PS2Mouse); 314 /* Processor tab: */ 315 m_machine.SetCPUCount(m_cache.m_cCPUCount); 316 m_machine.SetCPUProperty(KCPUPropertyType_PAE, m_cache.m_fPAEEnabled); 317 /* Acceleration tab: */ 318 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, m_cache.m_fHwVirtExEnabled); 319 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, m_cache.m_fNestedPagingEnabled); 320 break; 296 if (m_cache.m_bootItems[i].m_fEnabled) 297 m_machine.SetBootOrder(++iBootIndex, m_cache.m_bootItems[i].m_type); 321 298 } 322 /* Here come the properties which could be changed at runtime too: */ 323 case VBoxDefs::SettingsDialogType_Runtime: 324 break; 325 default: 326 break; 299 /* Save other unique boot-items: */ 300 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 301 { 302 if (!m_cache.m_bootItems[i].m_fEnabled) 303 m_machine.SetBootOrder(++iBootIndex, KDeviceType_Null); 304 } 305 m_machine.SetChipsetType(m_cache.m_chipsetType); 306 m_machine.GetBIOSSettings().SetIOAPICEnabled(m_cache.m_fIoApicEnabled); 307 m_machine.SetFirmwareType(m_cache.m_fEFIEnabled ? KFirmwareType_EFI : KFirmwareType_BIOS); 308 m_machine.SetRTCUseUTC(m_cache.m_fUTCEnabled); 309 m_machine.SetPointingHidType(m_cache.m_fUseAbsHID ? KPointingHidType_USBTablet : KPointingHidType_PS2Mouse); 310 /* Processor tab: */ 311 m_machine.SetCPUCount(m_cache.m_cCPUCount); 312 m_machine.SetCPUProperty(KCPUPropertyType_PAE, m_cache.m_fPAEEnabled); 313 /* Acceleration tab: */ 314 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, m_cache.m_fHwVirtExEnabled); 315 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, m_cache.m_fNestedPagingEnabled); 327 316 } 328 317 … … 550 539 void UIMachineSettingsSystem::polishPage() 551 540 { 552 /* Polish page depending on dialog type: */ 553 switch (dialogType()) 554 { 555 case VBoxDefs::SettingsDialogType_Offline: 556 break; 557 case VBoxDefs::SettingsDialogType_Runtime: 558 /* Motherboard tab: */ 559 mLbMemory->setEnabled(false); 560 mLbMemoryMin->setEnabled(false); 561 mLbMemoryMax->setEnabled(false); 562 mLbMemoryUnit->setEnabled(false); 563 mSlMemory->setEnabled(false); 564 mLeMemory->setEnabled(false); 565 mLbBootOrder->setEnabled(false); 566 mTwBootOrder->setEnabled(false); 567 mTbBootItemUp->setEnabled(false); 568 mTbBootItemDown->setEnabled(false); 569 mLbChipset->setEnabled(false); 570 mCbChipset->setEnabled(false); 571 mLbMotherboardExtended->setEnabled(false); 572 mCbApic->setEnabled(false); 573 mCbEFI->setEnabled(false); 574 mCbTCUseUTC->setEnabled(false); 575 mCbUseAbsHID->setEnabled(false); 576 /* Processor tab: */ 577 mLbCPU->setEnabled(false); 578 mLbCPUMin->setEnabled(false); 579 mLbCPUMax->setEnabled(false); 580 mSlCPU->setEnabled(false); 581 mLeCPU->setEnabled(false); 582 mLbProcessorExtended->setEnabled(false); 583 mCbPae->setEnabled(false); 584 /* Acceleration tab: */ 585 mLbVirt->setEnabled(false); 586 mCbVirt->setEnabled(false); 587 mCbNestedPaging->setEnabled(false); 588 break; 589 default: 590 break; 591 } 592 } 593 541 /* Motherboard tab: */ 542 mLbMemory->setEnabled(isMachineOffline()); 543 mLbMemoryMin->setEnabled(isMachineOffline()); 544 mLbMemoryMax->setEnabled(isMachineOffline()); 545 mLbMemoryUnit->setEnabled(isMachineOffline()); 546 mSlMemory->setEnabled(isMachineOffline()); 547 mLeMemory->setEnabled(isMachineOffline()); 548 mLbBootOrder->setEnabled(isMachineOffline()); 549 mTwBootOrder->setEnabled(isMachineOffline()); 550 mTbBootItemUp->setEnabled(isMachineOffline()); 551 mTbBootItemDown->setEnabled(isMachineOffline()); 552 mLbChipset->setEnabled(isMachineOffline()); 553 mCbChipset->setEnabled(isMachineOffline()); 554 mLbMotherboardExtended->setEnabled(isMachineOffline()); 555 mCbApic->setEnabled(isMachineOffline()); 556 mCbEFI->setEnabled(isMachineOffline()); 557 mCbTCUseUTC->setEnabled(isMachineOffline()); 558 mCbUseAbsHID->setEnabled(isMachineOffline()); 559 /* Processor tab: */ 560 mLbCPU->setEnabled(isMachineOffline()); 561 mLbCPUMin->setEnabled(isMachineOffline()); 562 mLbCPUMax->setEnabled(isMachineOffline()); 563 mSlCPU->setEnabled(isMachineOffline()); 564 mLeCPU->setEnabled(isMachineOffline()); 565 mLbProcessorExtended->setEnabled(isMachineOffline()); 566 mCbPae->setEnabled(isMachineOffline()); 567 /* Acceleration tab: */ 568 mLbVirt->setEnabled(isMachineOffline()); 569 mCbVirt->setEnabled(isMachineOffline()); 570 mCbNestedPaging->setEnabled(isMachineOffline()); 571 } 572 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r36394 r36519 307 307 case UISettingsPageType_Global: 308 308 { 309 /* Save settings depending on dialog type: */ 310 switch (dialogType()) 309 if (isMachineInValidMode()) 311 310 { 312 /* Here come the properties which could be changed only in offline state: */ 313 case VBoxDefs::SettingsDialogType_Offline: 314 /* Here come the properties which could be changed at runtime too: */ 315 case VBoxDefs::SettingsDialogType_Runtime: 311 /* Gather corresponding values from internal variables: */ 312 if (mUSBFilterListModified) 316 313 { 317 /* Gather corresponding values from internal variables: */ 318 if (mUSBFilterListModified) 314 /* Get host: */ 315 CHost host = vboxGlobal().virtualBox().GetHost(); 316 /* First, remove all old filters: */ 317 for (ulong count = host.GetUSBDeviceFilters().size(); count; --count) 318 host.RemoveUSBDeviceFilter(0); 319 /* Then add all new filters: */ 320 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 319 321 { 320 /* Get host: */ 321 CHost host = vboxGlobal().virtualBox().GetHost(); 322 /* First, remove all old filters: */ 323 for (ulong count = host.GetUSBDeviceFilters().size(); count; --count) 324 host.RemoveUSBDeviceFilter(0); 325 /* Then add all new filters: */ 326 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 327 { 328 UIUSBFilterData data = m_cache.m_items[iFilterIndex]; 329 CHostUSBDeviceFilter hostFilter = host.CreateUSBDeviceFilter(data.m_strName); 330 hostFilter.SetActive(data.m_fActive); 331 hostFilter.SetVendorId(data.m_strVendorId); 332 hostFilter.SetProductId(data.m_strProductId); 333 hostFilter.SetRevision(data.m_strRevision); 334 hostFilter.SetManufacturer(data.m_strManufacturer); 335 hostFilter.SetProduct(data.m_strProduct); 336 hostFilter.SetSerialNumber(data.m_strSerialNumber); 337 hostFilter.SetPort(data.m_strPort); 338 hostFilter.SetRemote(data.m_strRemote); 339 hostFilter.SetAction(data.m_action); 340 host.InsertUSBDeviceFilter(host.GetUSBDeviceFilters().size(), hostFilter); 341 } 322 UIUSBFilterData data = m_cache.m_items[iFilterIndex]; 323 CHostUSBDeviceFilter hostFilter = host.CreateUSBDeviceFilter(data.m_strName); 324 hostFilter.SetActive(data.m_fActive); 325 hostFilter.SetVendorId(data.m_strVendorId); 326 hostFilter.SetProductId(data.m_strProductId); 327 hostFilter.SetRevision(data.m_strRevision); 328 hostFilter.SetManufacturer(data.m_strManufacturer); 329 hostFilter.SetProduct(data.m_strProduct); 330 hostFilter.SetSerialNumber(data.m_strSerialNumber); 331 hostFilter.SetPort(data.m_strPort); 332 hostFilter.SetRemote(data.m_strRemote); 333 hostFilter.SetAction(data.m_action); 334 host.InsertUSBDeviceFilter(host.GetUSBDeviceFilters().size(), hostFilter); 342 335 } 343 break;344 336 } 345 default:346 break;347 337 } 348 338 break; … … 358 348 if (!ctl.isNull()) 359 349 { 360 /* Save settings depending on dialog type: */ 361 switch (dialogType()) 350 if (isMachineOffline()) 362 351 { 363 /* Here come the properties which could be changed only in offline state: */ 364 case VBoxDefs::SettingsDialogType_Offline: 352 ctl.SetEnabled(m_cache.m_fUSBEnabled); 353 ctl.SetEnabledEhci(m_cache.m_fEHCIEnabled); 354 } 355 if (isMachineInValidMode()) 356 { 357 if (mUSBFilterListModified) 365 358 { 366 ctl.SetEnabled(m_cache.m_fUSBEnabled); 367 ctl.SetEnabledEhci(m_cache.m_fEHCIEnabled); 368 /* And after that come the properties which could be changed at runtime too: */ 359 /* First, remove all old filters: */ 360 for (ulong count = ctl.GetDeviceFilters().size(); count; --count) 361 ctl.RemoveDeviceFilter(0); 362 /* Then add all new filters: */ 363 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 364 { 365 const UIUSBFilterData &data = m_cache.m_items[iFilterIndex]; 366 CUSBDeviceFilter filter = ctl.CreateDeviceFilter(data.m_strName); 367 filter.SetActive(data.m_fActive); 368 filter.SetVendorId(data.m_strVendorId); 369 filter.SetProductId(data.m_strProductId); 370 filter.SetRevision(data.m_strRevision); 371 filter.SetManufacturer(data.m_strManufacturer); 372 filter.SetProduct(data.m_strProduct); 373 filter.SetSerialNumber(data.m_strSerialNumber); 374 filter.SetPort(data.m_strPort); 375 filter.SetRemote(data.m_strRemote); 376 ctl.InsertDeviceFilter(~0, filter); 377 } 369 378 } 370 /* Here come the properties which could be changed at runtime too: */371 case VBoxDefs::SettingsDialogType_Runtime:372 {373 if (mUSBFilterListModified)374 {375 /* First, remove all old filters: */376 for (ulong count = ctl.GetDeviceFilters().size(); count; --count)377 ctl.RemoveDeviceFilter(0);378 /* Then add all new filters: */379 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex)380 {381 const UIUSBFilterData &data = m_cache.m_items[iFilterIndex];382 CUSBDeviceFilter filter = ctl.CreateDeviceFilter(data.m_strName);383 filter.SetActive(data.m_fActive);384 filter.SetVendorId(data.m_strVendorId);385 filter.SetProductId(data.m_strProductId);386 filter.SetRevision(data.m_strRevision);387 filter.SetManufacturer(data.m_strManufacturer);388 filter.SetProduct(data.m_strProduct);389 filter.SetSerialNumber(data.m_strSerialNumber);390 filter.SetPort(data.m_strPort);391 filter.SetRemote(data.m_strRemote);392 ctl.InsertDeviceFilter(~0, filter);393 }394 }395 break;396 }397 default:398 break;399 379 } 400 380 } … … 867 847 void UIMachineSettingsUSB::polishPage() 868 848 { 869 /* Polish page depending on dialog type: */ 870 switch (dialogType()) 871 { 872 case VBoxDefs::SettingsDialogType_Offline: 873 break; 874 case VBoxDefs::SettingsDialogType_Runtime: 875 mGbUSB->setEnabled(false); 876 mCbUSB2->setEnabled(false); 877 break; 878 default: 879 break; 880 } 881 } 882 849 mGbUSB->setEnabled(isMachineOffline()); 850 mCbUSB2->setEnabled(isMachineOffline()); 851 mGbUSBFilters->setEnabled(isMachineInValidMode()); 852 mTwFilters->setEnabled(isMachineInValidMode()); 853 } 854
Note:
See TracChangeset
for help on using the changeset viewer.