Skip to content
Snippets Groups Projects
Commit 5f4000aa authored by Stefan Reither's avatar Stefan Reither
Browse files

added running topicreplayer from gui

parent aa2a3820
No related branches found
No related tags found
1 merge request!28Topic replayer gui
Git can only track files and not directory.
Therefore this file is added to all empty directories
which need to be available after a Git clone.
......@@ -11,5 +11,4 @@ add_subdirectory(SystemStateMonitorPlugin)
add_subdirectory(LoggingPlugin)
add_subdirectory(ClockPlugin)
add_subdirectory(ScenarioManager)
add_subdirectory(TopicReplayerPlugin)
armarx_set_target("TopicReplayerGuiPlugin")
find_package(Qt4 COMPONENTS QtCore QtGui QtDesigner)
armarx_build_if(QT_FOUND "Qt not available")
# all include_directories must be guarded by if(Xyz_FOUND)
# for multiple libraries write: if(X_FOUND AND Y_FOUND)....
if(QT_FOUND)
include(${QT_USE_FILE})
endif()
set(SOURCES
./TopicReplayerGuiPlugin.cpp ./TopicReplayerWidgetController.cpp
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@GuiPlugin.cpp @COMPONENT_PATH@/@COMPONENT_NAME@WidgetController.cpp
)
set(HEADERS
./TopicReplayerGuiPlugin.h ./TopicReplayerWidgetController.h
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@GuiPlugin.h @COMPONENT_PATH@/@COMPONENT_NAME@WidgetController.h
)
set(GUI_MOC_HDRS ${HEADERS})
set(GUI_UIS
./TopicReplayerWidget.ui
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@Widget.ui
)
# Add more libraries you depend on here, e.g. ${QT_LIBRARIES}.
set(COMPONENT_LIBS ArmarXCoreTopicRecording ${QT_LIBRARIES})
Armarx_gui_library(TopicReplayerGuiPlugin "${SOURCES}" "${GUI_MOC_HDRS}" "${GUI_UIS}" "" "${COMPONENT_LIBS}")
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \package ArmarXGui::gui-plugins::TopicReplayerGuiPlugin
* \author Stefan Reither ( stef dot reither at web dot de )
* \date 2016
* \copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "TopicReplayerGuiPlugin.h"
#include "TopicReplayerWidgetController.h"
using namespace armarx;
TopicReplayerGuiPlugin::TopicReplayerGuiPlugin()
{
addWidget < TopicReplayerWidgetController > ();
}
Q_EXPORT_PLUGIN2(armarx_gui_TopicReplayerGuiPlugin, TopicReplayerGuiPlugin)
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \package ArmarXGui::gui-plugins::TopicReplayer
* \author Stefan Reither ( stef dot reither at web dot de )
* \date 2016
* \copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_ArmarXGui_TopicReplayer_GuiPlugin_H
#define _ARMARX_ArmarXGui_TopicReplayer_GuiPlugin_H
#include <ArmarXCore/core/system/ImportExportComponent.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h>
namespace armarx
{
/**
* \class TopicReplayerGuiPlugin
* \ingroup ArmarXGuiPlugins
* \brief TopicReplayerGuiPlugin brief description
*
* Detailed description
*/
class ARMARXCOMPONENT_IMPORT_EXPORT TopicReplayerGuiPlugin:
public armarx::ArmarXGuiPlugin
{
public:
/**
* All widgets exposed by this plugin are added in the constructor
* via calls to addWidget()
*/
TopicReplayerGuiPlugin();
};
}
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TopicReplayerWidget</class>
<widget class="QWidget" name="TopicReplayerWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>839</width>
<height>127</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>839</width>
<height>127</height>
</size>
</property>
<property name="windowTitle">
<string>TopicReplayerWidget</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>821</width>
<height>107</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_fileName"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_load">
<property name="text">
<string>Load File</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pushButton_start">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_pause">
<property name="text">
<string>Pause</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_reset">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Replay speed:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_replaySpeed">
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \package ArmarXGui::gui-plugins::TopicReplayerWidgetController
* \author Stefan Reither ( stef dot reither at web dot de )
* \date 2016
* \copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "TopicReplayerWidgetController.h"
#include <string>
#include <ArmarXCore/core/ArmarXManager.h>
#include <ArmarXCore/core/system/cmake/CMakePackageFinder.h>
#include <ArmarXCore/util/topicrecording/TopicReplayer.h>
#include <QFileDialog>
using namespace armarx;
TopicReplayerWidgetController::TopicReplayerWidgetController()
{
widget.setupUi(getWidget());
}
TopicReplayerWidgetController::~TopicReplayerWidgetController()
{
}
void TopicReplayerWidgetController::loadSettings(QSettings* settings)
{
}
void TopicReplayerWidgetController::saveSettings(QSettings* settings)
{
}
void TopicReplayerWidgetController::onInitComponent()
{
}
void TopicReplayerWidgetController::onConnectComponent()
{
connect(widget.pushButton_load, SIGNAL (clicked()), this, SLOT (loadFile()));
}
void armarx::TopicReplayerWidgetController::loadFile()
{
QFileDialog fileDialog;
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter(tr("TopicRecorder files (*.bag)"));
CMakePackageFinder finder("ArmarXCore");
if (finder.packageFound()) {
fileDialog.setDirectory(QString::fromStdString(finder.getBinaryDir()));
}
fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setVisible(true);
QString fileName;
if (fileDialog.exec())
fileName = fileDialog.selectedFiles().first();
widget.lineEdit_fileName->setText(fileName);
ARMARX_INFO << "1";
Ice::PropertiesPtr properties = Ice::createProperties();
ARMARX_INFO << "1";
properties->setProperty("ArmarX.TopicReplayer.RecordFile", fileName.toStdString());
ARMARX_INFO << "1";
IceInternal::Handle<TopicReplayer> topicReplayer = armarx::Component::create<TopicReplayer>(properties);
getArmarXManager()->addObject(topicReplayer);
ARMARX_INFO << topicReplayer->getDefaultName();
}
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package ArmarXGui::gui-plugins::TopicReplayerWidgetController
* @author Stefan Reither ( stef dot reither at web dot de )
* @date 2016
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_ArmarXGui_TopicReplayer_WidgetController_H
#define _ARMARX_ArmarXGui_TopicReplayer_WidgetController_H
#include "ui_TopicReplayerWidget.h"
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h>
#include <ArmarXCore/core/system/ImportExportComponent.h>
namespace armarx
{
/**
\page ArmarXGui-GuiPlugins-TopicReplayer TopicReplayer
\brief The TopicReplayer allows visualizing ...
\image html TopicReplayer.png
The user can
API Documentation \ref TopicReplayerWidgetController
\see TopicReplayerGuiPlugin
*/
/**
* \class TopicReplayerWidgetController
* \brief TopicReplayerWidgetController brief one line description
*
* Detailed description
*/
class ARMARXCOMPONENT_IMPORT_EXPORT
TopicReplayerWidgetController:
public armarx::ArmarXComponentWidgetController
{
Q_OBJECT
public:
/**
* Controller Constructor
*/
explicit TopicReplayerWidgetController();
/**
* Controller destructor
*/
virtual ~TopicReplayerWidgetController();
/**
* @see ArmarXWidgetController::loadSettings()
*/
virtual void loadSettings(QSettings* settings);
/**
* @see ArmarXWidgetController::saveSettings()
*/
virtual void saveSettings(QSettings* settings);
/**
* Returns the Widget name displayed in the ArmarXGui to create an
* instance of this class.
*/
virtual QString getWidgetName() const
{
return "TopicReplayerPlugin";
}
/**
* \see armarx::Component::onInitComponent()
*/
virtual void onInitComponent();
/**
* \see armarx::Component::onConnectComponent()
*/
virtual void onConnectComponent();
public slots:
/* QT slot declarations */
signals:
/* QT signal declarations */
private slots:
void loadFile();
private:
/**
* Widget Form
*/
Ui::TopicReplayerWidget widget;
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment