GUI: Updated data recorder action and message info on close

This commit is contained in:
matlabbe
2015-03-29 09:23:00 -04:00
parent ae239bcfbc
commit adb1a8ba22
4 changed files with 61 additions and 22 deletions

View File

@@ -35,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/gui/ImageView.h>
#include <rtabmap/gui/UCv2Qt.h>
#include <QtCore/QMetaType>
#include <QMessageBox>
#include <QtGui/QCloseEvent>
#include <QHBoxLayout>
namespace rtabmap {
@@ -50,6 +52,7 @@ DataRecorder::DataRecorder(QWidget * parent) :
imageView_->setImageDepthShown(true);
QHBoxLayout * layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->addWidget(imageView_);
this->setLayout(layout);
}
@@ -73,6 +76,7 @@ bool DataRecorder::init(const QString & path, bool recordInRAM)
UERROR("Error initializing the memory.");
return false;
}
path_ = path;
return true;
}
else
@@ -82,18 +86,23 @@ bool DataRecorder::init(const QString & path, bool recordInRAM)
}
}
void DataRecorder::close()
void DataRecorder::closeRecorder()
{
if(memory_)
{
delete memory_;
memory_ = 0;
}
UINFO("Data recorded to \"%s\".", this->path().toStdString().c_str());
if(this->isVisible())
{
QMessageBox::information(this, tr("Data recorder"), tr("Data recorded to \"%1\".").arg(this->path()));
}
}
DataRecorder::~DataRecorder()
{
this->close();
this->closeRecorder();
}
void DataRecorder::addData(const rtabmap::SensorData & data)
@@ -125,6 +134,12 @@ void DataRecorder::showImage(const rtabmap::SensorData & data)
}
}
void DataRecorder::closeEvent(QCloseEvent* event)
{
this->closeRecorder();
event->accept();
}
void DataRecorder::handleEvent(UEvent * event)
{
if(event->getClassName().compare("CameraEvent") == 0)