File indexing completed on 2022-10-04 14:29:25

0001 /*
0002     SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "animator.h"
0008 
0009 Animator::Animator()
0010 {
0011     connect(&m_timer, &QTimer::timeout, this, &Animator::tick);
0012 }
0013 
0014 void Animator::add(Animation* a)
0015 {
0016     if (!m_timer.isActive()) {
0017         startTimer();
0018     }
0019     AnimationGroup::add(a);
0020 }
0021 
0022 void Animator::startTimer()
0023 {
0024     m_time.restart();
0025     m_timer.start(0);
0026     start(0);
0027 }
0028 
0029 void Animator::stopTimer()
0030 {
0031     m_timer.stop();
0032     stop();
0033 }
0034 
0035 void Animator::tick()
0036 {
0037     if (AnimationGroup::step(m_time.elapsed())) {
0038         stopTimer();
0039     }
0040 }
0041 
0042 
0043 
0044 
0045