VirtualBox

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


Ignore:
Timestamp:
Feb 16, 2016 12:26:05 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​bugref:8088: Rework session-information window: Cleanups.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformation.cpp

    r59641 r59702  
    4242{
    4343    /* Prepare main-layout: */
    44     prepareLayout();
     44    prepareMainLayout();
    4545
    4646    /* Prepare model: */
     
    5151}
    5252
    53 void UIInformation::prepareLayout()
     53void UIInformation::prepareMainLayout()
    5454{
    5555    /* Create main-layout: */
     
    6969    m_pModel = new UIInformationModel(this, m_machine, m_console);
    7070    AssertPtrReturnVoid(m_pModel);
     71    {
     72        /* Prepare data for information-model: */
     73        /* General data-item: */
     74        UIInformationDataItem *pGeneral = new UIInformationDataGeneral(m_machine, m_console, m_pModel);
     75        AssertPtrReturnVoid(pGeneral);
     76        {
     77            m_pModel->addItem(pGeneral);
     78        }
    7179
    72     /* Prepare data for information-model: */
    73     /* General data-item: */
    74     UIInformationDataItem *pGeneral = new UIInformationDataGeneral(m_machine, m_console, m_pModel);
    75     AssertPtrReturnVoid(pGeneral);
    76     {
    77         m_pModel->addItem(pGeneral);
    78     }
    79     /* System data-item: */
    80     UIInformationDataItem *pSystem = new UIInformationDataSystem(m_machine, m_console, m_pModel);
    81     AssertPtrReturnVoid(pSystem);
    82     {
    83         m_pModel->addItem(pSystem);
    84     }
    85     /* Display data-item: */
    86     UIInformationDataItem *pDisplay = new UIInformationDataDisplay(m_machine, m_console, m_pModel);
    87     AssertPtrReturnVoid(pDisplay);
    88     {
    89         m_pModel->addItem(pDisplay);
    90     }
    91     /* Storage data-item: */
    92     UIInformationDataItem *pStorage = new UIInformationDataStorage(m_machine, m_console, m_pModel);
    93     AssertPtrReturnVoid(pStorage);
    94     {
    95         m_pModel->addItem(pStorage);
    96     }
    97     /* Audio data-item: */
    98     UIInformationDataItem *pAudio = new UIInformationDataAudio(m_machine, m_console, m_pModel);
    99     AssertPtrReturnVoid(pAudio);
    100     {
    101         m_pModel->addItem(pAudio);
    102     }
    103     /* Network data-item: */
    104     UIInformationDataItem *pNetwork = new UIInformationDataNetwork(m_machine, m_console, m_pModel);
    105     AssertPtrReturnVoid(pNetwork);
    106     {
    107         m_pModel->addItem(pNetwork);
    108     }
    109     /* Serial ports data-item: */
    110     UIInformationDataItem *pSerialPorts = new UIInformationDataSerialPorts(m_machine, m_console, m_pModel);
    111     AssertPtrReturnVoid(pSerialPorts);
    112     {
    113         m_pModel->addItem(pSerialPorts);
    114     }
     80        /* System data-item: */
     81        UIInformationDataItem *pSystem = new UIInformationDataSystem(m_machine, m_console, m_pModel);
     82        AssertPtrReturnVoid(pSystem);
     83        {
     84            m_pModel->addItem(pSystem);
     85        }
     86
     87        /* Display data-item: */
     88        UIInformationDataItem *pDisplay = new UIInformationDataDisplay(m_machine, m_console, m_pModel);
     89        AssertPtrReturnVoid(pDisplay);
     90        {
     91            m_pModel->addItem(pDisplay);
     92        }
     93
     94        /* Storage data-item: */
     95        UIInformationDataItem *pStorage = new UIInformationDataStorage(m_machine, m_console, m_pModel);
     96        AssertPtrReturnVoid(pStorage);
     97        {
     98            m_pModel->addItem(pStorage);
     99        }
     100
     101        /* Audio data-item: */
     102        UIInformationDataItem *pAudio = new UIInformationDataAudio(m_machine, m_console, m_pModel);
     103        AssertPtrReturnVoid(pAudio);
     104        {
     105            m_pModel->addItem(pAudio);
     106        }
     107
     108        /* Network data-item: */
     109        UIInformationDataItem *pNetwork = new UIInformationDataNetwork(m_machine, m_console, m_pModel);
     110        AssertPtrReturnVoid(pNetwork);
     111        {
     112            m_pModel->addItem(pNetwork);
     113        }
     114
     115        /* Serial ports data-item: */
     116        UIInformationDataItem *pSerialPorts = new UIInformationDataSerialPorts(m_machine, m_console, m_pModel);
     117        AssertPtrReturnVoid(pSerialPorts);
     118        {
     119            m_pModel->addItem(pSerialPorts);
     120        }
     121
    115122#ifdef VBOX_WITH_PARALLEL_PORTS
    116     /* Parallel ports data-item: */
    117     UIInformationDataItem *pParallelPorts = new UIInformationDataParallelPorts(m_machine, m_console, m_pModel);
    118     AssertPtrReturnVoid(pParallelPorts);
    119     {
    120         m_list.append(pParallelPorts);
    121     }
     123        /* Parallel ports data-item: */
     124        UIInformationDataItem *pParallelPorts = new UIInformationDataParallelPorts(m_machine, m_console, m_pModel);
     125        AssertPtrReturnVoid(pParallelPorts);
     126        {
     127            m_list.append(pParallelPorts);
     128        }
    122129#endif /* VBOX_WITH_PARALLEL_PORTS */
    123     /* USB data-item: */
    124     UIInformationDataItem *pUSB = new UIInformationDataUSB(m_machine, m_console, m_pModel);
    125     AssertPtrReturnVoid(pUSB);
    126     {
    127         m_pModel->addItem(pUSB);
    128     }
    129     /* Shared folders data-item: */
    130     UIInformationDataItem *pSharedFolders = new UIInformationDataSharedFolders(m_machine, m_console, m_pModel);
    131     AssertPtrReturnVoid(pSharedFolders);
    132     {
    133         m_pModel->addItem(pSharedFolders);
     130
     131        /* USB data-item: */
     132        UIInformationDataItem *pUSB = new UIInformationDataUSB(m_machine, m_console, m_pModel);
     133        AssertPtrReturnVoid(pUSB);
     134        {
     135            m_pModel->addItem(pUSB);
     136        }
     137
     138        /* Shared folders data-item: */
     139        UIInformationDataItem *pSharedFolders = new UIInformationDataSharedFolders(m_machine, m_console, m_pModel);
     140        AssertPtrReturnVoid(pSharedFolders);
     141        {
     142            m_pModel->addItem(pSharedFolders);
     143        }
    134144    }
    135145}
     
    150160        }
    151161        /* Connect datachanged signal: */
    152         connect(m_pModel, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)), m_pView, SLOT(updateData(const QModelIndex, const QModelIndex)));
     162        connect(m_pModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), m_pView, SLOT(updateData(const QModelIndex&, const QModelIndex&)));
    153163
    154164        /* Set model: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformation.h

    r59641 r59702  
    4949
    5050    /** Prepares main-layout. */
    51     void prepareLayout();
     51    void prepareMainLayout();
    5252
    5353    /** Prepares model. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationDataItem.cpp

    r59642 r59702  
    7272QVariant UIInformationDataItem::data(const QModelIndex &index, int role) const
    7373{
    74     switch (role)
    75     {
    76         case Qt::DisplayRole:
    77         {
    78             return tr("General", "details report");
    79         }
    80         break;
    81 
    82         case Qt::DecorationRole:
    83         {
    84             return QIcon(":/machine_16px.png");
    85         }
    86         break;
    87 
    88         default:
    89         break;
    90     }
     74    Q_UNUSED(index);
     75    Q_UNUSED(role);
     76    /* Return null QVariant by default: */
    9177    return QVariant();
    9278}
     
    11399        break;
    114100
    115         case Qt::UserRole+1:
     101        case Qt::UserRole + 1:
    116102        {
    117103            UITextTable p_text;
     
    122108        break;
    123109
    124         case Qt::UserRole+2:
     110        case Qt::UserRole + 2:
    125111        {
    126112            return m_type;
     
    155141        break;
    156142
    157         case Qt::UserRole+1:
     143        case Qt::UserRole + 1:
    158144        {
    159145#ifdef VBOX_WITH_FULL_DETAILS_REPORT
     
    161147            CBIOSSettings biosSettings = aMachine.GetBIOSSettings();
    162148            /* ACPI: */
    163             QString acpi = biosSettings.GetACPIEnabled()
    164                            ? tr("Enabled", "details report (ACPI)")
    165                            : tr("Disabled", "details report (ACPI)");
     149            QString acpi = biosSettings.GetACPIEnabled() ? tr("Enabled", "details report (ACPI)") :
     150                                                           tr("Disabled", "details report (ACPI)");
    166151            /* I/O APIC: */
    167             QString ioapic = biosSettings.GetIOAPICEnabled()
    168                              ? tr("Enabled", "details report (I/O APIC)")
    169                              : tr("Disabled", "details report (I/O APIC)");
     152            QString ioapic = biosSettings.GetIOAPICEnabled() ? tr("Enabled", "details report (I/O APIC)") :
     153                                                               tr("Disabled", "details report (I/O APIC)");
    170154            /* PAE/NX: */
    171             QString pae = aMachine.GetCpuProperty(KCpuPropertyType_PAE)
    172                           ? tr("Enabled", "details report (PAE/NX)")
    173                           : tr("Disabled", "details report (PAE/NX)");
     155            QString pae = aMachine.GetCpuProperty(KCpuPropertyType_PAE) ? tr("Enabled", "details report (PAE/NX)") :
     156                                                                          tr("Disabled", "details report (PAE/NX)");
    174157
    175158            iRowCount += 3; /* Full report rows: */
     
    179162            for (ulong i = 1; i <= vboxGlobal().virtualBox().GetSystemProperties().GetMaxBootPosition(); ++i)
    180163            {
    181                 KDeviceType device = m_machine.GetBootOrder (i);
     164                KDeviceType device = m_machine.GetBootOrder(i);
    182165                if (device == KDeviceType_Null)
    183166                    continue;
    184167                if (!bootOrder.isEmpty())
    185168                    bootOrder += ", ";
    186                 bootOrder += gpConverter->toString (device);
     169                bootOrder += gpConverter->toString(device);
    187170            }
    188171            if (bootOrder.isEmpty())
    189                 bootOrder = gpConverter->toString (KDeviceType_Null);
     172                bootOrder = gpConverter->toString(KDeviceType_Null);
    190173
    191174            /* Prepare data: */
     
    206189            {
    207190                /* VT-x/AMD-V: */
    208                 QString virt = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)
    209                     ? tr ("Enabled", "details report (VT-x/AMD-V)")
    210                     : tr ("Disabled", "details report (VT-x/AMD-V)");
     191                QString virt = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled) ?
     192                               tr("Enabled", "details report (VT-x/AMD-V)") :
     193                               tr("Disabled", "details report (VT-x/AMD-V)");
    211194                p_text << UITextTableLine(tr("VT-x/AMD-V", "details report"), virt);
    212195                /* Nested Paging: */
    213                 QString nested = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)
    214                     ? tr ("Enabled", "details report (Nested Paging)")
    215                     : tr ("Disabled", "details report (Nested Paging)");
     196                QString nested = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging) ?
     197                                 tr("Enabled", "details report (Nested Paging)") :
     198                                 tr("Disabled", "details report (Nested Paging)");
    216199                p_text << UITextTableLine(tr("Nested Paging", "details report"), nested);
    217200            }
     
    224207        break;
    225208
    226         case Qt::UserRole+2:
     209        case Qt::UserRole + 2:
    227210        {
    228211            return m_type;
     
    267250                p_text << UITextTableLine(tr("Screens", "details report"), QString::number(cGuestScreens));
    268251
    269             QString acc3d = m_machine.GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable()
    270                             ? tr("Enabled", "details report (3D Acceleration)")
    271                             : tr("Disabled", "details report (3D Acceleration)");
     252            QString acc3d = m_machine.GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable() ?
     253                            tr("Enabled", "details report (3D Acceleration)") :
     254                            tr("Disabled", "details report (3D Acceleration)");
    272255            p_text << UITextTableLine(tr("3D Acceleration", "details report"), acc3d);
    273256
    274257#ifdef VBOX_WITH_VIDEOHWACCEL
    275             QString acc2dVideo = m_machine.GetAccelerate2DVideoEnabled()
    276                                 ? tr("Enabled", "details report (2D Video Acceleration)")
    277                                 : tr("Disabled", "details report (2D Video Acceleration)");
     258            QString acc2dVideo = m_machine.GetAccelerate2DVideoEnabled() ?
     259                                 tr("Enabled", "details report (2D Video Acceleration)") :
     260                                tr("Disabled", "details report (2D Video Acceleration)");
    278261            p_text << UITextTableLine(tr("2D Video Acceleration", "details report"), acc2dVideo);
    279262#endif
     
    293276        break;
    294277
    295         case Qt::UserRole+2:
     278        case Qt::UserRole + 2:
    296279        {
    297280            return m_type;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationDataItem.h

    r59642 r59702  
    8585    CConsole m_console;
    8686
    87     /** Holds the model. */
     87    /** Holds the instance of model. */
    8888    UIInformationModel *m_pModel;
    8989};
     
    234234};
    235235
    236 /** UIInformationDataRuntimeAttributes extension for the details-element type 'runtime attributes'. */
     236/** UIInformationDataItem extension for the details-element type 'runtime attributes'. */
    237237class UIInformationDataRuntimeAttributes : public UIInformationDataItem
    238238{
     
    248248};
    249249
    250 /** UIInformationDataNetworkStatistics extension for the details-element type 'network statistics'. */
     250/** UIInformationDataItem extension for the details-element type 'network statistics'. */
    251251class UIInformationDataNetworkStatistics : public UIInformationDataItem
    252252{
     
    254254
    255255public:
     256
     257    /** Constructs details-element object for passed @a pParent set. */
     258    UIInformationDataNetworkStatistics(const CMachine &machine, const CConsole &console, UIInformationModel *pModel);
     259
     260    /** Returns data for item specified by @a idx for the @a role. */
     261    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
     262
     263private slots:
     264    /** Handles processing of statistics. */
     265    void sltProcessStatistics();
     266
     267private:
     268
     269    /** Returns parsed-data of statistics. */
     270    QString parseStatistics(const QString &strText);
    256271
    257272    /** VM statistics counter data map. */
     
    261276    /** VM statistics counter struct. */
    262277    struct CounterElementType { QString type; DataMapType list; };
    263 
    264     /** Constructs details-element object for passed @a pParent set. */
    265     UIInformationDataNetworkStatistics(const CMachine &machine, const CConsole &console, UIInformationModel *pModel);
    266 
    267     /** Returns data for item specified by @a idx for the @a role. */
    268     virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    269 
    270     QString parseStatistics(const QString &strText);
    271 
    272 public slots:
    273     void sltProcessStatistics();
    274 
    275 private:
    276278
    277279    /** VM statistics counter names. */
     
    287289};
    288290
    289 /** UIInformationDataStorageStatistics extension for the details-element type 'storage statistics'. */
     291/** UIInformationDataItem extension for the details-element type 'storage statistics'. */
    290292class UIInformationDataStorageStatistics : public UIInformationDataItem
    291293{
     
    293295
    294296public:
     297
     298    /** Constructs details-element object for passed @a pParent set. */
     299    UIInformationDataStorageStatistics(const CMachine &machine, const CConsole &console, UIInformationModel *pModel);
     300
     301    /** Returns data for item specified by @a idx for the @a role. */
     302    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
     303
     304private slots:
     305    /** Handles processing of statistics. */
     306    void sltProcessStatistics();
     307
     308private:
     309
     310    /** Returns parsed-data of statistics. */
     311    QString parseStatistics(const QString &strText);
    295312
    296313    /** VM statistics counter data map. */
     
    300317    /** VM statistics counter struct. */
    301318    struct CounterElementType { QString type; DataMapType list; };
    302 
    303     /** Constructs details-element object for passed @a pParent set. */
    304     UIInformationDataStorageStatistics(const CMachine &machine, const CConsole &console, UIInformationModel *pModel);
    305 
    306     /** Returns data for item specified by @a idx for the @a role. */
    307     virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    308 
    309     QString parseStatistics(const QString &strText);
    310 
    311 public slots:
    312     void sltProcessStatistics();
    313 
    314 private:
    315319
    316320    /** VM statistics counter names. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.cpp

    r59644 r59702  
    7171    roleNames[Qt::UserRole + 1] = "";
    7272    roleNames[Qt::UserRole + 2] = "";
     73    # if QT_VERSION < 0x050000
    7374    setRoleNames(roleNames);
     75    # endif /* QT_VERSION < 0x050000 */
    7476
    7577    /* Register meta-type: */
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