VirtualBox

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


Ignore:
Timestamp:
Jan 31, 2024 8:55:10 AM (10 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10501. Moving cloud machine metric data related progress tasks to common area.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r103068 r103131  
    856856        src/logviewer/UIVMLogViewerWidget.h \
    857857        src/activity/vmactivity/UIVMActivityMonitor.h \
     858        src/activity/UIMonitorCommon.h \
    858859        src/medium/UIFDCreationDialog.h \
    859860        src/medium/UIMediumEnumerator.h \
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/UIMonitorCommon.cpp

    r98103 r103131  
    4040#include "CMachineDebugger.h"
    4141#include "CPerformanceCollector.h"
     42
     43
     44
     45/*********************************************************************************************************************************
     46*   UIProgressTaskReadCloudMachineMetricList implementation.                                                                     *
     47*********************************************************************************************************************************/
     48
     49UIProgressTaskReadCloudMachineMetricList::UIProgressTaskReadCloudMachineMetricList(QObject *pParent, CCloudMachine comCloudMachine)
     50    :UIProgressTask(pParent)
     51    , m_comCloudMachine(comCloudMachine)
     52{
     53}
     54
     55CProgress UIProgressTaskReadCloudMachineMetricList::createProgress()
     56{
     57    if (!m_comCloudMachine.isOk())
     58        return CProgress();
     59    return m_comCloudMachine.ListMetricNames(m_metricNamesArray);
     60}
     61
     62void UIProgressTaskReadCloudMachineMetricList::handleProgressFinished(CProgress &comProgress)
     63{
     64    if (!comProgress.isOk())
     65        return;
     66    emit sigMetricListReceived(m_metricNamesArray.GetValues());
     67}
     68
     69
     70/*********************************************************************************************************************************
     71*   UIProgressTaskReadCloudMachineMetricData implementation.                                                                     *
     72*********************************************************************************************************************************/
     73
     74UIProgressTaskReadCloudMachineMetricData::UIProgressTaskReadCloudMachineMetricData(QObject *pParent,
     75                                                                                   CCloudMachine comCloudMachine,
     76                                                                                   KMetricType enmMetricType,
     77                                                                                   ULONG uDataPointsCount)
     78    :UIProgressTask(pParent)
     79    , m_comCloudMachine(comCloudMachine)
     80    , m_enmMetricType(enmMetricType)
     81    , m_uDataPointsCount(uDataPointsCount)
     82{
     83}
     84
     85CProgress UIProgressTaskReadCloudMachineMetricData::createProgress()
     86{
     87    if (!m_comCloudMachine.isOk())
     88        return CProgress();
     89
     90    CStringArray aUnit;
     91    return m_comCloudMachine.EnumerateMetricData(m_enmMetricType, m_uDataPointsCount, m_metricData, m_timeStamps, aUnit);
     92}
     93
     94
     95void UIProgressTaskReadCloudMachineMetricData::handleProgressFinished(CProgress &comProgress)
     96{
     97    if (!comProgress.isOk())
     98        return;
     99    if (m_metricData.isOk() && m_timeStamps.isOk())
     100        emit sigMetricDataReceived(m_enmMetricType, m_metricData.GetValues(), m_timeStamps.GetValues());
     101}
    42102
    43103/* static */
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/UIMonitorCommon.h

    r98103 r103131  
    3131# pragma once
    3232#endif
     33
     34#include <QPainterPath>
     35#include "UIProgressTask.h"
     36#include "COMEnums.h"
     37#include "CStringArray.h"
     38#include "CCloudMachine.h"
     39
     40class SHARED_LIBRARY_STUFF UIProgressTaskReadCloudMachineMetricList : public UIProgressTask
     41{
     42    Q_OBJECT;
     43
     44signals:
     45
     46    void sigMetricListReceived(QVector<QString> metricNamesList);
     47
     48public:
     49
     50    UIProgressTaskReadCloudMachineMetricList(QObject *pParent, CCloudMachine comCloudMachine);
     51
     52protected:
     53
     54    virtual CProgress createProgress() RT_OVERRIDE;
     55    virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
     56
     57private:
     58
     59    CCloudMachine m_comCloudMachine;
     60    CStringArray m_metricNamesArray;
     61};
     62
     63
     64class SHARED_LIBRARY_STUFF UIProgressTaskReadCloudMachineMetricData : public UIProgressTask
     65{
     66    Q_OBJECT;
     67
     68signals:
     69
     70    void sigMetricDataReceived(KMetricType enmMetricType, QVector<QString> data, QVector<QString> timeStamps);
     71
     72public:
     73
     74    UIProgressTaskReadCloudMachineMetricData(QObject *pParent, CCloudMachine comCloudMachine,
     75                                             KMetricType enmMetricType, ULONG uDataPointsCount);
     76
     77protected:
     78
     79    virtual CProgress createProgress() RT_OVERRIDE;
     80    virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
     81
     82private:
     83
     84    CCloudMachine m_comCloudMachine;
     85    CStringArray m_metricData;
     86    CStringArray m_timeStamps;
     87    KMetricType m_enmMetricType;
     88    ULONG m_uDataPointsCount;
     89};
     90
    3391
    3492/** UIDebuggerMetricData is used as data storage while parsing the xml stream received from IMachineDebugger. */
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp

    r102927 r103131  
    4444#include "UIConverter.h"
    4545#include "UIIconPool.h"
    46 #include "UIProgressTask.h"
    4746#include "UITranslator.h"
    4847#include "UIVMActivityMonitor.h"
     
    5655#include "CPerformanceCollector.h"
    5756#include "CPerformanceMetric.h"
    58 #include "CStringArray.h"
    5957#include "CRangedIntegerFormValue.h"
    6058#include <iprt/string.h>
     
    7270const int g_iBackgroundTint = 104;
    7371const quint64 uInvalidValueSentinel = ~0U;
    74 
    75 
    76 /*********************************************************************************************************************************
    77 *   UIProgressTaskReadCloudMachineMetricList definition.                                                                         *
    78 *********************************************************************************************************************************/
    79 
    80 class UIProgressTaskReadCloudMachineMetricList : public UIProgressTask
    81 {
    82     Q_OBJECT;
    83 
    84 signals:
    85 
    86     void sigMetricListReceived(QVector<QString> metricNamesList);
    87 
    88 public:
    89 
    90     UIProgressTaskReadCloudMachineMetricList(QObject *pParent, CCloudMachine comCloudMachine);
    91 
    92 protected:
    93 
    94     virtual CProgress createProgress() RT_OVERRIDE;
    95     virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
    96 
    97 private:
    98 
    99     CCloudMachine m_comCloudMachine;
    100     CStringArray m_metricNamesArray;
    101 };
    102 
    103 
    104 /*********************************************************************************************************************************
    105 *   UIProgressTaskReadCloudMachineMetricList definition.                                                                         *
    106 *********************************************************************************************************************************/
    107 
    108 class UIProgressTaskReadCloudMachineMetricData : public UIProgressTask
    109 {
    110     Q_OBJECT;
    111 
    112 signals:
    113 
    114     void sigMetricDataReceived(KMetricType enmMetricType, QVector<QString> data, QVector<QString> timeStamps);
    115 
    116 public:
    117 
    118     UIProgressTaskReadCloudMachineMetricData(QObject *pParent, CCloudMachine comCloudMachine,
    119                                              KMetricType enmMetricType, ULONG uDataPointsCount);
    120 
    121 protected:
    122 
    123     virtual CProgress createProgress() RT_OVERRIDE;
    124     virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
    125 
    126 private:
    127 
    128     CCloudMachine m_comCloudMachine;
    129     CStringArray m_metricData;
    130     CStringArray m_timeStamps;
    131     KMetricType m_enmMetricType;
    132     ULONG m_uDataPointsCount;
    133 };
    134 
    13572
    13673/*********************************************************************************************************************************
     
    254191    QLabel *m_pMouseOverLabel;
    255192};
    256 
    257 
    258 /*********************************************************************************************************************************
    259 *   UIProgressTaskReadCloudMachineMetricList implementation.                                                                     *
    260 *********************************************************************************************************************************/
    261 
    262 UIProgressTaskReadCloudMachineMetricList::UIProgressTaskReadCloudMachineMetricList(QObject *pParent, CCloudMachine comCloudMachine)
    263     :UIProgressTask(pParent)
    264     , m_comCloudMachine(comCloudMachine)
    265 {
    266 }
    267 
    268 CProgress UIProgressTaskReadCloudMachineMetricList::createProgress()
    269 {
    270     if (!m_comCloudMachine.isOk())
    271         return CProgress();
    272     return m_comCloudMachine.ListMetricNames(m_metricNamesArray);
    273 }
    274 
    275 void UIProgressTaskReadCloudMachineMetricList::handleProgressFinished(CProgress &comProgress)
    276 {
    277     if (!comProgress.isOk())
    278         return;
    279     emit sigMetricListReceived(m_metricNamesArray.GetValues());
    280 }
    281 
    282 
    283 /*********************************************************************************************************************************
    284 *   UIProgressTaskReadCloudMachineMetricData implementation.                                                                     *
    285 *********************************************************************************************************************************/
    286 
    287 UIProgressTaskReadCloudMachineMetricData::UIProgressTaskReadCloudMachineMetricData(QObject *pParent,
    288                                                                                    CCloudMachine comCloudMachine,
    289                                                                                    KMetricType enmMetricType,
    290                                                                                    ULONG uDataPointsCount)
    291     :UIProgressTask(pParent)
    292     , m_comCloudMachine(comCloudMachine)
    293     , m_enmMetricType(enmMetricType)
    294     , m_uDataPointsCount(uDataPointsCount)
    295 {
    296 }
    297 
    298 CProgress UIProgressTaskReadCloudMachineMetricData::createProgress()
    299 {
    300     if (!m_comCloudMachine.isOk())
    301         return CProgress();
    302 
    303     CStringArray aUnit;
    304     return m_comCloudMachine.EnumerateMetricData(m_enmMetricType, m_uDataPointsCount, m_metricData, m_timeStamps, aUnit);
    305 }
    306 
    307 
    308 void UIProgressTaskReadCloudMachineMetricData::handleProgressFinished(CProgress &comProgress)
    309 {
    310     if (!comProgress.isOk())
    311         return;
    312     if (m_metricData.isOk() && m_timeStamps.isOk())
    313         emit sigMetricDataReceived(m_enmMetricType, m_metricData.GetValues(), m_timeStamps.GetValues());
    314 }
    315193
    316194/*********************************************************************************************************************************
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