VirtualBox

Changeset 83191 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 3, 2020 12:32:40 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Details pane: Generate Storage details element, update it with information about image name and size.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r83175 r83191  
    534534    if (table.isEmpty())
    535535        table << UITextTableLine(QApplication::translate("UIDetails", "Not Attached", "details (storage)"), QString());
     536
     537    return table;
     538}
     539
     540UITextTable UIDetailsGenerator::generateMachineInformationStorage(UICloudMachine &guiCloudMachine,
     541                                                                  const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions)
     542{
     543    UITextTable table;
     544
     545    if (guiCloudMachine.isNull())
     546        return table;
     547
     548    if (!guiCloudMachine.isAccessible())
     549    {
     550        table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
     551        return table;
     552    }
     553
     554    /* Image: */
     555    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_HardDisks)
     556    {
     557        const QString strImageName = guiCloudMachine.imageName();
     558        const QString strImageSize = guiCloudMachine.imageSize();
     559        const QString strResult = !strImageName.isEmpty() && !strImageSize.isEmpty()
     560                                ? QString("%1 (%2)").arg(strImageName, strImageSize)
     561                                : QString();
     562        table << UITextTableLine(QApplication::translate("UIDetails", "Image", "details (storage)"), strResult);
     563    }
    536564
    537565    return table;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h

    r83151 r83191  
    5252                                                                       bool fLink = true);
    5353
     54    SHARED_LIBRARY_STUFF UITextTable generateMachineInformationStorage(UICloudMachine &guiCloudMachine,
     55                                                                       const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage &fOptions);
     56
    5457    SHARED_LIBRARY_STUFF UITextTable generateMachineInformationAudio(CMachine &comMachine,
    5558                                                                     const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio &fOptions);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp

    r83151 r83191  
    325325}
    326326
     327void UIDetailsUpdateTaskStorageCloud::run()
     328{
     329    /* Acquire corresponding machine: */
     330    UICloudMachine guiCloudMachine = property("cloudMachine").value<UICloudMachine>();
     331    if (guiCloudMachine.isNull())
     332        return;
     333
     334    /* Generate details table: */
     335    UITextTable table = UIDetailsGenerator::generateMachineInformationStorage(guiCloudMachine, m_fOptions);
     336    setProperty("table", QVariant::fromValue(table));
     337}
     338
    327339UITask *UIDetailsElementStorage::createUpdateTask()
    328340{
    329     return new UIDetailsUpdateTaskStorage(machine(), model()->optionsStorage());
     341    return   isLocal()
     342           ? static_cast<UITask*>(new UIDetailsUpdateTaskStorage(machine(), model()->optionsStorage()))
     343           : static_cast<UITask*>(new UIDetailsUpdateTaskStorageCloud(cloudMachine(), model()->optionsStorage()));
    330344}
    331345
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h

    r83151 r83191  
    295295};
    296296
     297/** UITask extension used as update task for the details-element type 'Storage' of cloud VM. */
     298class UIDetailsUpdateTaskStorageCloud : public UIDetailsUpdateTask
     299{
     300    Q_OBJECT;
     301
     302public:
     303
     304    /** Constructs update task passing @a guiCloudMachine to the base-class. */
     305    UIDetailsUpdateTaskStorageCloud(const UICloudMachine &guiCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeStorage fOptions)
     306        : UIDetailsUpdateTask(guiCloudMachine), m_fOptions(fOptions) {}
     307
     308private:
     309
     310    /** Contains update task body. */
     311    void run();
     312
     313    /** Holds the options. */
     314    UIExtraDataMetaDefs::DetailsElementOptionTypeStorage m_fOptions;
     315};
     316
    297317/** UIDetailsElementInterface extension for the details-element type 'Storage'. */
    298318class UIDetailsElementStorage : public UIDetailsElementInterface
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.cpp

    r83179 r83191  
    108108
    109109                /* Compose a list of types to build: */
    110                 types << DetailsElementType_General << DetailsElementType_System;
     110                types << DetailsElementType_General << DetailsElementType_System << DetailsElementType_Storage;
    111111
    112112                break;
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