OGS
MeshQualitySelectionDialog.cpp
Go to the documentation of this file.
1 
16 
17 #include <QFileDialog>
18 #include <QFileInfo>
19 #include <QSettings>
20 
21 #include "Base/OGSError.h"
22 
25  : QDialog(parent), _histogram_path("")
26 {
27  setupUi(this);
28  this->choiceEdges->toggle();
29 }
30 
32 
34  bool is_checked) const
35 {
36  histogramPathEdit->setEnabled(is_checked);
37  histogramPathButton->setEnabled(is_checked);
38 }
39 
41 {
42  QSettings settings;
43  QFileInfo fi(settings.value("lastOpenedFileDirectory").toString());
44  QString file_name =
45  QFileDialog::getSaveFileName(this, "Save histogram as", fi.baseName(),
46  "Text files (*.txt);;All files (* *.*)");
47  this->histogramPathEdit->setText(file_name);
48 }
49 
52 {
53  if (this->choiceEdges->isChecked())
54  {
56  }
57  else if (this->choiceArea->isChecked())
58  {
60  }
61  else if (this->choiceVolume->isChecked())
62  {
64  }
65  else if (this->choiceAngles->isChecked())
66  {
68  }
69  else if (this->choiceRadius->isChecked())
70  {
72  }
73  else
74  {
76  }
77 
78  if (this->histogramCheckBox->isChecked())
79  {
80  _histogram_path = this->histogramPathEdit->text().toStdString();
81  if (_histogram_path.empty())
82  {
83  OGSError::box("No path for histogram file specified.");
84  return;
85  }
86  }
87 
88  this->done(QDialog::Accepted);
89 }
90 
93 {
94  this->done(QDialog::Rejected);
95 }
Definition of the MshQualitySelectionDialog class.
Definition of the OGSError class.
MeshLib::MeshQualityType _metric
~MeshQualitySelectionDialog() override
void accept() override
Instructions if the OK-Button has been pressed.
MeshQualitySelectionDialog(QDialog *parent=nullptr)
Constructor.
void reject() override
Instructions if the Cancel-Button has been pressed.
void on_histogramCheckBox_toggled(bool is_checked) const
static void box(const QString &e)
Definition: OGSError.cpp:23