40 , ReqTimer_ (new QTimer (this))
43 ReqTimer_->setSingleShot (
true);
52 const auto& now = QDateTime::currentDateTime ();
55 Queue_.prepend ({
f, dep ? OptionalTracker_t { dep } : OptionalTracker_t () });
57 Queue_.append ({
f, dep ? OptionalTracker_t { dep } : OptionalTracker_t () });
59 const auto diff = LastRequest_.msecsTo (now);
62 else if (Queue_.size () == 1)
63 ReqTimer_->start (Timeout_ - diff);
85 ReqTimer_->start (Timeout_);
88 void QueueManager::exec ()
90 if (Queue_.isEmpty ())
96 const auto& pair = Queue_.takeFirst ();
97 if (pair.second && !*pair.second)
104 LastRequest_ = QDateTime::currentDateTime ();
106 if (!Queue_.isEmpty ())
107 ReqTimer_->start (Timeout_);
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > f
bool IsPaused() const
Checks if the queue is paused.
void Pause()
Pauses the queue rotation.
void Schedule(std::function< void()> functor, QObject *dependent=nullptr, QueuePriority prio=QueuePriority::Normal)
Adds the given functor.
void Clear()
Clears the queue.
QueuePriority
The priority of the action in the queue.
QueueManager(int timeout, QObject *parent=nullptr)
Creates a queue manager with the given timeout.
void Resume()
Continues the queue rotation.