mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Started blocks download catch, fixed a debug typo
This commit is contained in:
parent
efd25a5e70
commit
d599753771
4 changed files with 35 additions and 15 deletions
|
@ -2774,6 +2774,18 @@ bool Application::importSVOFromURL(const QString& urlString) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Application::importFromZIP(const QString& filePath) {
|
||||
qDebug() << "A zip file has been dropped in: " << filePath;
|
||||
QUrl empty;
|
||||
// handle Blocks download from Marketplace
|
||||
if (filePath.contains("vr.google.com/downloads")) {
|
||||
qApp->getFileDownloadInterface()->runUnzip("", filePath, true, true);
|
||||
} else {
|
||||
qApp->getFileDownloadInterface()->runUnzip(filePath, empty, true, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::onPresent(quint32 frameCount) {
|
||||
if (shouldPaint()) {
|
||||
postEvent(this, new QEvent(static_cast<QEvent::Type>(Idle)), Qt::HighEventPriority);
|
||||
|
@ -2781,13 +2793,6 @@ void Application::onPresent(quint32 frameCount) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Application::importFromZIP(const QString& filePath) {
|
||||
qDebug() << "A zip file has been dropped in: " << filePath;
|
||||
QUrl empty;
|
||||
qApp->getFileDownloadInterface()->runUnzip(filePath, empty, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _renderRequested { false };
|
||||
|
||||
bool Application::event(QEvent* event) {
|
||||
|
|
|
@ -34,6 +34,10 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent
|
|||
|
||||
void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool isZip) {
|
||||
qCDebug(scriptengine) << "Url that was downloaded: " + url.toString();
|
||||
if ((url.toString()).contains("vr.google.com/downloads")) {
|
||||
|
||||
path = downloadBlocksZip(url);
|
||||
}
|
||||
qCDebug(scriptengine) << "Path where download is saved: " + path;
|
||||
QString fileName = "/" + path.section("/", -1);
|
||||
QString tempDir = path;
|
||||
|
@ -52,10 +56,10 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
|
|||
}
|
||||
|
||||
QStringList fileList = unzipFile(path, tempDir);
|
||||
QString filename = QUrl::fromLocalFile(fileList.first()).toString();
|
||||
//QString filename = QUrl::fromLocalFile(fileList.first()).toString();
|
||||
|
||||
if (filename != "") {
|
||||
qCDebug(scriptengine) << "File to upload: " + filename;
|
||||
if (!fileList.isEmpty()) {
|
||||
qCDebug(scriptengine) << "File to upload: " + fileList.first();
|
||||
}
|
||||
else {
|
||||
qCDebug(scriptengine) << "Unzip failed";
|
||||
|
@ -111,6 +115,18 @@ QString FileScriptingInterface::convertUrlToPath(QUrl url) {
|
|||
return newUrl;
|
||||
}
|
||||
|
||||
// handles a download from Blocks in the marketplace
|
||||
QString FileScriptingInterface::downloadBlocksZip(QUrl url) {
|
||||
qCDebug(scriptengine) << "Made it to the download blocks! " << url.toString();
|
||||
|
||||
/*auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(nullptr, url);
|
||||
connect(request, &ResourceRequest::finished, this, [this, url] {
|
||||
unzipFile(url, ""); // so intellisense isn't mad
|
||||
});
|
||||
request->send();*/
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
// this function is not in use
|
||||
void FileScriptingInterface::downloadZip(QString path, const QString link) {
|
||||
QUrl url = QUrl(link);
|
||||
|
|
|
@ -34,6 +34,7 @@ private:
|
|||
bool isTempDir(QString tempDir);
|
||||
QStringList unzipFile(QString path, QString tempDir);
|
||||
void recursiveFileScan(QFileInfo file, QString* dirName);
|
||||
QString downloadBlocksZip(QUrl url);
|
||||
void downloadZip(QString path, const QString link);
|
||||
|
||||
};
|
||||
|
|
|
@ -80,10 +80,9 @@
|
|||
|
||||
// Add button links.
|
||||
|
||||
/* Blocks not yet implemented
|
||||
$('#exploreBlocksMarketplace').on('click', function () {
|
||||
window.location = "https://vr.google.com/objects";
|
||||
});*/
|
||||
});
|
||||
$('#exploreClaraMarketplace').on('click', function () {
|
||||
window.location = "https://clara.io/library?gameCheck=true&public=true";
|
||||
});
|
||||
|
@ -157,7 +156,7 @@
|
|||
|
||||
// One file request at a time.
|
||||
if (isPreparing) {
|
||||
console.log("WARNIKNG: Clara.io FBX: Prepare only one download at a time");
|
||||
console.log("WARNING: Clara.io FBX: Prepare only one download at a time");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,6 @@
|
|||
if (location.href.indexOf("google.com/") !== -1) { pageType = BLOCKS; }
|
||||
if (location.href.indexOf("clara.io/") !== -1) { pageType = CLARA; }
|
||||
|
||||
//if (pageType != BLOCKS)
|
||||
injectCommonCode(pageType === DIRECTORY);
|
||||
switch (pageType) {
|
||||
case DIRECTORY:
|
||||
|
@ -358,7 +356,7 @@
|
|||
break;
|
||||
case BLOCKS:
|
||||
console.log("in Blocks");
|
||||
//injectBlocksCode();
|
||||
injectBlocksCode();
|
||||
console.log("blocks injection");
|
||||
break;
|
||||
case CLARA:
|
||||
|
|
Loading…
Reference in a new issue