mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:50:05 +00:00 
			
		
		
		
	Timeline pause
This commit is contained in:
		
							parent
							
								
									41b9e25ea8
								
							
						
					
					
						commit
						ba1de683fa
					
				
					 6 changed files with 79 additions and 36 deletions
				
			
		|  | @ -16,21 +16,18 @@ namespace ui | |||
| static const std::string logPrefix_ = "scwx::qt::ui::animation_dock_widget"; | ||||
| static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||
| 
 | ||||
| enum class AnimationState | ||||
| { | ||||
|    Play, | ||||
|    Pause | ||||
| }; | ||||
| 
 | ||||
| class AnimationDockWidgetImpl | ||||
| { | ||||
| public: | ||||
|    explicit AnimationDockWidgetImpl(AnimationDockWidget* self) : self_ {self} {} | ||||
|    ~AnimationDockWidgetImpl() = default; | ||||
| 
 | ||||
|    const QIcon kPauseIcon_ {":/res/icons/font-awesome-6/pause-solid.svg"}; | ||||
|    const QIcon kPlayIcon_ {":/res/icons/font-awesome-6/play-solid.svg"}; | ||||
| 
 | ||||
|    AnimationDockWidget* self_; | ||||
| 
 | ||||
|    AnimationState animationState_ {AnimationState::Pause}; | ||||
|    types::AnimationState animationState_ {types::AnimationState::Pause}; | ||||
| 
 | ||||
|    std::chrono::sys_days selectedDate_ {}; | ||||
|    std::chrono::seconds  selectedTime_ {}; | ||||
|  | @ -171,17 +168,7 @@ void AnimationDockWidgetImpl::ConnectSignals() | |||
|    QObject::connect(self_->ui->playButton, | ||||
|                     &QAbstractButton::clicked, | ||||
|                     self_, | ||||
|                     [this]() | ||||
|                     { | ||||
|                        if (animationState_ == AnimationState::Pause) | ||||
|                        { | ||||
|                           emit self_->AnimationPlaySelected(); | ||||
|                        } | ||||
|                        else | ||||
|                        { | ||||
|                           emit self_->AnimationPauseSelected(); | ||||
|                        } | ||||
|                     }); | ||||
|                     [this]() { emit self_->AnimationPlaySelected(); }); | ||||
|    QObject::connect(self_->ui->stepNextButton, | ||||
|                     &QAbstractButton::clicked, | ||||
|                     self_, | ||||
|  | @ -192,6 +179,21 @@ void AnimationDockWidgetImpl::ConnectSignals() | |||
|                     [this]() { emit self_->AnimationStepEndSelected(); }); | ||||
| } | ||||
| 
 | ||||
| void AnimationDockWidget::UpdateAnimationState(types::AnimationState state) | ||||
| { | ||||
|    // Update icon to opposite of state
 | ||||
|    switch (state) | ||||
|    { | ||||
|    case types::AnimationState::Pause: | ||||
|       ui->playButton->setIcon(p->kPlayIcon_); | ||||
|       break; | ||||
| 
 | ||||
|    case types::AnimationState::Play: | ||||
|       ui->playButton->setIcon(p->kPauseIcon_); | ||||
|       break; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| } // namespace ui
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat