mirror of
https://github.com/overte-org/overte.git
synced 2025-07-29 07:10:15 +02:00
Changed FstReader name to ModelUploader
This commit is contained in:
parent
3bb6d9b3b3
commit
ba4ccc22ef
3 changed files with 23 additions and 22 deletions
|
@ -63,7 +63,7 @@
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
#include <OctreeSceneStats.h>
|
#include <OctreeSceneStats.h>
|
||||||
#include <LocalVoxelsList.h>
|
#include <LocalVoxelsList.h>
|
||||||
#include <FstReader.h>
|
#include <ModelUploader.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "InterfaceVersion.h"
|
#include "InterfaceVersion.h"
|
||||||
|
@ -3244,9 +3244,9 @@ void Application::toggleRunningScriptsWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::uploadFST(bool isHead) {
|
void Application::uploadFST(bool isHead) {
|
||||||
FstReader reader(isHead);
|
ModelUploader* uploader = new ModelUploader(isHead);
|
||||||
if (reader.zip()) {
|
if (uploader->zip()) {
|
||||||
reader.send();
|
uploader->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// FstReader.cpp
|
// ModelUploader.cpp
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Clément Brisset on 3/4/14.
|
// Created by Clément Brisset on 3/4/14.
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "AccountManager.h"
|
#include "AccountManager.h"
|
||||||
#include "FstReader.h"
|
#include "ModelUploader.h"
|
||||||
|
|
||||||
|
|
||||||
static const QString NAME_FIELD = "name";
|
static const QString NAME_FIELD = "name";
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
FstReader::FstReader(bool isHead) :
|
ModelUploader::ModelUploader(bool isHead) :
|
||||||
_zipDir(new TemporaryDir()),
|
_zipDir(new TemporaryDir()),
|
||||||
_lodCount(-1),
|
_lodCount(-1),
|
||||||
_texturesCount(-1),
|
_texturesCount(-1),
|
||||||
|
@ -51,11 +51,11 @@ FstReader::FstReader(bool isHead) :
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FstReader::~FstReader() {
|
ModelUploader::~ModelUploader() {
|
||||||
delete _dataMultiPart;
|
delete _dataMultiPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FstReader::zip() {
|
bool ModelUploader::zip() {
|
||||||
// File Dialog
|
// File Dialog
|
||||||
QString filename = QFileDialog::getOpenFileName(NULL,
|
QString filename = QFileDialog::getOpenFileName(NULL,
|
||||||
"Select your .fst file ...",
|
"Select your .fst file ...",
|
||||||
|
@ -167,7 +167,7 @@ bool FstReader::zip() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FstReader::send() {
|
bool ModelUploader::send() {
|
||||||
if (!_readyToSend) {
|
if (!_readyToSend) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -181,17 +181,18 @@ bool FstReader::send() {
|
||||||
AccountManager::getInstance().authenticatedRequest(MODEL_URL, QNetworkAccessManager::PostOperation, callbackParams, QByteArray(), _dataMultiPart);
|
AccountManager::getInstance().authenticatedRequest(MODEL_URL, QNetworkAccessManager::PostOperation, callbackParams, QByteArray(), _dataMultiPart);
|
||||||
_zipDir = NULL;
|
_zipDir = NULL;
|
||||||
_dataMultiPart = NULL;
|
_dataMultiPart = NULL;
|
||||||
|
qDebug() << "Sending model...";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FstReader::uploadSuccess(const QJsonObject& jsonResponse) {
|
void ModelUploader::uploadSuccess(const QJsonObject& jsonResponse) {
|
||||||
qDebug() << "Model sent with success to the data server.";
|
qDebug() << "Model sent with success to the data server.";
|
||||||
qDebug() << "It might take a few minute for it to appear in your model browser.";
|
qDebug() << "It might take a few minute for it to appear in your model browser.";
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FstReader::uploadFailed(QNetworkReply::NetworkError errorCode, const QString& errorString) {
|
void ModelUploader::uploadFailed(QNetworkReply::NetworkError errorCode, const QString& errorString) {
|
||||||
QMessageBox::warning(NULL,
|
QMessageBox::warning(NULL,
|
||||||
QString("ModelUploader::uploadFailed()"),
|
QString("ModelUploader::uploadFailed()"),
|
||||||
QString("Model could not be sent to the data server."),
|
QString("Model could not be sent to the data server."),
|
||||||
|
@ -200,7 +201,7 @@ void FstReader::uploadFailed(QNetworkReply::NetworkError errorCode, const QStrin
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FstReader::addTextures(const QFileInfo& texdir) {
|
bool ModelUploader::addTextures(const QFileInfo& texdir) {
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
filter << "*.png" << "*.tif" << "*.jpg" << "*.jpeg";
|
filter << "*.png" << "*.tif" << "*.jpg" << "*.jpeg";
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ bool FstReader::addTextures(const QFileInfo& texdir) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FstReader::compressFile(const QString &inFileName, const QString &outFileName) {
|
bool ModelUploader::compressFile(const QString &inFileName, const QString &outFileName) {
|
||||||
QFile inFile(inFileName);
|
QFile inFile(inFileName);
|
||||||
inFile.open(QIODevice::ReadOnly);
|
inFile.open(QIODevice::ReadOnly);
|
||||||
QByteArray buffer = inFile.readAll();
|
QByteArray buffer = inFile.readAll();
|
||||||
|
@ -253,7 +254,7 @@ bool FstReader::compressFile(const QString &inFileName, const QString &outFileNa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FstReader::addPart(const QString &path, const QString& name) {
|
bool ModelUploader::addPart(const QString &path, const QString& name) {
|
||||||
QFile* file = new QFile(path);
|
QFile* file = new QFile(path);
|
||||||
if (!file->open(QIODevice::ReadOnly)) {
|
if (!file->open(QIODevice::ReadOnly)) {
|
||||||
QMessageBox::warning(NULL,
|
QMessageBox::warning(NULL,
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// FstReader.h
|
// ModelUploader.h
|
||||||
// hifi
|
// hifi
|
||||||
//
|
//
|
||||||
// Created by Clément Brisset on 3/4/14.
|
// Created by Clément Brisset on 3/4/14.
|
||||||
|
@ -7,19 +7,19 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef __hifi__FstReader__
|
#ifndef __hifi__ModelUploader__
|
||||||
#define __hifi__FstReader__
|
#define __hifi__ModelUploader__
|
||||||
|
|
||||||
class TemporaryDir;
|
class TemporaryDir;
|
||||||
class QHttpMultiPart;
|
class QHttpMultiPart;
|
||||||
class QFileInfo;
|
class QFileInfo;
|
||||||
|
|
||||||
class FstReader : public QObject {
|
class ModelUploader : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FstReader(bool isHead);
|
ModelUploader(bool isHead);
|
||||||
~FstReader();
|
~ModelUploader();
|
||||||
|
|
||||||
bool zip();
|
bool zip();
|
||||||
bool send();
|
bool send();
|
||||||
|
@ -44,4 +44,4 @@ private:
|
||||||
bool addPart(const QString& path, const QString& name);
|
bool addPart(const QString& path, const QString& name);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__FstReader__) */
|
#endif /* defined(__hifi__ModelUploader__) */
|
Loading…
Reference in a new issue