VirtualBox

Changeset 75426 in vbox


Ignore:
Timestamp:
Nov 13, 2018 4:22:44 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9289: VirtualBox Manager / Details pane: A bit of cleanup for UIDetailsElements.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/details
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp

    r75361 r75426  
    231231{
    232232    /* Acquire corresponding machine: */
    233     CMachine machine = property("machine").value<CMachine>();
    234     if (machine.isNull())
    235         return;
    236 
    237     /* Prepare table: */
    238     UITextTable table;
    239 
    240     /* Gather information: */
    241     if (machine.GetAccessible())
    242     {
    243         /* Machine name: */
    244         table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"), machine.GetName());
    245 
    246         /* Operating system type: */
     233    CMachine comMachine = property("machine").value<CMachine>();
     234    if (comMachine.isNull())
     235        return;
     236
     237    /* Prepare table: */
     238    UITextTable table;
     239
     240    /* Gather information: */
     241    if (comMachine.GetAccessible())
     242    {
     243        /* Name: */
     244        table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"), comMachine.GetName());
     245
     246        /* Operating System: */
    247247        table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"),
    248                                  vboxGlobal().vmGuestOSTypeDescription(machine.GetOSTypeId()));
    249 
    250         /* Location of the settings file: */
    251         const QString strSettingsFilePath = machine.GetSettingsFilePath();
    252         if (!strSettingsFilePath.isEmpty())
    253         {
    254             table << UITextTableLine(QApplication::translate("UIDetails", "Settings File Location", "details (general)"),
    255                                      QDir::toNativeSeparators(QFileInfo(strSettingsFilePath).absolutePath()));
    256         }
    257 
    258         /* Get groups: */
    259         QStringList groups = machine.GetGroups().toList();
     248                                 vboxGlobal().vmGuestOSTypeDescription(comMachine.GetOSTypeId()));
     249
     250        /* Settings File Location: */
     251        table << UITextTableLine(QApplication::translate("UIDetails", "Settings File Location", "details (general)"),
     252                                 QDir::toNativeSeparators(QFileInfo(comMachine.GetSettingsFilePath()).absolutePath()));
     253
     254        /* Groups: */
     255        QStringList groups = comMachine.GetGroups().toList();
    260256        /* Do not show groups for machine which is in root group only: */
    261257        if (groups.size() == 1)
     
    286282{
    287283    /* Acquire corresponding machine: */
    288     CMachine machine = property("machine").value<CMachine>();
    289     if (machine.isNull())
    290         return;
    291 
    292     /* Prepare table: */
    293     UITextTable table;
    294 
    295     /* Gather information: */
    296     if (machine.GetAccessible())
     284    CMachine comMachine = property("machine").value<CMachine>();
     285    if (comMachine.isNull())
     286        return;
     287
     288    /* Prepare table: */
     289    UITextTable table;
     290
     291    /* Gather information: */
     292    if (comMachine.GetAccessible())
    297293    {
    298294        /* Base memory: */
    299295        table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"),
    300                                  QApplication::translate("UIDetails", "%1 MB", "details").arg(machine.GetMemorySize()));
     296                                 QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetMemorySize()));
    301297
    302298        /* CPU count: */
    303         int cCPU = machine.GetCPUCount();
     299        const int cCPU = comMachine.GetCPUCount();
    304300        if (cCPU > 1)
    305301            table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"),
     
    307303
    308304        /* CPU execution cap: */
    309         int iCPUExecCap = machine.GetCPUExecutionCap();
    310         if (iCPUExecCap < 100)
     305        const int iCPUExecutionCap = comMachine.GetCPUExecutionCap();
     306        if (iCPUExecutionCap < 100)
    311307            table << UITextTableLine(QApplication::translate("UIDetails", "Execution Cap", "details (system)"),
    312                                      QApplication::translate("UIDetails", "%1%", "details").arg(iCPUExecCap));
     308                                     QApplication::translate("UIDetails", "%1%", "details").arg(iCPUExecutionCap));
    313309
    314310        /* Boot-order: */
     
    316312        for (ulong i = 1; i <= vboxGlobal().virtualBox().GetSystemProperties().GetMaxBootPosition(); ++i)
    317313        {
    318             KDeviceType device = machine.GetBootOrder(i);
    319             if (device == KDeviceType_Null)
     314            const KDeviceType enmDeviceType = comMachine.GetBootOrder(i);
     315            if (enmDeviceType == KDeviceType_Null)
    320316                continue;
    321             bootOrder << gpConverter->toString(device);
     317            bootOrder << gpConverter->toString(enmDeviceType);
    322318        }
    323319        if (bootOrder.isEmpty())
     
    326322
    327323        /* Chipset type: */
    328         const KChipsetType enmChipsetType = machine.GetChipsetType();
     324        const KChipsetType enmChipsetType = comMachine.GetChipsetType();
    329325        if (enmChipsetType == KChipsetType_ICH9)
    330326            table << UITextTableLine(QApplication::translate("UIDetails", "Chipset Type", "details (system)"),
     
    332328
    333329        /* Firware type: */
    334         switch (machine.GetFirmwareType())
     330        switch (comMachine.GetFirmwareType())
    335331        {
    336332            case KFirmwareType_EFI:
     
    356352        {
    357353            /* VT-x/AMD-V: */
    358             if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled))
     354            if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled))
    359355            {
    360356                acceleration << QApplication::translate("UIDetails", "VT-x/AMD-V", "details (system)");
    361357                /* Nested Paging (only when hw virt is enabled): */
    362                 if (machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
     358                if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
    363359                    acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)");
    364360            }
    365361        }
    366         if (machine.GetCPUProperty(KCPUPropertyType_PAE))
     362        /* PAE/NX: */
     363        if (comMachine.GetCPUProperty(KCPUPropertyType_PAE))
    367364            acceleration << QApplication::translate("UIDetails", "PAE/NX", "details (system)");
    368         switch (machine.GetEffectiveParavirtProvider())
     365        /* Paravirtualization provider: */
     366        switch (comMachine.GetEffectiveParavirtProvider())
    369367        {
    370368            case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIDetails", "Minimal Paravirtualization", "details (system)"); break;
     
    389387{
    390388    /* Acquire corresponding machine: */
    391     CMachine machine = property("machine").value<CMachine>();
    392     if (machine.isNull())
    393         return;
    394 
    395     /* Prepare table: */
    396     UITextTable table;
    397 
    398     /* Gather information: */
    399     if (machine.GetAccessible())
     389    CMachine comMachine = property("machine").value<CMachine>();
     390    if (comMachine.isNull())
     391        return;
     392
     393    /* Prepare table: */
     394    UITextTable table;
     395
     396    /* Gather information: */
     397    if (comMachine.GetAccessible())
    400398    {
    401399        /* Video memory: */
    402400        table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"),
    403                                  QApplication::translate("UIDetails", "%1 MB", "details").arg(machine.GetVRAMSize()));
     401                                 QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetVRAMSize()));
    404402
    405403        /* Screen count: */
    406         int cGuestScreens = machine.GetMonitorCount();
     404        const int cGuestScreens = comMachine.GetMonitorCount();
    407405        if (cGuestScreens > 1)
    408406            table << UITextTableLine(QApplication::translate("UIDetails", "Screens", "details (display)"),
    409407                                     QString::number(cGuestScreens));
    410408
    411         /* Get scale-factor value: */
    412         const QString strScaleFactor = machine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor);
     409        /* Scale-factor: */
     410        const QString strScaleFactor = comMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor);
    413411        {
    414412            /* Try to convert loaded data to double: */
     
    424422        }
    425423
     424        /* Acceleration: */
    426425        QStringList acceleration;
    427426#ifdef VBOX_WITH_VIDEOHWACCEL
    428427        /* 2D acceleration: */
    429         if (machine.GetAccelerate2DVideoEnabled())
     428        if (comMachine.GetAccelerate2DVideoEnabled())
    430429            acceleration << QApplication::translate("UIDetails", "2D Video", "details (display)");
    431 #endif /* VBOX_WITH_VIDEOHWACCEL */
     430#endif
    432431        /* 3D acceleration: */
    433         if (machine.GetAccelerate3DEnabled())
     432        if (comMachine.GetAccelerate3DEnabled())
    434433            acceleration << QApplication::translate("UIDetails", "3D", "details (display)");
    435434        if (!acceleration.isEmpty())
     
    437436                                     acceleration.join(", "));
    438437
    439         /* VRDE info: */
    440         CVRDEServer srv = machine.GetVRDEServer();
    441         if (!srv.isNull())
    442         {
    443             if (srv.GetEnabled())
     438        /* VRDE: */
     439        const CVRDEServer comServer = comMachine.GetVRDEServer();
     440        if (!comServer.isNull())
     441        {
     442            if (comServer.GetEnabled())
    444443                table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server Port", "details (display/vrde)"),
    445                                          srv.GetVRDEProperty("TCP/Ports"));
     444                                         comServer.GetVRDEProperty("TCP/Ports"));
    446445            else
    447446                table << UITextTableLine(QApplication::translate("UIDetails", "Remote Desktop Server", "details (display/vrde)"),
     
    450449
    451450        /* Recording info: */
    452         CRecordingSettings comRecordingSettings = machine.GetRecordingSettings();
     451        CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
    453452        if (comRecordingSettings.GetEnabled())
    454453        {
    455454            /* For now all screens have the same config: */
    456             CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
     455            const CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
    457456
    458457            /** @todo r=andy Refine these texts (wrt audio and/or video). */
     
    466465        else
    467466        {
    468             /** @todo r=andy Refine these texts (wrt audio and/or video). */
    469467            table << UITextTableLine(QApplication::translate("UIDetails", "Recording", "details (display/recording)"),
    470468                                     QApplication::translate("UIDetails", "Disabled", "details (display/recording)"));
     
    482480{
    483481    /* Acquire corresponding machine: */
    484     CMachine machine = property("machine").value<CMachine>();
    485     if (machine.isNull())
    486         return;
    487 
    488     /* Prepare table: */
    489     UITextTable table;
    490 
    491     /* Gather information: */
    492     if (machine.GetAccessible())
     482    CMachine comMachine = property("machine").value<CMachine>();
     483    if (comMachine.isNull())
     484        return;
     485
     486    /* Prepare table: */
     487    UITextTable table;
     488
     489    /* Gather information: */
     490    if (comMachine.GetAccessible())
    493491    {
    494492        /* Iterate over all the machine controllers: */
    495         bool fSomeInfo = false;
    496         foreach (const CStorageController &controller, machine.GetStorageControllers())
     493        foreach (const CStorageController &comController, comMachine.GetStorageControllers())
    497494        {
    498495            /* Add controller information: */
    499             QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
    500             table << UITextTableLine(strControllerName.arg(controller.GetName()), QString());
    501             fSomeInfo = true;
     496            const QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
     497            table << UITextTableLine(strControllerName.arg(comController.GetName()), QString());
    502498            /* Populate map (its sorted!): */
    503499            QMap<StorageSlot, QString> attachmentsMap;
    504             foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName()))
     500            foreach (const CMediumAttachment &attachment, comMachine.GetMediumAttachmentsOfController(comController.GetName()))
    505501            {
     502                /* Acquire device type first of all: */
     503                const KDeviceType enmDeviceType = attachment.GetType();
     504
    506505                /* Prepare current storage slot: */
    507                 StorageSlot attachmentSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice());
    508                 AssertMsg(controller.isOk(),
     506                const StorageSlot attachmentSlot(comController.GetBus(), attachment.GetPort(), attachment.GetDevice());
     507                AssertMsg(comController.isOk(),
    509508                          ("Unable to acquire controller data: %s\n",
    510                            UIErrorString::formatRC(controller.lastRC()).toUtf8().constData()));
    511                 if (!controller.isOk())
     509                           UIErrorString::formatRC(comController.lastRC()).toUtf8().constData()));
     510                if (!comController.isOk())
    512511                    continue;
     512
    513513                /* Prepare attachment information: */
    514514                QString strAttachmentInfo = vboxGlobal().details(attachment.GetMedium(), false, false);
    515                 /* That temporary hack makes sure 'Inaccessible' word is always bold: */
     515                /* That hack makes sure 'Inaccessible' word is always bold: */
    516516                { // hack
    517                     QString strInaccessibleString(VBoxGlobal::tr("Inaccessible", "medium"));
    518                     QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
     517                    const QString strInaccessibleString(VBoxGlobal::tr("Inaccessible", "medium"));
     518                    const QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
    519519                    strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString);
    520520                } // hack
     521
    521522                /* Append 'device slot name' with 'device type name' for optical devices only: */
    522                 KDeviceType deviceType = attachment.GetType();
    523                 QString strDeviceType = deviceType == KDeviceType_DVD ?
    524                             QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)") : QString();
     523                QString strDeviceType = enmDeviceType == KDeviceType_DVD
     524                                      ? QApplication::translate("UIDetails", "[Optical Drive]", "details (storage)")
     525                                      : QString();
    525526                if (!strDeviceType.isNull())
    526527                    strDeviceType.append(' ');
     528
    527529                /* Insert that attachment information into the map: */
    528530                if (!strAttachmentInfo.isNull())
    529531                {
    530532                    /* Configure hovering anchors: */
    531                     const QString strAnchorType = deviceType == KDeviceType_DVD || deviceType == KDeviceType_Floppy ? QString("mount") :
    532                                                   deviceType == KDeviceType_HardDisk ? QString("attach") : QString();
     533                    const QString strAnchorType = enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy ? QString("mount") :
     534                                                  enmDeviceType == KDeviceType_HardDisk ? QString("attach") : QString();
    533535                    const CMedium medium = attachment.GetMedium();
    534536                    const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation();
     
    536538                                          QString("<a href=#%1,%2,%3,%4>%5</a>")
    537539                                                  .arg(strAnchorType,
    538                                                        controller.GetName(),
     540                                                       comController.GetName(),
    539541                                                       gpConverter->toString(attachmentSlot),
    540542                                                       strMediumLocation,
     
    542544                }
    543545            }
     546
    544547            /* Iterate over the sorted map: */
    545             QList<StorageSlot> storageSlots = attachmentsMap.keys();
    546             QList<QString> storageInfo = attachmentsMap.values();
     548            const QList<StorageSlot> storageSlots = attachmentsMap.keys();
     549            const QList<QString> storageInfo = attachmentsMap.values();
    547550            for (int i = 0; i < storageSlots.size(); ++i)
    548551                table << UITextTableLine(QString("  ") + gpConverter->toString(storageSlots[i]), storageInfo[i]);
    549552        }
    550         if (!fSomeInfo)
     553        if (table.isEmpty())
    551554            table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString());
    552555    }
     
    562565{
    563566    /* Acquire corresponding machine: */
    564     CMachine machine = property("machine").value<CMachine>();
    565     if (machine.isNull())
    566         return;
    567 
    568     /* Prepare table: */
    569     UITextTable table;
    570 
    571     /* Gather information: */
    572     if (machine.GetAccessible())
    573     {
    574         const CAudioAdapter &audio = machine.GetAudioAdapter();
    575         if (audio.GetEnabled())
     567    CMachine comMachine = property("machine").value<CMachine>();
     568    if (comMachine.isNull())
     569        return;
     570
     571    /* Prepare table: */
     572    UITextTable table;
     573
     574    /* Gather information: */
     575    if (comMachine.GetAccessible())
     576    {
     577        const CAudioAdapter comAudio = comMachine.GetAudioAdapter();
     578        if (comAudio.GetEnabled())
    576579        {
    577580            /* Driver: */
    578581            table << UITextTableLine(QApplication::translate("UIDetails", "Host Driver", "details (audio)"),
    579                                      gpConverter->toString(audio.GetAudioDriver()));
     582                                     gpConverter->toString(comAudio.GetAudioDriver()));
    580583
    581584            /* Controller: */
    582585            table << UITextTableLine(QApplication::translate("UIDetails", "Controller", "details (audio)"),
    583                                      gpConverter->toString(audio.GetAudioController()));
     586                                     gpConverter->toString(comAudio.GetAudioController()));
    584587
    585588#ifdef VBOX_WITH_AUDIO_INOUT_INFO
    586             /* Output: */
     589            /* I/O: */
    587590            table << UITextTableLine(QApplication::translate("UIDetails", "Audio Output", "details (audio)"),
    588                                      audio.GetEnabledOut() ?
     591                                     comAudio.GetEnabledOut() ?
    589592                                     QApplication::translate("UIDetails", "Enabled", "details (audio/output)") :
    590593                                     QApplication::translate("UIDetails", "Disabled", "details (audio/output)"));
    591 
    592             /* Input: */
    593594            table << UITextTableLine(QApplication::translate("UIDetails", "Audio Input", "details (audio)"),
    594                                      audio.GetEnabledIn() ?
     595                                     comAudio.GetEnabledIn() ?
    595596                                     QApplication::translate("UIDetails", "Enabled", "details (audio/input)") :
    596597                                     QApplication::translate("UIDetails", "Disabled", "details (audio/input)"));
     
    613614{
    614615    /* Acquire corresponding machine: */
    615     CMachine machine = property("machine").value<CMachine>();
    616     if (machine.isNull())
    617         return;
    618 
    619     /* Prepare table: */
    620     UITextTable table;
    621 
    622     /* Gather information: */
    623     if (machine.GetAccessible())
     616    CMachine comMachine = property("machine").value<CMachine>();
     617    if (comMachine.isNull())
     618        return;
     619
     620    /* Prepare table: */
     621    UITextTable table;
     622
     623    /* Gather information: */
     624    if (comMachine.GetAccessible())
    624625    {
    625626        /* Iterate over all the adapters: */
    626         bool fSomeInfo = false;
    627         ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(machine.GetChipsetType());
     627        const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(comMachine.GetChipsetType());
    628628        for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
    629629        {
    630             const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
    631             if (adapter.GetEnabled())
     630            const CNetworkAdapter comAdapter = comMachine.GetNetworkAdapter(uSlot);
     631
     632            /* Skip disabled adapters: */
     633            if (!comAdapter.GetEnabled())
     634                continue;
     635
     636            /* Gather adapter information: */
     637            const KNetworkAttachmentType enmType = comAdapter.GetAttachmentType();
     638            const QString strAttachmentTemplate = gpConverter->toString(comAdapter.GetAdapterType()).replace(QRegExp("\\s\\(.+\\)"), " (%1)");
     639            QString strAttachmentType;
     640            switch (enmType)
    632641            {
    633                 KNetworkAttachmentType type = adapter.GetAttachmentType();
    634                 QString strAttachmentType = gpConverter->toString(adapter.GetAdapterType())
    635                                             .replace(QRegExp("\\s\\(.+\\)"), " (%1)");
    636                 switch (type)
    637                 {
    638                     case KNetworkAttachmentType_Bridged:
    639                     {
    640                         strAttachmentType = strAttachmentType.arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)")
    641                                                                   .arg(adapter.GetBridgedInterface()));
    642                         break;
    643                     }
    644                     case KNetworkAttachmentType_Internal:
    645                     {
    646                         strAttachmentType = strAttachmentType.arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)")
    647                                                                   .arg(adapter.GetInternalNetwork()));
    648                         break;
    649                     }
    650                     case KNetworkAttachmentType_HostOnly:
    651                     {
    652                         strAttachmentType = strAttachmentType.arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)")
    653                                                                   .arg(adapter.GetHostOnlyInterface()));
    654                         break;
    655                     }
    656                     case KNetworkAttachmentType_Generic:
    657                     {
    658                         QString strGenericDriverProperties(summarizeGenericProperties(adapter));
    659                         strAttachmentType = strGenericDriverProperties.isNull() ?
    660                                   strAttachmentType.arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)").arg(adapter.GetGenericDriver())) :
    661                                   strAttachmentType.arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)")
    662                                                         .arg(adapter.GetGenericDriver(), strGenericDriverProperties));
    663                         break;
    664                     }
    665                     case KNetworkAttachmentType_NATNetwork:
    666                     {
    667                         strAttachmentType = strAttachmentType.arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)")
    668                                                                   .arg(adapter.GetNATNetwork()));
    669                         break;
    670                     }
    671                     default:
    672                     {
    673                         strAttachmentType = strAttachmentType.arg(gpConverter->toString(type));
    674                         break;
    675                     }
    676                 }
    677                 table << UITextTableLine(QApplication::translate("UIDetails", "Adapter %1", "details (network)").arg(adapter.GetSlot() + 1), strAttachmentType);
    678                 fSomeInfo = true;
     642                case KNetworkAttachmentType_Bridged:
     643                {
     644                    strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Bridged Adapter, %1", "details (network)")
     645                                                                  .arg(comAdapter.GetBridgedInterface()));
     646                    break;
     647                }
     648                case KNetworkAttachmentType_Internal:
     649                {
     650                    strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Internal Network, '%1'", "details (network)")
     651                                                                  .arg(comAdapter.GetInternalNetwork()));
     652                    break;
     653                }
     654                case KNetworkAttachmentType_HostOnly:
     655                {
     656                    strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Host-only Adapter, '%1'", "details (network)")
     657                                                                  .arg(comAdapter.GetHostOnlyInterface()));
     658                    break;
     659                }
     660                case KNetworkAttachmentType_Generic:
     661                {
     662                    const QString strGenericDriverProperties(summarizeGenericProperties(comAdapter));
     663                    strAttachmentType = strGenericDriverProperties.isNull() ?
     664                        strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1'", "details (network)")
     665                                                  .arg(comAdapter.GetGenericDriver())) :
     666                        strAttachmentTemplate.arg(QApplication::translate("UIDetails", "Generic Driver, '%1' { %2 }", "details (network)")
     667                                                  .arg(comAdapter.GetGenericDriver(), strGenericDriverProperties));
     668                    break;
     669                }
     670                case KNetworkAttachmentType_NATNetwork:
     671                {
     672                    strAttachmentType = strAttachmentTemplate.arg(QApplication::translate("UIDetails", "NAT Network, '%1'", "details (network)")
     673                                                                  .arg(comAdapter.GetNATNetwork()));
     674                    break;
     675                }
     676                default:
     677                {
     678                    strAttachmentType = strAttachmentTemplate.arg(gpConverter->toString(enmType));
     679                    break;
     680                }
    679681            }
    680         }
    681         if (!fSomeInfo)
     682            if (!strAttachmentType.isNull())
     683                table << UITextTableLine(QApplication::translate("UIDetails", "Adapter %1", "details (network)").arg(comAdapter.GetSlot() + 1), strAttachmentType);
     684        }
     685        if (table.isEmpty())
    682686            table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (network/adapter)"), QString());
    683687    }
     
    709713{
    710714    /* Acquire corresponding machine: */
    711     CMachine machine = property("machine").value<CMachine>();
    712     if (machine.isNull())
    713         return;
    714 
    715     /* Prepare table: */
    716     UITextTable table;
    717 
    718     /* Gather information: */
    719     if (machine.GetAccessible())
     715    CMachine comMachine = property("machine").value<CMachine>();
     716    if (comMachine.isNull())
     717        return;
     718
     719    /* Prepare table: */
     720    UITextTable table;
     721
     722    /* Gather information: */
     723    if (comMachine.GetAccessible())
    720724    {
    721725        /* Iterate over all the ports: */
    722         bool fSomeInfo = false;
    723         ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount();
     726        const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount();
    724727        for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
    725728        {
    726             const CSerialPort &port = machine.GetSerialPort(uSlot);
    727             if (port.GetEnabled())
     729            const CSerialPort comPort = comMachine.GetSerialPort(uSlot);
     730
     731            /* Skip disabled adapters: */
     732            if (!comPort.GetEnabled())
     733                continue;
     734
     735            /* Gather port information: */
     736            const KPortMode enmMode = comPort.GetHostMode();
     737            const QString strModeTemplate = vboxGlobal().toCOMPortName(comPort.GetIRQ(), comPort.GetIOBase()) + ", ";
     738            QString strModeType;
     739            switch (enmMode)
    728740            {
    729                 KPortMode mode = port.GetHostMode();
    730                 QString data = vboxGlobal().toCOMPortName(port.GetIRQ(), port.GetIOBase()) + ", ";
    731                 if (mode == KPortMode_HostPipe || mode == KPortMode_HostDevice ||
    732                     mode == KPortMode_RawFile || mode == KPortMode_TCP)
    733                     data += QString("%1 (%2)").arg(gpConverter->toString(mode)).arg(QDir::toNativeSeparators(port.GetPath()));
    734                 else
    735                     data += gpConverter->toString(mode);
    736                 table << UITextTableLine(QApplication::translate("UIDetails", "Port %1", "details (serial)").arg(port.GetSlot() + 1), data);
    737                 fSomeInfo = true;
     741                case KPortMode_HostPipe:
     742                {
     743                    strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
     744                    break;
     745                }
     746                case KPortMode_HostDevice:
     747                {
     748                    strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
     749                    break;
     750                }
     751                case KPortMode_RawFile:
     752                {
     753                    strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
     754                    break;
     755                }
     756                case KPortMode_TCP:
     757                {
     758                    strModeType = strModeTemplate + QString("%1 (%2)").arg(gpConverter->toString(enmMode)).arg(QDir::toNativeSeparators(comPort.GetPath()));
     759                    break;
     760                }
     761                default:
     762                {
     763                    strModeType = strModeTemplate + gpConverter->toString(enmMode);
     764                    break;
     765                }
    738766            }
    739         }
    740         if (!fSomeInfo)
     767            if (!strModeType.isNull())
     768                table << UITextTableLine(QApplication::translate("UIDetails", "Port %1", "details (serial)").arg(comPort.GetSlot() + 1), strModeType);
     769        }
     770        if (table.isEmpty())
    741771            table << UITextTableLine(QApplication::translate("UIDetails", "Disabled", "details (serial)"), QString());
    742772    }
     
    752782{
    753783    /* Acquire corresponding machine: */
    754     CMachine machine = property("machine").value<CMachine>();
    755     if (machine.isNull())
    756         return;
    757 
    758     /* Prepare table: */
    759     UITextTable table;
    760 
    761     /* Gather information: */
    762     if (machine.GetAccessible())
     784    CMachine comMachine = property("machine").value<CMachine>();
     785    if (comMachine.isNull())
     786        return;
     787
     788    /* Prepare table: */
     789    UITextTable table;
     790
     791    /* Gather information: */
     792    if (comMachine.GetAccessible())
    763793    {
    764794        /* Iterate over all the USB filters: */
    765         const CUSBDeviceFilters &filters = machine.GetUSBDeviceFilters();
    766         if (!filters.isNull() && machine.GetUSBProxyAvailable())
    767         {
    768             const CUSBDeviceFilters flts = machine.GetUSBDeviceFilters();
    769             const CUSBControllerVector controllers = machine.GetUSBControllers();
    770             if (!flts.isNull() && !controllers.isEmpty())
     795        const CUSBDeviceFilters comFilterObject = comMachine.GetUSBDeviceFilters();
     796        if (!comFilterObject.isNull() && comMachine.GetUSBProxyAvailable())
     797        {
     798            const CUSBControllerVector controllers = comMachine.GetUSBControllers();
     799            if (!controllers.isEmpty())
    771800            {
    772                 /* USB Controllers info: */
    773                 QStringList controllerList;
    774                 foreach (const CUSBController &controller, controllers)
    775                     controllerList << gpConverter->toString(controller.GetType());
     801                /* Controllers: */
     802                QStringList controllersReadable;
     803                foreach (const CUSBController &comController, controllers)
     804                    controllersReadable << gpConverter->toString(comController.GetType());
    776805                table << UITextTableLine(QApplication::translate("UIDetails", "USB Controller", "details (usb)"),
    777                                           controllerList.join(", "));
    778                 /* USB Device Filters info: */
    779                 const CUSBDeviceFilterVector &coll = flts.GetDeviceFilters();
     806                                         controllersReadable.join(", "));
     807
     808                /* Device Filters: */
     809                const CUSBDeviceFilterVector filters = comFilterObject.GetDeviceFilters();
    780810                uint uActive = 0;
    781                 for (int i = 0; i < coll.size(); ++i)
    782                     if (coll[i].GetActive())
     811                for (int i = 0; i < filters.size(); ++i)
     812                    if (filters.at(i).GetActive())
    783813                        ++uActive;
    784814                table << UITextTableLine(QApplication::translate("UIDetails", "Device Filters", "details (usb)"),
    785                                          QApplication::translate("UIDetails", "%1 (%2 active)", "details (usb)").arg(coll.size()).arg(uActive));
     815                                         QApplication::translate("UIDetails", "%1 (%2 active)", "details (usb)").arg(filters.size()).arg(uActive));
    786816            }
    787817            else
     
    802832{
    803833    /* Acquire corresponding machine: */
    804     CMachine machine = property("machine").value<CMachine>();
    805     if (machine.isNull())
    806         return;
    807 
    808     /* Prepare table: */
    809     UITextTable table;
    810 
    811     /* Gather information: */
    812     if (machine.GetAccessible())
    813     {
    814         /* Iterate over all the shared folders: */
    815         ulong uCount = machine.GetSharedFolders().size();
     834    CMachine comMachine = property("machine").value<CMachine>();
     835    if (comMachine.isNull())
     836        return;
     837
     838    /* Prepare table: */
     839    UITextTable table;
     840
     841    /* Gather information: */
     842    if (comMachine.GetAccessible())
     843    {
     844        /* Summary: */
     845        const ulong uCount = comMachine.GetSharedFolders().size();
    816846        if (uCount > 0)
    817847            table << UITextTableLine(QApplication::translate("UIDetails", "Shared Folders", "details (shared folders)"), QString::number(uCount));
     
    830860{
    831861    /* Acquire corresponding machine: */
    832     CMachine machine = property("machine").value<CMachine>();
    833     if (machine.isNull())
    834         return;
    835 
    836     /* Prepare table: */
    837     UITextTable table;
    838 
    839     /* Gather information: */
    840     if (machine.GetAccessible())
     862    CMachine comMachine = property("machine").value<CMachine>();
     863    if (comMachine.isNull())
     864        return;
     865
     866    /* Prepare table: */
     867    UITextTable table;
     868
     869    /* Gather information: */
     870    if (comMachine.GetAccessible())
    841871    {
    842872#ifndef VBOX_WS_MAC
    843         /* Get menu-bar availability status: */
    844         const QString strMenubarEnabled = machine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
     873        /* Menu-bar: */
     874        const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
    845875        {
    846876            /* Try to convert loaded data to bool: */
    847             const bool fEnabled = !(strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0 ||
    848                                     strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0 ||
    849                                     strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0 ||
    850                                     strMenubarEnabled == "0");
     877            const bool fEnabled = !(   strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0
     878                                    || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0
     879                                    || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0
     880                                    || strMenubarEnabled == "0");
    851881            /* Append information: */
    852882            table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"),
    853                                      fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)") :
    854                                                 QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)"));
     883                                     fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")
     884                                              : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)"));
    855885        }
    856886#endif /* !VBOX_WS_MAC */
    857887
    858         /* Get status-bar availability status: */
    859         const QString strStatusbarEnabled = machine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
     888        /* Status-bar: */
     889        const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
    860890        {
    861891            /* Try to convert loaded data to bool: */
    862             const bool fEnabled = !(strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0 ||
    863                                     strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0 ||
    864                                     strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0 ||
    865                                     strStatusbarEnabled == "0");
     892            const bool fEnabled = !(   strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0
     893                                    || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0
     894                                    || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0
     895                                    || strStatusbarEnabled == "0");
    866896            /* Append information: */
    867897            table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"),
    868                                      fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)") :
    869                                                 QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)"));
     898                                     fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")
     899                                              : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)"));
    870900        }
    871901
    872902#ifndef VBOX_WS_MAC
    873         /* Get mini-toolbar availability status: */
    874         const QString strMiniToolbarEnabled = machine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar);
     903        /* Mini-toolbar: */
     904        const QString strMiniToolbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar);
    875905        {
    876906            /* Try to convert loaded data to bool: */
    877             const bool fEnabled = !(strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0 ||
    878                                     strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0 ||
    879                                     strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0 ||
    880                                     strMiniToolbarEnabled == "0");
     907            const bool fEnabled = !(   strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0
     908                                    || strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0
     909                                    || strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0
     910                                    || strMiniToolbarEnabled == "0");
    881911            /* Append information: */
    882912            if (fEnabled)
    883913            {
    884914                /* Get mini-toolbar position: */
    885                 const QString &strMiniToolbarPosition = machine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment);
     915                const QString strMiniToolbarPosition = comMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment);
    886916                {
    887917                    /* Try to convert loaded data to alignment: */
     
    929959    if (machine.GetAccessible())
    930960    {
    931         /* Get description: */
    932         const QString &strDesc = machine.GetDescription();
    933         if (!strDesc.isEmpty())
    934             table << UITextTableLine(strDesc, QString());
     961        /* Summary: */
     962        const QString strDescription = machine.GetDescription();
     963        if (!strDescription.isEmpty())
     964            table << UITextTableLine(strDescription, QString());
    935965        else
    936966            table << UITextTableLine(QApplication::translate("UIDetails", "None", "details (description)"), QString());
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h

    r74049 r75426  
    55
    66/*
    7  * Copyright (C) 2012-2017 Oracle Corporation
     7 * Copyright (C) 2012-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3535public:
    3636
    37     /** Constructs update task taking @a machine as data. */
    38     UIDetailsUpdateTask(const CMachine &machine);
     37    /** Constructs update task taking @a comMachine as data. */
     38    UIDetailsUpdateTask(const CMachine &comMachine);
    3939};
    4040
     
    6161
    6262    /** Creates update task. */
    63     virtual UITask* createUpdateTask() = 0;
     63    virtual UITask *createUpdateTask() = 0;
    6464
    6565private slots:
     
    120120public:
    121121
    122     /** Constructs update task passing @a machine to the base-class. */
    123     UIDetailsUpdateTaskGeneral(const CMachine &machine)
    124         : UIDetailsUpdateTask(machine) {}
     122    /** Constructs update task passing @a comMachine to the base-class. */
     123    UIDetailsUpdateTaskGeneral(const CMachine &comMachine)
     124        : UIDetailsUpdateTask(comMachine) {}
    125125
    126126private:
     
    145145
    146146    /** Creates update task for this element. */
    147     UITask* createUpdateTask() { return new UIDetailsUpdateTaskGeneral(machine()); }
     147    UITask *createUpdateTask() { return new UIDetailsUpdateTaskGeneral(machine()); }
    148148};
    149149
     
    156156public:
    157157
    158     /** Constructs update task passing @a machine to the base-class. */
    159     UIDetailsUpdateTaskSystem(const CMachine &machine)
    160         : UIDetailsUpdateTask(machine) {}
     158    /** Constructs update task passing @a comMachine to the base-class. */
     159    UIDetailsUpdateTaskSystem(const CMachine &comMachine)
     160        : UIDetailsUpdateTask(comMachine) {}
    161161
    162162private:
     
    181181
    182182    /** Creates update task for this element. */
    183     UITask* createUpdateTask() { return new UIDetailsUpdateTaskSystem(machine()); }
     183    UITask *createUpdateTask() { return new UIDetailsUpdateTaskSystem(machine()); }
    184184};
    185185
     
    192192public:
    193193
    194     /** Constructs update task passing @a machine to the base-class. */
    195     UIDetailsUpdateTaskDisplay(const CMachine &machine)
    196         : UIDetailsUpdateTask(machine) {}
     194    /** Constructs update task passing @a comMachine to the base-class. */
     195    UIDetailsUpdateTaskDisplay(const CMachine &comMachine)
     196        : UIDetailsUpdateTask(comMachine) {}
    197197
    198198private:
     
    217217
    218218    /** Creates update task for this element. */
    219     UITask* createUpdateTask() { return new UIDetailsUpdateTaskDisplay(machine()); }
     219    UITask *createUpdateTask() { return new UIDetailsUpdateTaskDisplay(machine()); }
    220220};
    221221
     
    228228public:
    229229
    230     /** Constructs update task passing @a machine to the base-class. */
    231     UIDetailsUpdateTaskStorage(const CMachine &machine)
    232         : UIDetailsUpdateTask(machine) {}
     230    /** Constructs update task passing @a comMachine to the base-class. */
     231    UIDetailsUpdateTaskStorage(const CMachine &comMachine)
     232        : UIDetailsUpdateTask(comMachine) {}
    233233
    234234private:
     
    253253
    254254    /** Creates update task for this element. */
    255     UITask* createUpdateTask() { return new UIDetailsUpdateTaskStorage(machine()); }
     255    UITask *createUpdateTask() { return new UIDetailsUpdateTaskStorage(machine()); }
    256256};
    257257
     
    264264public:
    265265
    266     /** Constructs update task passing @a machine to the base-class. */
    267     UIDetailsUpdateTaskAudio(const CMachine &machine)
    268         : UIDetailsUpdateTask(machine) {}
     266    /** Constructs update task passing @a comMachine to the base-class. */
     267    UIDetailsUpdateTaskAudio(const CMachine &comMachine)
     268        : UIDetailsUpdateTask(comMachine) {}
    269269
    270270private:
     
    289289
    290290    /** Creates update task for this element. */
    291     UITask* createUpdateTask() { return new UIDetailsUpdateTaskAudio(machine()); }
     291    UITask *createUpdateTask() { return new UIDetailsUpdateTaskAudio(machine()); }
    292292};
    293293
     
    300300public:
    301301
    302     /** Constructs update task passing @a machine to the base-class. */
    303     UIDetailsUpdateTaskNetwork(const CMachine &machine)
    304         : UIDetailsUpdateTask(machine) {}
     302    /** Constructs update task passing @a comMachine to the base-class. */
     303    UIDetailsUpdateTaskNetwork(const CMachine &comMachine)
     304        : UIDetailsUpdateTask(comMachine) {}
    305305
    306306private:
     
    328328
    329329    /** Creates update task for this element. */
    330     UITask* createUpdateTask() { return new UIDetailsUpdateTaskNetwork(machine()); }
     330    UITask *createUpdateTask() { return new UIDetailsUpdateTaskNetwork(machine()); }
    331331};
    332332
     
    339339public:
    340340
    341     /** Constructs update task passing @a machine to the base-class. */
    342     UIDetailsUpdateTaskSerial(const CMachine &machine)
    343         : UIDetailsUpdateTask(machine) {}
     341    /** Constructs update task passing @a comMachine to the base-class. */
     342    UIDetailsUpdateTaskSerial(const CMachine &comMachine)
     343        : UIDetailsUpdateTask(comMachine) {}
    344344
    345345private:
     
    364364
    365365    /** Creates update task for this element. */
    366     UITask* createUpdateTask() { return new UIDetailsUpdateTaskSerial(machine()); }
     366    UITask *createUpdateTask() { return new UIDetailsUpdateTaskSerial(machine()); }
    367367};
    368368
     
    375375public:
    376376
    377     /** Constructs update task passing @a machine to the base-class. */
    378     UIDetailsUpdateTaskUSB(const CMachine &machine)
    379         : UIDetailsUpdateTask(machine) {}
     377    /** Constructs update task passing @a comMachine to the base-class. */
     378    UIDetailsUpdateTaskUSB(const CMachine &comMachine)
     379        : UIDetailsUpdateTask(comMachine) {}
    380380
    381381private:
     
    400400
    401401    /** Creates update task for this element. */
    402     UITask* createUpdateTask() { return new UIDetailsUpdateTaskUSB(machine()); }
     402    UITask *createUpdateTask() { return new UIDetailsUpdateTaskUSB(machine()); }
    403403};
    404404
     
    411411public:
    412412
    413     /** Constructs update task passing @a machine to the base-class. */
    414     UIDetailsUpdateTaskSF(const CMachine &machine)
    415         : UIDetailsUpdateTask(machine) {}
     413    /** Constructs update task passing @a comMachine to the base-class. */
     414    UIDetailsUpdateTaskSF(const CMachine &comMachine)
     415        : UIDetailsUpdateTask(comMachine) {}
    416416
    417417private:
     
    436436
    437437    /** Creates update task for this element. */
    438     UITask* createUpdateTask() { return new UIDetailsUpdateTaskSF(machine()); }
     438    UITask *createUpdateTask() { return new UIDetailsUpdateTaskSF(machine()); }
    439439};
    440440
     
    447447public:
    448448
    449     /** Constructs update task passing @a machine to the base-class. */
    450     UIDetailsUpdateTaskUI(const CMachine &machine)
    451         : UIDetailsUpdateTask(machine) {}
     449    /** Constructs update task passing @a comMachine to the base-class. */
     450    UIDetailsUpdateTaskUI(const CMachine &comMachine)
     451        : UIDetailsUpdateTask(comMachine) {}
    452452
    453453private:
     
    472472
    473473    /** Creates update task for this element. */
    474     UITask* createUpdateTask() { return new UIDetailsUpdateTaskUI(machine()); }
     474    UITask *createUpdateTask() { return new UIDetailsUpdateTaskUI(machine()); }
    475475};
    476476
     
    483483public:
    484484
    485     /** Constructs update task passing @a machine to the base-class. */
    486     UIDetailsUpdateTaskDescription(const CMachine &machine)
    487         : UIDetailsUpdateTask(machine) {}
     485    /** Constructs update task passing @a comMachine to the base-class. */
     486    UIDetailsUpdateTaskDescription(const CMachine &comMachine)
     487        : UIDetailsUpdateTask(comMachine) {}
    488488
    489489private:
     
    508508
    509509    /** Creates update task for this element. */
    510     UITask* createUpdateTask() { return new UIDetailsUpdateTaskDescription(machine()); }
     510    UITask *createUpdateTask() { return new UIDetailsUpdateTaskDescription(machine()); }
    511511};
    512512
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