VirtualBox

Changeset 98973 in vbox


Ignore:
Timestamp:
Mar 15, 2023 9:44:14 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156322
Message:

FE/Qt: bugref:10322: Runtime UI: A bit of code reordering for UIIndicatorsPool.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r98966 r98973  
    184184    }
    185185
    186 private slots:
    187 
    188     /** Refreshes the tooltip if the device config changes at runtime (hotplugging, USB storage). */
    189     void sltStorageDeviceChange()
    190     {
    191         updateAppearance();
    192     }
    193 
    194 private:
     186protected:
    195187
    196188    /** Update routine. */
    197     void updateAppearance()
     189    virtual void updateAppearance() RT_OVERRIDE
    198190    {
    199191        /* Acquire data: */
     
    213205        /* Update indicator state: */
    214206        setState(fAttachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
     207    }
     208
     209private slots:
     210
     211    /** Refreshes the tooltip if the device config changes at runtime (hotplugging, USB storage). */
     212    void sltStorageDeviceChange()
     213    {
     214        updateAppearance();
    215215    }
    216216};
     
    237237    }
    238238
    239 private:
     239protected:
    240240
    241241    /** Update routine. */
    242     void updateAppearance()
     242    virtual void updateAppearance() RT_OVERRIDE
    243243    {
    244244        QString strFullData;
     
    282282    }
    283283
    284 private:
     284protected:
    285285
    286286    /** Update routine. */
    287     void updateAppearance()
     287    virtual void updateAppearance() RT_OVERRIDE
    288288    {
    289289        QString strFullData;
     
    336336    }
    337337
    338 private:
     338protected:
    339339
    340340    /** Update routine. */
    341     void updateAppearance()
     341    virtual void updateAppearance() RT_OVERRIDE
    342342    {
    343343        QString strFullData;
     
    392392        {
    393393            /* Configure auto-update timer: */
    394             connect(m_pTimerAutoUpdate, &QTimer::timeout, this, &UIIndicatorNetwork::sltUpdateNetworkIPs);
     394            connect(m_pTimerAutoUpdate, &QTimer::timeout,
     395                    this, &UIIndicatorNetwork::sltUpdateNetworkIPs);
    395396            /* Start timer immediately if machine is running: */
    396397            sltHandleMachineStateChange();
     
    398399        /* Translate finally: */
    399400        retranslateUi();
     401    }
     402
     403protected:
     404
     405    /** Update routine. */
     406    virtual void updateAppearance() RT_OVERRIDE
     407    {
     408        QString strFullData;
     409        bool fAdaptersPresent = false;
     410        bool fCablesDisconnected = true;
     411        m_pMachine->acquireNetworkStatusInfo(strFullData, fAdaptersPresent, fCablesDisconnected);
     412
     413        /* Show/hide indicator if there are no attachments
     414         * and parent is visible already: */
     415        if (   parentWidget()
     416            && parentWidget()->isVisible())
     417            setVisible(fAdaptersPresent);
     418
     419        /* Update tool-tip: */
     420        if (!strFullData.isEmpty())
     421            setToolTip(s_strTable.arg(strFullData));
     422        /* Update indicator state: */
     423        setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null);
    400424    }
    401425
     
    423447private:
    424448
    425     /** Update routine. */
    426     void updateAppearance()
    427     {
    428         QString strFullData;
    429         bool fAdaptersPresent = false;
    430         bool fCablesDisconnected = true;
    431         m_pMachine->acquireNetworkStatusInfo(strFullData, fAdaptersPresent, fCablesDisconnected);
    432 
    433         /* Show/hide indicator if there are no attachments
    434          * and parent is visible already: */
    435         if (   parentWidget()
    436             && parentWidget()->isVisible())
    437             setVisible(fAdaptersPresent);
    438 
    439         /* Update tool-tip: */
    440         if (!strFullData.isEmpty())
    441             setToolTip(s_strTable.arg(strFullData));
    442         /* Update indicator state: */
    443         setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null);
    444     }
    445 
    446449    /** Holds the auto-update timer instance. */
    447450    QTimer *m_pTimerAutoUpdate;
     
    469472    }
    470473
    471 private:
     474protected:
    472475
    473476    /** Update routine. */
    474     void updateAppearance()
     477    virtual void updateAppearance() RT_OVERRIDE
    475478    {
    476479        QString strFullData;
     
    513516    }
    514517
    515 private:
     518protected:
    516519
    517520    /** Update routine. */
    518     void updateAppearance()
     521    virtual void updateAppearance() RT_OVERRIDE
    519522    {
    520523        QString strFullData;
     
    550553    }
    551554
    552 private:
     555protected:
    553556
    554557    /** Update routine. */
    555     void updateAppearance()
     558    virtual void updateAppearance() RT_OVERRIDE
    556559    {
    557560        QString strFullData;
     
    602605        /* Translate finally: */
    603606        retranslateUi();
     607    }
     608
     609protected:
     610
     611    /** Handles paint @a pEvent. */
     612    virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE
     613    {
     614        /* Call to base-class: */
     615        UISessionStateStatusBarIndicator::paintEvent(pEvent);
     616
     617        /* Create new painter: */
     618        QPainter painter(this);
     619        /* Configure painter for *enabled* state: */
     620        if (state() == UIIndicatorStateRecording_Enabled)
     621        {
     622            /* Configure painter for smooth animation: */
     623            painter.setRenderHint(QPainter::Antialiasing);
     624            painter.setRenderHint(QPainter::SmoothPixmapTransform);
     625            /* Shift rotation origin according pixmap center: */
     626            painter.translate(height() / 2, height() / 2);
     627            /* Rotate painter: */
     628            painter.rotate(rotationAngle());
     629            /* Unshift rotation origin according pixmap center: */
     630            painter.translate(- height() / 2, - height() / 2);
     631        }
     632        /* Draw contents: */
     633        drawContents(&painter);
     634    }
     635
     636    /** Update routine. */
     637    virtual void updateAppearance() RT_OVERRIDE
     638    {
     639        QString strFullData;
     640        bool fRecordingEnabled = false;
     641        bool fMachinePaused = false;
     642        m_pMachine->acquireRecordingStatusInfo(strFullData, fRecordingEnabled, fMachinePaused);
     643
     644        /* Update tool-tip: */
     645        if (!strFullData.isEmpty())
     646            setToolTip(s_strTable.arg(strFullData));
     647        /* Set initial indicator state: */
     648        if (!fRecordingEnabled)
     649            setState(UIIndicatorStateRecording_Disabled);
     650        else if (!fMachinePaused)
     651            setState(UIIndicatorStateRecording_Enabled);
     652        else
     653            setState(UIIndicatorStateRecording_Paused);
    604654    }
    605655
     
    631681private:
    632682
    633     /** Paint-event handler. */
    634     void paintEvent(QPaintEvent*)
    635     {
    636         /* Create new painter: */
    637         QPainter painter(this);
    638         /* Configure painter for *enabled* state: */
    639         if (state() == UIIndicatorStateRecording_Enabled)
    640         {
    641             /* Configure painter for smooth animation: */
    642             painter.setRenderHint(QPainter::Antialiasing);
    643             painter.setRenderHint(QPainter::SmoothPixmapTransform);
    644             /* Shift rotation origin according pixmap center: */
    645             painter.translate(height() / 2, height() / 2);
    646             /* Rotate painter: */
    647             painter.rotate(rotationAngle());
    648             /* Unshift rotation origin according pixmap center: */
    649             painter.translate(- height() / 2, - height() / 2);
    650         }
    651         /* Draw contents: */
    652         drawContents(&painter);
    653     }
    654 
    655     /** Update routine. */
    656     void updateAppearance()
    657     {
    658         QString strFullData;
    659         bool fRecordingEnabled = false;
    660         bool fMachinePaused = false;
    661         m_pMachine->acquireRecordingStatusInfo(strFullData, fRecordingEnabled, fMachinePaused);
    662 
    663         /* Update tool-tip: */
    664         if (!strFullData.isEmpty())
    665             setToolTip(s_strTable.arg(strFullData));
    666         /* Set initial indicator state: */
    667         if (!fRecordingEnabled)
    668             setState(UIIndicatorStateRecording_Disabled);
    669         else if (!fMachinePaused)
    670             setState(UIIndicatorStateRecording_Enabled);
    671         else
    672             setState(UIIndicatorStateRecording_Paused);
    673     }
    674 
    675683    /** Returns rotation start angle. */
    676684    double rotationAngleStart() const { return 0; }
     
    715723        if (m_pTimerAutoUpdate)
    716724        {
    717             connect(m_pTimerAutoUpdate, &QTimer::timeout, this, &UIIndicatorFeatures::sltHandleTimeout);
     725            connect(m_pTimerAutoUpdate, &QTimer::timeout,
     726                    this, &UIIndicatorFeatures::sltHandleTimeout);
    718727            /* Start the timer immediately if the machine is running: */
    719728            sltHandleMachineStateChange();
     
    728737    virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE
    729738    {
     739        /* Call to base-class: */
    730740        UISessionStateStatusBarIndicator::paintEvent(pEvent);
     741
     742        /* Create new painter: */
    731743        QPainter painter(this);
    732 
    733744        /* Draw a thin bar on th right hand side of the icon indication CPU load: */
    734745        QLinearGradient gradient(0, 0, 0, height());
     
    736747        gradient.setColorAt(0.5, Qt::yellow);
    737748        gradient.setColorAt(0.0, Qt::red);
    738 
    739749        painter.setPen(Qt::NoPen);
    740750        painter.setBrush(gradient);
     
    751761    }
    752762
     763    /** Update routine. */
     764    virtual void updateAppearance() RT_OVERRIDE
     765    {
     766        QString strFullData;
     767        KVMExecutionEngine enmEngine = KVMExecutionEngine_NotSet;
     768        m_pMachine->acquireFeaturesStatusInfo(strFullData, enmEngine);
     769
     770        /* Update tool-tip: */
     771        if (!strFullData.isEmpty())
     772            setToolTip(s_strTable.arg(strFullData));
     773        /* Update indicator state: */
     774        setState(enmEngine);
     775    }
     776
    753777private slots:
    754778
     
    774798
    775799private:
    776 
    777     /** Update routine. */
    778     void updateAppearance()
    779     {
    780         QString strFullData;
    781         KVMExecutionEngine enmEngine = KVMExecutionEngine_NotSet;
    782         m_pMachine->acquireFeaturesStatusInfo(strFullData, enmEngine);
    783 
    784         /* Update tool-tip: */
    785         if (!strFullData.isEmpty())
    786             setToolTip(s_strTable.arg(strFullData));
    787         /* Update indicator state: */
    788         setState(enmEngine);
    789     }
    790800
    791801    /** Holds the auto-update timer instance. */
     
    822832    }
    823833
    824 private slots:
    825 
    826     /** Handles state change. */
    827     void setState(int iState)
    828     {
    829         if ((iState & UIMouseStateType_MouseAbsoluteDisabled) &&
    830             (iState & UIMouseStateType_MouseAbsolute) &&
    831             !(iState & UIMouseStateType_MouseCaptured))
    832         {
    833             QIStateStatusBarIndicator::setState(4);
    834         }
    835         else
    836         {
    837             QIStateStatusBarIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured));
    838         }
    839     }
    840 
    841 private:
     834protected:
    842835
    843836    /** Update routine. */
    844     void updateAppearance()
     837    virtual void updateAppearance() RT_OVERRIDE
    845838    {
    846839        const QString strToolTip = QApplication::translate("UIIndicatorsPool",
     
    871864        setToolTip(strToolTip.arg(strFullData));
    872865    }
     866
     867private slots:
     868
     869    /** Handles state change. */
     870    void setState(int iState)
     871    {
     872        if ((iState & UIMouseStateType_MouseAbsoluteDisabled) &&
     873            (iState & UIMouseStateType_MouseAbsolute) &&
     874            !(iState & UIMouseStateType_MouseCaptured))
     875        {
     876            QIStateStatusBarIndicator::setState(4);
     877        }
     878        else
     879        {
     880            QIStateStatusBarIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured));
     881        }
     882    }
    873883};
    874884
     
    901911    }
    902912
    903 private:
     913protected:
    904914
    905915    /** Update routine. */
    906     void updateAppearance()
     916    virtual void updateAppearance() RT_OVERRIDE
    907917    {
    908918        const QString strToolTip = QApplication::translate("UIIndicatorsPool",
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette