Changeset 46809 in vbox
- Timestamp:
- Jun 26, 2013 5:23:10 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.cpp
r46242 r46809 39 39 fReverse, iAnimationDuration); 40 40 } 41 42 /* static */ 43 UIAnimationLoop* UIAnimationLoop::installAnimationLoop(QWidget *pTarget, const char *pszPropertyName, 44 const char *pszValuePropertyNameStart, const char *pszValuePropertyNameFinal, 45 int iAnimationDuration /*= 300*/) 46 { 47 /* Return newly created animation-loop: */ 48 return new UIAnimationLoop(pTarget, pszPropertyName, 49 pszValuePropertyNameStart, pszValuePropertyNameFinal, 50 iAnimationDuration); 51 } 52 41 53 42 54 UIAnimation::UIAnimation(QWidget *pParent, const char *pszPropertyName, … … 97 109 } 98 110 111 112 UIAnimationLoop::UIAnimationLoop(QWidget *pParent, const char *pszPropertyName, 113 const char *pszValuePropertyNameStart, const char *pszValuePropertyNameFinal, 114 int iAnimationDuration) 115 : QObject(pParent) 116 , m_pszPropertyName(pszPropertyName) 117 , m_pszValuePropertyNameStart(pszValuePropertyNameStart), m_pszValuePropertyNameFinal(pszValuePropertyNameFinal) 118 , m_iAnimationDuration(iAnimationDuration) 119 , m_pAnimation(0) 120 { 121 /* Prepare: */ 122 prepare(); 123 } 124 125 void UIAnimationLoop::prepare() 126 { 127 /* Prepare loop: */ 128 m_pAnimation = new QPropertyAnimation(parent(), m_pszPropertyName, this); 129 m_pAnimation->setDuration(m_iAnimationDuration); 130 m_pAnimation->setLoopCount(-1); 131 132 /* Fetch animation-borders: */ 133 update(); 134 } 135 136 void UIAnimationLoop::update() 137 { 138 /* Update animation: */ 139 m_pAnimation->setStartValue(parent()->property(m_pszValuePropertyNameStart)); 140 m_pAnimation->setEndValue(parent()->property(m_pszValuePropertyNameFinal)); 141 } 142 143 void UIAnimationLoop::start() 144 { 145 /* Start animation: */ 146 m_pAnimation->start(); 147 } 148 149 void UIAnimationLoop::stop() 150 { 151 /* Stop animation: */ 152 m_pAnimation->stop(); 153 } 154 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.h
r46242 r46809 71 71 }; 72 72 73 /* UIAnimationLoop factory: */ 74 class UIAnimationLoop : public QObject 75 { 76 Q_OBJECT; 77 78 public: 79 80 /* API: Factory stuff: */ 81 static UIAnimationLoop* installAnimationLoop(QWidget *pTarget, const char *pszPropertyName, 82 const char *pszValuePropertyNameStart, const char *pszValuePropertyNameFinal, 83 int iAnimationDuration = 300); 84 85 /* API: Update stuff: */ 86 void update(); 87 88 /* API: Loop stuff: */ 89 void start(); 90 void stop(); 91 92 protected: 93 94 /* Constructor: */ 95 UIAnimationLoop(QWidget *pParent, const char *pszPropertyName, 96 const char *pszValuePropertyNameStart, const char *pszValuePropertyNameFinal, 97 int iAnimationDuration); 98 99 private: 100 101 /* Helper: Prepare stuff: */ 102 void prepare(); 103 104 /* Variables: */ 105 const char *m_pszPropertyName; 106 const char *m_pszValuePropertyNameStart; 107 const char *m_pszValuePropertyNameFinal; 108 int m_iAnimationDuration; 109 QPropertyAnimation *m_pAnimation; 110 }; 111 73 112 #endif /* __UIAnimationFramework_h__ */
Note:
See TracChangeset
for help on using the changeset viewer.