VirtualBox

Ignore:
Timestamp:
Aug 16, 2018 3:58:57 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124395
Message:

Main/CloudProviderManager+CloudProvider+CloudProfile: Introduce CloudProfile as separate interface, and do a big cleanup. Adding synchronization and incomplete support for moving to an extension pack. Updated VBoxManage to list providers and touched up the GUI code slightly to deal with the changed interfaces.

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp

    r73029 r73716  
    13801380                         fFirst ? "Property:       " : "                ",
    13811381                         names[i], value.raw());
     1382                fFirst = false;
    13821383            }
    13831384        }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r73664 r73716  
    449449                     "                            hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
    450450                     "                            usbhost|usbfilters|systemproperties|extpacks|\n"
    451                      "                            groups|webcams|screenshotformats\n"
     451                     "                            groups|webcams|screenshotformats|cloudproviders|\n"
     452                     "                            cloudprofiles\n"
    452453                     "\n", SEP);
    453454
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r72976 r73716  
    900900}
    901901
     902/**
     903 * List available cloud providers.
     904 *
     905 * @returns See produceList.
     906 * @param   pVirtualBox         Reference to the IVirtualBox pointer.
     907 */
     908static HRESULT listCloudProviders(const ComPtr<IVirtualBox> pVirtualBox)
     909{
     910    HRESULT rc = S_OK;
     911    ComPtr<ICloudProviderManager> pCloudProviderManager;
     912    CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
     913    com::SafeIfaceArray<ICloudProvider> apCloudProviders;
     914    CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
     915
     916    RTPrintf("Supported %d cloud providers:\n", apCloudProviders.size());
     917    for (size_t i = 0; i < apCloudProviders.size(); ++i)
     918    {
     919        ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
     920        Bstr bstrProviderName;
     921        pCloudProvider->COMGETTER(Name)(bstrProviderName.asOutParam());
     922        RTPrintf("Name:            %ls\n", bstrProviderName.raw());
     923        pCloudProvider->COMGETTER(ShortName)(bstrProviderName.asOutParam());
     924        RTPrintf("Short Name:      %ls\n", bstrProviderName.raw());
     925        Bstr bstrProviderID;
     926        pCloudProvider->COMGETTER(Id)(bstrProviderID.asOutParam());
     927        RTPrintf("GUID:            %ls\n", bstrProviderID.raw());
     928
     929        RTPrintf("\n");
     930    }
     931    return rc;
     932}
     933
     934
     935/**
     936 * List all available cloud profiles (by iterating over the cloud providers).
     937 *
     938 * @returns See produceList.
     939 * @param   pVirtualBox         Reference to the IVirtualBox pointer.
     940 * @param   fOptLong            If true, list all profile properties.
     941 */
     942static HRESULT listCloudProfiles(const ComPtr<IVirtualBox> pVirtualBox, bool fOptLong)
     943{
     944    HRESULT rc = S_OK;
     945    ComPtr<ICloudProviderManager> pCloudProviderManager;
     946    CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
     947    com::SafeIfaceArray<ICloudProvider> apCloudProviders;
     948    CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
     949
     950    for (size_t i = 0; i < apCloudProviders.size(); ++i)
     951    {
     952        ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
     953        com::SafeIfaceArray<ICloudProfile> apCloudProfiles;
     954        CHECK_ERROR(pCloudProvider, COMGETTER(Profiles)(ComSafeArrayAsOutParam(apCloudProfiles)));
     955        for (size_t j = 0; j < apCloudProfiles.size(); ++j)
     956        {
     957            ComPtr<ICloudProfile> pCloudProfile = apCloudProfiles[j];
     958            Bstr bstrProfileName;
     959            pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam());
     960            RTPrintf("Name:          %ls\n", bstrProfileName.raw());
     961            Bstr bstrProviderID;
     962            pCloudProfile->COMGETTER(ProviderId)(bstrProviderID.asOutParam());
     963            RTPrintf("Provider GUID: %ls\n", bstrProviderID.raw());
     964
     965            if (fOptLong)
     966            {
     967                com::SafeArray<BSTR> names;
     968                com::SafeArray<BSTR> values;
     969                pCloudProfile->GetProperties(Bstr().raw(), ComSafeArrayAsOutParam(names), ComSafeArrayAsOutParam(values));
     970                size_t cNames = names.size();
     971                size_t cValues = values.size();
     972                bool fFirst = true;
     973                for (size_t k = 0; k < cNames; k++)
     974                {
     975                    Bstr value;
     976                    if (k < cValues)
     977                        value = values[k];
     978                    RTPrintf("%s%ls=%ls\n",
     979                             fFirst ? "Property:      " : "               ",
     980                             names[k], value.raw());
     981                    fFirst = false;
     982                }
     983            }
     984
     985            RTPrintf("\n");
     986        }
     987    }
     988    return rc;
     989}
     990
    902991
    903992/**
     
    9311020    kListNatNetworks,
    9321021    kListVideoInputDevices,
    933     kListScreenShotFormats
     1022    kListScreenShotFormats,
     1023    kListCloudProviders,
     1024    kListCloudProfiles,
    9341025};
    9351026
     
    12971388            break;
    12981389
     1390        case kListCloudProviders:
     1391            rc = listCloudProviders(pVirtualBox);
     1392            break;
     1393
     1394        case kListCloudProfiles:
     1395            rc = listCloudProfiles(pVirtualBox, fOptLong);
     1396            break;
     1397
    12991398        /* No default here, want gcc warnings. */
    13001399
     
    13491448        { "webcams",            kListVideoInputDevices,  RTGETOPT_REQ_NOTHING },
    13501449        { "screenshotformats",  kListScreenShotFormats,  RTGETOPT_REQ_NOTHING },
     1450        { "cloudproviders",     kListCloudProviders,     RTGETOPT_REQ_NOTHING },
     1451        { "cloudprofiles",      kListCloudProfiles,      RTGETOPT_REQ_NOTHING },
    13511452    };
    13521453
     
    14001501            case kListVideoInputDevices:
    14011502            case kListScreenShotFormats:
     1503            case kListCloudProviders:
     1504            case kListCloudProfiles:
    14021505                enmOptCommand = (enum enmListType)ch;
    14031506                if (fOptMultiple)
Note: See TracChangeset for help on using the changeset viewer.

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