Example #1
0
void Player::jumpTo(int i)
{
    // Reset user delay
    m_userDelay = 0;
    bool playing = m_timer.isActive();
    m_timer.stop();
    // Get subtitle in script
    const Subtitle *subtitle = m_script->subtitleAt(i);
    qint64 start_mss = subtitle->msseStart();
    setElapsedTime(start_mss);
    // Show it !
    updateCurrent(start_mss + 1);
    // Continuous play, even while pause
    if (playing) {
        m_timer.start();
    }
    else {
        m_pauseTotal = 0;
        if (m_pauseStart > 0) m_pauseStart = tick();

        if (m_autoHideEnabled) {
            m_pauseStart = tick();
            m_autoHideDuration = duration(subtitle);
            m_timerAutoHide.start();
        }
    }
}
        TEST_F(ConstantVelocityTransitionAnimatorTest, should_interpolate_position_according_to_time)
        {
            animator.addTransition(FIRST, SECOND, sprite);

            animator.updateFrame();
            assertDrawAt(sprite, FIRST);
            
            setElapsedTime(FIRST_SECOND_DISTANCE / VELOCITY / 2);
            animator.updateFrame();

            assertDrawAt(sprite, FIRST_SECOND_MIDPOINT);

            setElapsedTime(FIRST_SECOND_DISTANCE / VELOCITY + 1); // saturate
            animator.updateFrame();
            
            assertDrawAt(sprite, SECOND);
        }
		/*!
		 * Explicit constructor.
		 */
		AnnotatorPerformanceAnnotation::AnnotatorPerformanceAnnotation(CAS& aCas, const UnicodeString& annotatorName, long elapsedMillis)
			: AnnotationWrapper(aCas)
		{
			FSIndexRepository& indexRep = aCas.getIndexRepository();
			annotation = aCas.createAnnotation(tAnnotatorPerformanceAnnotation, 0, 0);
			setComponentName(annotatorName);
			setElapsedTime(elapsedMillis);
			indexRep.addFS(annotation);
		}
        TEST_F(ConstantVelocityTransitionAnimatorTest, should_when_there_are_no_active_transitions)
        {
            ASSERT_TRUE(animator.isFinished());
            
            animator.addTransition(FIRST, SECOND, sprite);
            animator.addTransition(FIRST2, SECOND2, sprite2);
            
            ASSERT_FALSE(animator.isFinished());

            setElapsedTime(FIRST_SECOND_DISTANCE / VELOCITY + 1);
            animator.updateFrame();
            
            ASSERT_FALSE(animator.isFinished());

            setElapsedTime(FIRST2_SECOND2_DISTANCE / VELOCITY + 1);
            animator.updateFrame();
            
            ASSERT_TRUE(animator.isFinished());
        }
 TEST_F(ConstantVelocityTransitionAnimatorTest, should_handle_multiple_transitions)
 {
     animator.addTransition(FIRST, SECOND, sprite);
     
     setElapsedTime(FIRST_SECOND_DISTANCE / VELOCITY / 2);
     animator.addTransition(FIRST2, SECOND2, sprite2);
     
     animator.updateFrame();
     
     InSequence order;
     EXPECT_CALL(*sprite, drawAt(FIRST_SECOND_MIDPOINT));
     EXPECT_CALL(*sprite2, drawAt(FIRST2));
     animator.drawFrame();
 }
Example #6
0
	void CSLevel::preFrame(const float &elapsedtime)
	{
		// remember this
		setElapsedTime(elapsedtime);

		// let the physx world do it's thing
		CS_SAFE(getPhysXWorld(), preFrame(elapsedtime));

		// let the objects do their thing
		CS_SAFE(m_ObjectFactory, preFrame(elapsedtime));

		// let the BlackBoard do it's thing
		CS_SAFE(m_BlackBoard, preFrame(elapsedtime));
	}
Example #7
0
CountdownDialog::CountdownDialog(QWidget *parent, int seconds):
		QDialog(parent, Qt::WindowStaysOnTopHint | Qt::Dialog ),
        m_pastEndMode(false),
        m_totalTime(seconds),
        m_progressBarWidth(150),
        m_progressBarHeight(15)

{
    setContentsMargins(10, 10, 10, 10);
    QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
    layout->setSpacing(14);

    setWindowTitle(tr("Recording..."));

    QWidget *hBox = new QWidget(this);
    QHBoxLayout *hBoxLayout = new QHBoxLayout;
    m_label = new QLabel( hBox );
    hBoxLayout->addWidget(m_label);
    m_time = new QLabel( hBox );
    hBoxLayout->addWidget(m_time);
    hBox->setLayout(hBoxLayout);

    layout->addWidget(hBox, 0, Qt::AlignCenter);

    m_label->setText(tr("Recording time remaining:  "));
    m_progressBar =
        new CountdownBar(this, m_progressBarWidth, m_progressBarHeight);

    m_progressBar->setFixedSize(m_progressBarWidth, m_progressBarHeight);

    // Simply re-emit from Stop button
    //
    m_stopButton = new QPushButton(tr("Stop"), this);
    m_stopButton->setFixedWidth(60);

    layout->addWidget(m_progressBar, 0, Qt::AlignCenter);
    layout->addWidget(m_stopButton, 0, Qt::AlignRight);
    setLayout(layout);

    connect (m_stopButton, SIGNAL(released()), this, SIGNAL(stopped()));

    // Set the total time to show the bar in initial position
    //
    setElapsedTime(0);

    m_shortcuts = new QShortcut(this);

}
 ConstantVelocityTransitionAnimatorTest()
 {
     setElapsedTime(0);
 }
Example #9
0
void Player::enableSpeedFactor(bool p_state)
{
    qint64 elapsed = elapsedTime();
    m_speedFactorEnabled = p_state;
    setElapsedTime(elapsed);
}
Example #10
0
void Player::setSpeedFactor(double p_factor)
{
    qint64 elapsed = elapsedTime();
    m_speedFactor = p_factor/100.0;
    setElapsedTime(elapsed);
}
Example #11
0
void
CountdownDialog::setTotalTime(int seconds)
{
    m_totalTime = seconds;
    setElapsedTime(0); // clear
}