示例#1
0
TEST_F(BitmapImageTest, animationRepetitions) {
    loadImage("/LayoutTests/fast/images/resources/full2loop.gif");
    int expectedRepetitionCount = 2;
    EXPECT_EQ(expectedRepetitionCount, repetitionCount());

    // We actually loop once more than stored repetition count.
    for (int repeat = 0; repeat < expectedRepetitionCount + 1; ++repeat) {
        for (size_t i = 0; i < frameCount(); ++i) {
            EXPECT_FALSE(animationFinished());
            advanceAnimation();
        }
    }
    EXPECT_TRUE(animationFinished());
}
int MainWindowImpl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: frameSignal(); break;
        case 1: resetTxSignal(); break;
        case 2: showDialog(); break;
        case 3: deleteItem(); break;
        case 4: uploadItem(); break;
        case 5: saveItem(); break;
        case 6: setPathDialog(); break;
        case 7: startAnimation(); break;
        case 8: setanimationtime(); break;
        case 9: animationFinished(); break;
        case 10: showAddCursorDialog(); break;
        case 11: showAddEllipseDialog(); break;
        case 12: animationslidertime((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 13: opacitySliderImpl((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 14: showConfigureDialog(); break;
        case 15: startTx(); break;
        case 16: restartPacketTimer(); break;
        case 17: resetTx(); break;
        case 18: showDebugWindow(); break;
        case 19: showAboutQMTSim(); break;
        case 20: showReadme(); break;
        case 21: viewButtonSlot(); break;
        case 22: showResizeDialog(); break;
        }
        _id -= 23;
    }
    return _id;
}
示例#3
0
/**
 * Update player position, speed and rotation.
 */
void Player::update(GameState gameState)
{
    // update animation
    AnimatedObject::update();

    if (state == DYING && animationFinished()) {
        setState(DEAD);
    }

    if (state == DYING || state == ALIVE) {
        // acceleration
        acc += Settings::playerAcc;
        if (acc.y < Settings::playerAcc.y)
            acc.y = Settings::playerAcc.y;

        speed.y += acc.y;

        // Put this here for now, should be done in the engine..
        if(gameState.currentState == GameState::ST_BOSS)
        {
            pos.y += speed.y;
            pos.z += speed.z;
        }
        else {
            pos += speed;
            pos.y = std::min(7.0f, pos.y);
        }

        if (speed.y > 0) {
            rotation.z = -acos(glm::dot(glm::normalize(speed), glm::normalize(glm::vec3(1.0, 0.0, 0.0))));
        } else {
            rotation.z = acos(glm::dot(glm::normalize(speed), glm::normalize(glm::vec3(1.0, 0.0, 0.0))));
        }
    }
}
示例#4
0
void Test::startTest() {
    // Populates the list with integers of 0 to <size of deck>
    for (int i = 0; i < testDeck_->deck_.length(); i++) {
        shuffledSequence_.append(i);
    }
    // Randomizes the elements of the list. This will be the shuffled order of the cards.
    std::random_shuffle(shuffledSequence_.begin(), shuffledSequence_.end());

    currentSequenceIndex_ = 0;
    rightCards_ = 0;
    wrongCards_ = 0;
    ui->rightLabel->setText(QString::number(rightCards_));
    ui->wrongLabel->setText(QString::number(wrongCards_));
    ui->buttonWidget->setVisible(false);
    currentCard_ = testDeck_->deck_[ shuffledSequence_[currentSequenceIndex_] ];
    state_ = question;

    flipAnimation.setParent(ui->cardWidget);
    flipAnimation.setTargetObject(ui->cardWidget);
    flipAnimation.setPropertyName("maximumSize");
    flipAnimation.setStartValue(QSize(800, 600));
    flipAnimation.setEndValue(QSize(0, 600));
    flipAnimation.setDuration(100);
    connect(&flipAnimation, SIGNAL(finished()), this, SLOT(animationFinished()) );
    updateCardAppearance();
}
void QocViewWidget::rebuildChart()
{
	QPushButton *pb = qobject_cast<QPushButton *>(sender());
//	QParallelAnimationGroup *group = new QParallelAnimationGroup();
	QSequentialAnimationGroup *group = new QSequentialAnimationGroup();

	if (pb)
	{
		pb->setEnabled(false);
		connect(group, SIGNAL(finished()), this, SLOT(animationFinished()));
		connect(this, SIGNAL(animationEnded(bool)), pb, SLOT(setEnabled(bool)));
	}
	QList<QocAbstractChartItem *> items = m_chart->items(QocAbstractChart::ChartLayer);
	foreach(QocAbstractChartItem *item, items)
	{
		QocAbstractValueItem *i = qobject_cast<QocAbstractValueItem *>(item);
		if ( i )
		{
			QPropertyAnimation *anim = new QPropertyAnimation(i, "value", group);
			anim->setStartValue(0);
			anim->setEndValue(i->value());
			anim->setDuration(2000/items.size());
			group->addAnimation(anim);

//			i->blockSignals(true);
			i->setValue(0);
//			i->blockSignals(false);
		}
	}
void TaskEditor::startAnimation(QSizeF endSize, bool show) {
    appearing = show;
    if (appearing)
      foreach(QGraphicsItem* child, childItems())
        child->show();

    this->show();

    fullSize = endSize;
    resize(fullSize);

    Plasma::Animation *animation = m_fadeAnimation.data();
    if (!animation) {
      animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation);
      animation->setTargetWidget(this);
      animation->setProperty("startValue", 0.0);
      animation->setProperty("endValue", 1.0);
      animation->setProperty("duration", 100);
      m_fadeAnimation = animation;
      connect(animation, SIGNAL(finished()), this, SLOT(animationFinished()));
    } else if (animation->state() == QAbstractAnimation::Running) {
      animation->pause();
    }

    if (show) {
      animation->setProperty("easingCurve", QEasingCurve::InQuad);
      animation->setProperty("direction", QAbstractAnimation::Forward);
      animation->start(QAbstractAnimation::KeepWhenStopped);
    } else {
      animation->setProperty("easingCurve", QEasingCurve::OutQuad);
      animation->setProperty("direction", QAbstractAnimation::Backward);
      animation->start(QAbstractAnimation::DeleteWhenStopped);
    }
}
void KexiAnimatedLayout::Private::animateTo(QWidget* destination)
{
    QWidget *from = q->currentWidget();
    Q_ASSERT(destination && from);
    destinationWidget = destination;
    if (from == destinationWidget)
        return;
    if (!(KexiUtils::graphicEffectsLevel() & KexiUtils::SimpleAnimationEffects))
    {
        // animations not allowed: switch to destination widget immediately
        animationFinished();
        return;
    }
    bool toRight = q->currentIndex() < q->indexOf(destinationWidget);
    hide();
    setParent(from);
    QSize s(from->parentWidget()->size());
    QPoint startPos(toRight ? QPoint(0, 0) : QPoint(s.width(), 0));
    QPoint endPos(toRight ? QPoint(s.width(), 0) : QPoint(0, 0));
    animation.setStartValue(-startPos);
    animation.setEndValue(-endPos);
    buffer = QPixmap(s.width() * 2, s.height());
    buffer.fill(Qt::white);
    from->render(&buffer, startPos);
    //qDebug() << s << from->geometry() << destinationWidget->geometry();
    destinationWidget->resize(from->size()); // needed because destination could
                                               // have been never displayed
    destinationWidget->render(&buffer, endPos);
    resize(buffer.size());
    move(animation.startValue().toPoint().x(), animation.startValue().toPoint().y());
    show();
    animation.start();
}
示例#8
0
void View::articleClicked() {
    Button *btn = dynamic_cast<Button*>(sender());
    if (!btn)
        return;

    QPropertyAnimation *animation = new QPropertyAnimation(btn, "geometry");
    animation->setDuration(750);
    animation->setEasingCurve(QEasingCurve::OutExpo);
    if (btn->isFront()) {
        btn->setZValue(1);
        animation->setStartValue(btn->geometry());
        animation->setEndValue(btn->gridGeometry());
        connect(animation, SIGNAL(finished()), btn, SLOT(setBack()));
        animation->start();
		//_actButton = NULL;
    } else {
        if (_actButton != NULL && _actButton != btn) {
            delete animation;
            return;
        }
        btn->setFront();
        btn->setGridGeometry(btn->geometry());
        animation->setStartValue(btn->geometry());
        unsigned int w = size().width() / 17;
        unsigned int h = (size().height() - _topBar->size().height()) / 15;
        animation->setEndValue(QRectF(w, h + _topBar->size().height(), 15 * w, 13 * h));
        animation->start();
        _actButton = btn;
    }
	btn->setEnabled(false);
    connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
	connect(animation, SIGNAL(finished()), this, SLOT(animationFinished()));
}
示例#9
0
/*!
  Set an \a animation for this QAnimationState. If an animation was previously handle by this
  state then it won't emit animationFinished for the old animation. The QAnimationState doesn't
  take the ownership of the animation.
*/
void QAnimationState::setAnimation(QAbstractAnimation *animation)
{
    if (animation == m_animation)
        return;

    //Disconnect from the previous animation if exist
    if(m_animation)
        disconnect(m_animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));

    m_animation = animation;

    if (m_animation) {
        //connect the new animation
        connect(m_animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
    }
}
示例#10
0
void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate)
{
    QRect r = widget->geometry();
    if (r.right() < 0 || r.bottom() < 0)
        r = QRect();

    animate = animate && !r.isNull() && !_final_geometry.isNull();

    // might make the wigdet go away by sending it to negative space
    const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
        QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());

