Changeset 47594 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 7, 2013 2:37:31 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r47478 r47594 465 465 case GlobalSettingsPageType_Language: strResult = "Language"; break; 466 466 case GlobalSettingsPageType_Display: strResult = "Display"; break; 467 case GlobalSettingsPageType_USB: strResult = "USB"; break;468 467 case GlobalSettingsPageType_Network: strResult = "Network"; break; 469 468 case GlobalSettingsPageType_Extensions: strResult = "Extensions"; break; … … 489 488 keys << "Language"; values << GlobalSettingsPageType_Language; 490 489 keys << "Display"; values << GlobalSettingsPageType_Display; 491 keys << "USB"; values << GlobalSettingsPageType_USB;492 490 keys << "Network"; values << GlobalSettingsPageType_Network; 493 491 keys << "Extensions"; values << GlobalSettingsPageType_Extensions; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r47478 r47594 281 281 GlobalSettingsPageType_Language, 282 282 GlobalSettingsPageType_Display, 283 GlobalSettingsPageType_USB,284 283 GlobalSettingsPageType_Network, 285 284 GlobalSettingsPageType_Extensions, -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r47585 r47594 382 382 break; 383 383 } 384 /* USB page: */385 case GlobalSettingsPageType_USB:386 {387 pSettingsPage = new UIMachineSettingsUSB(UISettingsPageType_Global);388 addItem(":/usb_32px.png", ":/usb_disabled_32px.png",389 ":/usb_16px.png", ":/usb_disabled_16px.png",390 iPageIndex, "#usb", pSettingsPage);391 break;392 }393 384 /* Network page: */ 394 385 case GlobalSettingsPageType_Network: … … 511 502 m_pSelector->setItemText(GlobalSettingsPageType_Display, tr("Display")); 512 503 513 /* USB page: */514 m_pSelector->setItemText(GlobalSettingsPageType_USB, tr("USB"));515 516 504 /* Network page: */ 517 505 m_pSelector->setItemText(GlobalSettingsPageType_Network, tr("Network")); … … 542 530 switch (iPageId) 543 531 { 544 case GlobalSettingsPageType_USB:545 {546 #ifdef ENABLE_GLOBAL_USB547 /* Get the host object: */548 CHost host = vboxGlobal().host();549 /* Show the host error message if any: */550 if (!host.isReallyOk())551 msgCenter().warnAboutUnaccessibleUSB(host, this);552 /* Check if USB is implemented: */553 CHostUSBDeviceFilterVector filters = host.GetUSBDeviceFilters();554 Q_UNUSED(filters);555 if (host.lastRC() == E_NOTIMPL)556 return false;557 #else /* ENABLE_GLOBAL_USB */558 return false;559 #endif /* !ENABLE_GLOBAL_USB */560 break;561 }562 532 case GlobalSettingsPageType_Network: 563 533 { … … 694 664 case MachineSettingsPageType_USB: 695 665 { 696 pSettingsPage = new UIMachineSettingsUSB (UISettingsPageType_Machine);666 pSettingsPage = new UIMachineSettingsUSB; 697 667 addItem(":/usb_32px.png", ":/usb_disabled_32px.png", 698 668 ":/usb_16px.png", ":/usb_disabled_16px.png", -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r47573 r47594 138 138 }; 139 139 140 UIMachineSettingsUSB::UIMachineSettingsUSB(UISettingsPageType type) 141 : UISettingsPage(type) 142 , m_pToolBar(0) 140 UIMachineSettingsUSB::UIMachineSettingsUSB() 141 : m_pToolBar(0) 143 142 , mNewAction(0), mAddAction(0), mEdtAction(0), mDelAction(0) 144 143 , mMupAction(0), mMdnAction(0) … … 244 243 m_cache.clear(); 245 244 246 /* Depending on page type: */ 247 switch (pageType()) 248 { 249 case UISettingsPageType_Global: 245 /* Prepare USB data: */ 246 UIDataSettingsMachineUSB usbData; 247 248 /* Check if controller is valid: */ 249 const CUSBDeviceFilters &filters = m_machine.GetUSBDeviceFilters(); 250 if (!filters.isNull()) 251 { 252 /* Gather USB values: */ 253 usbData.m_fUSBEnabled = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI) > 0; 254 usbData.m_fEHCIEnabled = m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI) > 0; 255 256 /* For each USB filter: */ 257 const CUSBDeviceFilterVector &coll = filters.GetDeviceFilters(); 258 for (int iFilterIndex = 0; iFilterIndex < coll.size(); ++iFilterIndex) 250 259 { 251 /* For each USB filter: */ 252 const CHostUSBDeviceFilterVector &filters = vboxGlobal().host().GetUSBDeviceFilters(); 253 for (int iFilterIndex = 0; iFilterIndex < filters.size(); ++iFilterIndex) 260 /* Prepare USB filter data: */ 261 UIDataSettingsMachineUSBFilter usbFilterData; 262 263 /* Check if filter is valid: */ 264 const CUSBDeviceFilter &filter = coll[iFilterIndex]; 265 if (!filter.isNull()) 254 266 { 255 /* Prepare USB filter data: */ 256 UIDataSettingsMachineUSBFilter usbFilterData; 257 258 /* Check if filter is valid: */ 259 const CHostUSBDeviceFilter &filter = filters[iFilterIndex]; 260 if (!filter.isNull()) 261 { 262 usbFilterData.m_fActive = filter.GetActive(); 263 usbFilterData.m_strName = filter.GetName(); 264 usbFilterData.m_strVendorId = filter.GetVendorId(); 265 usbFilterData.m_strProductId = filter.GetProductId(); 266 usbFilterData.m_strRevision = filter.GetRevision(); 267 usbFilterData.m_strManufacturer = filter.GetManufacturer(); 268 usbFilterData.m_strProduct = filter.GetProduct(); 269 usbFilterData.m_strSerialNumber = filter.GetSerialNumber(); 270 usbFilterData.m_strPort = filter.GetPort(); 271 usbFilterData.m_strRemote = filter.GetRemote(); 272 usbFilterData.m_action = filter.GetAction(); 273 CHostUSBDevice hostUSBDevice(filter); 274 if (!hostUSBDevice.isNull()) 275 { 276 usbFilterData.m_fHostUSBDevice = true; 277 usbFilterData.m_hostUSBDeviceState = hostUSBDevice.GetState(); 278 } 279 else 280 { 281 usbFilterData.m_fHostUSBDevice = false; 282 usbFilterData.m_hostUSBDeviceState = KUSBDeviceState_NotSupported; 283 } 284 } 285 286 /* Cache USB filter data: */ 287 m_cache.child(iFilterIndex).cacheInitialData(usbFilterData); 267 usbFilterData.m_fActive = filter.GetActive(); 268 usbFilterData.m_strName = filter.GetName(); 269 usbFilterData.m_strVendorId = filter.GetVendorId(); 270 usbFilterData.m_strProductId = filter.GetProductId(); 271 usbFilterData.m_strRevision = filter.GetRevision(); 272 usbFilterData.m_strManufacturer = filter.GetManufacturer(); 273 usbFilterData.m_strProduct = filter.GetProduct(); 274 usbFilterData.m_strSerialNumber = filter.GetSerialNumber(); 275 usbFilterData.m_strPort = filter.GetPort(); 276 usbFilterData.m_strRemote = filter.GetRemote(); 288 277 } 289 278 290 break; 279 /* Cache USB filter data: */ 280 m_cache.child(iFilterIndex).cacheInitialData(usbFilterData); 291 281 } 292 case UISettingsPageType_Machine: 293 { 294 /* Prepare USB data: */ 295 UIDataSettingsMachineUSB usbData; 296 297 /* Check if controller is valid: */ 298 const CUSBDeviceFilters &filters = m_machine.GetUSBDeviceFilters(); 299 if (!filters.isNull()) 300 { 301 /* Gather USB values: */ 302 usbData.m_fUSBEnabled = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI) > 0; 303 usbData.m_fEHCIEnabled = m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI) > 0; 304 305 /* For each USB filter: */ 306 const CUSBDeviceFilterVector &coll = filters.GetDeviceFilters(); 307 for (int iFilterIndex = 0; iFilterIndex < coll.size(); ++iFilterIndex) 308 { 309 /* Prepare USB filter data: */ 310 UIDataSettingsMachineUSBFilter usbFilterData; 311 312 /* Check if filter is valid: */ 313 const CUSBDeviceFilter &filter = coll[iFilterIndex]; 314 if (!filter.isNull()) 315 { 316 usbFilterData.m_fActive = filter.GetActive(); 317 usbFilterData.m_strName = filter.GetName(); 318 usbFilterData.m_strVendorId = filter.GetVendorId(); 319 usbFilterData.m_strProductId = filter.GetProductId(); 320 usbFilterData.m_strRevision = filter.GetRevision(); 321 usbFilterData.m_strManufacturer = filter.GetManufacturer(); 322 usbFilterData.m_strProduct = filter.GetProduct(); 323 usbFilterData.m_strSerialNumber = filter.GetSerialNumber(); 324 usbFilterData.m_strPort = filter.GetPort(); 325 usbFilterData.m_strRemote = filter.GetRemote(); 326 } 327 328 /* Cache USB filter data: */ 329 m_cache.child(iFilterIndex).cacheInitialData(usbFilterData); 330 } 331 } 332 333 /* Cache USB data: */ 334 m_cache.cacheInitialData(usbData); 335 336 break; 337 } 338 default: 339 break; 340 } 282 } 283 284 /* Cache USB data: */ 285 m_cache.cacheInitialData(usbData); 341 286 342 287 /* Upload properties & settings or machine to data: */ … … 352 297 m_filters.clear(); 353 298 354 /* Depending on page type: */ 355 switch (pageType()) 356 { 357 case UISettingsPageType_Global: 358 { 359 /* Hide unused widgets: */ 360 mGbUSB->setVisible(false); 361 mCbUSB2->setVisible(false); 362 break; 363 } 364 case UISettingsPageType_Machine: 365 { 366 /* Get USB data from cache: */ 367 const UIDataSettingsMachineUSB &usbData = m_cache.base(); 368 /* Load USB data to page: */ 369 mGbUSB->setChecked(usbData.m_fUSBEnabled); 370 mCbUSB2->setChecked(usbData.m_fEHCIEnabled); 371 break; 372 } 373 default: 374 break; 375 } 299 /* Get USB data from cache: */ 300 const UIDataSettingsMachineUSB &usbData = m_cache.base(); 301 /* Load USB data to page: */ 302 mGbUSB->setChecked(usbData.m_fUSBEnabled); 303 mCbUSB2->setChecked(usbData.m_fEHCIEnabled); 376 304 377 305 /* For each USB filter => load it to the page: */ … … 396 324 void UIMachineSettingsUSB::putToCache() 397 325 { 398 /* Depending on page type: */ 399 switch (pageType()) 400 { 401 case UISettingsPageType_Machine: 402 { 403 /* Prepare USB data: */ 404 UIDataSettingsMachineUSB usbData = m_cache.base(); 405 406 /* USB 1.0 (OHCI): */ 407 usbData.m_fUSBEnabled = mGbUSB->isChecked(); 408 /* USB 2.0 (EHCI): */ 409 CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName); 410 usbData.m_fEHCIEnabled = extPack.isNull() || !extPack.GetUsable() ? false : mCbUSB2->isChecked(); 411 412 /* Update USB cache: */ 413 m_cache.cacheCurrentData(usbData); 414 415 break; 416 } 417 default: 418 break; 419 } 326 /* Prepare USB data: */ 327 UIDataSettingsMachineUSB usbData = m_cache.base(); 328 329 /* USB 1.0 (OHCI): */ 330 usbData.m_fUSBEnabled = mGbUSB->isChecked(); 331 /* USB 2.0 (EHCI): */ 332 CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName); 333 usbData.m_fEHCIEnabled = extPack.isNull() || !extPack.GetUsable() ? false : mCbUSB2->isChecked(); 334 335 /* Update USB cache: */ 336 m_cache.cacheCurrentData(usbData); 420 337 421 338 /* For each USB filter => recache USB filter data: */ … … 431 348 fetchData(data); 432 349 433 /* Save settings depending on page type: */ 434 switch (pageType()) 435 { 436 /* Here come the global USB properties: */ 437 case UISettingsPageType_Global: 350 /* Check if USB data really changed: */ 351 if (m_cache.wasChanged()) 352 { 353 /* Check if controller is valid: */ 354 CUSBDeviceFilters filters = m_machine.GetUSBDeviceFilters(); 355 if (!filters.isNull()) 438 356 { 439 /* Check if USB data really changed: */ 440 if (m_cache.wasChanged()) 357 /* Get USB data from cache: */ 358 359 const UIDataSettingsMachineUSB &usbData = m_cache.data(); 360 /* Store USB data: */ 361 if (isMachineOffline()) 441 362 { 442 /* Store USB data: */ 443 if (isMachineInValidMode()) 363 ULONG cOhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI); 364 ULONG cEhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI); 365 366 if (!cOhciCtls && usbData.m_fUSBEnabled) 367 m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI); 368 else if (cOhciCtls && !usbData.m_fUSBEnabled) 369 m_machine.RemoveUSBController("OHCI"); 370 371 if (!cEhciCtls && usbData.m_fEHCIEnabled) 372 m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI); 373 else if (cEhciCtls && !usbData.m_fEHCIEnabled) 374 m_machine.RemoveUSBController("EHCI"); 375 } 376 /* Store USB filters data: */ 377 if (isMachineInValidMode()) 378 { 379 /* For each USB filter data set: */ 380 int iOperationPosition = 0; 381 for (int iFilterIndex = 0; iFilterIndex < m_cache.childCount(); ++iFilterIndex) 444 382 { 445 /* Get host: */ 446 CHost host = vboxGlobal().host(); 447 /* For each USB filter data set: */ 448 for (int iFilterIndex = 0; iFilterIndex < m_cache.childCount(); ++iFilterIndex) 383 /* Check if USB filter data really changed: */ 384 const UICacheSettingsMachineUSBFilter &usbFilterCache = m_cache.child(iFilterIndex); 385 if (usbFilterCache.wasChanged()) 449 386 { 450 /* Check if USB filter data really changed: */ 451 const UICacheSettingsMachineUSBFilter &usbFilterCache = m_cache.child(iFilterIndex); 452 if (usbFilterCache.wasChanged()) 387 /* If filter was removed or updated: */ 388 if (usbFilterCache.wasRemoved() || usbFilterCache.wasUpdated()) 453 389 { 454 /* If filter was removed or updated: */ 455 if (usbFilterCache.wasRemoved() || usbFilterCache.wasUpdated()) 456 host.RemoveUSBDeviceFilter(iFilterIndex); 457 /* If filter was created or updated: */ 458 if (usbFilterCache.wasCreated() || usbFilterCache.wasUpdated()) 459 { 460 /* Get USB filter data from cache: */ 461 const UIDataSettingsMachineUSBFilter &usbFilterData = usbFilterCache.data(); 462 463 /* Store USB filter data: */ 464 CHostUSBDeviceFilter hostFilter = host.CreateUSBDeviceFilter(usbFilterData.m_strName); 465 hostFilter.SetActive(usbFilterData.m_fActive); 466 hostFilter.SetVendorId(usbFilterData.m_strVendorId); 467 hostFilter.SetProductId(usbFilterData.m_strProductId); 468 hostFilter.SetRevision(usbFilterData.m_strRevision); 469 hostFilter.SetManufacturer(usbFilterData.m_strManufacturer); 470 hostFilter.SetProduct(usbFilterData.m_strProduct); 471 hostFilter.SetSerialNumber(usbFilterData.m_strSerialNumber); 472 hostFilter.SetPort(usbFilterData.m_strPort); 473 hostFilter.SetRemote(usbFilterData.m_strRemote); 474 hostFilter.SetAction(usbFilterData.m_action); 475 host.InsertUSBDeviceFilter(iFilterIndex, hostFilter); 476 } 390 filters.RemoveDeviceFilter(iOperationPosition); 391 if (usbFilterCache.wasRemoved()) 392 --iOperationPosition; 393 } 394 395 /* If filter was created or updated: */ 396 if (usbFilterCache.wasCreated() || usbFilterCache.wasUpdated()) 397 { 398 /* Get USB filter data from cache: */ 399 const UIDataSettingsMachineUSBFilter &usbFilterData = usbFilterCache.data(); 400 /* Store USB filter data: */ 401 CUSBDeviceFilter filter = filters.CreateDeviceFilter(usbFilterData.m_strName); 402 filter.SetActive(usbFilterData.m_fActive); 403 filter.SetVendorId(usbFilterData.m_strVendorId); 404 filter.SetProductId(usbFilterData.m_strProductId); 405 filter.SetRevision(usbFilterData.m_strRevision); 406 filter.SetManufacturer(usbFilterData.m_strManufacturer); 407 filter.SetProduct(usbFilterData.m_strProduct); 408 filter.SetSerialNumber(usbFilterData.m_strSerialNumber); 409 filter.SetPort(usbFilterData.m_strPort); 410 filter.SetRemote(usbFilterData.m_strRemote); 411 filters.InsertDeviceFilter(iOperationPosition, filter); 477 412 } 478 413 } 414 415 /* Advance operation position: */ 416 ++iOperationPosition; 479 417 } 480 418 } 481 break;482 419 } 483 /* Here come VM USB properties: */484 case UISettingsPageType_Machine:485 {486 /* Check if USB data really changed: */487 if (m_cache.wasChanged())488 {489 /* Check if controller is valid: */490 CUSBDeviceFilters filters = m_machine.GetUSBDeviceFilters();491 if (!filters.isNull())492 {493 /* Get USB data from cache: */494 495 const UIDataSettingsMachineUSB &usbData = m_cache.data();496 /* Store USB data: */497 if (isMachineOffline())498 {499 ULONG cOhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI);500 ULONG cEhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI);501 502 if (!cOhciCtls && usbData.m_fUSBEnabled)503 m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);504 else if (cOhciCtls && !usbData.m_fUSBEnabled)505 m_machine.RemoveUSBController("OHCI");506 507 if (!cEhciCtls && usbData.m_fEHCIEnabled)508 m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);509 else if (cEhciCtls && !usbData.m_fEHCIEnabled)510 m_machine.RemoveUSBController("EHCI");511 }512 /* Store USB filters data: */513 if (isMachineInValidMode())514 {515 /* For each USB filter data set: */516 int iOperationPosition = 0;517 for (int iFilterIndex = 0; iFilterIndex < m_cache.childCount(); ++iFilterIndex)518 {519 /* Check if USB filter data really changed: */520 const UICacheSettingsMachineUSBFilter &usbFilterCache = m_cache.child(iFilterIndex);521 if (usbFilterCache.wasChanged())522 {523 /* If filter was removed or updated: */524 if (usbFilterCache.wasRemoved() || usbFilterCache.wasUpdated())525 {526 filters.RemoveDeviceFilter(iOperationPosition);527 if (usbFilterCache.wasRemoved())528 --iOperationPosition;529 }530 531 /* If filter was created or updated: */532 if (usbFilterCache.wasCreated() || usbFilterCache.wasUpdated())533 {534 /* Get USB filter data from cache: */535 const UIDataSettingsMachineUSBFilter &usbFilterData = usbFilterCache.data();536 /* Store USB filter data: */537 CUSBDeviceFilter filter = filters.CreateDeviceFilter(usbFilterData.m_strName);538 filter.SetActive(usbFilterData.m_fActive);539 filter.SetVendorId(usbFilterData.m_strVendorId);540 filter.SetProductId(usbFilterData.m_strProductId);541 filter.SetRevision(usbFilterData.m_strRevision);542 filter.SetManufacturer(usbFilterData.m_strManufacturer);543 filter.SetProduct(usbFilterData.m_strProduct);544 filter.SetSerialNumber(usbFilterData.m_strSerialNumber);545 filter.SetPort(usbFilterData.m_strPort);546 filter.SetRemote(usbFilterData.m_strRemote);547 filters.InsertDeviceFilter(iOperationPosition, filter);548 }549 }550 551 /* Advance operation position: */552 ++iOperationPosition;553 }554 }555 }556 }557 break;558 }559 default:560 break;561 420 } 562 421 … … 693 552 /* Prepare new USB filter data: */ 694 553 UIDataSettingsMachineUSBFilter usbFilterData; 695 switch (pageType())696 {697 case UISettingsPageType_Global:698 usbFilterData.m_action = KUSBDeviceFilterAction_Hold;699 break;700 default:701 break;702 }703 554 usbFilterData.m_fActive = true; 704 555 usbFilterData.m_strName = mUSBFilterName.arg(iMaxFilterIndex + 1); … … 726 577 /* Prepare new USB filter data: */ 727 578 UIDataSettingsMachineUSBFilter usbFilterData; 728 switch (pageType())729 {730 case UISettingsPageType_Global:731 usbFilterData.m_action = KUSBDeviceFilterAction_Hold;732 break;733 default:734 break;735 }736 579 usbFilterData.m_fActive = true; 737 580 usbFilterData.m_strName = vboxGlobal().details(usb); … … 767 610 768 611 /* Configure USB filter details dialog: */ 769 UIMachineSettingsUSBFilterDetails dlgFilterDetails( pageType(),this);612 UIMachineSettingsUSBFilterDetails dlgFilterDetails(this); 770 613 dlgFilterDetails.mLeName->setText(usbFilterData.m_strName); 771 614 dlgFilterDetails.mLeVendorID->setText(usbFilterData.m_strVendorId); … … 776 619 dlgFilterDetails.mLeProduct->setText(usbFilterData.m_strProduct); 777 620 dlgFilterDetails.mLeSerialNo->setText(usbFilterData.m_strSerialNumber); 778 switch (pageType()) 779 { 780 case UISettingsPageType_Global: 781 { 782 if (usbFilterData.m_action == KUSBDeviceFilterAction_Ignore) 783 dlgFilterDetails.mCbAction->setCurrentIndex(0); 784 else if (usbFilterData.m_action == KUSBDeviceFilterAction_Hold) 785 dlgFilterDetails.mCbAction->setCurrentIndex(1); 786 else 787 AssertMsgFailed(("Invalid USBDeviceFilterAction type")); 788 break; 789 } 790 case UISettingsPageType_Machine: 791 { 792 QString strRemote = usbFilterData.m_strRemote.toLower(); 793 if (strRemote == "yes" || strRemote == "true" || strRemote == "1") 794 dlgFilterDetails.mCbRemote->setCurrentIndex(ModeOn); 795 else if (strRemote == "no" || strRemote == "false" || strRemote == "0") 796 dlgFilterDetails.mCbRemote->setCurrentIndex(ModeOff); 797 else 798 dlgFilterDetails.mCbRemote->setCurrentIndex(ModeAny); 799 break; 800 } 801 default: 802 break; 803 } 621 QString strRemote = usbFilterData.m_strRemote.toLower(); 622 if (strRemote == "yes" || strRemote == "true" || strRemote == "1") 623 dlgFilterDetails.mCbRemote->setCurrentIndex(ModeOn); 624 else if (strRemote == "no" || strRemote == "false" || strRemote == "0") 625 dlgFilterDetails.mCbRemote->setCurrentIndex(ModeOff); 626 else 627 dlgFilterDetails.mCbRemote->setCurrentIndex(ModeAny); 804 628 805 629 /* Run USB filter details dialog: */ … … 814 638 usbFilterData.m_strSerialNumber = dlgFilterDetails.mLeSerialNo->text().isEmpty() ? QString::null : dlgFilterDetails.mLeSerialNo->text(); 815 639 usbFilterData.m_strPort = dlgFilterDetails.mLePort->text().isEmpty() ? QString::null : dlgFilterDetails.mLePort->text(); 816 switch ( pageType())640 switch (dlgFilterDetails.mCbRemote->currentIndex()) 817 641 { 818 case UISettingsPageType_Global: 819 { 820 usbFilterData.m_action = gpConverter->fromString<KUSBDeviceFilterAction>(dlgFilterDetails.mCbAction->currentText()); 821 break; 822 } 823 case UISettingsPageType_Machine: 824 { 825 switch (dlgFilterDetails.mCbRemote->currentIndex()) 826 { 827 case ModeAny: usbFilterData.m_strRemote = QString(); break; 828 case ModeOn: usbFilterData.m_strRemote = QString::number(1); break; 829 case ModeOff: usbFilterData.m_strRemote = QString::number(0); break; 830 default: AssertMsgFailed(("Invalid combo box index")); 831 } 832 break; 833 } 834 default: 835 break; 642 case ModeAny: usbFilterData.m_strRemote = QString(); break; 643 case ModeOn: usbFilterData.m_strRemote = QString::number(1); break; 644 case ModeOff: usbFilterData.m_strRemote = QString::number(0); break; 645 default: AssertMsgFailed(("Invalid combo box index")); 836 646 } 837 647 pItem->setText(0, usbFilterData.m_strName); … … 938 748 } 939 749 940 /* Fetch data to m_properties & m_settings or m_machine & m_console: */941 void UIMachineSettingsUSB::fetchData(const QVariant &data)942 {943 switch (pageType())944 {945 case UISettingsPageType_Global:946 {947 m_properties = data.value<UISettingsDataGlobal>().m_properties;948 m_settings = data.value<UISettingsDataGlobal>().m_settings;949 break;950 }951 case UISettingsPageType_Machine:952 {953 m_machine = data.value<UISettingsDataMachine>().m_machine;954 m_console = data.value<UISettingsDataMachine>().m_console;955 break;956 }957 default:958 break;959 }960 }961 962 /* Upload m_properties & m_settings or m_machine & m_console to data: */963 void UIMachineSettingsUSB::uploadData(QVariant &data) const964 {965 switch (pageType())966 {967 case UISettingsPageType_Global:968 {969 data = QVariant::fromValue(UISettingsDataGlobal(m_properties, m_settings));970 break;971 }972 case UISettingsPageType_Machine:973 {974 data = QVariant::fromValue(UISettingsDataMachine(m_machine, m_console));975 break;976 }977 default:978 break;979 }980 }981 982 750 /* static */ 983 751 QString UIMachineSettingsUSB::toolTipFor(const UIDataSettingsMachineUSBFilter &usbFilterData) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r47573 r47594 105 105 106 106 /* Common settings / USB page: */ 107 class UIMachineSettingsUSB : public UISettingsPage ,108 public Ui::UIMachineSettingsUSB107 class UIMachineSettingsUSB : public UISettingsPageMachine, 108 public Ui::UIMachineSettingsUSB 109 109 { 110 110 Q_OBJECT; … … 119 119 }; 120 120 121 UIMachineSettingsUSB( UISettingsPageType type);121 UIMachineSettingsUSB(); 122 122 123 123 bool isOHCIEnabled() const; … … 171 171 void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew); 172 172 173 /* Fetch data to m_properties, m_settings or m_machine: */174 void fetchData(const QVariant &data);175 176 /* Upload m_properties, m_settings or m_machine to data: */177 void uploadData(QVariant &data) const;178 179 173 /* Returns the multi-line description of the given USB filter: */ 180 174 static QString toolTipFor(const UIDataSettingsMachineUSBFilter &data); 181 175 182 176 void polishPage(); 183 184 /* Global data source: */185 CSystemProperties m_properties;186 VBoxGlobalSettings m_settings;187 188 /* Machine data source: */189 CMachine m_machine;190 CConsole m_console;191 177 192 178 /* Other variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp
r44528 r47594 22 22 #include "UIConverter.h" 23 23 24 UIMachineSettingsUSBFilterDetails::UIMachineSettingsUSBFilterDetails( UISettingsPageType type,QWidget *pParent /* = 0 */)24 UIMachineSettingsUSBFilterDetails::UIMachineSettingsUSBFilterDetails(QWidget *pParent /* = 0 */) 25 25 : QIWithRetranslateUI2<QIDialog>(pParent, Qt::Sheet) 26 , m_type(type)27 26 { 28 27 /* Apply UI decorations */ … … 32 31 mCbRemote->insertItem (UIMachineSettingsUSB::ModeOn, ""); /* Yes */ 33 32 mCbRemote->insertItem (UIMachineSettingsUSB::ModeOff, ""); /* No */ 34 mLbRemote->setHidden (m_type != UISettingsPageType_Machine);35 mCbRemote->setHidden (m_type != UISettingsPageType_Machine);36 37 mCbAction->insertItem (0, ""); /* KUSBDeviceFilterAction_Ignore */38 mCbAction->insertItem (1, ""); /* KUSBDeviceFilterAction_Hold */39 mLbAction->setHidden (m_type != UISettingsPageType_Global);40 mCbAction->setHidden (m_type != UISettingsPageType_Global);41 33 42 34 mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this)); … … 61 53 mCbRemote->setItemText (UIMachineSettingsUSB::ModeOn, tr ("Yes", "remote")); 62 54 mCbRemote->setItemText (UIMachineSettingsUSB::ModeOff, tr ("No", "remote")); 63 64 mCbAction->setItemText (0,65 gpConverter->toString (KUSBDeviceFilterAction_Ignore));66 mCbAction->setItemText (1,67 gpConverter->toString (KUSBDeviceFilterAction_Hold));68 55 } 69 56 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.h
r33882 r47594 26 26 27 27 class UIMachineSettingsUSBFilterDetails : public QIWithRetranslateUI2<QIDialog>, 28 public Ui::UIMachineSettingsUSBFilterDetails28 public Ui::UIMachineSettingsUSBFilterDetails 29 29 { 30 30 Q_OBJECT; … … 32 32 public: 33 33 34 UIMachineSettingsUSBFilterDetails(UISettingsPageType type, QWidget *pParent = 0); 35 36 protected: 37 38 void retranslateUi(); 34 UIMachineSettingsUSBFilterDetails(QWidget *pParent = 0); 39 35 40 36 private: 41 37 42 /* Private member vars */ 43 UISettingsPageType m_type; 38 void retranslateUi(); 44 39 }; 45 40 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.ui
r43106 r47594 219 219 </widget> 220 220 </item> 221 <item row="9" column="0" >222 <widget class="QLabel" name="mLbAction" >223 <property name="text" >224 <string>&Action:</string>225 </property>226 <property name="alignment" >227 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>228 </property>229 <property name="buddy" >230 <cstring>mCbAction</cstring>231 </property>232 </widget>233 </item>234 221 <item row="9" column="1" > 235 <widget class="QComboBox" name="mCbAction" >236 <property name="sizePolicy" >237 <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >238 <horstretch>0</horstretch>239 <verstretch>0</verstretch>240 </sizepolicy>241 </property>242 <property name="toolTip" >243 <string>Defines an action performed by the host computer when a matching device is attached: give it up to the host OS (<i>Ignore</i>) or grab it for later usage by virtual machines (<i>Hold</i>).</string>244 </property>245 </widget>246 </item>247 <item row="10" column="1" >248 222 <spacer> 249 223 <property name="orientation" > … … 258 232 </spacer> 259 233 </item> 260 <item row="1 1" column="0" colspan="2" >234 <item row="10" column="0" colspan="2" > 261 235 <widget class="QIDialogButtonBox" name="mButtonBox" > 262 236 <property name="standardButtons" >
Note:
See TracChangeset
for help on using the changeset viewer.