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