mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
Change text in case of drag and drop.
This commit is contained in:
parent
4265ddbd0e
commit
03efde5b3c
4 changed files with 19 additions and 12 deletions
|
@ -252,7 +252,7 @@ Window {
|
||||||
}
|
}
|
||||||
uploadOpen = true;
|
uploadOpen = true;
|
||||||
|
|
||||||
function doUpload(url) {
|
function doUpload(url, dropping) {
|
||||||
var fileUrl = fileDialogHelper.urlToPath(url);
|
var fileUrl = fileDialogHelper.urlToPath(url);
|
||||||
|
|
||||||
var path = assetProxyModel.data(treeView.selection.currentIndex, 0x100);
|
var path = assetProxyModel.data(treeView.selection.currentIndex, 0x100);
|
||||||
|
@ -290,11 +290,11 @@ Window {
|
||||||
uploadButton.enabled = true;
|
uploadButton.enabled = true;
|
||||||
uploadOpen = false;
|
uploadOpen = false;
|
||||||
}
|
}
|
||||||
});
|
}, dropping);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileUrl) {
|
if (fileUrl) {
|
||||||
doUpload(fileUrl);
|
doUpload(fileUrl, true);
|
||||||
} else {
|
} else {
|
||||||
var browser = desktop.fileDialog({
|
var browser = desktop.fileDialog({
|
||||||
selectDirectory: false,
|
selectDirectory: false,
|
||||||
|
@ -305,7 +305,7 @@ Window {
|
||||||
});
|
});
|
||||||
browser.selectedFile.connect(function(url) {
|
browser.selectedFile.connect(function(url) {
|
||||||
currentDirectory = browser.dir;
|
currentDirectory = browser.dir;
|
||||||
doUpload(url);
|
doUpload(url, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4460,11 +4460,13 @@ void Application::toggleAssetServerWidget(QString filePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QUrl url("AssetServer.qml");
|
static const QUrl url("AssetServer.qml");
|
||||||
auto urlSetter = [=](QQmlContext* context, QObject* newObject){
|
auto startUpload = [=](QQmlContext* context, QObject* newObject){
|
||||||
emit uploadRequest(filePath);
|
if (!filePath.isEmpty()) {
|
||||||
|
emit uploadRequest(filePath);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", urlSetter);
|
DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload);
|
||||||
emit uploadRequest(filePath);
|
startUpload(nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::packageModel() {
|
void Application::packageModel() {
|
||||||
|
|
|
@ -59,13 +59,18 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback
|
||||||
request->start();
|
request->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue startedCallback, QJSValue completedCallback) {
|
void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue startedCallback, QJSValue completedCallback, bool dropEvent) {
|
||||||
static const QString helpText =
|
static const QString helpText =
|
||||||
"Upload your asset to a specific folder by entering the full path. Specifying "
|
"Upload your asset to a specific folder by entering the full path. Specifying\n"
|
||||||
"a new folder name will automatically create that folder for you.";
|
"a new folder name will automatically create that folder for you.";
|
||||||
|
static const QString dropHelpText =
|
||||||
|
"This file will be added to your Asset Server.\n"
|
||||||
|
"Use the field below to place your file in a specific folder or to rename it.\n"
|
||||||
|
"Specifying a new folder name will automatically create that folder for you.";
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
auto result = offscreenUi->inputDialog(OffscreenUi::ICON_INFORMATION, "Specify Asset Path", helpText, mapping);
|
auto result = offscreenUi->inputDialog(OffscreenUi::ICON_INFORMATION, "Specify Asset Path",
|
||||||
|
dropEvent ? dropHelpText : helpText, mapping);
|
||||||
|
|
||||||
if (!result.isValid()) {
|
if (!result.isValid()) {
|
||||||
completedCallback.call({ -1 });
|
completedCallback.call({ -1 });
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void setMapping(QString path, QString hash, QJSValue callback = QJSValue());
|
Q_INVOKABLE void setMapping(QString path, QString hash, QJSValue callback = QJSValue());
|
||||||
Q_INVOKABLE void getMapping(QString path, QJSValue callback = QJSValue());
|
Q_INVOKABLE void getMapping(QString path, QJSValue callback = QJSValue());
|
||||||
Q_INVOKABLE void uploadFile(QString path, QString mapping, QJSValue startedCallback = QJSValue(), QJSValue completedCallback = QJSValue());
|
Q_INVOKABLE void uploadFile(QString path, QString mapping, QJSValue startedCallback = QJSValue(), QJSValue completedCallback = QJSValue(), bool dropEvent = false);
|
||||||
Q_INVOKABLE void deleteMappings(QStringList paths, QJSValue callback);
|
Q_INVOKABLE void deleteMappings(QStringList paths, QJSValue callback);
|
||||||
Q_INVOKABLE void deleteMapping(QString path, QJSValue callback) { deleteMappings(QStringList(path), callback = QJSValue()); }
|
Q_INVOKABLE void deleteMapping(QString path, QJSValue callback) { deleteMappings(QStringList(path), callback = QJSValue()); }
|
||||||
Q_INVOKABLE void getAllMappings(QJSValue callback = QJSValue());
|
Q_INVOKABLE void getAllMappings(QJSValue callback = QJSValue());
|
||||||
|
|
Loading…
Reference in a new issue