mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
GUI: updated Source menu check behavior, checking if "rtabmap.tmp.db" exists before deleting it (in case of another RTAB-Map is running in the same working directory)
This commit is contained in:
@@ -206,9 +206,7 @@ private:
|
|||||||
void createAndAddScanToMap(int nodeId, const Transform & pose, int mapId);
|
void createAndAddScanToMap(int nodeId, const Transform & pose, int mapId);
|
||||||
void drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords, const std::multimap<int, cv::KeyPoint> & loopWords);
|
void drawKeypoints(const std::multimap<int, cv::KeyPoint> & refWords, const std::multimap<int, cv::KeyPoint> & loopWords);
|
||||||
void setupMainLayout(bool vertical);
|
void setupMainLayout(bool vertical);
|
||||||
void updateSelectSourceImageMenu(bool used, PreferencesDialog::Src src);
|
void updateSelectSourceMenu();
|
||||||
void updateSelectSourceDatabase(bool used);
|
|
||||||
void updateSelectSourceRGBDMenu(bool used, PreferencesDialog::Src src);
|
|
||||||
|
|
||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr getAssembledCloud(
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr getAssembledCloud(
|
||||||
const std::map<int, Transform> & poses,
|
const std::map<int, Transform> & poses,
|
||||||
|
|||||||
@@ -212,9 +212,9 @@ public slots:
|
|||||||
void setDetectionRate(double value);
|
void setDetectionRate(double value);
|
||||||
void setTimeLimit(float value);
|
void setTimeLimit(float value);
|
||||||
void setSLAMMode(bool enabled);
|
void setSLAMMode(bool enabled);
|
||||||
void selectSourceImage(Src src = kSrcUndef, bool checked = true);
|
void selectSourceImage(Src src = kSrcUndef);
|
||||||
void selectSourceDatabase(bool user = false, bool checked = true);
|
void selectSourceDatabase(bool user = false);
|
||||||
void selectSourceRGBD(Src src = kSrcUndef, bool checked = true);
|
void selectSourceRGBD(Src src = kSrcUndef);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void closeDialog ( QAbstractButton * button );
|
void closeDialog ( QAbstractButton * button );
|
||||||
|
|||||||
@@ -339,13 +339,10 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Settings menu
|
//Settings menu
|
||||||
this->updateSelectSourceImageMenu(_preferencesDialog->isSourceImageUsed(), _preferencesDialog->getSourceImageType());
|
|
||||||
connect(_ui->actionImageFiles, SIGNAL(triggered()), this, SLOT(selectImages()));
|
connect(_ui->actionImageFiles, SIGNAL(triggered()), this, SLOT(selectImages()));
|
||||||
connect(_ui->actionVideo, SIGNAL(triggered()), this, SLOT(selectVideo()));
|
connect(_ui->actionVideo, SIGNAL(triggered()), this, SLOT(selectVideo()));
|
||||||
connect(_ui->actionUsbCamera, SIGNAL(triggered()), this, SLOT(selectStream()));
|
connect(_ui->actionUsbCamera, SIGNAL(triggered()), this, SLOT(selectStream()));
|
||||||
this->updateSelectSourceDatabase(_preferencesDialog->isSourceDatabaseUsed());
|
|
||||||
connect(_ui->actionDatabase, SIGNAL(triggered()), this, SLOT(selectDatabase()));
|
connect(_ui->actionDatabase, SIGNAL(triggered()), this, SLOT(selectDatabase()));
|
||||||
this->updateSelectSourceRGBDMenu(_preferencesDialog->isSourceOpenniUsed(), _preferencesDialog->getSourceRGBD());
|
|
||||||
connect(_ui->actionOpenNI_PCL, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
connect(_ui->actionOpenNI_PCL, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
||||||
connect(_ui->actionOpenNI_PCL_ASUS, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
connect(_ui->actionOpenNI_PCL_ASUS, SIGNAL(triggered()), this, SLOT(selectOpenni()));
|
||||||
connect(_ui->actionFreenect, SIGNAL(triggered()), this, SLOT(selectFreenect()));
|
connect(_ui->actionFreenect, SIGNAL(triggered()), this, SLOT(selectFreenect()));
|
||||||
@@ -360,6 +357,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
_ui->actionOpenNI2_Sense->setEnabled(CameraOpenNI2::available());
|
_ui->actionOpenNI2_Sense->setEnabled(CameraOpenNI2::available());
|
||||||
connect(_ui->actionOpenNI2_kinect, SIGNAL(triggered()), this, SLOT(selectOpenni2()));
|
connect(_ui->actionOpenNI2_kinect, SIGNAL(triggered()), this, SLOT(selectOpenni2()));
|
||||||
_ui->actionOpenNI2_kinect->setEnabled(CameraOpenNI2::available());
|
_ui->actionOpenNI2_kinect->setEnabled(CameraOpenNI2::available());
|
||||||
|
this->updateSelectSourceMenu();
|
||||||
|
|
||||||
connect(_ui->actionSave_state, SIGNAL(triggered()), this, SLOT(saveFigures()));
|
connect(_ui->actionSave_state, SIGNAL(triggered()), this, SLOT(saveFigures()));
|
||||||
connect(_ui->actionLoad_state, SIGNAL(triggered()), this, SLOT(loadFigures()));
|
connect(_ui->actionLoad_state, SIGNAL(triggered()), this, SLOT(loadFigures()));
|
||||||
@@ -1750,20 +1748,32 @@ void MainWindow::processRtabmapEventInit(int status, const QString & info)
|
|||||||
|
|
||||||
if(_databaseUpdated)
|
if(_databaseUpdated)
|
||||||
{
|
{
|
||||||
if(!_newDatabasePath.isEmpty() && !_newDatabasePathOutput.isEmpty())
|
if(!_newDatabasePath.isEmpty())
|
||||||
{
|
{
|
||||||
if(QFile::rename(_newDatabasePath, _newDatabasePathOutput))
|
if(!_newDatabasePathOutput.isEmpty())
|
||||||
{
|
{
|
||||||
std::string msg = uFormat("Database saved to \"%s\".", _newDatabasePathOutput.toStdString().c_str());
|
if(QFile::rename(_newDatabasePath, _newDatabasePathOutput))
|
||||||
UINFO(msg.c_str());
|
{
|
||||||
QMessageBox::information(this, tr("Database saved!"), QString(msg.c_str()));
|
std::string msg = uFormat("Database saved to \"%s\".", _newDatabasePathOutput.toStdString().c_str());
|
||||||
|
UINFO(msg.c_str());
|
||||||
|
QMessageBox::information(this, tr("Database saved!"), QString(msg.c_str()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string msg = uFormat("Failed to rename temporary database from \"%s\" to \"%s\".", _newDatabasePath.toStdString().c_str(), _newDatabasePathOutput.toStdString().c_str());
|
||||||
|
UERROR(msg.c_str());
|
||||||
|
QMessageBox::critical(this, tr("Closing failed!"), QString(msg.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(QFile::remove(_newDatabasePath))
|
||||||
|
{
|
||||||
|
UINFO("Deleted temporary database \"%s\".", _newDatabasePath.toStdString().c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string msg = uFormat("Failed to rename temporary database from \"%s\" to \"%s\".", _newDatabasePath.toStdString().c_str(), _newDatabasePathOutput.toStdString().c_str());
|
UERROR("Temporary database \"%s\" could not be deleted.", _newDatabasePath.toStdString().c_str());
|
||||||
UERROR(msg.c_str());
|
|
||||||
QMessageBox::critical(this, tr("Closing failed!"), QString(msg.c_str()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!_openedDatabasePath.isEmpty())
|
else if(!_openedDatabasePath.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -1772,6 +1782,18 @@ void MainWindow::processRtabmapEventInit(int status, const QString & info)
|
|||||||
QMessageBox::information(this, tr("Database updated!"), QString(msg.c_str()));
|
QMessageBox::information(this, tr("Database updated!"), QString(msg.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(!_newDatabasePath.isEmpty())
|
||||||
|
{
|
||||||
|
// just remove temporary database;
|
||||||
|
if(QFile::remove(_newDatabasePath))
|
||||||
|
{
|
||||||
|
UINFO("Deleted temporary database \"%s\".", _newDatabasePath.toStdString().c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UERROR("Temporary database \"%s\" could not be deleted.", _newDatabasePath.toStdString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
_openedDatabasePath.clear();
|
_openedDatabasePath.clear();
|
||||||
_newDatabasePath.clear();
|
_newDatabasePath.clear();
|
||||||
_newDatabasePathOutput.clear();
|
_newDatabasePathOutput.clear();
|
||||||
@@ -1877,9 +1899,7 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
|||||||
{
|
{
|
||||||
// Camera settings...
|
// Camera settings...
|
||||||
_ui->doubleSpinBox_stats_imgRate->setValue(_preferencesDialog->getGeneralInputRate());
|
_ui->doubleSpinBox_stats_imgRate->setValue(_preferencesDialog->getGeneralInputRate());
|
||||||
this->updateSelectSourceImageMenu(_preferencesDialog->isSourceImageUsed(), _preferencesDialog->getSourceImageType());
|
this->updateSelectSourceMenu();
|
||||||
this->updateSelectSourceDatabase(_preferencesDialog->isSourceDatabaseUsed());
|
|
||||||
this->updateSelectSourceRGBDMenu(_preferencesDialog->isSourceOpenniUsed(), _preferencesDialog->getSourceRGBD());
|
|
||||||
QString src;
|
QString src;
|
||||||
if(_preferencesDialog->isSourceImageUsed())
|
if(_preferencesDialog->isSourceImageUsed())
|
||||||
{
|
{
|
||||||
@@ -2205,28 +2225,22 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
|
|||||||
return QWidget::eventFilter(obj, event);
|
return QWidget::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateSelectSourceImageMenu(bool used, PreferencesDialog::Src src)
|
void MainWindow::updateSelectSourceMenu()
|
||||||
{
|
{
|
||||||
_ui->actionUsbCamera->setChecked(used && src == PreferencesDialog::kSrcUsbDevice);
|
_ui->actionUsbCamera->setChecked(_preferencesDialog->isSourceImageUsed() && _preferencesDialog->getSourceImageType() == PreferencesDialog::kSrcUsbDevice);
|
||||||
_ui->actionImageFiles->setChecked(used && src == PreferencesDialog::kSrcImages);
|
_ui->actionImageFiles->setChecked(_preferencesDialog->isSourceImageUsed() && _preferencesDialog->getSourceImageType() == PreferencesDialog::kSrcImages);
|
||||||
_ui->actionVideo->setChecked(used && src == PreferencesDialog::kSrcVideo);
|
_ui->actionVideo->setChecked(_preferencesDialog->isSourceImageUsed() && _preferencesDialog->getSourceImageType() == PreferencesDialog::kSrcVideo);
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateSelectSourceDatabase(bool used)
|
_ui->actionDatabase->setChecked(_preferencesDialog->isSourceDatabaseUsed());
|
||||||
{
|
|
||||||
_ui->actionDatabase->setChecked(used);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateSelectSourceRGBDMenu(bool used, PreferencesDialog::Src src)
|
_ui->actionOpenNI_PCL->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_PCL);
|
||||||
{
|
_ui->actionOpenNI_PCL_ASUS->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_PCL);
|
||||||
_ui->actionOpenNI_PCL->setChecked(used && src == PreferencesDialog::kSrcOpenNI_PCL);
|
_ui->actionFreenect->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcFreenect);
|
||||||
_ui->actionOpenNI_PCL_ASUS->setChecked(used && src == PreferencesDialog::kSrcOpenNI_PCL);
|
_ui->actionOpenNI_CV->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV);
|
||||||
_ui->actionFreenect->setChecked(used && src == PreferencesDialog::kSrcFreenect);
|
_ui->actionOpenNI_CV_ASUS->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI_CV_ASUS);
|
||||||
_ui->actionOpenNI_CV->setChecked(used && src == PreferencesDialog::kSrcOpenNI_CV);
|
_ui->actionOpenNI2->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI2);
|
||||||
_ui->actionOpenNI_CV_ASUS->setChecked(used && src == PreferencesDialog::kSrcOpenNI_CV_ASUS);
|
_ui->actionOpenNI2_Sense->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI2);
|
||||||
_ui->actionOpenNI2->setChecked(used && src == PreferencesDialog::kSrcOpenNI2);
|
_ui->actionOpenNI2_kinect->setChecked(_preferencesDialog->isSourceOpenniUsed() && _preferencesDialog->getSourceRGBD() == PreferencesDialog::kSrcOpenNI2);
|
||||||
_ui->actionOpenNI2_Sense->setChecked(used && src == PreferencesDialog::kSrcOpenNI2);
|
|
||||||
_ui->actionOpenNI2_kinect->setChecked(used && src == PreferencesDialog::kSrcOpenNI2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::changeImgRateSetting()
|
void MainWindow::changeImgRateSetting()
|
||||||
@@ -2314,16 +2328,31 @@ void MainWindow::newDatabase()
|
|||||||
_databaseUpdated = false;
|
_databaseUpdated = false;
|
||||||
ULOGGER_DEBUG("");
|
ULOGGER_DEBUG("");
|
||||||
this->clearTheCache();
|
this->clearTheCache();
|
||||||
std::string databasePath = (_preferencesDialog->getWorkingDirectory()+QDir::separator()+Parameters::getDefaultDatabaseName().c_str()).toStdString();
|
std::string databasePath = (_preferencesDialog->getWorkingDirectory()+QDir::separator()+QString("rtabmap.tmp.db")).toStdString();
|
||||||
if(QFile::exists(databasePath.c_str()))
|
if(QFile::exists(databasePath.c_str()))
|
||||||
{
|
{
|
||||||
if(QFile::remove(databasePath.c_str()))
|
int r = QMessageBox::question(this,
|
||||||
|
tr("Creating temporary database"),
|
||||||
|
tr("Cannot create a new database because the temporary database \"%1\" already exists. "
|
||||||
|
"There may be another instance of RTAB-Map running with the same Working Directory or "
|
||||||
|
"the last time RTAB-Map was not closed correctly. "
|
||||||
|
"Do you want to continue (the database will be deleted to create the new one)?").arg(databasePath.c_str()),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
|
|
||||||
|
if(r == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
UINFO("Deleted database \"%s\".", databasePath.c_str());
|
if(QFile::remove(databasePath.c_str()))
|
||||||
|
{
|
||||||
|
UINFO("Deleted temporary database \"%s\".", databasePath.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UERROR("Temporary database \"%s\" could not be deleted!", databasePath.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UERROR("Cannot create a new database because the temporary database \"%s\" cannot be deleted.", databasePath.c_str());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3491,55 +3520,47 @@ void MainWindow::updateEditMenu()
|
|||||||
|
|
||||||
void MainWindow::selectImages()
|
void MainWindow::selectImages()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceImage(PreferencesDialog::kSrcImages, _ui->actionImageFiles->isChecked());
|
_preferencesDialog->selectSourceImage(PreferencesDialog::kSrcImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectVideo()
|
void MainWindow::selectVideo()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceImage(PreferencesDialog::kSrcVideo, _ui->actionVideo->isChecked());
|
_preferencesDialog->selectSourceImage(PreferencesDialog::kSrcVideo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectStream()
|
void MainWindow::selectStream()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceImage(PreferencesDialog::kSrcUsbDevice, _ui->actionUsbCamera->isChecked());
|
_preferencesDialog->selectSourceImage(PreferencesDialog::kSrcUsbDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectDatabase()
|
void MainWindow::selectDatabase()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceDatabase(true, _ui->actionDatabase->isChecked());
|
_preferencesDialog->selectSourceDatabase(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectOpenni()
|
void MainWindow::selectOpenni()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_PCL,
|
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_PCL);
|
||||||
_ui->actionOpenNI_PCL->isChecked() ||
|
|
||||||
_ui->actionOpenNI_PCL_ASUS->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectFreenect()
|
void MainWindow::selectFreenect()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcFreenect,
|
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcFreenect);
|
||||||
_ui->actionFreenect->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectOpenniCv()
|
void MainWindow::selectOpenniCv()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV,
|
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV);
|
||||||
_ui->actionOpenNI_CV->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectOpenniCvAsus()
|
void MainWindow::selectOpenniCvAsus()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV_ASUS,
|
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI_CV_ASUS);
|
||||||
_ui->actionOpenNI_CV_ASUS->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::selectOpenni2()
|
void MainWindow::selectOpenni2()
|
||||||
{
|
{
|
||||||
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI2,
|
_preferencesDialog->selectSourceRGBD(PreferencesDialog::kSrcOpenNI2);
|
||||||
_ui->actionOpenNI2->isChecked() ||
|
|
||||||
_ui->actionOpenNI2_Sense->isChecked() ||
|
|
||||||
_ui->actionOpenNI2_kinect->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1968,7 +1968,7 @@ QString PreferencesDialog::loadCustomConfig(const QString & section, const QStri
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::selectSourceImage(Src src, bool ckecked)
|
void PreferencesDialog::selectSourceImage(Src src)
|
||||||
{
|
{
|
||||||
ULOGGER_DEBUG("");
|
ULOGGER_DEBUG("");
|
||||||
|
|
||||||
@@ -1993,70 +1993,62 @@ void PreferencesDialog::selectSourceImage(Src src, bool ckecked)
|
|||||||
|
|
||||||
if(!fromPrefDialog)
|
if(!fromPrefDialog)
|
||||||
{
|
{
|
||||||
if(ckecked)
|
if(_ui->general_checkBox_activateRGBD->isChecked())
|
||||||
{
|
{
|
||||||
if(_ui->general_checkBox_activateRGBD->isChecked())
|
int button = QMessageBox::information(this,
|
||||||
|
tr("Desactivate RGB-D SLAM?"),
|
||||||
|
tr("You've selected source input as images only and RGB-D SLAM mode is activated. "
|
||||||
|
"RGB-D SLAM cannot work with images only so do you want to desactivate it?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
if(button & QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
int button = QMessageBox::information(this,
|
_ui->general_checkBox_activateRGBD->setChecked(false);
|
||||||
tr("Desactivate RGB-D SLAM?"),
|
|
||||||
tr("You've selected source input as images only and RGB-D SLAM mode is activated. "
|
|
||||||
"RGB-D SLAM cannot work with images only so do you want to desactivate it?"),
|
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
|
||||||
if(button & QMessageBox::Yes)
|
|
||||||
{
|
|
||||||
_ui->general_checkBox_activateRGBD->setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ui->groupBox_sourceImage->setChecked(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ckecked)
|
if(src == kSrcImages)
|
||||||
{
|
{
|
||||||
if(src == kSrcImages)
|
QString path = QFileDialog::getExistingDirectory(this, QString(), _ui->source_images_lineEdit_path->text());
|
||||||
|
QDir dir(path);
|
||||||
|
if(!path.isEmpty() && dir.exists())
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getExistingDirectory(this, QString(), _ui->source_images_lineEdit_path->text());
|
QStringList filters;
|
||||||
QDir dir(path);
|
filters << "*.jpg" << "*.ppm" << "*.bmp" << "*.png" << "*.pnm" << "*.tiff";
|
||||||
if(!path.isEmpty() && dir.exists())
|
dir.setNameFilters(filters);
|
||||||
|
QFileInfoList files = dir.entryInfoList();
|
||||||
|
if(!files.empty())
|
||||||
{
|
{
|
||||||
QStringList filters;
|
_ui->source_comboBox_image_type->setCurrentIndex(1);
|
||||||
filters << "*.jpg" << "*.ppm" << "*.bmp" << "*.png" << "*.pnm" << "*.tiff";
|
_ui->source_images_lineEdit_path->setText(path);
|
||||||
dir.setNameFilters(filters);
|
_ui->source_images_spinBox_startPos->setValue(1);
|
||||||
QFileInfoList files = dir.entryInfoList();
|
_ui->source_images_refreshDir->setChecked(false);
|
||||||
if(!files.empty())
|
|
||||||
{
|
|
||||||
_ui->source_comboBox_image_type->setCurrentIndex(1);
|
|
||||||
_ui->source_images_lineEdit_path->setText(path);
|
|
||||||
_ui->source_images_spinBox_startPos->setValue(1);
|
|
||||||
_ui->source_images_refreshDir->setChecked(false);
|
|
||||||
_ui->groupBox_sourceImage->setChecked(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QMessageBox::information(this,
|
|
||||||
tr("RTAB-Map"),
|
|
||||||
tr("Images must be one of these formats: ") + filters.join(" "));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(src == kSrcVideo)
|
|
||||||
{
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_video_lineEdit_path->text(), tr("Videos (*.avi *.mpg *.mp4)"));
|
|
||||||
QFile file(path);
|
|
||||||
if(!path.isEmpty() && file.exists())
|
|
||||||
{
|
|
||||||
_ui->source_comboBox_image_type->setCurrentIndex(2);
|
|
||||||
_ui->source_video_lineEdit_path->setText(path);
|
|
||||||
_ui->groupBox_sourceImage->setChecked(true);
|
_ui->groupBox_sourceImage->setChecked(true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::information(this,
|
||||||
|
tr("RTAB-Map"),
|
||||||
|
tr("Images must be one of these formats: ") + filters.join(" "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // kSrcUsbDevice
|
}
|
||||||
|
else if(src == kSrcVideo)
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), _ui->source_video_lineEdit_path->text(), tr("Videos (*.avi *.mpg *.mp4)"));
|
||||||
|
QFile file(path);
|
||||||
|
if(!path.isEmpty() && file.exists())
|
||||||
{
|
{
|
||||||
_ui->source_comboBox_image_type->setCurrentIndex(0);
|
_ui->source_comboBox_image_type->setCurrentIndex(2);
|
||||||
|
_ui->source_video_lineEdit_path->setText(path);
|
||||||
_ui->groupBox_sourceImage->setChecked(true);
|
_ui->groupBox_sourceImage->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // kSrcUsbDevice
|
||||||
|
{
|
||||||
|
_ui->source_comboBox_image_type->setCurrentIndex(0);
|
||||||
|
_ui->groupBox_sourceImage->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(_ui->groupBox_sourceImage->isChecked())
|
if(_ui->groupBox_sourceImage->isChecked())
|
||||||
{
|
{
|
||||||
@@ -2080,33 +2072,25 @@ void PreferencesDialog::selectSourceImage(Src src, bool ckecked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::selectSourceDatabase(bool user, bool ckecked)
|
void PreferencesDialog::selectSourceDatabase(bool user)
|
||||||
{
|
{
|
||||||
ULOGGER_DEBUG("");
|
ULOGGER_DEBUG("");
|
||||||
|
|
||||||
if(user)
|
QString dir = _ui->source_database_lineEdit_path->text();
|
||||||
|
if(dir.isEmpty())
|
||||||
{
|
{
|
||||||
_ui->groupBox_sourceDatabase->setChecked(false);
|
dir = getWorkingDirectory();
|
||||||
}
|
}
|
||||||
|
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), dir, tr("RTAB-Map database files (*.db)"));
|
||||||
if(ckecked)
|
QFile file(path);
|
||||||
|
if(!path.isEmpty() && file.exists())
|
||||||
{
|
{
|
||||||
QString dir = _ui->source_database_lineEdit_path->text();
|
int r = QMessageBox::question(this, tr("Odometry in database..."), tr("Use odometry saved in database (if some saved)?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
if(dir.isEmpty())
|
|
||||||
{
|
|
||||||
dir = getWorkingDirectory();
|
|
||||||
}
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, tr("Select file"), dir, tr("RTAB-Map database files (*.db)"));
|
|
||||||
QFile file(path);
|
|
||||||
if(!path.isEmpty() && file.exists())
|
|
||||||
{
|
|
||||||
int r = QMessageBox::question(this, tr("Odometry in database..."), tr("Use odometry saved in database (if some saved)?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
||||||
|
|
||||||
_ui->groupBox_sourceDatabase->setChecked(true);
|
_ui->groupBox_sourceDatabase->setChecked(true);
|
||||||
_ui->source_checkBox_ignoreOdometry->setChecked(r != QMessageBox::Yes);
|
_ui->source_checkBox_ignoreOdometry->setChecked(r != QMessageBox::Yes);
|
||||||
_ui->source_database_lineEdit_path->setText(path);
|
_ui->source_database_lineEdit_path->setText(path);
|
||||||
_ui->source_spinBox_databaseStartPos->setValue(0);
|
_ui->source_spinBox_databaseStartPos->setValue(0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_ui->groupBox_sourceDatabase->isChecked())
|
if(_ui->groupBox_sourceDatabase->isChecked())
|
||||||
@@ -2131,27 +2115,24 @@ void PreferencesDialog::selectSourceDatabase(bool user, bool ckecked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::selectSourceRGBD(Src src, bool ckecked)
|
void PreferencesDialog::selectSourceRGBD(Src src)
|
||||||
{
|
{
|
||||||
ULOGGER_DEBUG("");
|
ULOGGER_DEBUG("");
|
||||||
|
|
||||||
if(ckecked)
|
if(!_ui->general_checkBox_activateRGBD->isChecked())
|
||||||
{
|
{
|
||||||
if(!_ui->general_checkBox_activateRGBD->isChecked())
|
int button = QMessageBox::information(this,
|
||||||
|
tr("Activate RGB-D SLAM?"),
|
||||||
|
tr("You've selected RGB-D camera as source input, "
|
||||||
|
"would you want to activate RGB-D SLAM mode?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
|
if(button & QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
int button = QMessageBox::information(this,
|
_ui->general_checkBox_activateRGBD->setChecked(true);
|
||||||
tr("Activate RGB-D SLAM?"),
|
|
||||||
tr("You've selected RGB-D camera as source input, "
|
|
||||||
"would you want to activate RGB-D SLAM mode?"),
|
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
|
||||||
if(button & QMessageBox::Yes)
|
|
||||||
{
|
|
||||||
_ui->general_checkBox_activateRGBD->setChecked(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ui->groupBox_sourceOpenni->setChecked(ckecked);
|
_ui->groupBox_sourceOpenni->setChecked(true);
|
||||||
_ui->radioButton_opennipcl->setChecked(src == kSrcOpenNI_PCL);
|
_ui->radioButton_opennipcl->setChecked(src == kSrcOpenNI_PCL);
|
||||||
_ui->radioButton_freenect->setChecked(src == kSrcFreenect);
|
_ui->radioButton_freenect->setChecked(src == kSrcFreenect);
|
||||||
_ui->radioButton_opennicv->setChecked(src == kSrcOpenNI_CV);
|
_ui->radioButton_opennicv->setChecked(src == kSrcOpenNI_CV);
|
||||||
|
|||||||
Reference in New Issue
Block a user