Changeset 108613 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 19, 2025 4:15:54 PM (5 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168025
- 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 65 65 * @param fForward Brings whether animation goes to iValue or from it. */ 66 66 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;75 67 }; 76 68 … … 103 95 /** Returns animation state. */ 104 96 State state() const { return m_enmState; } 105 106 /** Fetches animation limits. */107 void fetchAnimationLimits();108 97 109 98 private slots: … … 145 134 QState *m_pStateMana; 146 135 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 169 136 /** Holds the animation state. */ 170 137 State m_enmState; … … 178 145 UIToolItemAnimation::UIToolItemAnimation(QObject *pTarget, const QByteArray &propertyName, QObject *pParent, bool fForward) 179 146 : QPropertyAnimation(pTarget, propertyName, pParent) 180 , m_fForward(fForward)181 147 { 182 148 setEasingCurve(QEasingCurve(QEasingCurve::OutQuart)); 149 setStartValue(fForward ? 0 : 100); 150 setEndValue(fForward ? 100 : 0); 183 151 setDuration(200); 184 }185 186 void UIToolItemAnimation::setValue(int iValue)187 {188 setStartValue(m_fForward ? 0 : iValue);189 setEndValue(m_fForward ? iValue : 0);190 152 } 191 153 … … 202 164 , m_pStateMach(0) 203 165 , 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)214 166 , m_enmState(State_Home) 215 167 { … … 297 249 prepareStateManagers(); 298 250 } 299 300 /* Fetch animation limits: */301 fetchAnimationLimits();302 251 } 303 252 … … 307 256 if (m_pStateHome) 308 257 { 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); 312 260 313 261 /* Add Home=>Machines state transition: */ … … 315 263 if (pHomeToMachines) 316 264 { 317 /* Create animation for animat edShiftMachines: */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); 320 268 } 321 269 … … 324 272 if (pHomeToManagers) 325 273 { 326 /* Create animation for animat edShiftManagers: */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); 329 277 } 330 278 } … … 336 284 if (m_pStateMach) 337 285 { 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); 341 288 342 289 /* Add Machines=>Home state transition: */ … … 344 291 if (pMachinesToHome) 345 292 { 346 /* Create animation for animat edShiftMachines: */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); 349 296 } 350 297 … … 353 300 if (pMachinesToManagers) 354 301 { 355 /* Create animation for animat edShiftMachines: */356 m_pAnmMachMana1 = new UIToolItemAnimation(m_pParent, "animatedShiftMachines", this, false);357 pMachinesToManagers->addAnimation( m_pAnmMachMana1);358 359 /* Create animation for animat edShiftManagers: */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); 362 309 } 363 310 } … … 369 316 if (m_pStateMana) 370 317 { 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); 374 320 375 321 /* Add Managers=>Home state transition: */ … … 377 323 if (pManagersToHome) 378 324 { 379 /* Create animation for animat edShiftManagers: */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); 382 328 } 383 329 … … 386 332 if (pManagersToMachines) 387 333 { 388 /* Create animation for animat edShiftMachines: */389 m_pAnmManaMach1 = new UIToolItemAnimation(m_pParent, "animatedShiftMachines", this, true);390 pManagersToMachines->addAnimation( m_pAnmManaMach1);391 392 /* Create animation for animat edShiftManagers: */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); 395 341 } 396 342 } … … 406 352 connect(m_pStateMach, &QState::propertiesAssigned, this, &UIToolsAnimationEngine::sltHandleAnimationFinished); 407 353 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);425 354 } 426 355 … … 537 466 /* Update linked values: */ 538 467 recalculateOverallShifts(enmClass); 539 if (m_pAnimationEngine)540 m_pAnimationEngine->fetchAnimationLimits();541 468 updateLayout(); 542 469 sltItemMinimumWidthHintChanged(); … … 715 642 switch (pItem->itemType()) 716 643 { 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; 720 658 } 721 659 } … … 1148 1086 } 1149 1087 1150 void UIToolsModel::setAnimat edShiftMachines(int iAnimatedValue)1088 void UIToolsModel::setAnimationProgressMachines(int iAnimatedValue) 1151 1089 { 1152 1090 m_iAnimatedShiftMachines = iAnimatedValue; … … 1154 1092 } 1155 1093 1156 void UIToolsModel::setAnimat edShiftManagers(int iAnimatedValue)1094 void UIToolsModel::setAnimationProgressManagers(int iAnimatedValue) 1157 1095 { 1158 1096 m_iAnimatedShiftManagers = iAnimatedValue; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r108608 r108613 53 53 { 54 54 Q_OBJECT; 55 Q_PROPERTY(int animat edShiftMachines READ animatedShiftMachines WRITE setAnimatedShiftMachines);56 Q_PROPERTY(int animat edShiftManagers READ animatedShiftManagers WRITE setAnimatedShiftManagers);55 Q_PROPERTY(int animationProgressMachines READ animationProgressMachines WRITE setAnimationProgressMachines); 56 Q_PROPERTY(int animationProgressManagers READ animationProgressManagers WRITE setAnimationProgressManagers); 57 57 58 58 signals: … … 171 171 /** Updates layout. */ 172 172 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; }178 173 /** @} */ 179 174 … … 237 232 /** @name Animation stuff. 238 233 * @{ */ 234 /** Returns Machines overall shift. */ 235 int overallShiftMachines() const { return m_iOverallShiftMachines; } 236 /** Returns Managers overall shift. */ 237 int overallShiftManagers() const { return m_iOverallShiftManagers; } 239 238 /** Recalculates overall shifts. 240 239 * @param enmClass Brings tool-class for which shift should be recalculated. */ 241 240 void recalculateOverallShifts(UIToolClass enmClass = UIToolClass_Invalid); 242 241 243 /** Returns the Machines animated shift. */244 int animat edShiftMachines() const { return m_iAnimatedShiftMachines; }245 /** Returns the Managers animated shift. */246 int animat edShiftManagers() const { return m_iAnimatedShiftManagers; }247 /** Defines the Machines animated @a iShift. */248 void setAnimat edShiftMachines(int iShift);249 /** Defines the Managers animated @a iShift. */250 void setAnimat edShiftManagers(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); 251 250 /** @} */ 252 251
Note:
See TracChangeset
for help on using the changeset viewer.