本文整理汇总了C++中DocumentData::uploading方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentData::uploading方法的具体用法?C++ DocumentData::uploading怎么用?C++ DocumentData::uploading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentData
的用法示例。
在下文中一共展示了DocumentData::uploading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: partLoaded
void FileUploader::partLoaded(const MTPBool &result, mtpRequestId requestId) {
QMap<mtpRequestId, int32>::iterator j = docRequestsSent.end();
QMap<mtpRequestId, QByteArray>::iterator i = requestsSent.find(requestId);
if (i == requestsSent.cend()) {
j = docRequestsSent.find(requestId);
}
if (i != requestsSent.cend() || j != docRequestsSent.cend()) {
if (mtpIsFalse(result)) { // failed to upload current file
currentFailed();
return;
} else {
QMap<mtpRequestId, int32>::iterator dcIt = dcMap.find(requestId);
if (dcIt == dcMap.cend()) { // must not happen
currentFailed();
return;
}
int32 dc = dcIt.value();
dcMap.erase(dcIt);
int32 sentPartSize = 0;
Queue::const_iterator k = queue.constFind(uploading);
if (i != requestsSent.cend()) {
sentPartSize = i.value().size();
requestsSent.erase(i);
} else {
sentPartSize = k->docPartSize;
docRequestsSent.erase(j);
}
sentSize -= sentPartSize;
sentSizes[dc] -= sentPartSize;
if (k->type() == PreparePhoto) {
k->fileSentSize += sentPartSize;
PhotoData *photo = App::photo(k->id());
if (photo->uploading() && k->file) {
photo->uploadingData->size = k->file->partssize;
photo->uploadingData->offset = k->fileSentSize;
}
emit photoProgress(k.key());
} else if (k->type() == PrepareDocument || k->type() == PrepareAudio) {
DocumentData *doc = App::document(k->id());
if (doc->uploading()) {
doc->uploadOffset = (k->docSentParts - docRequestsSent.size()) * k->docPartSize;
if (doc->uploadOffset > doc->size) {
doc->uploadOffset = doc->size;
}
}
emit documentProgress(k.key());
}
}
}
sendNext();
}