VirtualBox

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


Ignore:
Timestamp:
Mar 19, 2025 4:15:54 PM (5 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168025
Message:

FE/Qt: bugref:10814: VBox Manager / Tool-pane: Stop caching/updating actual animation values; Use 0 to 100 and 100 to 0 animations instead which animates progress percentage.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r108612 r108613  
    6565      * @param  fForward      Brings whether animation goes to iValue or from it. */
    6666    UIToolItemAnimation(QObject *pTarget, const QByteArray &propertyName, QObject *pParent, bool fForward);
    67 
    68     /** Defines the animation value. */
    69     void setValue(int iValue);
    70 
    71 private:
    72 
    73     /** Holds whether animation goes to value or from it. */
    74     bool  m_fForward;
    7567};
    7668
     
    10395    /** Returns animation state. */
    10496    State state() const { return m_enmState; }
    105 
    106     /** Fetches animation limits. */
    107     void fetchAnimationLimits();
    10897
    10998private slots:
     
    145134    QState *m_pStateMana;
    146135
    147     /** Holds the instance of animation from Home to Machines. */
    148     UIToolItemAnimation *m_pAnmHomeMach;
    149     /** Holds the instance of animation from Home to Managers. */
    150     UIToolItemAnimation *m_pAnmHomeMana;
    151     /** Holds the instance of animation from Machines to Home. */
    152     UIToolItemAnimation *m_pAnmMachHome;
    153     /** Holds the instance of 1st animation from Machines to Managers. */
    154     UIToolItemAnimation *m_pAnmMachMana1;
    155     /** Holds the instance of 2nd animation from Machines to Managers. */
    156     UIToolItemAnimation *m_pAnmMachMana2;
    157     /** Holds the instance of animation from Managers to Home. */
    158     UIToolItemAnimation *m_pAnmManaHome;
    159     /** Holds the instance of 1st animation from Managers to Machines. */
    160     UIToolItemAnimation *m_pAnmManaMach1;
    161     /** Holds the instance of 2nd animation from Managers to Machines. */
    162     UIToolItemAnimation *m_pAnmManaMach2;
    163 
    164     /** Holds the vertical Machines tool hint. */
    165     int  m_iVerticalHintMach;
    166     /** Holds the vertical Managers tool hint. */
    167     int  m_iVerticalHintMana;
    168 
    169136    /** Holds the animation state. */
    170137    State  m_enmState;
     
    178145UIToolItemAnimation::UIToolItemAnimation(QObject *pTarget, const QByteArray &propertyName, QObject *pParent, bool fForward)
    179146    : QPropertyAnimation(pTarget, propertyName, pParent)
    180     , m_fForward(fForward)
    181147{
    182148    setEasingCurve(QEasingCurve(QEasingCurve::OutQuart));
     149    setStartValue(fForward ? 0 : 100);
     150    setEndValue(fForward ? 100 : 0);
    183151    setDuration(200);
    184 }
    185 
    186 void UIToolItemAnimation::setValue(int iValue)
    187 {
    188     setStartValue(m_fForward ? 0 : iValue);
    189     setEndValue(m_fForward ? iValue : 0);
    190152}
    191153
     
    202164    , m_pStateMach(0)
    203165    , m_pStateMana(0)
    204     , m_pAnmHomeMach(0)
    205     , m_pAnmHomeMana(0)
    206     , m_pAnmMachHome(0)
    207     , m_pAnmMachMana1(0)
    208     , m_pAnmMachMana2(0)
    209     , m_pAnmManaHome(0)
    210     , m_pAnmManaMach1(0)
    211     , m_pAnmManaMach2(0)
    212     , m_iVerticalHintMach(0)
    213     , m_iVerticalHintMana(0)
    214166    , m_enmState(State_Home)
    215167{
     
    297249        prepareStateManagers();
    298250    }
    299 
    300     /* Fetch animation limits: */
    301     fetchAnimationLimits();
    302251}
    303252
     
    307256    if (m_pStateHome)
    308257    {
    309         /* When we entering Home state => we assigning animatedShiftMachines to 0 and animatedShiftManagers to 0: */
    310         m_pStateHome->assignProperty(m_pParent, "animatedShiftMachines", 0);
    311         m_pStateHome->assignProperty(m_pParent, "animatedShiftManagers", 0);
     258        m_pStateHome->assignProperty(m_pParent, "animationProgressMachines", 0);
     259        m_pStateHome->assignProperty(m_pParent, "animationProgressManagers", 0);
    312260
    313261        /* Add Home=>Machines state transition: */
     
    315263        if (pHomeToMachines)
    316264        {
    317             /* Create animation for animatedShiftMachines: */
    318             m_pAnmHomeMach = new UIToolItemAnimation(m_pParent, "animatedShiftMachines", this, true);
    319             pHomeToMachines->addAnimation(m_pAnmHomeMach);
     265            /* Create animation for animationProgressMachines: */
     266            UIToolItemAnimation *pAnmHomeMach = new UIToolItemAnimation(m_pParent, "animationProgressMachines", this, true);
     267            pHomeToMachines->addAnimation(pAnmHomeMach);
    320268        }
    321269
     
    324272        if (pHomeToManagers)
    325273        {
    326             /* Create animation for animatedShiftManagers: */
    327             m_pAnmHomeMana = new UIToolItemAnimation(m_pParent, "animatedShiftManagers", this, true);
    328             pHomeToManagers->addAnimation(m_pAnmHomeMana);
     274            /* Create animation for animationProgressManagers: */
     275            UIToolItemAnimation *pAnmHomeMana = new UIToolItemAnimation(m_pParent, "animationProgressManagers", this, true);
     276            pHomeToManagers->addAnimation(pAnmHomeMana);
    329277        }
    330278    }
     
    336284    if (m_pStateMach)
    337285    {
    338         /* When we entering Machines state => we assigning animatedShiftMachines to m_iVerticalHintMach and animatedShiftManagers to 0: */
    339         m_pStateMach->assignProperty(m_pParent, "animatedShiftMachines", m_iVerticalHintMach);
    340         m_pStateMach->assignProperty(m_pParent, "animatedShiftManagers", 0);
     286        m_pStateMach->assignProperty(m_pParent, "animationProgressMachines", 100);
     287        m_pStateMach->assignProperty(m_pParent, "animationProgressManagers", 0);
    341288
    342289        /* Add Machines=>Home state transition: */
     
    344291        if (pMachinesToHome)
    345292        {
    346             /* Create animation for animatedShiftMachines: */
    347             m_pAnmMachHome = new UIToolItemAnimation(m_pParent, "animatedShiftMachines", this, false);
    348             pMachinesToHome->addAnimation(m_pAnmMachHome);
     293            /* Create animation for animationProgressMachines: */
     294            UIToolItemAnimation *pAnmMachHome = new UIToolItemAnimation(m_pParent, "animationProgressMachines", this, false);
     295            pMachinesToHome->addAnimation(pAnmMachHome);
    349296        }
    350297
     
    353300        if (pMachinesToManagers)
    354301        {
    355             /* Create animation for animatedShiftMachines: */
    356             m_pAnmMachMana1 = new UIToolItemAnimation(m_pParent, "animatedShiftMachines", this, false);
    357             pMachinesToManagers->addAnimation(m_pAnmMachMana1);
    358 
    359             /* Create animation for animatedShiftManagers: */
    360             m_pAnmMachMana2 = new UIToolItemAnimation(m_pParent, "animatedShiftManagers", this, true);
    361             pMachinesToManagers->addAnimation(m_pAnmMachMana2);
     302            /* Create animation for animationProgressMachines: */
     303            UIToolItemAnimation *pAnmMachMana1 = new UIToolItemAnimation(m_pParent, "animationProgressMachines", this, false);
     304            pMachinesToManagers->addAnimation(pAnmMachMana1);
     305
     306            /* Create animation for animationProgressManagers: */
     307            UIToolItemAnimation *pAnmMachMana2 = new UIToolItemAnimation(m_pParent, "animationProgressManagers", this, true);
     308            pMachinesToManagers->addAnimation(pAnmMachMana2);
    362309        }
    363310    }
     
    369316    if (m_pStateMana)
    370317    {
    371         /* When we entering Managers state => we assigning animatedShiftMachines to 0 and animatedShiftManagers to m_iVerticalHintMana: */
    372         m_pStateMana->assignProperty(m_pParent, "animatedShiftMachines", 0);
    373         m_pStateMana->assignProperty(m_pParent, "animatedShiftManagers", m_iVerticalHintMana);
     318        m_pStateMana->assignProperty(m_pParent, "animationProgressMachines", 0);
     319        m_pStateMana->assignProperty(m_pParent, "animationProgressManagers", 100);
    374320
    375321        /* Add Managers=>Home state transition: */
     
    377323        if (pManagersToHome)
    378324        {
    379             /* Create animation for animatedShiftManagers: */
    380             m_pAnmManaHome = new UIToolItemAnimation(m_pParent, "animatedShiftManagers", this, false);
    381             pManagersToHome->addAnimation(m_pAnmManaHome);
     325            /* Create animation for animationProgressManagers: */
     326            UIToolItemAnimation *pAnmManaHome = new UIToolItemAnimation(m_pParent, "animationProgressManagers", this, false);
     327            pManagersToHome->addAnimation(pAnmManaHome);
    382328        }
    383329
     
    386332        if (pManagersToMachines)
    387333        {
    388             /* Create animation for animatedShiftMachines: */
    389             m_pAnmManaMach1 = new UIToolItemAnimation(m_pParent, "animatedShiftMachines", this, true);
    390             pManagersToMachines->addAnimation(m_pAnmManaMach1);
    391 
    392             /* Create animation for animatedShiftManagers: */
    393             m_pAnmManaMach2 = new UIToolItemAnimation(m_pParent, "animatedShiftManagers", this, false);
    394             pManagersToMachines->addAnimation(m_pAnmManaMach2);
     334            /* Create animation for animationProgressMachines: */
     335            UIToolItemAnimation *pAnmManaMach1 = new UIToolItemAnimation(m_pParent, "animationProgressMachines", this, true);
     336            pManagersToMachines->addAnimation(pAnmManaMach1);
     337
     338            /* Create animation for animationProgressManagers: */
     339            UIToolItemAnimation *pAnmManaMach2 = new UIToolItemAnimation(m_pParent, "animationProgressManagers", this, false);
     340            pManagersToMachines->addAnimation(pAnmManaMach2);
    395341        }
    396342    }
     
    406352    connect(m_pStateMach, &QState::propertiesAssigned, this, &UIToolsAnimationEngine::sltHandleAnimationFinished);
    407353    connect(m_pStateMana, &QState::propertiesAssigned, this, &UIToolsAnimationEngine::sltHandleAnimationFinished);
    408 }
    409 
    410 void UIToolsAnimationEngine::fetchAnimationLimits()
    411 {
    412     /* Acquire limits from parent class: */
    413     const int iVerticalHintMach = m_pParent->overallShiftMachines();
    414     const int iVerticalHintMana = m_pParent->overallShiftManagers();
    415 
    416     /* Update animation values: */
    417     m_pAnmHomeMach->setValue(iVerticalHintMach);
    418     m_pAnmHomeMana->setValue(iVerticalHintMana);
    419     m_pAnmMachHome->setValue(iVerticalHintMach);
    420     m_pAnmMachMana1->setValue(iVerticalHintMach);
    421     m_pAnmMachMana2->setValue(iVerticalHintMana);
    422     m_pAnmManaHome->setValue(iVerticalHintMana);
    423     m_pAnmManaMach1->setValue(iVerticalHintMach);
    424     m_pAnmManaMach2->setValue(iVerticalHintMana);
    425354}
    426355
     
    537466        /* Update linked values: */
    538467        recalculateOverallShifts(enmClass);
    539         if (m_pAnimationEngine)
    540             m_pAnimationEngine->fetchAnimationLimits();
    541468        updateLayout();
    542469        sltItemMinimumWidthHintChanged();
     
    715642            switch (pItem->itemType())
    716643            {
    717                 case UIToolType_Machines: iVerticalIndent += animatedShiftMachines(); break;
    718                 case UIToolType_Managers: iVerticalIndent += animatedShiftManagers(); break;
    719                 default: break;
     644                case UIToolType_Machines:
     645                {
     646                    const double fRatio = (double)animationProgressMachines() / 100;
     647                    iVerticalIndent += fRatio * overallShiftMachines();
     648                    break;
     649                }
     650                case UIToolType_Managers:
     651                {
     652                    const double fRatio = (double)animationProgressManagers() / 100;
     653                    iVerticalIndent += fRatio * overallShiftManagers();
     654                    break;
     655                }
     656                default:
     657                    break;
    720658            }
    721659        }
     
    11481086}
    11491087
    1150 void UIToolsModel::setAnimatedShiftMachines(int iAnimatedValue)
     1088void UIToolsModel::setAnimationProgressMachines(int iAnimatedValue)
    11511089{
    11521090    m_iAnimatedShiftMachines = iAnimatedValue;
     
    11541092}
    11551093
    1156 void UIToolsModel::setAnimatedShiftManagers(int iAnimatedValue)
     1094void UIToolsModel::setAnimationProgressManagers(int iAnimatedValue)
    11571095{
    11581096    m_iAnimatedShiftManagers = iAnimatedValue;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h

    r108608 r108613  
    5353{
    5454    Q_OBJECT;
    55     Q_PROPERTY(int animatedShiftMachines READ animatedShiftMachines WRITE setAnimatedShiftMachines);
    56     Q_PROPERTY(int animatedShiftManagers READ animatedShiftManagers WRITE setAnimatedShiftManagers);
     55    Q_PROPERTY(int animationProgressMachines READ animationProgressMachines WRITE setAnimationProgressMachines);
     56    Q_PROPERTY(int animationProgressManagers READ animationProgressManagers WRITE setAnimationProgressManagers);
    5757
    5858signals:
     
    171171        /** Updates layout. */
    172172        void updateLayout();
    173 
    174         /** Returns the Machines overall shift. */
    175         int overallShiftMachines() const { return m_iOverallShiftMachines; }
    176         /** Returns the Managers overall shift. */
    177         int overallShiftManagers() const { return m_iOverallShiftManagers; }
    178173    /** @} */
    179174
     
    237232    /** @name Animation stuff.
    238233     * @{ */
     234        /** Returns Machines overall shift. */
     235        int overallShiftMachines() const { return m_iOverallShiftMachines; }
     236        /** Returns Managers overall shift. */
     237        int overallShiftManagers() const { return m_iOverallShiftManagers; }
    239238        /** Recalculates overall shifts.
    240239          * @param  enmClass  Brings tool-class for which shift should be recalculated. */
    241240        void recalculateOverallShifts(UIToolClass enmClass = UIToolClass_Invalid);
    242241
    243         /** Returns the Machines animated shift. */
    244         int animatedShiftMachines() const { return m_iAnimatedShiftMachines; }
    245         /** Returns the Managers animated shift. */
    246         int animatedShiftManagers() const { return m_iAnimatedShiftManagers; }
    247         /** Defines the Machines animated @a iShift. */
    248         void setAnimatedShiftMachines(int iShift);
    249         /** Defines the Managers animated @a iShift. */
    250         void setAnimatedShiftManagers(int iShift);
     242        /** Returns Machines animation progress. */
     243        int animationProgressMachines() const { return m_iAnimatedShiftMachines; }
     244        /** Returns Managers animation progress. */
     245        int animationProgressManagers() const { return m_iAnimatedShiftManagers; }
     246        /** Defines Machines animation @a iProgress. */
     247        void setAnimationProgressMachines(int iProgress);
     248        /** Defines Managers animation @a iProgress. */
     249        void setAnimationProgressManagers(int iProgress);
    251250    /** @} */
    252251
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