VirtualBox

Changeset 83151 in vbox


Ignore:
Timestamp:
Feb 25, 2020 1:06:21 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Details pane: Generate General and System details elements, most of options are dummy for now, will be added later.

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

Legend:

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

    r83146 r83151  
    3030    , m_strId(strId)
    3131    , m_strName(strName)
     32    , m_fAccessible(true)
     33    , m_strOsType("Other")
     34    , m_iMemorySize(0)
     35    , m_iCpuCount(0)
    3236{
    3337    //printf("Data for machine with id = {%s} is created\n", m_strId.toUtf8().constData());
     
    3943    , m_strId(other.m_strId)
    4044    , m_strName(other.m_strName)
     45    , m_fAccessible(other.m_fAccessible)
     46    , m_strOsType(other.m_strOsType)
     47    , m_iMemorySize(other.m_iMemorySize)
     48    , m_iCpuCount(other.m_iCpuCount)
    4149{
    4250    //printf("Data for machine with id = {%s} is copied\n", m_strId.toUtf8().constData());
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudMachine.h

    r83148 r83151  
    5757    /** Holds the cloud VM name. */
    5858    const QString  m_strName;
     59
     60    /** Holds whether cloud VM is accessible. */
     61    bool  m_fAccessible;
     62
     63    /** Holds the cloud VM OS type. */
     64    QString  m_strOsType;
     65    /** Holds the cloud VM memory size. */
     66    int      m_iMemorySize;
     67    /** Holds the cloud VM CPU count. */
     68    int      m_iCpuCount;
    5969};
    6070
     
    90100    QString name() const { return d->m_strName; }
    91101
     102    /** Returns whether cloud VM is accessible. */
     103    bool isAccessible() const { return d->m_fAccessible; }
     104
     105    /** Returns cloud VM OS type. */
     106    QString osType() const { return d->m_strOsType; }
     107    /** Returns cloud VM memory size. */
     108    int memorySize() const { return d->m_iMemorySize; }
     109    /** Returns cloud VM CPU count. */
     110    int cpuCount() const { return d->m_iCpuCount; }
     111
    92112private:
    93113
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r82968 r83151  
    2222/* GUI includes: */
    2323#include "UIBootOrderEditor.h"
     24#include "UICloudMachine.h"
    2425#include "UIConverter.h"
    2526#include "UIDetailsGenerator.h"
     
    122123}
    123124
     125UITextTable UIDetailsGenerator::generateMachineInformationGeneral(UICloudMachine &guiCloudMachine,
     126                                                                  const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions)
     127{
     128    UITextTable table;
     129
     130    if (guiCloudMachine.isNull())
     131        return table;
     132
     133    if (!guiCloudMachine.isAccessible())
     134    {
     135        table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
     136        return table;
     137    }
     138
     139    /* Name: */
     140    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Name)
     141        table << UITextTableLine(QApplication::translate("UIDetails", "Name", "details (general)"),
     142                                 guiCloudMachine.name());
     143
     144    /* Operating system: */
     145    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_OS)
     146        table << UITextTableLine(QApplication::translate("UIDetails", "Operating System", "details (general)"),
     147                                 uiCommon().vmGuestOSTypeDescription(guiCloudMachine.osType()));
     148
     149    return table;
     150}
     151
    124152UITextTable UIDetailsGenerator::generateMachineInformationSystem(CMachine &comMachine,
    125153                                                                 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions)
     
    246274}
    247275
     276UITextTable UIDetailsGenerator::generateMachineInformationSystem(UICloudMachine &guiCloudMachine,
     277                                                                 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions)
     278{
     279    UITextTable table;
     280
     281    if (guiCloudMachine.isNull())
     282        return table;
     283
     284    if (!guiCloudMachine.isAccessible())
     285    {
     286        table << UITextTableLine(QApplication::translate("UIDetails", "Information Inaccessible", "details"), QString());
     287        return table;
     288    }
     289
     290    /* Base memory: */
     291    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)
     292        table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"),
     293                                 QApplication::translate("UIDetails", "%1 MB").arg(guiCloudMachine.memorySize()));
     294
     295    /* Processors: */
     296    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_CPUCount)
     297        table << UITextTableLine(QApplication::translate("UIDetails", "Processors", "details (system)"),
     298                                 QString::number(guiCloudMachine.cpuCount()));
     299
     300    return table;
     301}
    248302
    249303UITextTable UIDetailsGenerator::generateMachineInformationDisplay(CMachine &comMachine,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h

    r82968 r83151  
    2727
    2828/* Forward declarations: */
     29class UICloudMachine;
    2930class CMachine;
    3031
     
    3536                                                                       const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions);
    3637
     38    SHARED_LIBRARY_STUFF UITextTable generateMachineInformationGeneral(UICloudMachine &guiCloudMachine,
     39                                                                       const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions);
     40
    3741    SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(CMachine &comMachine,
     42                                                                      const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions);
     43
     44    SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(UICloudMachine &guiCloudMachine,
    3845                                                                      const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem &fOptions);
    3946
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp

    r82998 r83151  
    2222
    2323/* GUI includes: */
     24#include "UICloudMachine.h"
    2425#include "UICommon.h"
    2526#include "UIConverter.h"
     
    5253#include "CVRDEServer.h"
    5354
    54 UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &machine)
     55UIDetailsUpdateTask::UIDetailsUpdateTask(const CMachine &comMachine)
    5556    : UITask(UITask::Type_DetailsPopulation)
    5657{
    5758    /* Store machine as property: */
    58     setProperty("machine", QVariant::fromValue(machine));
     59    setProperty("machine", QVariant::fromValue(comMachine));
     60}
     61
     62UIDetailsUpdateTask::UIDetailsUpdateTask(const UICloudMachine &guiCloudMachine)
     63    : UITask(UITask::Type_DetailsPopulation)
     64{
     65    /* Store cloud machine as property: */
     66    setProperty("cloudMachine", QVariant::fromValue(guiCloudMachine));
    5967}
    6068
     
    235243}
    236244
     245void UIDetailsUpdateTaskGeneralCloud::run()
     246{
     247    /* Acquire corresponding machine: */
     248    UICloudMachine guiCloudMachine = property("cloudMachine").value<UICloudMachine>();
     249    if (guiCloudMachine.isNull())
     250        return;
     251
     252    /* Generate details table: */
     253    UITextTable table = UIDetailsGenerator::generateMachineInformationGeneral(guiCloudMachine, m_fOptions);
     254    setProperty("table", QVariant::fromValue(table));
     255}
     256
    237257UITask *UIDetailsElementGeneral::createUpdateTask()
    238258{
    239     return new UIDetailsUpdateTaskGeneral(machine(), model()->optionsGeneral());
     259    return   isLocal()
     260           ? static_cast<UITask*>(new UIDetailsUpdateTaskGeneral(machine(), model()->optionsGeneral()))
     261           : static_cast<UITask*>(new UIDetailsUpdateTaskGeneralCloud(cloudMachine(), model()->optionsGeneral()));
    240262}
    241263
     
    253275}
    254276
     277void UIDetailsUpdateTaskSystemCloud::run()
     278{
     279    /* Acquire corresponding machine: */
     280    UICloudMachine guiCloudMachine = property("cloudMachine").value<UICloudMachine>();
     281    if (guiCloudMachine.isNull())
     282        return;
     283
     284    /* Generate details table: */
     285    UITextTable table = UIDetailsGenerator::generateMachineInformationSystem(guiCloudMachine, m_fOptions);
     286    setProperty("table", QVariant::fromValue(table));
     287}
     288
    255289UITask *UIDetailsElementSystem::createUpdateTask()
    256290{
    257     return new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem());
     291    return   isLocal()
     292           ? static_cast<UITask*>(new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem()))
     293           : static_cast<UITask*>(new UIDetailsUpdateTaskSystemCloud(cloudMachine(), model()->optionsSystem()));
    258294}
    259295
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h

    r82998 r83151  
    4040    /** Constructs update task taking @a comMachine as data. */
    4141    UIDetailsUpdateTask(const CMachine &comMachine);
     42    /** Constructs update task taking @a guiCloudMachine as data. */
     43    UIDetailsUpdateTask(const UICloudMachine &guiCloudMachine);
    4244};
    4345
     
    136138};
    137139
     140/** UITask extension used as update task for the details-element type 'General' of cloud VM. */
     141class UIDetailsUpdateTaskGeneralCloud : public UIDetailsUpdateTask
     142{
     143    Q_OBJECT;
     144
     145public:
     146
     147    /** Constructs update task passing @a guiCloudMachine to the base-class. */
     148    UIDetailsUpdateTaskGeneralCloud(const UICloudMachine &guiCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral fOptions)
     149        : UIDetailsUpdateTask(guiCloudMachine), m_fOptions(fOptions) {}
     150
     151private:
     152
     153    /** Contains update task body. */
     154    void run();
     155
     156    /** Holds the options. */
     157    UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral m_fOptions;
     158};
     159
    138160/** UIDetailsElementInterface extension for the details-element type 'General'. */
    139161class UIDetailsElementGeneral : public UIDetailsElementInterface
     
    175197};
    176198
     199/** UITask extension used as update task for the details-element type 'System' of cloud VM. */
     200class UIDetailsUpdateTaskSystemCloud : public UIDetailsUpdateTask
     201{
     202    Q_OBJECT;
     203
     204public:
     205
     206    /** Constructs update task passing @a guiCloudMachine to the base-class. */
     207    UIDetailsUpdateTaskSystemCloud(const UICloudMachine &guiCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSystem fOptions)
     208        : UIDetailsUpdateTask(guiCloudMachine), m_fOptions(fOptions) {}
     209
     210private:
     211
     212    /** Contains update task body. */
     213    void run();
     214
     215    /** Holds the options. */
     216    UIExtraDataMetaDefs::DetailsElementOptionTypeSystem m_fOptions;
     217};
     218
    177219/** UIDetailsElementInterface extension for the details-element type 'System'. */
    178220class UIDetailsElementSystem : public UIDetailsElementInterface
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