/** * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved. * * This file is part of the QCAD project. * * QCAD is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * QCAD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with QCAD. */ include("scripts/EAction.js"); include("scripts/simple.js"); //include("scripts/Misc/MiscIO/MiscIO.js"); //include("scripts/File/File.js"); /** * SAX style XML handler. */ /** * \ingroup ecma_misc_examples_ioexamples * \class ExTxtImport * This action reads an XML file and outputs information to stderr. * This can be used as starting point for XML importers. */ function DEMImport(guiAction) { EAction.call(this, guiAction); // this.setUiOptions("DEMImport.ui"); } DEMImport.prototype = new EAction(); DEMImport.includeBasePath = includeBasePath; DEMImport.prototype.beginEvent = function() { EAction.prototype.beginEvent.call(this); var appWin = EAction.getMainWindow(); var initialPath = QDir.homePath(); var filterAll = qsTr("DEM文件") + " (*.dem);";//+ qsTr("All Files") + " (*)"; var fileDialog = new QFileDialog(appWin, qsTr("请导入DEM文件"), initialPath, ""); fileDialog.setNameFilters([ filterAll ]); fileDialog.selectNameFilter(filterAll); fileDialog.setOption(QFileDialog.DontUseNativeDialog, getDontUseNativeDialog()); fileDialog.fileMode = QFileDialog.ExistingFiles; if (!fileDialog.exec()) { destr(fileDialog); EAction.activateMainWindow(); this.terminate(); return; } var files = fileDialog.selectedFiles(); if (files.length===0) { destr(fileDialog); EAction.activateMainWindow(); this.terminate(); return; } destr(fileDialog); EAction.activateMainWindow(); var fileName = files[0]; //var file = new QFile(fileName); EAction.handleUserMessage("Starting to load file: " + fileName); };