Changeset 124 for smplayer/trunk/src/floatingwidget.cpp
- Timestamp:
- Mar 16, 2012, 4:02:47 PM (13 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 121-122
- Property svn:mergeinfo changed
-
smplayer/trunk/src/floatingwidget.cpp
r119 r124 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 1 Ricardo Villalba <rvm@escomposlinux.org>2 Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 22 22 #include <QHBoxLayout> 23 23 24 #ifndef OLD_ANIMATION 25 #include <QPropertyAnimation> 26 #endif 27 24 28 FloatingWidget::FloatingWidget( QWidget * parent ) 25 29 : QWidget( parent, Qt::Window | Qt::FramelessWindowHint | 26 30 Qt::WindowStaysOnTopHint ) 27 31 { 32 #ifndef OLD_ANIMATION 33 animation = 0; 34 #endif 35 28 36 setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ); 29 37 … … 40 48 _margin = 0; 41 49 _animated = false; 50 #ifdef OLD_ANIMATION 42 51 animation_timer = new QTimer(this); 43 52 animation_timer->setInterval(2); 44 53 connect( animation_timer, SIGNAL(timeout()), this, SLOT(animate()) ); 45 54 #endif 46 55 connect( &auto_hide_timer, SIGNAL(timeout()), 47 56 this, SLOT(checkUnderMouse()) ); … … 50 59 51 60 FloatingWidget::~FloatingWidget() { 61 #ifndef OLD_ANIMATION 62 if (animation) delete animation; 63 #endif 52 64 } 53 65 … … 105 117 106 118 void FloatingWidget::showAnimated(QPoint final_position, Movement movement) { 119 #ifndef OLD_ANIMATION 120 show(); 121 if (!animation) { 122 animation = new QPropertyAnimation(this, "pos"); 123 } 124 animation->setDuration(300); 125 animation->setEasingCurve(QEasingCurve::OutBounce); 126 animation->setEndValue(final_position); 127 QPoint initial_position = final_position; 128 if (movement == Upward) { 129 initial_position.setY( initial_position.y() + height() ); 130 } else { 131 initial_position.setY( initial_position.y() - height() ); 132 } 133 animation->setStartValue(initial_position); 134 135 animation->start(); 136 #else 107 137 current_movement = movement; 108 138 final_y = final_position.y(); … … 118 148 119 149 animation_timer->start(); 150 #endif 120 151 } 121 152 153 #ifdef OLD_ANIMATION 122 154 void FloatingWidget::animate() { 123 155 if (current_y == final_y) { … … 128 160 } 129 161 } 162 #endif 130 163 131 164 void FloatingWidget::checkUnderMouse() {
Note:
See TracChangeset
for help on using the changeset viewer.