16 : QDialog(parent),
_mesh(mesh)
20 QString::fromStdString(
_mesh.getName()) +
26 QString file_type(
"VTK Unstructured Grid (*.vtu)");
28 file_type.append(
";;Legacy geometry file (*.msh)");
31 QString
const file_name = QFileDialog::getSaveFileName(
35 QString::fromStdString(
_mesh.getName()),
38 if (!file_name.isEmpty())
40 this->fileNameEdit->setText(file_name);
49 this->compressionCheckBox->setChecked(
false);
50 this->compressionCheckBox->setEnabled(
false);
51 this->compressionLabel->setEnabled(
false);
55 this->compressionCheckBox->setEnabled(
true);
56 this->compressionLabel->setEnabled(
true);
62 QString
const& file_name(this->fileNameEdit->text());
63 if (file_name.isEmpty())
69 QFileInfo fi(file_name);
70 if (fi.suffix().toLower() ==
"vtu")
72 int const dataMode = dataModeBox->currentIndex();
73 bool const compress(compressionCheckBox->isChecked());
75 compress, dataMode) != 0)
80 if (fi.suffix().toLower() ==
"msh")
85 file_name.toStdString());
89 this->done(QDialog::Accepted);
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.
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)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, std::set< std::string > output_variable_names, bool const use_compression, int const data_mode)