- Timestamp:
- Feb 9, 2007 4:21:36 PM (18 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r779 r815 102 102 void cannotSaveGlobalConfig (const CVirtualBox &vbox); 103 103 void cannotSetSystemProperties (const CSystemProperties &props); 104 void cannotAccessUSB (const COMBase &obj); 104 105 105 106 void cannotCreateMachine (const CVirtualBox &vbox, … … 113 114 bool strict = true, 114 115 QWidget *parent = 0); 115 void cannotGetUSBController (const CMachine &machine);116 116 117 117 void cannotStartMachine (const CConsole &console); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r806 r815 491 491 } 492 492 493 void VBoxProblemReporter::cannotAccessUSB (const COMBase &obj) 494 { 495 /* if there is no error info available, it should mean that 496 * IMachine::GetUSBController(), IHost::GetUSBDevices() etc. just returned 497 * E_NOTIMPL, as for the OSE version. Don't show the error message in this 498 * case since it's normal. */ 499 COMErrorInfo errInfo = obj.errorInfo(); 500 if (obj.lastRC() == E_NOTIMPL && !errInfo.isBasicAvailable()) 501 return; 502 503 message (mainWindowShown(), Error, 504 tr ("Failed to access the USB subsystem."), 505 formatErrorInfo (errInfo), 506 "cannotAccessUSB"); 507 } 508 493 509 void VBoxProblemReporter::cannotCreateMachine (const CVirtualBox &vbox, 494 510 QWidget *parent /* = 0 */) … … 555 571 .arg (machine.GetName()), 556 572 formatErrorInfo (errInfo)); 557 }558 559 void VBoxProblemReporter::cannotGetUSBController (const CMachine &machine)560 {561 /* if there is no error info available, it should mean that562 * IMachine::GetUSBController returned just E_NOTIMPL, as for the OSE563 * version. Don't show the error message in this case since it's normal. */564 COMErrorInfo errInfo = machine.errorInfo();565 if (machine.lastRC() == E_NOTIMPL && !errInfo.isBasicAvailable())566 return;567 568 message (mainWindowShown(), Error,569 tr ("Failed to access the USB controller of the virtual "570 "machine <b>%1</b>.")571 .arg (machine.GetName()),572 formatErrorInfo (errInfo),573 "cannotGetUSBController");574 573 } 575 574 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui
r711 r815 1022 1022 <include location="local" impldecl="in implementation">VBoxUtils.h</include> 1023 1023 <include location="local" impldecl="in implementation">VBoxGlobal.h</include> 1024 <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include> 1024 1025 <include location="local" impldecl="in implementation">VBoxUSBFilterSettings.h</include> 1025 1026 </includes> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h
r711 r815 126 126 6 /* seems that RichText adds some margin */ + 127 127 whatsThisLabel->fontMetrics().width ('m') * 40); 128 128 129 129 /* 130 130 * create and layout non-standard widgets … … 215 215 if (!object->isWidgetType()) 216 216 return QDialog::eventFilter (object, event); 217 217 218 218 QWidget *widget = static_cast <QWidget *> (object); 219 219 if (widget->topLevelWidget() != this) … … 332 332 333 333 CHost host = vboxGlobal().virtualBox().GetHost(); 334 CHostUSBDeviceFilterEnumerator en = host.GetUSBDeviceFilters().Enumerate(); 335 while (en.HasMore()) 336 { 337 CHostUSBDeviceFilter hostFilter = en.GetNext(); 338 CUSBDeviceFilter filter = CUnknown (hostFilter); 339 addUSBFilter (filter, false); 340 } 341 lvUSBFilters->setCurrentItem (lvUSBFilters->firstChild()); 342 lvUSBFilters_currentChanged (lvUSBFilters->firstChild()); 343 344 // wvalXXXX->revalidate(); 334 CHostUSBDeviceFilterCollection coll = host.GetUSBDeviceFilters(); 335 if (coll.isNull()) 336 { 337 /* disable the USB host filters category if the USB is 338 * not available (i.e. in VirtualBox OSE) */ 339 340 QListViewItem *usbItem = listView->findItem ("#usb", listView_Link); 341 Assert (usbItem); 342 usbItem->setVisible (false); 343 344 /* disable validators if any */ 345 pageUSB->setEnabled (false); 346 347 /* Show an error message (if there is any). 348 * This message box may be suppressed if the user wishes so. */ 349 vboxProblem().cannotAccessUSB (host); 350 } 351 else 352 { 353 CHostUSBDeviceFilterEnumerator en = coll.Enumerate(); 354 while (en.HasMore()) 355 { 356 CHostUSBDeviceFilter hostFilter = en.GetNext(); 357 CUSBDeviceFilter filter = CUnknown (hostFilter); 358 addUSBFilter (filter, false); 359 } 360 lvUSBFilters->setCurrentItem (lvUSBFilters->firstChild()); 361 lvUSBFilters_currentChanged (lvUSBFilters->firstChild()); 362 } 345 363 } 346 364 … … 440 458 if (!warning.isEmpty()) 441 459 warningString = QString ("<font color=red>%1</font>").arg (warning); 442 460 443 461 if (!warningString.isEmpty()) 444 462 whatsThisLabel->setText (warningString); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r780 r815 1242 1242 pageUSB->setEnabled (false); 1243 1243 1244 /* If machine has something to say, show the message.1244 /* Show an error message (if there is any). 1245 1245 * Note that we don't use the generic cannotLoadMachineSettings() 1246 1246 * call here because we want this message to be suppressable. */ 1247 vboxProblem().cannot GetUSBController(machine);1247 vboxProblem().cannotAccessUSB (machine); 1248 1248 } 1249 1249 else -
trunk/src/VBox/Main/HostImpl.cpp
r606 r815 458 458 STDMETHODIMP Host::COMGETTER(USBDevices)(IHostUSBDeviceCollection **aUSBDevices) 459 459 { 460 #ifdef VBOX_WITH_USB 460 461 if (!aUSBDevices) 461 462 return E_POINTER; … … 463 464 AutoLock alock (this); 464 465 CHECK_READY(); 466 467 HRESULT rc = checkUSBProxyService(); 468 CheckComRCReturnRC (rc); 465 469 466 470 ComObjPtr <HostUSBDeviceCollection> collection; … … 469 473 collection.queryInterfaceTo (aUSBDevices); 470 474 return S_OK; 475 #else 476 /* Note: The GUI depends on this method returning E_NOTIMPL with no 477 * extended error info to indicate that USB is simply not available 478 * (w/o treting it as a failure), for example, as in OSE */ 479 return E_NOTIMPL; 480 #endif 471 481 } 472 482 473 483 STDMETHODIMP Host::COMGETTER(USBDeviceFilters) (IHostUSBDeviceFilterCollection ** aUSBDeviceFilters) 474 484 { 485 #ifdef VBOX_WITH_USB 475 486 if (!aUSBDeviceFilters) 476 487 return E_POINTER; … … 478 489 AutoLock alock (this); 479 490 CHECK_READY(); 491 492 HRESULT rc = checkUSBProxyService(); 493 CheckComRCReturnRC (rc); 480 494 481 495 ComObjPtr <HostUSBDeviceFilterCollection> collection; … … 484 498 collection.queryInterfaceTo (aUSBDeviceFilters); 485 499 return S_OK; 500 #else 501 /* Note: The GUI depends on this method returning E_NOTIMPL with no 502 * extended error info to indicate that USB is simply not available 503 * (w/o treting it as a failure), for example, as in OSE */ 504 return E_NOTIMPL; 505 #endif 486 506 } 487 507 … … 762 782 STDMETHODIMP Host::CreateUSBDeviceFilter (INPTR BSTR aName, IHostUSBDeviceFilter **aFilter) 763 783 { 784 #ifdef VBOX_WITH_USB 764 785 if (!aFilter) 765 786 return E_POINTER; … … 771 792 CHECK_READY(); 772 793 794 HRESULT rc = checkUSBProxyService(); 795 CheckComRCReturnRC (rc); 796 773 797 ComObjPtr <HostUSBDeviceFilter> filter; 774 798 filter.createObject(); 775 HRESULTrc = filter->init (this, aName);799 rc = filter->init (this, aName); 776 800 ComAssertComRCRet (rc, rc); 777 801 rc = filter.queryInterfaceTo (aFilter); 778 802 AssertComRCReturn (rc, rc); 779 803 return S_OK; 804 #else 805 /* Note: The GUI depends on this method returning E_NOTIMPL with no 806 * extended error info to indicate that USB is simply not available 807 * (w/o treting it as a failure), for example, as in OSE */ 808 return E_NOTIMPL; 809 #endif 780 810 } 781 811 782 812 STDMETHODIMP Host::InsertUSBDeviceFilter (ULONG aPosition, IHostUSBDeviceFilter *aFilter) 783 813 { 814 #ifdef VBOX_WITH_USB 784 815 if (!aFilter) 785 816 return E_INVALIDARG; … … 787 818 AutoLock alock (this); 788 819 CHECK_READY(); 820 821 HRESULT rc = checkUSBProxyService(); 822 CheckComRCReturnRC (rc); 789 823 790 824 ComObjPtr <HostUSBDeviceFilter> filter = getDependentChild (aFilter); … … 798 832 tr ("The given USB device filter is already in the list")); 799 833 800 / / iterate to the position...834 /* iterate to the position... */ 801 835 USBDeviceFilterList::iterator it = mUSBDeviceFilters.begin(); 802 836 std::advance (it, aPosition); 803 / / ...and insert837 /* ...and insert */ 804 838 mUSBDeviceFilters.insert (it, filter); 805 839 filter->mInList = true; 806 840 807 / / notify the proxy (only when the filter is active)841 /* notify the proxy (only when the filter is active) */ 808 842 if (filter->data().mActive) 809 843 { … … 813 847 } 814 848 815 / / save the global settings849 /* save the global settings */ 816 850 alock.unlock(); 817 851 return mParent->saveSettings(); 852 #else 853 /* Note: The GUI depends on this method returning E_NOTIMPL with no 854 * extended error info to indicate that USB is simply not available 855 * (w/o treting it as a failure), for example, as in OSE */ 856 return E_NOTIMPL; 857 #endif 818 858 } 819 859 820 860 STDMETHODIMP Host::RemoveUSBDeviceFilter (ULONG aPosition, IHostUSBDeviceFilter **aFilter) 821 861 { 862 #ifdef VBOX_WITH_USB 822 863 if (!aFilter) 823 864 return E_POINTER; … … 825 866 AutoLock alock (this); 826 867 CHECK_READY(); 868 869 HRESULT rc = checkUSBProxyService(); 870 CheckComRCReturnRC (rc); 827 871 828 872 if (!mUSBDeviceFilters.size()) … … 837 881 ComObjPtr <HostUSBDeviceFilter> filter; 838 882 { 839 / / iterate to the position...883 /* iterate to the position... */ 840 884 USBDeviceFilterList::iterator it = mUSBDeviceFilters.begin(); 841 885 std::advance (it, aPosition); 842 / / ...get an element from there...886 /* ...get an element from there... */ 843 887 filter = *it; 844 / / ...and remove888 /* ...and remove */ 845 889 filter->mInList = false; 846 890 mUSBDeviceFilters.erase (it); … … 849 893 filter.queryInterfaceTo (aFilter); 850 894 851 / / notify the proxy (only when the filter is active)895 /* notify the proxy (only when the filter is active) */ 852 896 if (filter->data().mActive) 853 897 { … … 857 901 } 858 902 859 / / save the global settings903 /* save the global settings */ 860 904 alock.unlock(); 861 905 return mParent->saveSettings(); 906 #else 907 /* Note: The GUI depends on this method returning E_NOTIMPL with no 908 * extended error info to indicate that USB is simply not available 909 * (w/o treting it as a failure), for example, as in OSE */ 910 return E_NOTIMPL; 911 #endif 862 912 } 863 913 … … 1568 1618 } 1569 1619 1620 /** 1621 * Checks for the presense and status of the USB Proxy Service. 1622 * Returns S_OK when the Proxy is present and OK, or E_FAIL and a 1623 * corresponding error message otherwise. Intended to be used by methods 1624 * that rely on the Proxy Service availability. 1625 * 1626 * @note Locks this object for reading. 1627 */ 1628 HRESULT Host::checkUSBProxyService() 1629 { 1630 #ifdef VBOX_WITH_USB 1631 AutoLock lock (this); 1632 CHECK_READY(); 1633 1634 AssertReturn (mUSBProxyService, E_FAIL); 1635 if (!mUSBProxyService->isActive()) 1636 { 1637 /* disable the USB controller completely to avoid assertions if the 1638 * USB proxy service could not start. */ 1639 1640 Assert (VBOX_FAILURE (mUSBProxyService->getLastError())); 1641 if (mUSBProxyService->getLastError() == VERR_FILE_NOT_FOUND) 1642 return setError (E_FAIL, 1643 tr ("Could not load the Host USB Proxy Service (%Vrc)." 1644 "The service might be not installed on the host computer"), 1645 mUSBProxyService->getLastError()); 1646 else 1647 return setError (E_FAIL, 1648 tr ("Could not load the Host USB Proxy service (%Vrc)"), 1649 mUSBProxyService->getLastError()); 1650 } 1651 1652 return S_OK; 1653 #else 1654 return E_NOTIMPL; 1655 #endif 1656 } 1657 1570 1658 #ifdef __WIN__ 1571 1659 -
trunk/src/VBox/Main/MachineImpl.cpp
r779 r815 1120 1120 CheckComRCReturnRC (autoCaller.rc()); 1121 1121 1122 HRESULT rc = mParent->host()->checkUSBProxyService(); 1123 CheckComRCReturnRC (rc); 1124 1122 1125 AutoReaderLock alock (this); 1123 1124 USBProxyService *usbProxyService = mParent->host()->usbProxyService();1125 AssertReturn (usbProxyService, E_FAIL);1126 if (!usbProxyService->isActive())1127 {1128 /* disable the USB controller completely to avoid assertions if the1129 * USB proxy service could not start. */1130 1131 Assert (VBOX_FAILURE (usbProxyService->getLastError()));1132 if (usbProxyService->getLastError() == VERR_FILE_NOT_FOUND)1133 return setError (E_FAIL,1134 tr ("Could not load the USB proxy service (%Vrc), "1135 "the virtual USB Controller is not available."1136 "The service may not be installed on the host computer"),1137 usbProxyService->getLastError());1138 else1139 return setError (E_FAIL,1140 tr ("Could not load the USB proxy service (%Vrc), "1141 "the virtual USB Controller is not available"),1142 usbProxyService->getLastError());1143 }1144 1126 1145 1127 mUSBController.queryInterfaceTo (a_ppUSBController); -
trunk/src/VBox/Main/include/HostImpl.h
r1 r815 115 115 void onUSBDeviceStateChanged (HostUSBDevice *aDevice); 116 116 117 HRESULT checkUSBProxyService(); 118 119 /* must be called from under this object's lock */ 117 120 USBProxyService *usbProxyService() { return mUSBProxyService; } 118 121
Note:
See TracChangeset
for help on using the changeset viewer.