#ifndef QT_NO_ANIMATION
    AnimationMap::const_iterator it = m_animation_map.constFind(widget);
    if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)
        return;

    QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget);
    anim->setDuration(animate ? 200 : 0);
    anim->setEasingCurve(QEasingCurve::InOutQuad);
    anim->setEndValue(final_geometry);
    m_animation_map[widget] = anim;
    connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
    anim->start(QPropertyAnimation::DeleteWhenStopped);
#else
    //we do it in one shot
    widget->setGeometry(final_geometry);
#ifndef QT_NO_MAINWINDOW
    m_mainWindowLayout->animationFinished(widget);
#endif //QT_NO_MAINWINDOW
#endif //QT_NO_ANIMATION
}
    void startZoomOutAnimation()
    {
        if (zoomedIndex < 0)
            return;

        int lm, tm, rm, bm;
        m_public->getContentsMargins(&lm, &tm, &rm, &bm);
        QRect adjustedGeo = m_public->geometry().adjusted(lm, tm, -rm, -bm);
        int spacing = m_public->spacing();

        QSize cellSize = calculateCellSize(adjustedGeo,spacing);
        QParallelAnimationGroup * animGroup = new QParallelAnimationGroup;
        for (int i = 0; i < list.size(); ++i) {
            Wrapper * wr = list.at(i);
            wr->item->widget()->show();
            QPropertyAnimation * anim = new QPropertyAnimation(wr->item->widget(), "geometry");
            anim->setEndValue(
                        calculateCellGeometry(
                            adjustedGeo, cellSize, spacing,
                            wr->row, wr->col, wr->rowSpan,wr->colSpan));
            anim->setDuration(duration);
            anim->setEasingCurve(easing);
            animGroup->addAnimation(anim);
        }
        qApp->connect(animGroup, SIGNAL(finished()), m_public, SIGNAL(animationFinished()));
        animationRunning = true;
        animGroup->start(QAbstractAnimation::DeleteWhenStopped);
        zoomedIndex = -1;
    }
