Changeset 12113 in vbox
- Timestamp:
- Sep 4, 2008 10:55:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsUSB.cpp
r11530 r12113 178 178 179 179 CUSBController ctl = aMachine.GetUSBController(); 180 mGbUSB->setChecked ( ctl.GetEnabled());181 mCbUSB2->setChecked ( ctl.GetEnabledEhci());180 mGbUSB->setChecked (!ctl.isNull() && ctl.GetEnabled()); 181 mCbUSB2->setChecked (!ctl.isNull() && ctl.GetEnabledEhci()); 182 182 usbAdapterToggled (mGbUSB->isChecked()); 183 183 184 CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate(); 185 while (en.HasMore()) 186 addUSBFilter (en.GetNext(), false /* isNew */); 184 if (!ctl.isNull()) 185 { 186 CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate(); 187 while (en.HasMore()) 188 addUSBFilter (en.GetNext(), false /* isNew */); 189 } 187 190 188 191 mTwFilters->setCurrentItem (mTwFilters->topLevelItem (0)); … … 192 195 void VBoxVMSettingsUSB::putBackTo() 193 196 { 194 CUSBController ctl = mMachine.GetUSBController(); 195 196 ctl.SetEnabled (mGbUSB->isChecked()); 197 ctl.SetEnabledEhci (mCbUSB2->isChecked()); 198 199 if (mUSBFilterListModified) 200 { 201 /* First, remove all old filters */ 202 for (ulong count = ctl.GetDeviceFilters().GetCount(); count; -- count) 203 ctl.RemoveDeviceFilter (0); 204 205 /* Then add all new filters */ 206 for (int i = 0; i < mFilters.size(); ++ i) 207 { 208 CUSBDeviceFilter filter = mFilters [i]; 209 filter.SetActive (mTwFilters->topLevelItem (i)-> 210 checkState (0) == Qt::Checked); 211 ctl.InsertDeviceFilter (~0, filter); 212 } 213 } 214 197 CUSBController ctl = mMachine.GetUSBController(); 198 if (!ctl.isNull()) 199 { 200 ctl.SetEnabled (mGbUSB->isChecked()); 201 ctl.SetEnabledEhci (mCbUSB2->isChecked()); 202 203 if (mUSBFilterListModified) 204 { 205 /* First, remove all old filters */ 206 for (ulong count = ctl.GetDeviceFilters().GetCount(); count; -- count) 207 ctl.RemoveDeviceFilter (0); 208 209 /* Then add all new filters */ 210 for (int i = 0; i < mFilters.size(); ++ i) 211 { 212 CUSBDeviceFilter filter = mFilters [i]; 213 filter.SetActive (mTwFilters->topLevelItem (i)-> 214 checkState (0) == Qt::Checked); 215 ctl.InsertDeviceFilter (~0, filter); 216 } 217 } 218 } 215 219 mUSBFilterListModified = false; 216 220 } … … 323 327 else if (mType == MachineType) 324 328 { 325 filter = mMachine.GetUSBController() 326 .CreateDeviceFilter (mUSBFilterName.arg (maxFilterIndex + 1)); 329 CUSBController ctl = mMachine.GetUSBController(); 330 if (ctl.isNull()) 331 return; 332 filter = ctl.CreateDeviceFilter (mUSBFilterName.arg (maxFilterIndex + 1)); 327 333 } 328 334 else … … 362 368 else if (mType == MachineType) 363 369 { 364 filter = mMachine.GetUSBController() 365 .CreateDeviceFilter (vboxGlobal().details (usb)); 370 CUSBController ctl = mMachine.GetUSBController(); 371 if (ctl.isNull()) 372 return; 373 filter = ctl.CreateDeviceFilter (vboxGlobal().details (usb)); 366 374 } 367 375 else
Note:
See TracChangeset
for help on using the changeset viewer.