00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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 }