From 718b8f7eb9adca76dbb4a37733c362816ee01d71 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 26 Mar 2014 15:04:45 -0700 Subject: [PATCH] Changed back to upload either head or skeleton --- interface/src/Application.cpp | 12 ++++++++++-- interface/src/Application.h | 4 +++- interface/src/Menu.cpp | 3 ++- interface/src/Menu.h | 3 ++- libraries/shared/src/FstReader.cpp | 9 +++------ libraries/shared/src/FstReader.h | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 13c05fa702..5e0d49a94a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3512,13 +3512,21 @@ void Application::reloadAllScripts() { } } -void Application::uploadFST() { - FstReader reader; +void Application::uploadFST(bool isHead) { + FstReader reader(isHead); if (reader.zip()) { reader.send(); } } +void Application::uploadHead() { + uploadFST(true); +} + +void Application::uploadSkeleton() { + uploadFST(false); +} + void Application::removeScriptName(const QString& fileNameString) { _activeScripts.removeOne(fileNameString); } diff --git a/interface/src/Application.h b/interface/src/Application.h index 15778f2a17..6350d1b63e 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -261,7 +261,9 @@ public slots: void stopAllScripts(); void reloadAllScripts(); - void uploadFST(); + void uploadFST(bool isHead); + void uploadHead(); + void uploadSkeleton(); private slots: void timer(); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 30be26ee96..d9dcb23b77 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -144,7 +144,8 @@ Menu::Menu() : SLOT(goTo())); addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model"); - addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadFST, 0, Application::getInstance(), SLOT(uploadFST())); + addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadHead, 0, Application::getInstance(), SLOT(uploadHead())); + addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadSkeleton, 0, Application::getInstance(), SLOT(uploadSkeleton())); addDisabledActionAndSeparator(fileMenu, "Settings"); addActionToQMenuAndActionHash(fileMenu, MenuOption::SettingsImport, 0, this, SLOT(importSettings())); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 9452ba220d..25810f0bdd 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -298,7 +298,8 @@ namespace MenuOption { const QString StopAllScripts = "Stop All Scripts"; const QString TestPing = "Test Ping"; const QString TransmitterDrive = "Transmitter Drive"; - const QString UploadFST = "Upload FST file"; + const QString UploadHead = "Upload Head Model"; + const QString UploadSkeleton = "Upload Skeleton Model"; const QString Visage = "Visage"; const QString Quit = "Quit"; const QString Voxels = "Voxels"; diff --git a/libraries/shared/src/FstReader.cpp b/libraries/shared/src/FstReader.cpp index 0fb9c46458..551731a542 100644 --- a/libraries/shared/src/FstReader.cpp +++ b/libraries/shared/src/FstReader.cpp @@ -25,17 +25,16 @@ static const QString NAME_FIELD = "name"; static const QString FILENAME_FIELD = "filename"; static const QString TEXDIR_FIELD = "texdir"; static const QString LOD_FIELD = "lod"; -static const QString HEAD_SPECIFIC_FIELD = "bs"; static const QString MODEL_URL = "/api/v1/models"; static const int MAX_SIZE = 10 * 1024 * 1024; // 10 MB -FstReader::FstReader() : +FstReader::FstReader(bool isHead) : _lodCount(-1), _texturesCount(-1), _totalSize(0), - _isHead(false), + _isHead(isHead), _readyToSend(false), _dataMultiPart(new QHttpMultiPart(QHttpMultiPart::FormDataType)) { @@ -95,9 +94,7 @@ bool FstReader::zip() { } // according to what is read, we modify the command - if (line[1] == HEAD_SPECIFIC_FIELD) { - _isHead = true; - } else if (line[1] == NAME_FIELD) { + if (line[0] == NAME_FIELD) { QHttpPart textPart; textPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data;" " name=\"model_name\""); diff --git a/libraries/shared/src/FstReader.h b/libraries/shared/src/FstReader.h index 1d9da71641..d06742810b 100644 --- a/libraries/shared/src/FstReader.h +++ b/libraries/shared/src/FstReader.h @@ -16,7 +16,7 @@ class QHttpMultiPart; class FstReader { public: - FstReader(); + FstReader(bool isHead); ~FstReader(); bool zip();