ExportDialog.cpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of the Universite de Sherbrooke nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00028 #include "rtabmap/gui/ExportDialog.h"
00029 #include "ui_exportDialog.h"
00030 
00031 #include <QFileDialog>
00032 #include <QPushButton>
00033 
00034 namespace rtabmap {
00035 
00036 ExportDialog::ExportDialog(QWidget * parent) :
00037         QDialog(parent)
00038 {
00039         _ui = new Ui_ExportDialog();
00040         _ui->setupUi(this);
00041 
00042         connect(_ui->toolButton_path, SIGNAL(clicked()), this, SLOT(getPath()));
00043 
00044         restoreDefaults();
00045         connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
00046 
00047         connect(_ui->spinBox_ignored, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
00048         connect(_ui->doubleSpinBox_framerate, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00049         connect(_ui->spinBox_session, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
00050         connect(_ui->checkBox_rgb, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00051         connect(_ui->checkBox_depth, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00052         connect(_ui->checkBox_depth2d, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00053         connect(_ui->checkBox_odom, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00054         connect(_ui->checkBox_userData, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00055 
00056         _ui->lineEdit_path->setText(QDir::currentPath()+QDir::separator()+"output.db");
00057 }
00058 
00059 ExportDialog::~ExportDialog()
00060 {
00061         delete _ui;
00062 }
00063 
00064 void ExportDialog::saveSettings(QSettings & settings, const QString & group) const
00065 {
00066         if(!group.isEmpty())
00067         {
00068                 settings.beginGroup(group);
00069         }
00070         settings.setValue("framesIgnored", this->framesIgnored());
00071         settings.setValue("targetFramerate", this->targetFramerate());
00072         settings.setValue("sessionExported", this->sessionExported());
00073         settings.setValue("rgbExported", this->isRgbExported());
00074         settings.setValue("depthExported", this->isDepthExported());
00075         settings.setValue("depth2dExported", this->isDepth2dExported());
00076         settings.setValue("odomExported", this->isOdomExported());
00077         settings.setValue("userDataExported", this->isUserDataExported());
00078         if(!group.isEmpty())
00079         {
00080                 settings.endGroup();
00081         }
00082 }
00083 
00084 void ExportDialog::loadSettings(QSettings & settings, const QString & group)
00085 {
00086         if(!group.isEmpty())
00087         {
00088                 settings.beginGroup(group);
00089         }
00090         _ui->spinBox_ignored->setValue(settings.value("framesIgnored", this->framesIgnored()).toInt());
00091         _ui->doubleSpinBox_framerate->setValue(settings.value("targetFramerate", this->targetFramerate()).toDouble());
00092         _ui->spinBox_session->setValue(settings.value("sessionExported", this->sessionExported()).toInt());
00093         _ui->checkBox_rgb->setChecked(settings.value("rgbExported", this->isRgbExported()).toBool());
00094         _ui->checkBox_depth->setChecked(settings.value("depthExported", this->isDepthExported()).toBool());
00095         _ui->checkBox_depth2d->setChecked(settings.value("depth2dExported", this->isDepth2dExported()).toBool());
00096         _ui->checkBox_odom->setChecked(settings.value("odomExported", this->isOdomExported()).toBool());
00097         _ui->checkBox_userData->setChecked(settings.value("userDataExported", this->isUserDataExported()).toBool());
00098         if(!group.isEmpty())
00099         {
00100                 settings.endGroup();
00101         }
00102 }
00103 
00104 void ExportDialog::restoreDefaults()
00105 {
00106         _ui->spinBox_ignored->setValue(0);
00107         _ui->doubleSpinBox_framerate->setValue(0);
00108         _ui->spinBox_session->setValue(-1);
00109         _ui->checkBox_rgb->setChecked(true);
00110         _ui->checkBox_depth->setChecked(true);
00111         _ui->checkBox_depth2d->setChecked(true);
00112         _ui->checkBox_odom->setChecked(true);
00113         _ui->checkBox_userData->setChecked(false);
00114 }
00115 
00116 void ExportDialog::getPath()
00117 {
00118         QString path = QFileDialog::getSaveFileName(this, tr("Output database path..."), _ui->lineEdit_path->text(), tr("RTAB-Map database (*.db)"));
00119         if(!path.isEmpty())
00120         {
00121                 _ui->lineEdit_path->setText(path);
00122         }
00123 }
00124 
00125 QString ExportDialog::outputPath() const
00126 {
00127         return _ui->lineEdit_path->text();
00128 }
00129 
00130 int ExportDialog::framesIgnored() const
00131 {
00132         return _ui->spinBox_ignored->value();
00133 }
00134 
00135 double ExportDialog::targetFramerate() const
00136 {
00137         return _ui->doubleSpinBox_framerate->value();
00138 }
00139 
00140 int ExportDialog::sessionExported() const
00141 {
00142         return _ui->spinBox_session->value();
00143 }
00144 
00145 bool ExportDialog::isRgbExported() const
00146 {
00147         return _ui->checkBox_rgb->isChecked();
00148 }
00149 
00150 bool ExportDialog::isDepthExported() const
00151 {
00152         return _ui->checkBox_depth->isChecked();
00153 }
00154 
00155 bool ExportDialog::isDepth2dExported() const
00156 {
00157         return _ui->checkBox_depth2d->isChecked();
00158 }
00159 
00160 bool ExportDialog::isOdomExported() const
00161 {
00162         return _ui->checkBox_odom->isChecked();
00163 }
00164 
00165 bool ExportDialog::isUserDataExported() const
00166 {
00167         return _ui->checkBox_userData->isChecked();
00168 }
00169 
00170 }


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:19