VirtualBox

Changeset 98978 in vbox for trunk


Ignore:
Timestamp:
Mar 15, 2023 10:37:32 AM (21 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking recording indicator of UIIndicatorsPool; Renaming state enum to local indicator rules; New state for the case when no recording is available.

File:
1 edited

Legend:

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

    r98977 r98978  
    587587
    588588    /** Recording states. */
    589     enum UIIndicatorStateRecording
    590     {
    591         UIIndicatorStateRecording_Disabled = 0,
    592         UIIndicatorStateRecording_Enabled  = 1,
    593         UIIndicatorStateRecording_Paused   = 2
     589    enum RecordingState
     590    {
     591        RecordingState_Unavailable = 0,
     592        RecordingState_Disabled    = 1,
     593        RecordingState_Enabled     = 2,
     594        RecordingState_Paused      = 3
    594595    };
    595596
     
    603604    {
    604605        /* Assign state-icons: */
    605         setStateIcon(UIIndicatorStateRecording_Disabled, UIIconPool::iconSet(":/video_capture_16px.png"));
    606         setStateIcon(UIIndicatorStateRecording_Enabled,  UIIconPool::iconSet(":/movie_reel_16px.png"));
    607         setStateIcon(UIIndicatorStateRecording_Paused,   UIIconPool::iconSet(":/movie_reel_16px.png"));
     606        setStateIcon(RecordingState_Unavailable, UIIconPool::iconSet(":/video_capture_disabled_16px.png"));
     607        setStateIcon(RecordingState_Disabled,    UIIconPool::iconSet(":/video_capture_16px.png"));
     608        setStateIcon(RecordingState_Enabled,     UIIconPool::iconSet(":/movie_reel_16px.png"));
     609        setStateIcon(RecordingState_Paused,      UIIconPool::iconSet(":/movie_reel_16px.png"));
     610        /* Configure connection: */
     611        connect(pMachine, &UIMachine::sigInitialized,
     612                this, &UIIndicatorRecording::updateAppearance);
    608613        /* Create *enabled* state animation: */
    609614        m_pAnimation = UIAnimationLoop::installAnimationLoop(this, "rotationAngle",
    610                                                                    "rotationAngleStart", "rotationAngleFinal",
    611                                                                    1000);
     615                                                             "rotationAngleStart", "rotationAngleFinal",
     616                                                             1000);
    612617        /* Translate finally: */
    613618        retranslateUi();
     
    625630        QPainter painter(this);
    626631        /* Configure painter for *enabled* state: */
    627         if (state() == UIIndicatorStateRecording_Enabled)
     632        if (state() == RecordingState_Enabled)
    628633        {
    629634            /* Configure painter for smooth animation: */
     
    655660            setToolTip(s_strTable.arg(strFullData));
    656661        /* Set initial indicator state: */
    657         if (!fRecordingEnabled)
    658             setState(UIIndicatorStateRecording_Disabled);
    659         else if (!fMachinePaused)
    660             setState(UIIndicatorStateRecording_Enabled);
    661         else
    662             setState(UIIndicatorStateRecording_Paused);
     662        RecordingState enmState = RecordingState_Unavailable;
     663        if (m_pMachine->isSessionValid())
     664        {
     665            if (!fRecordingEnabled)
     666                enmState = RecordingState_Disabled;
     667            else if (!fMachinePaused)
     668                enmState = RecordingState_Enabled;
     669            else
     670                enmState = RecordingState_Paused;
     671        }
     672        setState(enmState);
    663673    }
    664674
     
    671681        switch (iState)
    672682        {
    673             case UIIndicatorStateRecording_Disabled:
     683            case RecordingState_Disabled:
    674684                m_pAnimation->stop();
    675685                m_dRotationAngle = 0;
    676686                break;
    677             case UIIndicatorStateRecording_Enabled:
     687            case RecordingState_Enabled:
    678688                m_pAnimation->start();
    679689                break;
    680             case UIIndicatorStateRecording_Paused:
     690            case RecordingState_Paused:
    681691                m_pAnimation->stop();
    682692                break;
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