27 : QDialog(parent), _mesh(mesh)
37 QString file_type(
"VTK Unstructured Grid (*.vtu)");
39 file_type.append(
";;Legacy geometry file (*.msh)");
42 QString
const file_name = QFileDialog::getSaveFileName(
49 if (!file_name.isEmpty())
51 this->fileNameEdit->setText(file_name);
60 this->compressionCheckBox->setChecked(
false);
61 this->compressionCheckBox->setEnabled(
false);
62 this->compressionLabel->setEnabled(
false);
66 this->compressionCheckBox->setEnabled(
true);
67 this->compressionLabel->setEnabled(
true);
73 QString
const& file_name(this->fileNameEdit->text());
74 if (file_name.isEmpty())
80 QFileInfo fi(file_name);
81 if (fi.suffix().toLower() ==
"vtu")
83 int dataMode = this->dataModeBox->currentIndex();
84 bool compress(this->compressionCheckBox->isChecked());
88 if (fi.suffix().toLower() ==
"msh")
93 file_name.toStdString());
97 this->done(QDialog::Accepted);
Manages the last directory used for saving a file.
Definition of the MeshIO class.
Definition of the Mesh class.
Definition of the OGSError class.
Definition of the SaveMeshDialog class.
Implementation of the VtuInterface class.
std::string writeToString()
Writes the object to a string.
static void setDir(const QString &path)
Sets the directory last used for saving a file.
static const QString getDir()
Returns the directory last used for saving a file.
Interface for handling mesh files from OGS-5 and below. (*.msh files)
void setMesh(const MeshLib::Mesh *mesh)
Set mesh for writing.
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....
bool writeToFile(std::filesystem::path const &file_path)
const std::string getName() const
Get name of the mesh.
static void box(const QString &e)
void accept() override
Instructions if the OK-Button has been pressed.
void on_dataModeBox_currentIndexChanged(int index)
void on_selectDirButton_clicked()
Selection of path to save file.
SaveMeshDialog(MeshLib::Mesh const &mesh, QDialog *parent=nullptr)
MeshLib::Mesh const & _mesh
int writeStringToFile(std::string_view content, std::filesystem::path const &file_path)