mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
GUI: Updated data recorder action and message info on close
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user