FotoBox
|
#include <countdown.h>
Signals | |
void | update (unsigned int) |
Update countdown. More... | |
void | elapsed () |
Countdown elapsed. More... | |
Public Member Functions | |
Countdown (QObject *parent=nullptr, unsigned int i_seconds=0) | |
Countdown constructor. More... | |
~Countdown () override=default | |
Countdown default destructor. More... | |
Countdown (const Countdown &other)=delete | |
Countdown default copy constructor. More... | |
Countdown & | operator= (const Countdown &other)=delete |
Countdown default copy assignment. More... | |
Countdown (Countdown &&other)=delete | |
Countdown default move constructor. More... | |
Countdown & | operator= (Countdown &&other)=delete |
Countdown default move assignment. More... | |
void | setStartTime (unsigned int i_seconds) |
Set the countdown start time. More... | |
auto | isActive () const -> bool |
Show countdown status. More... | |
auto | start () -> bool |
Start countdown. More... | |
auto | stop () -> bool |
Stop countdown and check. More... | |
auto | reset () -> bool |
Reset countdown (reset. More... | |
Private Member Functions | |
void | updateTimeLeft () |
Start the timer until there is no time left, means. More... | |
Private Attributes | |
QTimer | m_timer |
unsigned int | m_startTime |
unsigned int | m_timeLeft |
bool | m_isActive {false} |
Static Private Attributes | |
static constexpr int | ONE_SECOND = 1000 |
The Countdown class.
Provides a countdown which operates on the base of seconds
Definition at line 20 of file countdown.h.
|
explicit |
Countdown constructor.
parent | QObject |
i_seconds | set the start time |
Definition at line 12 of file countdown.cpp.
References m_timer, ONE_SECOND, and updateTimeLeft().
|
overridedefault |
Countdown default destructor.
|
signal |
Countdown elapsed.
Referenced by FotoBox::FotoBox::countdown(), FotoBox::Preferences::Preferences(), and updateTimeLeft().
auto FotoBox::Countdown::isActive | ( | ) | const -> bool |
Show countdown status.
Definition at line 52 of file countdown.cpp.
References m_isActive.
Countdown default copy assignment.
Countdown default move assignment.
auto FotoBox::Countdown::reset | ( | ) | -> bool |
Reset countdown (reset.
Will also
Definition at line 88 of file countdown.cpp.
Referenced by setStartTime().
void FotoBox::Countdown::setStartTime | ( | unsigned int | i_seconds | ) |
Set the countdown start time.
i_seconds | setter |
Definition at line 46 of file countdown.cpp.
References m_startTime, and reset().
auto FotoBox::Countdown::start | ( | ) | -> bool |
Start countdown.
only start if not running
Definition at line 57 of file countdown.cpp.
Referenced by FotoBox::FotoBox::countdown(), and FotoBox::Preferences::Preferences().
auto FotoBox::Countdown::stop | ( | ) | -> bool |
Stop countdown and check.
Definition at line 78 of file countdown.cpp.
Referenced by updateTimeLeft().
|
signal |
Update countdown.
Referenced by FotoBox::FotoBox::countdown(), FotoBox::Preferences::Preferences(), and updateTimeLeft().
|
private |
Start the timer until there is no time left, means.
Attention: this function always deals with the already expired second.
Definition at line 25 of file countdown.cpp.
References elapsed(), m_timeLeft, stop(), and update().
Referenced by Countdown().
|
private |
|
private |
countdown start time (seconds)
Definition at line 112 of file countdown.h.
Referenced by setStartTime().
|
private |
|
private |
|
staticconstexprprivate |