VirtualBox

Changeset 98489 in vbox


Ignore:
Timestamp:
Feb 7, 2023 11:45:36 AM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking UIIndicatorsPool recording indicator to move COM related logic to UISession; Including small build fix for r155754.

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

Legend:

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

    r98488 r98489  
    14201420    }
    14211421}
     1422
     1423void UIDetailsGenerator::acquireRecordingStatusInfo(CMachine &comMachine, QString &strInfo,
     1424                                                    bool &fRecordingEnabled)
     1425{
     1426    /* Get recording settings: */
     1427    CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
     1428    fRecordingEnabled = comRecordingSettings.GetEnabled();
     1429    if (fRecordingEnabled)
     1430    {
     1431        /* For now all screens have the same config: */
     1432        CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
     1433        const bool fVideoEnabled = comRecordingScreen0Settings.IsFeatureEnabled(KRecordingFeature_Video);
     1434        const bool fAudioEnabled = comRecordingScreen0Settings.IsFeatureEnabled(KRecordingFeature_Audio);
     1435
     1436        /* Compose tool-tip: */
     1437        QString strToolTip;
     1438        if (fVideoEnabled && fAudioEnabled)
     1439            strToolTip = QApplication::translate("UIIndicatorsPool", "Video/audio recording file", "Recording tooltip");
     1440        else if (fAudioEnabled)
     1441            strToolTip = QApplication::translate("UIIndicatorsPool", "Audio recording file", "Recording tooltip");
     1442        else if (fVideoEnabled)
     1443            strToolTip = QApplication::translate("UIIndicatorsPool", "Video recording file", "Recording tooltip");
     1444        strInfo += e_strTableRow2
     1445            .arg(strToolTip)
     1446            .arg(comRecordingScreen0Settings.GetFilename());
     1447    }
     1448    /* Handle 'no-recording' case: */
     1449    else
     1450    {
     1451        strInfo += e_strTableRow1
     1452            .arg(QApplication::translate("UIIndicatorsPool", "Recording disabled", "Recording tooltip"));
     1453    }
     1454}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h

    r98488 r98489  
    108108                                                       bool &fAcceleration3D);
    109109
     110    SHARED_LIBRARY_STUFF void acquireRecordingStatusInfo(CMachine &comMachine, QString &strInfo,
     111                                                         bool &fRecordingEnabled);
     112
    110113    /** Holds the table row format 1. */
    111114    extern const QString e_strTableRow1;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r98488 r98489  
    3030#include <QHBoxLayout>
    3131#include <QPainter>
     32#include <QStyle>
    3233#include <QTimer>
    3334
     
    4647
    4748/* COM includes: */
    48 #include "CRecordingSettings.h"
    49 #include "CRecordingScreenSettings.h"
    5049#include "CMachine.h"
    5150#include "CMachineDebugger.h"
     
    567566    };
    568567
    569     /** Recording modes. */
    570     enum UIIndicatorStateRecordingMode
    571     {
    572         UIIndicatorStateRecordingMode_None  = RT_BIT(0),
    573         UIIndicatorStateRecordingMode_Video = RT_BIT(1),
    574         UIIndicatorStateRecordingMode_Audio = RT_BIT(2)
    575     };
    576 
    577 public:
    578 
    579     /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     568public:
     569
     570    /** Constructs indicator passing @a pMachine to the base-class. */
    580571    UIIndicatorRecording(UIMachine *pMachine, UISession *pSession)
    581572        : UISessionStateStatusBarIndicator(IndicatorType_Recording, pMachine, pSession)
    582573        , m_pAnimation(0)
    583574        , m_dRotationAngle(0)
    584         , m_enmRecordingMode(UIIndicatorStateRecordingMode_None)
    585575    {
    586576        /* Assign state-icons: */
     
    648638    void updateAppearance()
    649639    {
    650         /* Get machine: */
    651         const CMachine comMachine = m_pSession->machine();
    652         const bool fMachinePaused = m_pSession->isPaused();
    653 
    654         /* Update indicator state early: */
    655         CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
    656         Assert(comRecordingSettings.isOk());
    657         if (!comRecordingSettings.GetEnabled())
     640        QString strFullData;
     641        bool fRecordingEnabled = false;
     642        bool fMachinePaused = false;
     643        m_pMachine->acquireRecordingStatusInfo(strFullData, fRecordingEnabled, fMachinePaused);
     644
     645        /* Update tool-tip: */
     646        setToolTip(s_strTable.arg(strFullData));
     647        /* Set initial indicator state: */
     648        if (!fRecordingEnabled)
    658649            setState(UIIndicatorStateRecording_Disabled);
    659650        else if (!fMachinePaused)
     
    661652        else
    662653            setState(UIIndicatorStateRecording_Paused);
    663 
    664         updateRecordingMode();
    665 
    666         /* Prepare tool-tip: */
    667         QString strFullData;
    668         switch (state())
    669         {
    670             case UIIndicatorStateRecording_Disabled:
    671             {
    672                 strFullData += s_strTableRow1
    673                     .arg(QApplication::translate("UIIndicatorsPool", "Recording disabled", "Recording tooltip"));
    674                 break;
    675             }
    676             case UIIndicatorStateRecording_Enabled:
    677             case UIIndicatorStateRecording_Paused:
    678             {
    679                 QString strToolTip;
    680                 if (   m_enmRecordingMode & UIIndicatorStateRecordingMode_Audio
    681                     && m_enmRecordingMode & UIIndicatorStateRecordingMode_Video)
    682                     strToolTip = QApplication::translate("UIIndicatorsPool", "Video/audio recording file", "Recording tooltip");
    683                 else if (m_enmRecordingMode & UIIndicatorStateRecordingMode_Audio)
    684                     strToolTip = QApplication::translate("UIIndicatorsPool", "Audio recording file", "Recording tooltip");
    685                 else if (m_enmRecordingMode & UIIndicatorStateRecordingMode_Video)
    686                     strToolTip = QApplication::translate("UIIndicatorsPool", "Video recording file", "Recording tooltip");
    687 
    688                 /* For now all screens have the same config: */
    689                 CRecordingScreenSettings comRecordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
    690                 Assert(comRecordingScreen0Settings.isOk());
    691 
    692                 strFullData += s_strTableRow2
    693                     .arg(strToolTip)
    694                     .arg(comRecordingScreen0Settings.GetFilename());
    695                 break;
    696             }
    697             default:
    698                 break;
    699         }
    700 
    701         /* Update tool-tip: */
    702         setToolTip(s_strTable.arg(strFullData));
    703654    }
    704655
     
    712663    void setRotationAngle(double dRotationAngle) { m_dRotationAngle = dRotationAngle; update(); }
    713664
    714     /* Parses RecordScreenSettings::Options and updates m_enmRecordingMode accordingly. */
    715     void updateRecordingMode()
    716     {
    717         m_enmRecordingMode = UIIndicatorStateRecordingMode_None;
    718 
    719         /* Get machine: */
    720         if (!m_pSession)
    721             return;
    722         const CMachine comMachine = m_pSession->machine();
    723         if (comMachine.isNull())
    724             return;
    725 
    726         CRecordingSettings comRecordingSettings = comMachine.GetRecordingSettings();
    727         /* For now all screens have the same config: */
    728         CRecordingScreenSettings recordingScreen0Settings = comRecordingSettings.GetScreenSettings(0);
    729         if (recordingScreen0Settings.IsFeatureEnabled(KRecordingFeature_Video))
    730             m_enmRecordingMode = (UIIndicatorStateRecordingMode)((int)m_enmRecordingMode | (int)UIIndicatorStateRecordingMode_Video);
    731 
    732         if (recordingScreen0Settings.IsFeatureEnabled(KRecordingFeature_Audio))
    733             m_enmRecordingMode = (UIIndicatorStateRecordingMode)((int)m_enmRecordingMode | (int)UIIndicatorStateRecordingMode_Audio);
    734     }
    735 
    736665    /** Holds the rotation animation instance. */
    737666    UIAnimationLoop *m_pAnimation;
    738667    /** Holds current rotation angle. */
    739     double m_dRotationAngle;
    740 
    741     /** Holds the recording mode. */
    742     UIIndicatorStateRecordingMode m_enmRecordingMode;
     668    double  m_dRotationAngle;
    743669};
    744670
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98488 r98489  
    486486{
    487487    uisession()->acquireDisplayStatusInfo(strInfo, fAcceleration3D);
     488}
     489
     490void UIMachine::acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused)
     491{
     492    uisession()->acquireRecordingStatusInfo(strInfo, fRecordingEnabled, fMachinePaused);
    488493}
    489494
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98488 r98489  
    395395        /** Acquires status info for Display indicator. */
    396396        void acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D);
     397        /** Acquires status info for Recording indicator. */
     398        void acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused);
    397399    /** @} */
    398400
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98488 r98489  
    365365    CMachine comMachine = machine();
    366366    UIDetailsGenerator::acquireDisplayStatusInfo(comMachine, strInfo, fAcceleration3D);
     367}
     368
     369void UISession::acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused)
     370{
     371    CMachine comMachine = machine();
     372    fMachinePaused = isPaused();
     373    UIDetailsGenerator::acquireRecordingStatusInfo(comMachine, strInfo, fRecordingEnabled);
    367374}
    368375
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98488 r98489  
    281281        /** Acquires status info for Display indicator. */
    282282        void acquireDisplayStatusInfo(QString &strInfo, bool &fAcceleration3D);
     283        /** Acquires status info for Recording indicator. */
     284        void acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused);
    283285    /** @} */
    284286
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