VirtualBox

Changeset 70 in vbox


Ignore:
Timestamp:
Jan 16, 2007 4:12:31 PM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Fixed the VM Settings dialog (USB page):

  • The debug vesion could assert if the USB controller were not available (for example, as in VBox OSE);
  • Show an error message from the USB proxy service if the USB controller is not available because the proxy service could not be loaded.
Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 edited

Legend:

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

    r1 r70  
    110110    void cannotSaveMachineSettings (const CMachine &machine,
    111111                                    QWidget *parent = 0);
     112    void cannotLoadMachineSettings (const CMachine &machine,
     113                                    bool strict = true,
     114                                    QWidget *parent = 0);
     115
    112116    void cannotStartMachine (const CConsole &console);
    113117    void cannotStartMachine (const CProgress &progress);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r56 r70  
    636636    static QString sGeneralFullHrefTpl, sGeneralFullBoldTpl;
    637637
    638     // generate templates after every language change
     638    /* generate templates after every language change */
    639639
    640640    if (!detailReportTemplatesReady)
     
    648648                                             tr ("<nobr>%3 MB</nobr>", "details report"));
    649649        sGeneralBasicHrefTpl = QString (sSectionHrefTpl)
    650                 .arg (2 + 3) // rows
    651                 .arg ("machine_16px.png", // icon
    652                       "#general", // link
    653                       tr ("General", "details report"), // title
    654                       generalItems); // items
     650                .arg (2 + 3) /* rows */
     651                .arg ("machine_16px.png", /* icon */
     652                      "#general", /* link */
     653                      tr ("General", "details report"), /* title */
     654                      generalItems); /* items */
    655655        sGeneralBasicBoldTpl = QString (sSectionBoldTpl)
    656                 .arg (2 + 3) // rows
    657                 .arg ("machine_16px.png", // icon
    658                       "#general", // link
    659                       tr ("General", "details report"), // title
    660                       generalItems); // items
     656                .arg (2 + 3) /* rows */
     657                .arg ("machine_16px.png", /* icon */
     658                      "#general", /* link */
     659                      tr ("General", "details report"), /* title */
     660                      generalItems); /* items */
    661661
    662662        generalItems
     
    668668
    669669        sGeneralFullHrefTpl = QString (sSectionHrefTpl)
    670             .arg (2 + 7) // rows
    671             .arg ("machine_16px.png", // icon
    672                   "#general", // link
    673                   tr ("General", "details report"), // title
    674                   generalItems); // items
     670            .arg (2 + 7) /* rows */
     671            .arg ("machine_16px.png", /* icon */
     672                  "#general", /* link */
     673                  tr ("General", "details report"), /* title */
     674                  generalItems); /* items */
    675675        sGeneralFullBoldTpl = QString (sSectionBoldTpl)
    676             .arg (2 + 7) // rows
    677             .arg ("machine_16px.png", // icon
    678                   "#general", // link
    679                   tr ("General", "details report"), // title
    680                   generalItems); // items
    681     }
    682 
    683     // common generated content
     676            .arg (2 + 7) /* rows */
     677            .arg ("machine_16px.png", /* icon */
     678                  "#general", /* link */
     679                  tr ("General", "details report"), /* title */
     680                  generalItems); /* items */
     681    }
     682
     683    /* common generated content */
    684684
    685685    const QString &sectionTpl = withLinks
     
    689689    QString hardDisks;
    690690    {
    691         int rows = 2; // including section header and footer
     691        int rows = 2; /* including section header and footer */
    692692
    693693        CHardDiskAttachmentEnumerator aen = m.GetHardDiskAttachments().Enumerate();
     
    715715
    716716        hardDisks = sectionTpl
    717             .arg (rows) // rows
    718             .arg ("hd_16px.png", // icon
    719                   "#hdds", // link
    720                   tr ("Hard Disks", "details report"), // title
    721                   hardDisks); // items
    722     }
    723 
    724     // compose details report
     717            .arg (rows) /* rows */
     718            .arg ("hd_16px.png", /* icon */
     719                  "#hdds", /* link */
     720                  tr ("Hard Disks", "details report"), /* title */
     721                  hardDisks); /* items */
     722    }
     723
     724    /* compose details report */
    725725
    726726    const QString &generalBasicTpl = withLinks
     
    745745    else
    746746    {
    747         // boot order
     747        /* boot order */
    748748        QString bootOrder;
    749749        for (ulong i = 1; i <= vbox.GetSystemProperties().GetMaxBootPosition(); i++)
     
    761761        CBIOSSettings biosSettings = m.GetBIOSSettings();
    762762
    763         // ACPI
     763        /* ACPI */
    764764        QString acpi = biosSettings.GetACPIEnabled()
    765765            ? tr ("Enabled", "details report (ACPI)")
    766766            : tr ("Disabled", "details report (ACPI)");
    767767
    768         // IO APIC
     768        /* IO APIC */
    769769        QString ioapic = biosSettings.GetIOAPICEnabled()
    770770            ? tr ("Enabled", "details report (IO APIC)")
    771771            : tr ("Disabled", "details report (IO APIC)");
    772772
    773         // General + Hard Disks
     773        /* General + Hard Disks */
    774774        detailsReport
    775775            = generalFullTpl
     
    785785        QString item;
    786786
    787         // Floppy
     787        /* Floppy */
    788788        CFloppyDrive floppy = m.GetFloppyDrive();
    789789        item = QString (sSectionItemTpl);
     
    811811        }
    812812        detailsReport += sectionTpl
    813             .arg (2 + 1) // rows
    814             .arg ("fd_16px.png", // icon
    815                   "#floppy", // link
    816                   tr ("Floppy", "details report"), // title
    817                   item); // items
    818 
    819         // DVD
     813            .arg (2 + 1) /* rows */
     814            .arg ("fd_16px.png", /* icon */
     815                  "#floppy", /* link */
     816                  tr ("Floppy", "details report"), /* title */
     817                  item); /* items */
     818
     819        /* DVD */
    820820        CDVDDrive dvd = m.GetDVDDrive();
    821821        item = QString (sSectionItemTpl);
     
    843843        }
    844844        detailsReport += sectionTpl
    845             .arg (2 + 1) // rows
    846             .arg ("cd_16px.png", // icon
    847                   "#dvd", // link
    848                   tr ("CD/DVD-ROM", "details report"), // title
     845            .arg (2 + 1) /* rows */
     846            .arg ("cd_16px.png", /* icon */
     847                  "#dvd", /* link */
     848                  tr ("CD/DVD-ROM", "details report"), /* title */
    849849                  item); // items
    850850
    851         // audio
     851        /* audio */
    852852        {
    853853            CAudioAdapter audio = m.GetAudioAdapter();
     
    861861
    862862            detailsReport += sectionTpl
    863                 .arg (2 + 1) // rows
    864                 .arg ("sound_16px.png", // icon
    865                       "#audio", // link
    866                       tr ("Audio", "details report"), // title
    867                       item); // items
    868         }
    869         // network
     863                .arg (2 + 1) /* rows */
     864                .arg ("sound_16px.png", /* icon */
     865                      "#audio", /* link */
     866                      tr ("Audio", "details report"), /* title */
     867                      item); /* items */
     868        }
     869        /* network */
    870870        {
    871871            item = QString::null;
    872872            ulong count = vbox.GetSystemProperties().GetNetworkAdapterCount();
    873             int rows = 2; // including section header and footer
     873            int rows = 2; /* including section header and footer */
    874874            for (ulong slot = 0; slot < count; slot ++)
    875875            {
     
    892892
    893893            detailsReport += sectionTpl
    894                 .arg (rows) // rows
    895                 .arg ("nw_16px.png", // icon
    896                       "#network", // link
    897                       tr ("Network", "details report"), // title
    898                       item); // items
    899         }
    900         // USB
     894                .arg (rows) /* rows */
     895                .arg ("nw_16px.png", /* icon */
     896                      "#network", /* link */
     897                      tr ("Network", "details report"), /* title */
     898                      item); /* items */
     899        }
     900        /* USB */
    901901        {
    902902            CUSBController ctl = m.GetUSBController();
    903903            if (!ctl.isNull())
    904904            {
     905                /* the USB controller may be unavailable (i.e. in VirtualBox OSE) */
     906
    905907                if (ctl.GetEnabled())
    906908                {
     
    922924
    923925                detailsReport += sectionTpl
    924                     .arg (2 + 1) // rows
    925                     .arg ("usb_16px.png", // icon
    926                           "#usb", // link
    927                           tr ("USB Controller", "details report"), // title
    928                           item); // items
     926                    .arg (2 + 1) /* rows */
     927                    .arg ("usb_16px.png", /* icon */
     928                          "#usb", /* link */
     929                          tr ("USB Controller", "details report"), /* title */
     930                          item); /* items */
    929931            }
    930932        }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r1 r70  
    532532                                                     QWidget *parent /* = 0 */)
    533533{
    534     // below, we use CMachine (machine) to preserve current error info
    535     // for formatErrorInfo()
    536 
    537     message (
    538         parent ? parent : mainWindowShown(),
    539         Error,
    540         tr ("Failed to save the settings of the virtual machine <b>%1</b>.")
    541             .arg (CMachine (machine).GetName()),
    542         formatErrorInfo (machine)
    543     );
     534    /* preserve the current error info before calling the object again */
     535    COMErrorInfo errInfo = machine.errorInfo();
     536     
     537    message (parent ? parent : mainWindowShown(), Error,
     538             tr ("Failed to save the settings of the virtual machine <b>%1</b>.")
     539                 .arg (machine.GetName()),
     540             formatErrorInfo (errInfo));
     541}
     542
     543/**
     544 *  @param  strict  if |true| then show the message even if there is no basic
     545 *                  error info available
     546 */
     547void VBoxProblemReporter::cannotLoadMachineSettings (const CMachine &machine,
     548                                                     bool strict /* = true */,
     549                                                     QWidget *parent /* = 0 */)
     550{
     551    COMErrorInfo errInfo = machine.errorInfo();
     552    if (!strict && !errInfo.isBasicAvailable())
     553        return;
     554
     555    message (parent ? parent : mainWindowShown(), Error,
     556             tr ("Failed to load the settings of the virtual machine <b>%1</b>.")
     557                 .arg (machine.GetName()),
     558             formatErrorInfo (errInfo));
    544559}
    545560
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h

    r59 r70  
    12311231    }
    12321232
    1233     /* usb */
     1233    /* USB */
    12341234    {
    12351235        CUSBController ctl = machine.GetUSBController();
    12361236
    1237         QListViewItem *usbListItem = listView->findItem ("USB", 0, Qt::Contains);
    1238         if (usbListItem && ctl.isNull())
    1239             usbListItem->setVisible (false);
    1240 
    1241         cbEnableUSBController->setChecked (ctl.GetEnabled());
    1242 
    1243         CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate();
    1244         while (en.HasMore())
    1245             addUSBFilter (en.GetNext(), false /* isNew */);
    1246 
    1247         lvUSBFilters->setCurrentItem (lvUSBFilters->firstChild());
    1248         /*
    1249          *  silly, silly Qt -- doesn't emit currentChanged after adding the
    1250          *  first item to an empty list
    1251          */
    1252         lvUSBFilters_currentChanged (lvUSBFilters->firstChild());
     1237        if (ctl.isNull())
     1238        {
     1239            /* disable the USB controller category if the USB controller is
     1240             * not available (i.e. in VirtualBox OSE) */
     1241
     1242            QListViewItem *usbItem = listView->findItem ("#usb", listView_Link);
     1243            Assert (usbItem);
     1244            if (usbItem)
     1245                usbItem->setVisible (false);
     1246
     1247            /* if machine has something to say, show the message */
     1248            vboxProblem().cannotLoadMachineSettings (machine, false /* strict */);
     1249        }
     1250        else
     1251        {
     1252            cbEnableUSBController->setChecked (ctl.GetEnabled());
     1253
     1254            CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate();
     1255            while (en.HasMore())
     1256                addUSBFilter (en.GetNext(), false /* isNew */);
     1257
     1258            lvUSBFilters->setCurrentItem (lvUSBFilters->firstChild());
     1259            /*
     1260             *  silly, silly Qt -- doesn't emit currentChanged after adding the
     1261             *  first item to an empty list
     1262             */
     1263            lvUSBFilters_currentChanged (lvUSBFilters->firstChild());
     1264        }
    12531265    }
    12541266
     
    14291441        CUSBController ctl = cmachine.GetUSBController();
    14301442
    1431         ctl.SetEnabled (cbEnableUSBController->isChecked());
    1432 
    1433         /*
    1434          *  first, remove all old filters (only if the list is changed,
    1435          *  not only individual properties of filters)
    1436          */
    1437         if (mUSBFilterListModified)
    1438             for (ulong count = ctl.GetDeviceFilters().GetCount(); count; -- count)
    1439                 ctl.RemoveDeviceFilter (0);
    1440 
    1441         /* then add all new filters */
    1442         for (QListViewItem *item = lvUSBFilters->firstChild(); item;
    1443              item = item->nextSibling())
    1444         {
    1445             USBListItem *uli = static_cast <USBListItem *> (item);
    1446             VBoxUSBFilterSettings *settings =
    1447                 static_cast <VBoxUSBFilterSettings *>
    1448                     (wstUSBFilters->widget (uli->mId));
    1449             Assert (settings);
    1450 
    1451             COMResult res = settings->putBackToFilter();
    1452             if (!res.isOk())
    1453                 return res;
    1454 
    1455             CUSBDeviceFilter filter = settings->filter();
    1456             filter.SetActive (uli->isOn());
    1457 
     1443        if (!ctl.isNull())
     1444        {
     1445            /* the USB controller may be unavailable (i.e. in VirtualBox OSE) */
     1446
     1447            ctl.SetEnabled (cbEnableUSBController->isChecked());
     1448
     1449            /*
     1450             *  first, remove all old filters (only if the list is changed,
     1451             *  not only individual properties of filters)
     1452             */
    14581453            if (mUSBFilterListModified)
    1459                 ctl.InsertDeviceFilter (~0, filter);
     1454                for (ulong count = ctl.GetDeviceFilters().GetCount(); count; -- count)
     1455                    ctl.RemoveDeviceFilter (0);
     1456
     1457            /* then add all new filters */
     1458            for (QListViewItem *item = lvUSBFilters->firstChild(); item;
     1459                 item = item->nextSibling())
     1460            {
     1461                USBListItem *uli = static_cast <USBListItem *> (item);
     1462                VBoxUSBFilterSettings *settings =
     1463                    static_cast <VBoxUSBFilterSettings *>
     1464                        (wstUSBFilters->widget (uli->mId));
     1465                Assert (settings);
     1466
     1467                COMResult res = settings->putBackToFilter();
     1468                if (!res.isOk())
     1469                    return res;
     1470
     1471                CUSBDeviceFilter filter = settings->filter();
     1472                filter.SetActive (uli->isOn());
     1473
     1474                if (mUSBFilterListModified)
     1475                    ctl.InsertDeviceFilter (~0, filter);
     1476            }
    14601477        }
    14611478
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