You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
545 B
13 lines
545 B
4 years ago
|
#include "request_repeater.hpp"
|
||
|
|
||
|
RequestRepeater::RequestRepeater(QObject *parent, QString requestURL, const QString &cache_key, int period_seconds, bool disableWithScreen) :
|
||
|
HttpRequest(parent, requestURL, cache_key), disableWithScreen(disableWithScreen) {
|
||
|
QTimer* timer = new QTimer(this);
|
||
|
QObject::connect(timer, &QTimer::timeout, [=](){
|
||
|
if (!GLWindow::ui_state.scene.started && reply == NULL && (GLWindow::ui_state.awake || !disableWithScreen)) {
|
||
|
sendRequest(requestURL);
|
||
|
}
|
||
|
});
|
||
|
timer->start(period_seconds * 1000);
|
||
|
}
|