示例#12
0
void AnimatedFrame::handleAnimationFinish()
{
	if(widget_) {
		if(animation_.direction() == QTimeLine::Forward) {
			hide();
		}
		if(effects_ & kSlide) {
			if(animation_.direction() == QTimeLine::Backward) {
				if(edge_ == kNorth || edge_ == kSouth) {
					setMinimumHeight(widget_->minimumHeight());
					setMaximumHeight(widget_->maximumHeight());
				}
				else {
					setMinimumWidth(widget_->minimumWidth());
					setMaximumWidth(widget_->maximumWidth());
				}
			}
		}

		if(effects_ & kFade) {
			if(animation_.direction() == QTimeLine::Backward)
				widget_->show();
		}
	}

	emit animationFinished();
}
KexiAnimatedLayout::Private::Private(KexiAnimatedLayout * qq)
 : QWidget(), q(qq), animation(this, "pos")
{
    hide();
    setAttribute(Qt::WA_OpaquePaintEvent, true);
    animation.setEasingCurve(QEasingCurve::InOutQuart);
    animation.setDuration(500);
    connect(&animation, SIGNAL(finished()), this, SLOT(animationFinished()));
}
示例#14
0
void BaseAnimatedStackedWidget::init()
{
	animationPage_ = createAnimationPage();
	connect(animationPage_, SIGNAL(finished()), SLOT(animationFinished()));

	stackedWidget_->addWidget(normalPage());
	stackedWidget_->addWidget(animationPage_);
	stackedWidget_->setCurrentWidget(normalPage());
}
示例#15
0
KLineEditViewButton::KLineEditViewButton(QWidget *parent)
    : QWidget(parent)
{
    m_timeline = new QTimeLine(200, this);
    m_timeline->setFrameRange(0, 255);
    m_timeline->setCurveShape(QTimeLine::EaseInOutCurve);
    m_timeline->setDirection(QTimeLine::Backward);
    connect(m_timeline, SIGNAL(finished()), this, SLOT(animationFinished()));
    connect(m_timeline, SIGNAL(frameChanged(int)), this, SLOT(update()));
}
void SliderWindow::timeLineFinished() {
	
	if (m_d->timeLine.direction() == QTimeLine::Forward) {
		m_d->timer.start(holdDuration);
	} else {
		hide();
		emit animationFinished();
		m_d->isAnimating = false;
	}
}
ScrobblesWidget::ScrobblesWidget( QWidget* parent )
    :QWidget( parent ), ui( new Ui::ScrobblesWidget ), m_lastIndex( 0 )
{
    ui->setupUi( this );

    connect( ui->scrobbles, SIGNAL( trackClicked(TrackWidget&)), SLOT( onTrackClicked(TrackWidget&)));
    connect( ui->slidingWidget, SIGNAL( animationFinished()), SLOT(onMoveFinished()));

    ui->stackedWidget->setCurrentWidget( ui->scrobbles );
}
示例#18
0
KateFadeEffect::KateFadeEffect(QWidget* widget)
  : QObject(widget)
  , m_widget(widget)
  , m_effect(0) // effect only exists during fading animation
{
  m_timeLine = new QTimeLine(500, this);
  m_timeLine->setUpdateInterval(40);

  connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(opacityChanged(qreal)));
  connect(m_timeLine, SIGNAL(finished()), this, SLOT(animationFinished()));
}
示例#19
0
void AnimatedSplitter::animateActiveWidgetWidth(int width, int time)
{
	int min, max;
	getRange(0, &min, &max);
	qDebug() << min << max;
	QPropertyAnimation *animation = new QPropertyAnimation(this, "activeWidgetWidth");
	animation->setDuration(time);
	animation->setStartValue(activeWidgetWidth());
	animation->setEndValue(width);
	connect(animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
	animation->start(QAbstractAnimation::DeleteWhenStopped);
}
示例#20
0
void SlidingStackedWidget::animationDoneSlot()
{
    // When ready, call the QStackedWidget slot setCurrentIndex(int)
    setCurrentIndex(next);
    // Then hide the outshifted widget now, and  (may be done already
    // implicitely by QStackedWidget)
    widget(now)->hide();
    // Then set the position of the outshifted widget now back to its original
    widget(now)->move(pNow);

    active = false;
    emit animationFinished();
}
示例#21
0
/*!
  \internal
  \fn void SelectedItem::detachAnimation()
  Stops animation and disconnects the current movie.
*/
void SelectedItem::detachAnimation()
{
    stopAnimation();

    // If there was a movie, make sure it isn't still connected to any slots that we're responsible
    // for, and kiss it goodbye (but do not delete it - it is owned by a GridItem).
    if ( movie ) {
        QObject::disconnect(movie,SIGNAL(frameChanged(int)),mConnector,SLOT(animationChanged()));
        QObject::disconnect(movie,SIGNAL(finished()),mConnector,SLOT(animationFinished()));
        QObject::disconnect(movie,SIGNAL(error(QImageReader::ImageReaderError)),mConnector,SLOT(animationError(QImageReader::ImageReaderError)));
        movie = 0;
    }
}
void SlidingStackedWidget::animationDoneSlot(void) {
    //when ready, call the QStackedWidget slot setCurrentIndex(int)
    setCurrentIndex(m_next);  //this function is inherit from QStackedWidget
    //then hide the outshifted widget now, and  (may be done already implicitely by QStackedWidget)
    widget(m_now)->hide();
    //then set the position of the outshifted widget now back to its original
    widget(m_now)->move(m_pnow);
    //so that the application could also still call the QStackedWidget original functions/slots for changings
    //widget(m_now)->update();
    //setCurrentIndex(m_next);  //this function is inherit from QStackedWidget
    m_active=false;
    emit animationFinished();
}
示例#23
0
void ImageItem::fadeOut()
{

	QPropertyAnimation* anim = new QPropertyAnimation(this, "fade");
	anim->setDuration(300);
	anim->setStartValue(255); // from fully visible
	anim->setEndValue(0); // to invisible
	anim->setEasingCurve(QEasingCurve::InOutQuad);

	QObject::connect(anim, SIGNAL(finished()), this, SLOT(animationFinished()));

	mIsAnimationFinished =true;
	anim->start(QAbstractAnimation::DeleteWhenStopped);
}
int QWidgetAnimator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: animationFinished(); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
void
unicorn::SlidingStackedWidget::animationDoneSlot(void)
{
    setCurrentIndex( m_next );
    widget(m_now)->hide();
    widget(m_now)->move(m_pnow);
    m_active = false;

    // animate again if they changed index while we were animating
    if ( m_index != currentIndex() )
        slide( m_index );
    else
        emit animationFinished();
}
void
ScrobblesWidget::onTrackClicked( TrackWidget& trackWidget )
{
    MetadataWidget* w;
    ui->slidingWidget->addWidget( w = new MetadataWidget( trackWidget.track() ));
    w->fetchTrackInfo( true );
    w->setBackButtonVisible( true );

    trackWidget.startSpinner();
    connect( ui->slidingWidget, SIGNAL( animationFinished()), &trackWidget, SLOT(clearSpinner()) );

    connect( w, SIGNAL(finished()), SLOT(onMetadataWidgetFinished()));
    connect( w, SIGNAL(backClicked()), SLOT(onBackClicked()));
}
示例#27
0
SettingsWidget::SettingsWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SettingsWidget)
{
    ui->setupUi(this);
#ifdef Q_OS_WIN
    this->ui->buttonAssociate->show();
#else
    this->ui->buttonAssociate->hide();
#endif
    this->appsColumnModel = new QStandardItemModel;
    this->backupsColumnModel = new QStandardItemModel;
    this->computerColumnModel = new QStandardItemModel;
    this->phoneColumnModel = new QStandardItemModel;

    this->setLayout(this->ui->gridLayout_7);
    this->ui->pageSettingsGeneral->setLayout(this->ui->layoutGeneralSettings);
    this->ui->pageSettingsFile->setLayout(this->ui->layoutFileSettings);
    this->ui->pageSettingsApp->setLayout(this->ui->layoutSettingsApps);
    this->ui->groupComputer->setLayout(this->ui->gridComputer);
    this->ui->groupPhone->setLayout(this->ui->gridPhone);
    ui->groupBoxBoth->setLayout(ui->gridBoth);
    ui->pageSettingsShell->setLayout(ui->shellGridLayout);
    ui->pageSettingsAnimations->setLayout(ui->layoutAnimationsSettings);
    this->currentIndex=0;

    connect(this->ui->buttonSaveSettings, SIGNAL(clicked()), this, SLOT(saveSettings()));
    connect(this->ui->buttonFontApp, SIGNAL(clicked()), this, SLOT(chooseFontApp()));
    connect(this->ui->buttonFontTables, SIGNAL(clicked()), this, SLOT(chooseFontTables()));
    connect(this->ui->buttonFontShell, SIGNAL(clicked()), this, SLOT(chooseFontShell()));
    connect(this->ui->buttonDefaults, SIGNAL(clicked()), this, SLOT(setSettingsToDefaults()));
    connect(this->ui->radioComputerPath, SIGNAL(toggled(bool)), this, SLOT(settingsSlotChanged()));
    connect(this->ui->radioPhonePath, SIGNAL(toggled(bool)), this, SLOT(settingsSlotChanged()));
    connect(this->ui->checkAppName, SIGNAL(toggled(bool)), this, SLOT(settingsSlotChanged()));
    connect(this, SIGNAL(settingsChanged()), this, SLOT(getSettings()));
    connect(this, SIGNAL(settingsChanged()), this, SLOT(changeFont()));
    connect(this->ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(changePage(int)));
    connect(&this->animation.animation, SIGNAL(finished()), this, SLOT(animationFinished()));
    connect(this->ui->buttonDetectSdExt, SIGNAL(clicked()), this, SLOT(detectSdExtFolder()));

    ui->listWidgetCurvePicker->setIconSize(QSize(64,64));

    createCurveIcons();

    connect(ui->listWidgetCurvePicker, SIGNAL(currentRowChanged(int)), this, SLOT(curveChanged(int)));

    this->getSettings();
    this->changeFont();
}
示例#28
0
void
AnimatedWidget::onAnimationFinished()
{
    if ( m_animateForward )
    {
        setMinimumHeight( hiddenSize().height() );
        setMaximumHeight( QWIDGETSIZE_MAX );
    }
    else
    {
        setFixedHeight( hiddenSize().height() );
    }
    
    emit animationFinished();
}
示例#29
0
MousePing::MousePing(QPointF p, const QColor& color)
  : QObject(),
    QGraphicsEllipseItem( Utilities::squareAt(p, 0) ),
    m_size(0),
    m_animation(this, "size")
{
  QPen pen;
  pen.setWidth(7);
  pen.setColor(color);
  setPen(pen);

  m_animation.setDuration(1000);
  m_animation.setStartValue(5);
  m_animation.setEndValue(55);
  m_animation.start();
  connect( &m_animation, SIGNAL(finished()), this, SLOT(animationFinished()) );
}
示例#30
0
void QMacSplitter::init()
{
    setChildrenCollapsible(false);
    setAutoFillBackground(true);
    anim=new QParallelAnimationGroup(this);
    a1=new QPropertyAnimation(this);
    a2=new QPropertyAnimation(this);
    anim->addAnimation(a1);
    anim->addAnimation(a2);
    connect (anim,SIGNAL(finished()),this,SLOT(animationFinished()));
    a1->setDuration(400);
    a1->setEasingCurve(QEasingCurve::Linear);
    a2->setDuration(400);
    a2->setEasingCurve(QEasingCurve::Linear);
    expandedSize=150;
    collapseIndex=-1;
    expandIndex=-1;
}