| 1 |
//########################################################################## |
| 2 |
//# # |
| 3 |
//# CLOUDCOMPARE PLUGIN: qFacets # |
| 4 |
//# # |
| 5 |
//# This program is free software; you can redistribute it and/or modify # |
| 6 |
//# it under the terms of the GNU General Public License as published by # |
| 7 |
//# the Free Software Foundation; version 2 or later of the License. # |
| 8 |
//# # |
| 9 |
//# This program is distributed in the hope that it will be useful, # |
| 10 |
//# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
| 11 |
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
| 12 |
//# GNU General Public License for more details. # |
| 13 |
//# # |
| 14 |
//# COPYRIGHT: Thomas Dewez, BRGM # |
| 15 |
//# # |
| 16 |
//########################################################################## |
| 17 |
|
| 18 |
#include "facetsExportDlg.h" |
| 19 |
|
| 20 |
//Qt |
| 21 |
#include <QFileDialog> |
| 22 |
|
| 23 |
//System |
| 24 |
#include <assert.h> |
| 25 |
|
| 26 |
FacetsExportDlg::FacetsExportDlg(IOMode mode, QWidget* parent) |
| 27 |
: QDialog(parent, Qt::Tool) |
| 28 |
, Ui::FacetsExportDlg() |
| 29 |
, m_mode(mode) |
| 30 |
{ |
| 31 |
setupUi(this); |
| 32 |
|
| 33 |
connect(browseToolButton, &QAbstractButton::clicked, this, &FacetsExportDlg::browseDestination); |
| 34 |
} |
| 35 |
|
| 36 |
void FacetsExportDlg::browseDestination() |
| 37 |
{ |
| 38 |
QString saveFileFilter; |
| 39 |
switch(m_mode) |
| 40 |
{ |
| 41 |
case SHAPE_FILE_IO: |
| 42 |
saveFileFilter = "Shapefile (*.shp)"; |
| 43 |
break; |
| 44 |
case ASCII_FILE_IO: |
| 45 |
saveFileFilter = "ASCII table (*.csv)"; |
| 46 |
break; |
| 47 |
default: |
| 48 |
assert(false); |
| 49 |
return; |
| 50 |
} |
| 51 |
|
| 52 |
//open file saving dialog |
| 53 |
QString outputFilename = QFileDialog::getSaveFileName(nullptr, "Select destination", destinationPathLineEdit->text(), saveFileFilter); |
| 54 |
|
| 55 |
if (outputFilename.isEmpty()) |
| 56 |
return; |
| 57 |
|
| 58 |
destinationPathLineEdit->setText(outputFilename); |
| 59 |
} |