MEPP2 Project
DialogDecompressionValence1.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 #include "ui_DialogDecompressionValence1.h"
13 
14 #include <QFileDialog>
15 
19 {
20  ui->setupUi(this);
21  connect(
22  ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFilename()));
23 
24  // ---
25 
26  ui->verticalLayout->addWidget(helpButton, 0, Qt::AlignRight);
27  QObject::connect( helpButton, SIGNAL(clicked(bool)), this, SLOT(onHelpTriggered()) );
28 
29  link = "https://liris.cnrs.fr/mepp/doc/nightly/_filter_decompression_valence.html";
30 }
34 void
36  const std::string &p3dFilePath,
37  int stop_level,
38  bool write_info,
39  bool write_intermediate_meshes,
40  bool display_intermediate_meshes)
41 {
42  Qt::CheckState write_info_state =
43  write_info ? Qt::CheckState::Checked : Qt::CheckState::Unchecked;
44  Qt::CheckState write_intermediate_meshes_state =
45  write_intermediate_meshes ? Qt::CheckState::Checked
46  : Qt::CheckState::Unchecked;
47  Qt::CheckState display_intermediate_meshes_state =
48  display_intermediate_meshes ? Qt::CheckState::Checked
49  : Qt::CheckState::Unchecked;
50 
51  ui->p3dFilePath->setText(QString::fromStdString(p3dFilePath));
52  ui->stop_level->setText(QString::number(stop_level));
53  ui->write_information->setCheckState(write_info_state);
54  ui->write_intermediate_meshes->setCheckState(write_intermediate_meshes_state);
55  ui->display_intermediate_meshes->setCheckState(
56  display_intermediate_meshes_state);
57 }
59 void
61  std::string &p3dFilePath,
62  int &stop_level,
63  bool &write_info,
64  bool &write_intermediate_meshes,
65  bool &display_intermediate_meshes)
66 {
67  p3dFilePath = ui->p3dFilePath->text().toStdString();
68  // remove starting and finishing quotes if present
69  if(p3dFilePath.front() == '"' && p3dFilePath.back() == '"')
70  {
71  p3dFilePath.pop_back();
72  p3dFilePath.erase(0, 1);
73  }
74 #ifdef WIN32
75  // replace '\' in windows path with '/'
76  std::replace(p3dFilePath.begin(), p3dFilePath.end(), '\\', '/');
77 #endif
78 
79  stop_level = ui->stop_level->text().toInt();
80  write_info = ui->write_information->isChecked();
81  write_intermediate_meshes = ui->write_intermediate_meshes->isChecked();
82  display_intermediate_meshes = ui->display_intermediate_meshes->isChecked();
83 }
85 void
87 {
88  QString filename =
89  QFileDialog::getOpenFileName(this,
90  tr("Open File"),
91  ui->p3dFilePath->text(),
92  tr("P3D files (*.p3d);;All files (*)"),
93  0,
94  QFileDialog::DontUseNativeDialog);
95 
96  if(!filename.isEmpty())
97  ui->p3dFilePath->setText(filename);
98 }
FEVV::DialogDecompressionValence1::ui
Ui::DialogDecompressionValence1 * ui
Definition: DialogDecompressionValence1.h:48
FEVV::DialogDecompressionValence1::setDecompressionValenceParams
void setDecompressionValenceParams(const std::string &p3dFilePath, int stop_level, bool write_info, bool write_intermediate_meshes, bool display_intermediate_meshes)
Definition: DialogDecompressionValence1.cpp:35
FEVV::DialogDecompressionValence1::DialogDecompressionValence1
DialogDecompressionValence1(QWidget *parent=0)
Definition: DialogDecompressionValence1.cpp:17
tr
double tr(double &n)
Truncate a number to 1/1000 (only if BOOLEAN_OPERATIONS_DEBUG is enable)
Definition: boolops_definitions.hpp:127
FEVV::DialogDecompressionValence1::getDecompressionValenceParams
void getDecompressionValenceParams(std::string &p3dFilePath, int &stop_level, bool &write_info, bool &write_intermediate_meshes, bool &display_intermediate_meshes)
Definition: DialogDecompressionValence1.cpp:60
FEVV::DialogDecompressionValence1::~DialogDecompressionValence1
~DialogDecompressionValence1()
Definition: DialogDecompressionValence1.cpp:32
FEVV::BasePluginDialogQt::helpButton
QPushButton * helpButton
Definition: BasePluginDialogQt.h:61
FEVV::DialogDecompressionValence1::selectFilename
void selectFilename()
Definition: DialogDecompressionValence1.cpp:86
FEVV::BasePluginDialogQt::link
QString link
Definition: BasePluginDialogQt.h:63
Ui
Definition: DialogBooleanOperations1.h:17
DialogDecompressionValence1.h
FEVV::DialogDecompressionValence1
Definition: DialogDecompressionValence1.h:23
FEVV::DialogDecompressionValence1::onHelpTriggered
void onHelpTriggered()
Definition: DialogDecompressionValence1.h:45
FEVV::BasePluginDialogQt
This class is intended to provide a help message to plugins dialogs.
Definition: BasePluginDialogQt.h:29