Ignore:
Timestamp:
Mar 16, 2012, 4:02:47 PM (13 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: 0.7.1 trunk update

Location:
smplayer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • smplayer/trunk

  • smplayer/trunk/src/floatingwidget.cpp

    r119 r124  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2011 Ricardo Villalba <rvm@escomposlinux.org>
     2    Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    2222#include <QHBoxLayout>
    2323
     24#ifndef OLD_ANIMATION
     25#include <QPropertyAnimation>
     26#endif
     27
    2428FloatingWidget::FloatingWidget( QWidget * parent )
    2529        : QWidget( parent, Qt::Window | Qt::FramelessWindowHint |
    2630                       Qt::WindowStaysOnTopHint )
    2731{
     32#ifndef OLD_ANIMATION
     33        animation = 0;
     34#endif
     35
    2836        setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
    2937
     
    4048        _margin = 0;
    4149        _animated = false;
     50#ifdef OLD_ANIMATION
    4251        animation_timer = new QTimer(this);
    4352        animation_timer->setInterval(2);
    4453        connect( animation_timer, SIGNAL(timeout()), this, SLOT(animate()) );
    45 
     54#endif
    4655        connect( &auto_hide_timer, SIGNAL(timeout()),
    4756             this, SLOT(checkUnderMouse()) );
     
    5059
    5160FloatingWidget::~FloatingWidget() {
     61#ifndef OLD_ANIMATION
     62        if (animation) delete animation;
     63#endif
    5264}
    5365
     
    105117
    106118void 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
    107137        current_movement = movement;
    108138        final_y = final_position.y();
     
    118148
    119149        animation_timer->start();
     150#endif
    120151}
    121152
     153#ifdef OLD_ANIMATION
    122154void FloatingWidget::animate() {
    123155        if (current_y == final_y) {
     
    128160        }
    129161}
     162#endif
    130163
    131164void FloatingWidget::checkUnderMouse() {
Note: See TracChangeset for help on using the changeset viewer.