コード例 #1
0
ファイル: SCAnimationDirector.cpp プロジェクト: KDE/koffice
void SCAnimationDirector::navigateToPage(int index)
{
    if (m_pageEffectRunner) {
        m_pageEffectRunner->finish();
        finishAnimations();
        // finish on first step
        m_timeLine.stop();
    }
    else if (m_timeLine.state() == QTimeLine::Running) { // there are still shape animations running
        finishAnimations();
        m_timeLine.stop();
    }

    m_pageIndex = index;
    KoPAPage *page = m_pages[m_pageIndex];

    m_stepIndex = 0;

    updateActivePage(page);
    updatePageAnimation();
    updateStepAnimation();
    // trigger a repaint
    m_canvas->update();

    if (hasAnimation()) {
        startTimeLine(m_animations.at(m_stepIndex)->totalDuration());
    }
}
コード例 #2
0
ファイル: SCAnimationDirector.cpp プロジェクト: KDE/koffice
bool SCAnimationDirector::navigate(Navigation navigation)
{
    bool finished = false;
    if (m_pageEffectRunner) {
        m_pageEffectRunner->finish();
        finishAnimations();
        // finish on first step
        m_timeLine.stop();
        finished = true;
    }
    else if (m_timeLine.state() == QTimeLine::Running) { // there are still shape animations running
        finishAnimations();
        m_timeLine.stop();
        finished = true;
    }

    bool presentationFinished = false;

    switch (navigation)
    {
        case FirstPage:
        case PreviousPage:
        case NextPage:
        case LastPage:
            presentationFinished = changePage(navigation);
            break;
        case PreviousStep:
            previousStep();
            break;
        case NextStep:
            if (!finished) {
                presentationFinished = nextStep();
            }
            break;
        default:
            break;
    }

    return presentationFinished;
}
コード例 #3
0
void Ut_VolumeBar::testAnimationSetup()
{
    QCOMPARE(volumeBar->percentageAnimation->propertyName().constData(), "currentPercentage");
    QCOMPARE(volumeBar->fadeInAnimation->propertyName().constData(), "opacity");
    QCOMPARE(volumeBar->fadeOutAnimation->propertyName().constData(), "opacity");
    QCOMPARE(volumeBar->fadeInAnimation->startValue().toReal(), (qreal)0);
    QCOMPARE(volumeBar->fadeInAnimation->endValue().toReal(), (qreal)1);
    QCOMPARE(volumeBar->fadeOutAnimation->endValue().toReal(), (qreal)0);
    QVERIFY(disconnect(&volumeBar->visibilityTimer, SIGNAL(timeout()), volumeBar->fadeOutAnimation, SLOT(start())));
    QVERIFY(disconnect(volumeBar->fadeOutAnimation, SIGNAL(finished()), volumeBar, SLOT(finishAnimations())));
}