Changeset View
Changeset View
Standalone View
Standalone View
kstyle/animations/breezetransitiondata.h
Show All 24 Lines | |||||
25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
27 | // IN THE SOFTWARE. | 27 | // IN THE SOFTWARE. | ||
28 | ////////////////////////////////////////////////////////////////////////////// | 28 | ////////////////////////////////////////////////////////////////////////////// | ||
29 | 29 | | |||
30 | #include "breezetransitionwidget.h" | 30 | #include "breezetransitionwidget.h" | ||
31 | 31 | | |||
32 | #include <QObject> | 32 | #include <QObject> | ||
33 | #include <QTime> | 33 | #include <QElapsedTimer> | ||
34 | #include <QWidget> | 34 | #include <QWidget> | ||
35 | 35 | | |||
36 | namespace Breeze | 36 | namespace Breeze | ||
37 | { | 37 | { | ||
38 | 38 | | |||
39 | //* generic data | 39 | //* generic data | ||
40 | class TransitionData: public QObject | 40 | class TransitionData: public QObject | ||
41 | { | 41 | { | ||
Show All 29 Lines | |||||
71 | 71 | | |||
72 | //* max renderTime | 72 | //* max renderTime | ||
73 | const int& maxRenderTime() const | 73 | const int& maxRenderTime() const | ||
74 | { return _maxRenderTime; } | 74 | { return _maxRenderTime; } | ||
75 | 75 | | |||
76 | //* start clock | 76 | //* start clock | ||
77 | void startClock() | 77 | void startClock() | ||
78 | { | 78 | { | ||
79 | if( _clock.isNull() ) _clock.start(); | 79 | if( !_clock.isValid() ) _clock.start(); | ||
80 | else _clock.restart(); | 80 | else _clock.restart(); | ||
81 | } | 81 | } | ||
82 | 82 | | |||
83 | //* check if rendering is two slow | 83 | //* check if rendering is two slow | ||
84 | bool slow() const | 84 | bool slow() const | ||
85 | { return !( _clock.isNull() || _clock.elapsed() <= maxRenderTime() ); } | 85 | { return !( !_clock.isValid() || _clock.elapsed() <= maxRenderTime() ); } | ||
86 | 86 | | |||
87 | protected Q_SLOTS: | 87 | protected Q_SLOTS: | ||
88 | 88 | | |||
89 | //* initialize animation | 89 | //* initialize animation | ||
90 | virtual bool initializeAnimation() = 0; | 90 | virtual bool initializeAnimation() = 0; | ||
91 | 91 | | |||
92 | //* animate | 92 | //* animate | ||
93 | virtual bool animate() = 0; | 93 | virtual bool animate() = 0; | ||
Show All 19 Lines | |||||
113 | 113 | | |||
114 | //* enability | 114 | //* enability | ||
115 | bool _enabled = true; | 115 | bool _enabled = true; | ||
116 | 116 | | |||
117 | //* used to avoid recursion when grabbing widgets | 117 | //* used to avoid recursion when grabbing widgets | ||
118 | bool _recursiveCheck = false; | 118 | bool _recursiveCheck = false; | ||
119 | 119 | | |||
120 | //* timer used to detect slow rendering | 120 | //* timer used to detect slow rendering | ||
121 | QTime _clock; | 121 | QElapsedTimer _clock; | ||
122 | 122 | | |||
123 | //* max render time | 123 | //* max render time | ||
124 | /*! used to detect slow rendering */ | 124 | /*! used to detect slow rendering */ | ||
125 | int _maxRenderTime = 200; | 125 | int _maxRenderTime = 200; | ||
126 | 126 | | |||
127 | //* animation handling | 127 | //* animation handling | ||
128 | TransitionWidget::Pointer _transition; | 128 | TransitionWidget::Pointer _transition; | ||
129 | 129 | | |||
Show All 15 Lines |