mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Fixes
This commit is contained in:
parent
e70f6855aa
commit
df2153186d
2 changed files with 15 additions and 8 deletions
|
@ -18,6 +18,10 @@
|
||||||
#include <recording/Frame.h>
|
#include <recording/Frame.h>
|
||||||
#include <recording/ClipCache.h>
|
#include <recording/ClipCache.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include <QtScript/QScriptValue>
|
||||||
|
#include <AssetClient.h>
|
||||||
|
#include <AssetUpload.h>
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
|
|
||||||
|
@ -176,13 +180,18 @@ void RecordingScriptingInterface::saveRecording(const QString& filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUrl) {
|
bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUrl) {
|
||||||
if (!getClipAtpUrl.isFunction())
|
if (!getClipAtpUrl.isFunction()) {
|
||||||
|
qCWarning(scriptengine) << "The argument is not a function.";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
|
bool result{ false };
|
||||||
QMetaObject::invokeMethod(this, "saveRecordingToAsset", Qt::BlockingQueuedConnection,
|
QMetaObject::invokeMethod(this, "saveRecordingToAsset", Qt::BlockingQueuedConnection,
|
||||||
Q_ARG(QScriptValue, getClipAtpUrl));
|
Q_ARG(QScriptValue, getClipAtpUrl),
|
||||||
return false;
|
Q_RETURN_ARG(bool, result));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_lastClip) {
|
if (!_lastClip) {
|
||||||
|
@ -192,7 +201,6 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
|
||||||
|
|
||||||
if (auto upload = DependencyManager::get<AssetClient>()->createUpload(recording::Clip::toBuffer(_lastClip), HFR_EXTENSION)) {
|
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 {
|
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
|
||||||
auto filename = QFileInfo(upload->getFilename()).fileName();
|
|
||||||
QString clip_atp_url = "";
|
QString clip_atp_url = "";
|
||||||
|
|
||||||
if (upload->getError() == AssetUpload::NoError) {
|
if (upload->getError() == AssetUpload::NoError) {
|
||||||
|
@ -200,7 +208,7 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
|
||||||
clip_atp_url = QString("%1:%2.%3").arg(URL_SCHEME_ATP, hash, upload->getExtension());
|
clip_atp_url = QString("%1:%2.%3").arg(URL_SCHEME_ATP, hash, upload->getExtension());
|
||||||
upload->deleteLater();
|
upload->deleteLater();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Error during the Asset upload.";
|
qCWarning(scriptengine) << "Error during the Asset upload.";
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValueList args;
|
QScriptValueList args;
|
||||||
|
@ -211,6 +219,7 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCWarning(scriptengine) << "Saving on asset failed.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
#include <recording/Forward.h>
|
#include <recording/Forward.h>
|
||||||
#include <recording/Frame.h>
|
#include <recording/Frame.h>
|
||||||
|
|
||||||
#include <QtScript/QScriptValue>
|
class QScriptValue;
|
||||||
#include <AssetClient.h>
|
|
||||||
#include <AssetUpload.h>
|
|
||||||
|
|
||||||
class RecordingScriptingInterface : public QObject, public Dependency {
|
class RecordingScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in a new issue