mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Fix drag&drop
This commit is contained in:
parent
17e5b441cf
commit
4a90ec303c
4 changed files with 26 additions and 20 deletions
|
@ -45,6 +45,7 @@ Window {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
ApplicationInterface.uploadRequest.connect(uploadClicked);
|
||||
assetMappingsModel.errorGettingMappings.connect(handleGetMappingsError);
|
||||
reload();
|
||||
}
|
||||
|
@ -245,24 +246,14 @@ Window {
|
|||
Timer {
|
||||
id: timer
|
||||
}
|
||||
function uploadClicked() {
|
||||
function uploadClicked(fileUrl) {
|
||||
if (uploadOpen) {
|
||||
return;
|
||||
}
|
||||
uploadOpen = true;
|
||||
|
||||
var fileUrl = "";
|
||||
|
||||
var browser = desktop.fileDialog({
|
||||
selectDirectory: false,
|
||||
dir: currentDirectory
|
||||
});
|
||||
browser.canceled.connect(function() {
|
||||
uploadOpen = false;
|
||||
});
|
||||
browser.selectedFile.connect(function(url){
|
||||
function doUpload(url) {
|
||||
var fileUrl = fileDialogHelper.urlToPath(url);
|
||||
currentDirectory = browser.dir;
|
||||
|
||||
var path = assetProxyModel.data(treeView.selection.currentIndex, 0x100);
|
||||
var directory = path ? path.slice(0, path.lastIndexOf('/') + 1) : "/";
|
||||
|
@ -299,8 +290,24 @@ Window {
|
|||
uploadButton.enabled = true;
|
||||
uploadOpen = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (fileUrl) {
|
||||
doUpload(fileUrl);
|
||||
} else {
|
||||
var browser = desktop.fileDialog({
|
||||
selectDirectory: false,
|
||||
dir: currentDirectory
|
||||
});
|
||||
browser.canceled.connect(function() {
|
||||
uploadOpen = false;
|
||||
});
|
||||
browser.selectedFile.connect(function(url) {
|
||||
currentDirectory = browser.dir;
|
||||
doUpload(url);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function errorMessageBox(message) {
|
||||
|
@ -312,10 +319,6 @@ Window {
|
|||
});
|
||||
}
|
||||
|
||||
function itemSelected() {
|
||||
return treeView.selection.hasSelection()
|
||||
}
|
||||
|
||||
Item {
|
||||
width: pane.contentWidth
|
||||
height: pane.height
|
||||
|
@ -457,7 +460,6 @@ Window {
|
|||
height: 30
|
||||
width: 155
|
||||
|
||||
enabled: fileUrlTextField.text != ""
|
||||
onClicked: uploadClickedTimer.running = true
|
||||
|
||||
// For some reason trigginer an API that enters
|
||||
|
|
|
@ -4457,9 +4457,10 @@ void Application::toggleRunningScriptsWidget() {
|
|||
void Application::toggleAssetServerWidget(QString filePath) {
|
||||
static const QUrl url("AssetServer.qml");
|
||||
auto urlSetter = [=](QQmlContext* context, QObject* newObject){
|
||||
newObject->setProperty("currentFileUrl", filePath);
|
||||
emit uploadRequest(filePath);
|
||||
};
|
||||
DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", urlSetter);
|
||||
emit uploadRequest(filePath);
|
||||
}
|
||||
|
||||
void Application::packageModel() {
|
||||
|
|
|
@ -231,6 +231,8 @@ signals:
|
|||
void beforeAboutToQuit();
|
||||
void activeDisplayPluginChanged();
|
||||
|
||||
void uploadRequest(QString path);
|
||||
|
||||
public slots:
|
||||
QVector<EntityItemID> pasteEntities(float x, float y, float z);
|
||||
bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
bool isKnownMapping(QString path) const { return _pathToItemMap.contains(path); }
|
||||
bool isKnownFolder(QString path) const;
|
||||
|
||||
signals:
|
||||
void errorGettingMappings(QString errorString);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue