ExportDialog.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
29 #include "ui_exportDialog.h"
30 
31 #include <QFileDialog>
32 #include <QPushButton>
33 
34 namespace rtabmap {
35 
36 ExportDialog::ExportDialog(QWidget * parent) :
37  QDialog(parent)
38 {
39  _ui = new Ui_ExportDialog();
40  _ui->setupUi(this);
41 
42  connect(_ui->toolButton_path, SIGNAL(clicked()), this, SLOT(getPath()));
43 
45  connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
46 
47  connect(_ui->spinBox_ignored, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
48  connect(_ui->doubleSpinBox_framerate, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
49  connect(_ui->spinBox_session, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
50  connect(_ui->checkBox_rgb, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
51  connect(_ui->checkBox_depth, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
52  connect(_ui->checkBox_depth2d, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
53  connect(_ui->checkBox_odom, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
54  connect(_ui->checkBox_userData, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
55 
56  _ui->lineEdit_path->setText(QDir::currentPath()+QDir::separator()+"output.db");
57 }
58 
60 {
61  delete _ui;
62 }
63 
64 void ExportDialog::saveSettings(QSettings & settings, const QString & group) const
65 {
66  if(!group.isEmpty())
67  {
68  settings.beginGroup(group);
69  }
70  settings.setValue("framesIgnored", this->framesIgnored());
71  settings.setValue("targetFramerate", this->targetFramerate());
72  settings.setValue("sessionExported", this->sessionExported());
73  settings.setValue("rgbExported", this->isRgbExported());
74  settings.setValue("depthExported", this->isDepthExported());
75  settings.setValue("depth2dExported", this->isDepth2dExported());
76  settings.setValue("odomExported", this->isOdomExported());
77  settings.setValue("userDataExported", this->isUserDataExported());
78  if(!group.isEmpty())
79  {
80  settings.endGroup();
81  }
82 }
83 
84 void ExportDialog::loadSettings(QSettings & settings, const QString & group)
85 {
86  if(!group.isEmpty())
87  {
88  settings.beginGroup(group);
89  }
90  _ui->spinBox_ignored->setValue(settings.value("framesIgnored", this->framesIgnored()).toInt());
91  _ui->doubleSpinBox_framerate->setValue(settings.value("targetFramerate", this->targetFramerate()).toDouble());
92  _ui->spinBox_session->setValue(settings.value("sessionExported", this->sessionExported()).toInt());
93  _ui->checkBox_rgb->setChecked(settings.value("rgbExported", this->isRgbExported()).toBool());
94  _ui->checkBox_depth->setChecked(settings.value("depthExported", this->isDepthExported()).toBool());
95  _ui->checkBox_depth2d->setChecked(settings.value("depth2dExported", this->isDepth2dExported()).toBool());
96  _ui->checkBox_odom->setChecked(settings.value("odomExported", this->isOdomExported()).toBool());
97  _ui->checkBox_userData->setChecked(settings.value("userDataExported", this->isUserDataExported()).toBool());
98  if(!group.isEmpty())
99  {
100  settings.endGroup();
101  }
102 }
103 
105 {
106  _ui->spinBox_ignored->setValue(0);
107  _ui->doubleSpinBox_framerate->setValue(0);
108  _ui->spinBox_session->setValue(-1);
109  _ui->checkBox_rgb->setChecked(true);
110  _ui->checkBox_depth->setChecked(true);
111  _ui->checkBox_depth2d->setChecked(true);
112  _ui->checkBox_odom->setChecked(true);
113  _ui->checkBox_userData->setChecked(false);
114 }
115 
117 {
118  QString path = QFileDialog::getSaveFileName(this, tr("Output database path..."), _ui->lineEdit_path->text(), tr("RTAB-Map database (*.db)"));
119  if(!path.isEmpty())
120  {
121  _ui->lineEdit_path->setText(path);
122  }
123 }
124 
126 {
127  return _ui->lineEdit_path->text();
128 }
129 
131 {
132  return _ui->spinBox_ignored->value();
133 }
134 
136 {
137  return _ui->doubleSpinBox_framerate->value();
138 }
139 
141 {
142  return _ui->spinBox_session->value();
143 }
144 
146 {
147  return _ui->checkBox_rgb->isChecked();
148 }
149 
151 {
152  return _ui->checkBox_depth->isChecked();
153 }
154 
156 {
157  return _ui->checkBox_depth2d->isChecked();
158 }
159 
161 {
162  return _ui->checkBox_odom->isChecked();
163 }
164 
166 {
167  return _ui->checkBox_userData->isChecked();
168 }
169 
170 }
int sessionExported() const
bool isDepthExported() const
void saveSettings(QSettings &settings, const QString &group) const
double targetFramerate() const
bool isDepth2dExported() const
int framesIgnored() const
QString outputPath() const
ExportDialog(QWidget *parent=0)
bool isUserDataExported() const
bool isRgbExported() const
bool isOdomExported() const
Ui_ExportDialog * _ui
Definition: ExportDialog.h:70
void loadSettings(QSettings &settings, const QString &group)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:34:58