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 dataMode = this->dataModeBox->currentIndex();
73 bool compress(this->compressionCheckBox->isChecked());
77 if (fi.suffix().toLower() ==
"msh")
82 file_name.toStdString());
86 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.
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....
bool writeToFile(std::filesystem::path const &file_path)
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)