mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
GUI: Don't backup empty database...
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1936 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -255,6 +255,7 @@ private:
|
||||
bool _processingStatistics;
|
||||
bool _odometryReceived;
|
||||
QString _openedDatabasePath;
|
||||
bool _emptyNewDatabase;
|
||||
|
||||
QMap<int, Signature> _cachedSignatures;
|
||||
QMap<int, int> _mapIds;
|
||||
|
||||
@@ -116,6 +116,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
_processingStatistics(false),
|
||||
_odometryReceived(false),
|
||||
_openedDatabasePath(""),
|
||||
_emptyNewDatabase(true),
|
||||
_odometryCorrection(Transform::getIdentity()),
|
||||
_lastOdometryProcessed(true),
|
||||
_oneSecondTimer(0),
|
||||
@@ -1441,7 +1442,8 @@ void MainWindow::processRtabmapEventInit(int status, const QString & info)
|
||||
else if((RtabmapEventInit::Status)status == RtabmapEventInit::kClosed)
|
||||
{
|
||||
_initProgressDialog->setValue(_initProgressDialog->maximumSteps());
|
||||
if(_openedDatabasePath.compare(_preferencesDialog->getWorkingDirectory()+QDir::separator()+Parameters::getDefaultDatabaseName().c_str()) == 0)
|
||||
if(_openedDatabasePath.compare(_preferencesDialog->getWorkingDirectory()+QDir::separator()+Parameters::getDefaultDatabaseName().c_str()) == 0 &&
|
||||
!_emptyNewDatabase)
|
||||
{
|
||||
// Temp database used, automatically backup with unique name (timestamp)
|
||||
QString newName = _preferencesDialog->getWorkingDirectory()+QDir::separator()+(QString("rtabmap_%1.db").arg(QDateTime::currentDateTime().toString("yyMMdd-hhmmsszzz")));
|
||||
@@ -1947,6 +1949,7 @@ void MainWindow::newDatabase()
|
||||
}
|
||||
}
|
||||
_openedDatabasePath = databasePath.c_str();
|
||||
_emptyNewDatabase = true;
|
||||
this->post(new RtabmapEventCmd(RtabmapEventCmd::kCmdInit, databasePath, 0, _preferencesDialog->getAllParameters()));
|
||||
}
|
||||
|
||||
@@ -2304,6 +2307,8 @@ void MainWindow::startDetection()
|
||||
"progress will not be shown in the GUI."));
|
||||
}
|
||||
|
||||
_emptyNewDatabase = false; // if a new database is used, it won't be empty anymore...
|
||||
|
||||
emit stateChanged(kDetecting);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user