Upload QByteArray

This commit is contained in:
EdgarPironti 2015-11-19 22:51:36 -08:00
parent 1b18d3656f
commit 1db6d0e3c1
2 changed files with 8 additions and 16 deletions

View file

@ -177,8 +177,7 @@ void RecordingScriptingInterface::saveRecording(const QString& filename) {
}
bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUrl) {
if (!getClipAtpUrl.isFunction())
if (!getClipAtpUrl.isFunction())
return false;
if (QThread::currentThread() != thread()) {
@ -192,13 +191,14 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
return false;
}
QString filename = "./temp.hfr";
recording::Clip::toFile(filename, _lastClip);
//QString filename = "./temp.hfr";
//recording::Clip::toFile(filename, _lastClip);
QUrl url{ filename };
if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) { // Here we should use the other implementation of createUpload, but we need the QByteArray of the _lastClip
//QUrl url{ filename };
//if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) {
if (auto upload = DependencyManager::get<AssetClient>()->createUpload(recording::Clip::toBuffer(_lastClip), HFR_EXTENSION)) {
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
auto filename = QFileInfo(upload->getFilename()).fileName();
QString clip_atp_url = "";
@ -215,18 +215,13 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
args << clip_atp_url;
getClipAtpUrl.call(QScriptValue(), args);
});
// start the upload now
upload->start();
return true;
}
}
return false;
}
void RecordingScriptingInterface::loadLastRecording() {
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);

View file

@ -82,9 +82,6 @@ protected:
Flag _useAttachments { false };
Flag _useSkeletonModel { false };
recording::ClipPointer _lastClip;
private:
void clipUploadFinished(AssetUpload* upload, const QString& hash);
};
#endif // hifi_RecordingScriptingInterface_h