Skip to content
Snippets Groups Projects
Commit 6a54a165 authored by Markus Grotz's avatar Markus Grotz
Browse files

added config dialog for ViewSelection gui plugin

parent aa1ccb30
No related branches found
No related tags found
No related merge requests found
......@@ -16,12 +16,12 @@ if(QT_FOUND)
endif()
set(SOURCES
./ViewSelectionGuiPlugin.cpp ./ViewSelectionWidgetController.cpp
./ViewSelectionGuiPlugin.cpp ./ViewSelectionWidgetController.cpp ./ViewSelectionConfigDialog.cpp
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@GuiPlugin.cpp @COMPONENT_PATH@/@COMPONENT_NAME@WidgetController.cpp
)
set(HEADERS
./ViewSelectionGuiPlugin.h ./ViewSelectionWidgetController.h
./ViewSelectionGuiPlugin.h ./ViewSelectionWidgetController.h ./ViewSelectionConfigDialog.h
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@GuiPlugin.h @COMPONENT_PATH@/@COMPONENT_NAME@WidgetController.h
)
......@@ -29,6 +29,7 @@ set(GUI_MOC_HDRS ${HEADERS})
set(GUI_UIS
./ViewSelectionWidget.ui
./ViewSelectionConfigDialog.ui
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@Widget.ui
)
......
#include "ViewSelectionConfigDialog.h"
#include "ui_ViewSelectionConfigDialog.h"
#include <RobotAPI/interface/components/ViewSelectionInterface.h>
#include <QPushButton>
#include <QMessageBox>
#include <IceUtil/UUID.h>
using namespace armarx;
ViewSelectionConfigDialog::ViewSelectionConfigDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::ViewSelectionConfigDialog),
uuid(IceUtil::generateUUID())
{
ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(verifyConfig()));
viewSelectionProxyFinder = new IceProxyFinder<ViewSelectionInterfacePrx>(this);
viewSelectionProxyFinder->setSearchMask("*ViewSelection");
//ui->verticalLayout->addWidget(viewSelectionProxyFinder);
}
ViewSelectionConfigDialog::~ViewSelectionConfigDialog()
{
delete ui;
}
void ViewSelectionConfigDialog::onInitComponent()
{
}
void ViewSelectionConfigDialog::onConnectComponent()
{
viewSelectionProxyFinder->setIceManager(getIceManager());
}
void ViewSelectionConfigDialog::onExitComponent()
{
QObject::disconnect();
}
std::string ViewSelectionConfigDialog::getDefaultName() const
{
return "ViewSelectionConfigDialog" + uuid;
}
void ViewSelectionConfigDialog::verifyConfig()
{
if (!viewSelectionProxyFinder->getSelectedProxyName().trimmed().length())
{
QMessageBox::critical(this, "Invalid Configuration", "The proxy names must not be empty");
return;
}
this->accept();
}
#ifndef VIEWSELECTIONCONFIGDIALOG_H
#define VIEWSELECTIONCONFIGDIALOG_H
#include <QDialog>
#include <ArmarXCore/core/ManagedIceObject.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/IceProxyFinder.h>
using namespace armarx;
namespace Ui
{
class ViewSelectionConfigDialog;
}
class ViewSelectionConfigDialog : public QDialog,
virtual public armarx::ManagedIceObject
{
Q_OBJECT
public:
explicit ViewSelectionConfigDialog(QWidget* parent = 0);
~ViewSelectionConfigDialog();
std::string getViewSelectionName()
{
return viewSelectionProxyFinder->getSelectedProxyName().toStdString();
}
signals:
public slots:
void verifyConfig();
// ManagedIceObject interface
protected:
void onInitComponent();
void onConnectComponent();
void onExitComponent();
std::string getDefaultName() const;
private:
Ui::ViewSelectionConfigDialog* ui;
IceProxyFinderBase* viewSelectionProxyFinder;
std::string uuid;
};
#endif // VIEWSELECTIONCONFIGDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ViewSelectionConfigDialog</class>
<widget class="QDialog" name="ViewSelectionConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>179</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>20</x>
<y>140</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>351</width>
<height>80</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout"/>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ViewSelectionConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ViewSelectionConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -33,7 +33,6 @@ ViewSelectionWidgetController::ViewSelectionWidgetController()
connect(widget.pushButton, SIGNAL(clicked()), this, SLOT(triggerSaliencyMapVisualization()));
connect(widget.checkBox, SIGNAL(toggled(bool)), this, SLOT(toggleViewSelection(bool)));
}
......@@ -43,28 +42,39 @@ ViewSelectionWidgetController::~ViewSelectionWidgetController()
}
void ViewSelectionWidgetController::loadSettings(QSettings* settings)
QPointer<QDialog> ViewSelectionWidgetController::getConfigDialog(QWidget* parent)
{
if (!configDialog)
{
configDialog = new ViewSelectionConfigDialog(parent);
}
return qobject_cast<ViewSelectionConfigDialog*>(configDialog);
}
void ViewSelectionWidgetController::loadSettings(QSettings* settings)
{
viewSelectionName = settings->value("viewSelectionName", "").toString().toStdString();
}
void ViewSelectionWidgetController::saveSettings(QSettings* settings)
{
viewSelectionName = settings->value("viewSelectionName", QString::fromStdString(viewSelectionName)).toString().toStdString();
}
void ViewSelectionWidgetController::onInitComponent()
{
usingProxy("ViewSelection");
usingTopic("ViewSelectionObserver");
usingProxy(viewSelectionName);
usingTopic(viewSelectionName + "Observer");
}
void ViewSelectionWidgetController::onConnectComponent()
{
viewSelection = getProxy<ViewSelectionInterfacePrx>("ViewSelection");
viewSelection = getProxy<ViewSelectionInterfacePrx>(viewSelectionName);
widget.checkBox->setChecked(viewSelection->isEnabledAutomaticViewSelection());
}
......@@ -103,3 +113,8 @@ void ViewSelectionWidgetController::triggerSaliencyMapVisualization()
{
viewSelection->drawSaliencyMap();
}
void armarx::ViewSelectionWidgetController::configured()
{
viewSelectionName = configDialog->getViewSelectionName();
}
......@@ -32,8 +32,14 @@
#include <RobotAPI/interface/components/ViewSelectionInterface.h>
#include "ViewSelectionConfigDialog.h"
namespace armarx
{
//class ViewSelectionConfigDialog;
/**
\page ArmarXGui-GuiPlugins-ViewSelection ViewSelection
\brief The ViewSelection allows visualizing ...
......@@ -80,6 +86,7 @@ namespace armarx
*/
virtual void saveSettings(QSettings* settings);
void configured();
void onActivateAutomaticViewSelection(const Ice::Current& c = Ice::Current());
void onDeactivateAutomaticViewSelection(const Ice::Current& c = Ice::Current());
......@@ -104,6 +111,9 @@ namespace armarx
*/
virtual void onConnectComponent();
virtual QPointer<QDialog> getConfigDialog(QWidget* parent);
public slots:
void triggerSaliencyMapVisualization();
......@@ -119,8 +129,12 @@ namespace armarx
*/
Ui::ViewSelectionWidget widget;
QPointer<ViewSelectionConfigDialog> configDialog;
ViewSelectionInterfacePrx viewSelection;
std::string viewSelectionName;
};
}
......
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