OGS
GeoOnMeshMappingDialog.cpp
Go to the documentation of this file.
1 
15 #include "GeoOnMeshMappingDialog.h"
16 
17 #include "Base/OGSError.h"
18 #include "MeshLib/Mesh.h"
19 
21  std::vector<std::unique_ptr<MeshLib::Mesh>> const& mesh_vec,
22  QDialog* parent)
23  : QDialog(parent), _new_geo_name("")
24 {
25  setupUi(this);
26 
27  for (const auto& mesh : mesh_vec)
28  {
29  this->meshNameComboBox->addItem(
30  QString::fromStdString(mesh->getName()));
31  }
32 }
33 
35 
37 {
38  return this->meshNameComboBox->currentIndex();
39 }
40 
42 {
43  if (idx == 1)
44  {
45  this->normalMappingButton->setChecked(true);
46  }
47 
48  bool is_enabled(idx != 1);
49  this->normalMappingButton->setEnabled(is_enabled);
50  this->advancedMappingButton->setEnabled(is_enabled);
51  this->geoNameEdit->setEnabled(is_enabled &&
52  this->advancedMappingButton->isChecked());
53 }
54 
56 {
57  if (this->advancedMappingButton->isChecked())
58  {
59  _new_geo_name = this->geoNameEdit->text().toStdString();
60  if (_new_geo_name.empty())
61  {
62  OGSError::box("Please enter name for new geometry.");
63  return;
64  }
65  }
66  this->done(QDialog::Accepted);
67 }
Definition of the GeoOnMeshMappingDialog class.
Definition of the Mesh class.
Definition of the OGSError class.
GeoOnMeshMappingDialog(std::vector< std::unique_ptr< MeshLib::Mesh >> const &mesh_vec, QDialog *parent=nullptr)
void on_meshNameComboBox_currentIndexChanged(int idx)
~GeoOnMeshMappingDialog() override
void accept() override
Instructions if the OK-Button has been pressed.
static void box(const QString &e)
Definition: OGSError.cpp:23