mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:18:12 +02:00
Code review
This commit is contained in:
parent
3be2319081
commit
e1a1ff3988
3 changed files with 19 additions and 8 deletions
|
@ -34,6 +34,16 @@ Q_DECLARE_METATYPE(JSONCallbackParameters)
|
||||||
|
|
||||||
const QString ACCOUNTS_GROUP = "accounts";
|
const QString ACCOUNTS_GROUP = "accounts";
|
||||||
|
|
||||||
|
JSONCallbackParameters::JSONCallbackParameters() :
|
||||||
|
jsonCallbackReceiver(NULL),
|
||||||
|
jsonCallbackMethod(),
|
||||||
|
errorCallbackReceiver(NULL),
|
||||||
|
errorCallbackMethod(),
|
||||||
|
updateReciever(NULL),
|
||||||
|
updateSlot()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
AccountManager::AccountManager() :
|
AccountManager::AccountManager() :
|
||||||
_authURL(),
|
_authURL(),
|
||||||
_networkAccessManager(NULL),
|
_networkAccessManager(NULL),
|
||||||
|
@ -178,8 +188,7 @@ void AccountManager::invokedRequest(const QString& path, QNetworkAccessManager::
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we ended up firing of a request, hook up to it now
|
// if we ended up firing of a request, hook up to it now
|
||||||
connect(networkReply, SIGNAL(finished()),
|
connect(networkReply, SIGNAL(finished()), SLOT(processReply()));
|
||||||
SLOT(processReply()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +217,7 @@ void AccountManager::passSuccessToCallback(QNetworkReply* requestReply) {
|
||||||
// remove the related reply-callback group from the map
|
// remove the related reply-callback group from the map
|
||||||
_pendingCallbackMap.remove(requestReply);
|
_pendingCallbackMap.remove(requestReply);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
|
if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
|
||||||
qDebug() << "Received JSON response from data-server that has no matching callback.";
|
qDebug() << "Received JSON response from data-server that has no matching callback.";
|
||||||
qDebug() << jsonResponse;
|
qDebug() << jsonResponse;
|
||||||
|
|
|
@ -19,10 +19,7 @@
|
||||||
|
|
||||||
class JSONCallbackParameters {
|
class JSONCallbackParameters {
|
||||||
public:
|
public:
|
||||||
JSONCallbackParameters() :
|
JSONCallbackParameters();
|
||||||
jsonCallbackReceiver(NULL), jsonCallbackMethod(),
|
|
||||||
errorCallbackReceiver(NULL), errorCallbackMethod(),
|
|
||||||
updateReciever(NULL), updateSlot() {};
|
|
||||||
|
|
||||||
bool isEmpty() const { return !jsonCallbackReceiver && !errorCallbackReceiver; }
|
bool isEmpty() const { return !jsonCallbackReceiver && !errorCallbackReceiver; }
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ static const int MAX_SIZE = 10 * 1024 * 1024; // 10 MB
|
||||||
static const int TIMEOUT = 1000;
|
static const int TIMEOUT = 1000;
|
||||||
static const int MAX_CHECK = 30;
|
static const int MAX_CHECK = 30;
|
||||||
|
|
||||||
|
static const int QCOMPRESS_HEADER_POSITION = 0;
|
||||||
|
static const int QCOMPRESS_HEADER_SIZE = 4;
|
||||||
|
|
||||||
ModelUploader::ModelUploader(bool isHead) :
|
ModelUploader::ModelUploader(bool isHead) :
|
||||||
_lodCount(-1),
|
_lodCount(-1),
|
||||||
|
@ -290,7 +292,10 @@ bool ModelUploader::addPart(const QString &path, const QString& name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QByteArray buffer = qCompress(file.readAll());
|
QByteArray buffer = qCompress(file.readAll());
|
||||||
buffer.remove(0, 4);
|
|
||||||
|
// Qt's qCompress() default compression level (-1) is the standard zLib compression.
|
||||||
|
// Here remove Qt's custom header that prevent the data server from uncompressing the files with zLib.
|
||||||
|
buffer.remove(QCOMPRESS_HEADER_POSITION, QCOMPRESS_HEADER_SIZE);
|
||||||
|
|
||||||
QHttpPart part;
|
QHttpPart part;
|
||||||
part.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data;"
|
part.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data;"
|
||||||
|
|
Loading…
Reference in a new issue