Added call back to model upload.

This commit is contained in:
Atlante45 2014-04-03 16:07:25 -07:00
parent f25a8c5948
commit 3bb6d9b3b3
2 changed files with 29 additions and 2 deletions

View file

@ -172,14 +172,34 @@ bool FstReader::send() {
return false;
}
AccountManager::getInstance().authenticatedRequest(MODEL_URL, QNetworkAccessManager::PostOperation, JSONCallbackParameters(), QByteArray(), _dataMultiPart);
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "uploadSuccess";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "uploadFailed";
AccountManager::getInstance().authenticatedRequest(MODEL_URL, QNetworkAccessManager::PostOperation, callbackParams, QByteArray(), _dataMultiPart);
_zipDir = NULL;
_dataMultiPart = NULL;
qDebug() << "Model sent.";
return true;
}
void FstReader::uploadSuccess(const QJsonObject& jsonResponse) {
qDebug() << "Model sent with success to the data server.";
qDebug() << "It might take a few minute for it to appear in your model browser.";
deleteLater();
}
void FstReader::uploadFailed(QNetworkReply::NetworkError errorCode, const QString& errorString) {
QMessageBox::warning(NULL,
QString("ModelUploader::uploadFailed()"),
QString("Model could not be sent to the data server."),
QMessageBox::Ok);
qDebug() << "Model upload failed (" << errorCode << "): " << errorString;
deleteLater();
}
bool FstReader::addTextures(const QFileInfo& texdir) {
QStringList filter;
filter << "*.png" << "*.tif" << "*.jpg" << "*.jpeg";

View file

@ -12,8 +12,11 @@
class TemporaryDir;
class QHttpMultiPart;
class QFileInfo;
class FstReader : public QObject {
Q_OBJECT
public:
FstReader(bool isHead);
~FstReader();
@ -21,6 +24,10 @@ public:
bool zip();
bool send();
private slots:
void uploadSuccess(const QJsonObject& jsonResponse);
void uploadFailed(QNetworkReply::NetworkError errorCode, const QString& errorString);
private:
TemporaryDir* _zipDir;
int _lodCount;