Skip to content
Permalink
Browse files

Make play/rewind/pause buttons show animation state, and add explicit

buttons to fast forward to end or rewind to start of animation
  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent 6eaefb6 commit 232890236a6811a72dd8582d0b9da6d71fcaf511
@@ -32,11 +32,20 @@ QgsTemporalControllerDockWidget::QgsTemporalControllerDockWidget( const QString

mNavigationObject = new QgsTemporalNavigationObject( this );

connect( mForwardButton, &QPushButton::clicked, this, &QgsTemporalControllerDockWidget::forwardButton_clicked );
connect( mBackButton, &QPushButton::clicked, this, &QgsTemporalControllerDockWidget::backButton_clicked );
connect( mNextButton, &QPushButton::clicked, this, &QgsTemporalControllerDockWidget::nextButton_clicked );
connect( mPreviousButton, &QPushButton::clicked, this, &QgsTemporalControllerDockWidget::previousButton_clicked );
connect( mStopButton, &QPushButton::clicked, this, &QgsTemporalControllerDockWidget::stopButton_clicked );
connect( mForwardButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::playForward );
connect( mBackButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::playBackward );
connect( mNextButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::next );
connect( mPreviousButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::previous );
connect( mStopButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::pause );
connect( mFastForwardButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::skipToEnd );
connect( mRewindButton, &QPushButton::clicked, mNavigationObject, &QgsTemporalNavigationObject::rewindToStart );

connect( mNavigationObject, &QgsTemporalNavigationObject::stateChanged, this, [ = ]( QgsTemporalNavigationObject::AnimationState state )
{
mForwardButton->setChecked( state == QgsTemporalNavigationObject::Forward );
mBackButton->setChecked( state == QgsTemporalNavigationObject::Reverse );
mStopButton->setChecked( state == QgsTemporalNavigationObject::Idle );
} );

connect( mStartDateTime, &QDateTimeEdit::dateTimeChanged, this, &QgsTemporalControllerDockWidget::updateTemporalExtent );
connect( mEndDateTime, &QDateTimeEdit::dateTimeChanged, this, &QgsTemporalControllerDockWidget::updateTemporalExtent );
@@ -95,6 +104,8 @@ QgsTemporalControllerDockWidget::QgsTemporalControllerDockWidget( const QString
mNextButton->setToolTip( tr( "Go to next frame" ) );
mPreviousButton->setToolTip( tr( "Go to previous frame" ) );
mStopButton->setToolTip( tr( "Pause" ) );
mRewindButton->setToolTip( tr( "Rewind to start" ) );
mFastForwardButton->setToolTip( tr( "Fast forward to end" ) );

updateFrameDuration();
}
@@ -162,32 +173,6 @@ void QgsTemporalControllerDockWidget::setDatesToProjectTime()
}
}

void QgsTemporalControllerDockWidget::stopButton_clicked()
{
updateButtonsEnable( true );
mNavigationObject->pause();
}

void QgsTemporalControllerDockWidget::forwardButton_clicked()
{
mNavigationObject->playForward();
}

void QgsTemporalControllerDockWidget::backButton_clicked()
{
mNavigationObject->playBackward();
}

void QgsTemporalControllerDockWidget::nextButton_clicked()
{
mNavigationObject->next();
}

void QgsTemporalControllerDockWidget::previousButton_clicked()
{
mNavigationObject->previous();
}

void QgsTemporalControllerDockWidget::setDateInputsEnable( bool enabled )
{
mStartDateTime->setEnabled( enabled );
@@ -71,36 +71,6 @@ class GUI_EXPORT QgsTemporalControllerDockWidget : public QgsDockWidget, private

private slots:

/**
* Handles the action to be done when the
* previous button on the widget is clicked.
**/
void previousButton_clicked();

/**
* Handles the action to be done when the
* next button on the widget is clicked.
**/
void nextButton_clicked();

/**
* Handles the action to be done when the
* stop button on the widget is clicked.
**/
void stopButton_clicked();

/**
* Handles the action to be done when the
* back button on the widget is clicked.
**/
void backButton_clicked();

/**
* Handles the action to be done when the
* forward button on the widget is clicked.
**/
void forwardButton_clicked();

/**
* Handles the action to be done when the
* time slider value has changed.
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1205</width>
<height>134</height>
<height>136</height>
</rect>
</property>
<property name="windowTitle">
@@ -52,6 +52,17 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="mRewindButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/temporal_navigation/previous.svg</normaloff>:/images/themes/default/temporal_navigation/previous.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mPreviousButton">
<property name="text">
@@ -72,6 +83,9 @@
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/temporal_navigation/back.svg</normaloff>:/images/themes/default/temporal_navigation/back.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@@ -83,6 +97,9 @@
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/temporal_navigation/stop.svg</normaloff>:/images/themes/default/temporal_navigation/stop.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@@ -94,6 +111,9 @@
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/temporal_navigation/forward.svg</normaloff>:/images/themes/default/temporal_navigation/forward.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@@ -107,6 +127,17 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mFastForwardButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/temporal_navigation/next.svg</normaloff>:/images/themes/default/temporal_navigation/next.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
@@ -229,6 +260,8 @@
</customwidgets>
<resources>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 2328902

Please sign in to comment.
You can’t perform that action at this time.