VirtualBox

Ignore:
Timestamp:
Feb 9, 2007 4:21:36 PM (18 years ago)
Author:
vboxsync
Message:

Main:

  • Return E_NOTIMPL for global USB filters and all other stuff when no VBOX_WITH_USB is defined (as in OSE).
  • Moved the USB Proxy Service check to Host to make it reusable both for global-related USB methods and for VM-related methods.

FE/Qt:

  • Don't show Global USB UI when USB is not available.
  • Show the "USB Proxy Service is unavailable" message box when opening both global and VM settings.
Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r779 r815  
    102102    void cannotSaveGlobalConfig (const CVirtualBox &vbox);
    103103    void cannotSetSystemProperties (const CSystemProperties &props);
     104    void cannotAccessUSB (const COMBase &obj);
    104105
    105106    void cannotCreateMachine (const CVirtualBox &vbox,
     
    113114                                    bool strict = true,
    114115                                    QWidget *parent = 0);
    115     void cannotGetUSBController (const CMachine &machine);
    116116
    117117    void cannotStartMachine (const CConsole &console);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r806 r815  
    491491}
    492492
     493void 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
    493509void VBoxProblemReporter::cannotCreateMachine (const CVirtualBox &vbox,
    494510                                               QWidget *parent /* = 0 */)
     
    555571                 .arg (machine.GetName()),
    556572             formatErrorInfo (errInfo));
    557 }
    558 
    559 void VBoxProblemReporter::cannotGetUSBController (const CMachine &machine)
    560 {
    561     /* if there is no error info available, it should mean that
    562      * IMachine::GetUSBController returned just E_NOTIMPL, as for the OSE
    563      * 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");
    574573}
    575574
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui

    r711 r815  
    10221022    <include location="local" impldecl="in implementation">VBoxUtils.h</include>
    10231023    <include location="local" impldecl="in implementation">VBoxGlobal.h</include>
     1024    <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include>
    10241025    <include location="local" impldecl="in implementation">VBoxUSBFilterSettings.h</include>
    10251026</includes>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h

    r711 r815  
    126126                                     6 /* seems that RichText adds some margin */ +
    127127                                     whatsThisLabel->fontMetrics().width ('m') * 40);
    128    
     128
    129129    /*
    130130     *  create and layout non-standard widgets
     
    215215    if (!object->isWidgetType())
    216216        return QDialog::eventFilter (object, event);
    217    
     217
    218218    QWidget *widget = static_cast <QWidget *> (object);
    219219    if (widget->topLevelWidget() != this)
     
    332332
    333333    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    }
    345363}
    346364
     
    440458    if (!warning.isEmpty())
    441459        warningString = QString ("<font color=red>%1</font>").arg (warning);
    442    
     460
    443461    if (!warningString.isEmpty())
    444462        whatsThisLabel->setText (warningString);
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h

    r780 r815  
    12421242            pageUSB->setEnabled (false);
    12431243
    1244             /* If machine has something to say, show the message.
     1244            /* Show an error message (if there is any).
    12451245             * Note that we don't use the generic cannotLoadMachineSettings()
    12461246             * call here because we want this message to be suppressable. */
    1247             vboxProblem().cannotGetUSBController (machine);
     1247            vboxProblem().cannotAccessUSB (machine);
    12481248        }
    12491249        else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette