mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Removed Q_OBJECT from Storage::Uploader.
This commit is contained in:
parent
d4bb62d055
commit
09966fb291
2 changed files with 10 additions and 17 deletions
|
@ -153,12 +153,9 @@ const QString &Uploader::File::filename() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Uploader::Uploader(not_null<ApiWrap*> api)
|
Uploader::Uploader(not_null<ApiWrap*> api)
|
||||||
: _api(api) {
|
: _api(api)
|
||||||
nextTimer.setSingleShot(true);
|
, _nextTimer([=] { sendNext(); })
|
||||||
connect(&nextTimer, SIGNAL(timeout()), this, SLOT(sendNext()));
|
, _stopSessionsTimer([=] { stopSessions(); }) {
|
||||||
stopSessionsTimer.setSingleShot(true);
|
|
||||||
connect(&stopSessionsTimer, SIGNAL(timeout()), this, SLOT(stopSessions()));
|
|
||||||
|
|
||||||
const auto session = &_api->session();
|
const auto session = &_api->session();
|
||||||
photoReady(
|
photoReady(
|
||||||
) | rpl::start_with_next([=](const UploadedPhoto &data) {
|
) | rpl::start_with_next([=](const UploadedPhoto &data) {
|
||||||
|
@ -423,16 +420,16 @@ void Uploader::sendNext() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stopping = stopSessionsTimer.isActive();
|
const auto stopping = _stopSessionsTimer.isActive();
|
||||||
if (queue.empty()) {
|
if (queue.empty()) {
|
||||||
if (!stopping) {
|
if (!stopping) {
|
||||||
stopSessionsTimer.start(kKillSessionTimeout);
|
_stopSessionsTimer.callOnce(kKillSessionTimeout);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stopping) {
|
if (stopping) {
|
||||||
stopSessionsTimer.stop();
|
_stopSessionsTimer.cancel();
|
||||||
}
|
}
|
||||||
auto i = uploadingId.msg ? queue.find(uploadingId) : queue.begin();
|
auto i = uploadingId.msg ? queue.find(uploadingId) : queue.begin();
|
||||||
if (!uploadingId.msg) {
|
if (!uploadingId.msg) {
|
||||||
|
@ -625,7 +622,7 @@ void Uploader::sendNext() {
|
||||||
|
|
||||||
parts.erase(part);
|
parts.erase(part);
|
||||||
}
|
}
|
||||||
nextTimer.start(kUploadRequestInterval);
|
_nextTimer.callOnce(kUploadRequestInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Uploader::cancel(const FullMsgId &msgId) {
|
void Uploader::cancel(const FullMsgId &msgId) {
|
||||||
|
@ -666,7 +663,7 @@ void Uploader::clear() {
|
||||||
_api->instance().stopSession(MTP::uploadDcId(i));
|
_api->instance().stopSession(MTP::uploadDcId(i));
|
||||||
sentSizes[i] = 0;
|
sentSizes[i] = 0;
|
||||||
}
|
}
|
||||||
stopSessionsTimer.stop();
|
_stopSessionsTimer.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Uploader::partLoaded(const MTPBool &result, mtpRequestId requestId) {
|
void Uploader::partLoaded(const MTPBool &result, mtpRequestId requestId) {
|
||||||
|
|
|
@ -8,10 +8,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "api/api_common.h"
|
#include "api/api_common.h"
|
||||||
|
#include "base/timer.h"
|
||||||
#include "mtproto/facade.h"
|
#include "mtproto/facade.h"
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
|
||||||
|
|
||||||
class ApiWrap;
|
class ApiWrap;
|
||||||
struct FileLoadResult;
|
struct FileLoadResult;
|
||||||
struct SendMediaReady;
|
struct SendMediaReady;
|
||||||
|
@ -64,8 +63,6 @@ struct UploadSecureDone {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Uploader final : public QObject {
|
class Uploader final : public QObject {
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Uploader(not_null<ApiWrap*> api);
|
explicit Uploader(not_null<ApiWrap*> api);
|
||||||
~Uploader();
|
~Uploader();
|
||||||
|
@ -114,7 +111,6 @@ public:
|
||||||
return _secureFailed.events();
|
return _secureFailed.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void unpause();
|
void unpause();
|
||||||
void sendNext();
|
void sendNext();
|
||||||
void stopSessions();
|
void stopSessions();
|
||||||
|
@ -148,7 +144,7 @@ private:
|
||||||
FullMsgId _pausedId;
|
FullMsgId _pausedId;
|
||||||
std::map<FullMsgId, File> queue;
|
std::map<FullMsgId, File> queue;
|
||||||
std::map<FullMsgId, File> uploaded;
|
std::map<FullMsgId, File> uploaded;
|
||||||
QTimer nextTimer, stopSessionsTimer;
|
base::Timer _nextTimer, _stopSessionsTimer;
|
||||||
|
|
||||||
rpl::event_stream<UploadedPhoto> _photoReady;
|
rpl::event_stream<UploadedPhoto> _photoReady;
|
||||||
rpl::event_stream<UploadedDocument> _documentReady;
|
rpl::event_stream<UploadedDocument> _documentReady;
|
||||||
|
|
Loading…
Add table
Reference in a new issue