Commit c1928b96 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Populate action search bar

parent 3cf7aba2
......@@ -8,6 +8,7 @@
#include <gepetto/gui/mainwindow.hh>
#include <gepetto/gui/windows-manager.hh>
#include <gepetto/gui/omniorb/url.hh>
#include <gepetto/gui/action-search-bar.hh>
#include <omniORB4/CORBA.h>
......@@ -20,6 +21,7 @@
#include "hppwidgetsplugin/twojointsconstraint.hh"
#include "hppwidgetsplugin/listjointconstraint.hh"
#include "hppwidgetsplugin/conversions.hh"
#include "hppwidgetsplugin/joint-action.hh"
#include "hppwidgetsplugin/roadmap.hh"
#include <gepetto/gui/meta.hh>
......@@ -31,6 +33,7 @@ namespace hpp {
using gepetto::gui::MainWindow;
typedef graphics::WindowsManager::Color_t OsgColor_t;
typedef graphics::Configuration OsgConfiguration_t;
typedef gepetto::gui::ActionSearchBar ActionSearchBar;
HppWidgetsPlugin::JointElement::JointElement (
const std::string& n, const std::string& prefix,
......@@ -134,6 +137,17 @@ namespace hpp {
main->registerSlot("requestCreateJointGroup", this);
main->registerSlot("getHppIIOPurl", this);
main->registerSlot("getSelectedJoint", jointTreeWidget_);
ActionSearchBar* asb = main->actionSearchBar();
JointAction* a;
a = new JointAction (tr("Add joint &frame"), jointTreeWidget_, this);
connect (a, SIGNAL (triggered(std::string)), SLOT (addJointFrame(std::string)));
asb->addAction(a);
a = new JointAction (tr("Display &roadmap"), jointTreeWidget_, this);
connect (a, SIGNAL (triggered(std::string)), SLOT (displayRoadmap(std::string)));
asb->addAction(a);
}
QString HppWidgetsPlugin::name() const
......@@ -385,6 +399,11 @@ namespace hpp {
return pathPlayer_;
}
JointTreeWidget* HppWidgetsPlugin::jointTreeWidget() const
{
return jointTreeWidget_;
}
void HppWidgetsPlugin::updateRobotJoints(const QString robotName)
{
hpp::Names_t_var joints = client()->robot()->getAllJointNames ();
......
......@@ -118,6 +118,9 @@ signals:
/// Get the pathPlayer widget.
PathPlayer* pathPlayer() const;
/// Get the pathPlayer widget.
JointTreeWidget* jointTreeWidget() const;
/// Get the list of joints from corbaserver and update internal joint map.
/// \param robotName name of the robot
virtual void updateRobotJoints (const QString robotName);
......
......@@ -8,6 +8,10 @@
#include "gepetto/gui/mainwindow.hh"
#include "hppwidgetsplugin/jointtreewidget.hh"
#include "hppwidgetsplugin/pathplayer.hh"
#include "hppwidgetsplugin/joint-action.hh"
using CORBA::ULong;
namespace hpp {
......
......@@ -5,6 +5,7 @@
#include <gepetto/gui/mainwindow.hh>
#include <gepetto/gui/windows-manager.hh>
#include <gepetto/gui/action-search-bar.hh>
#include "hppwidgetsplugin/joint-tree-item.hh"
#include "hppwidgetsplugin/jointbounddialog.hh"
......@@ -15,6 +16,9 @@ using CORBA::ULong;
namespace hpp {
namespace gui {
using gepetto::gui::MainWindow;
using gepetto::gui::ActionSearchBar;
JointTreeWidget::JointTreeWidget(HppWidgetsPlugin *plugin, QWidget *parent) :
QWidget(parent),
plugin_ (plugin),
......@@ -29,6 +33,7 @@ namespace hpp {
plugin_,
gepetto::gui::MainWindow::instance()));
reset ();
initSearchActions ();
connect(ui_->jointTree, SIGNAL (customContextMenuRequested(QPoint)),
SLOT (customContextMenu(QPoint)));
......@@ -41,6 +46,20 @@ namespace hpp {
delete ui_;
}
void JointTreeWidget::initSearchActions()
{
ActionSearchBar* asb = MainWindow::instance()->actionSearchBar();
JointAction* a;
a = new JointAction (tr("Move &joint..."), this, this);
connect (a, SIGNAL (triggered(std::string)), SLOT (openJointMoveDialog(std::string)));
asb->addAction(a);
a = new JointAction (tr("Set &bounds..."), this, this);
connect (a, SIGNAL (triggered(std::string)), SLOT (openJointBoundDialog(std::string)));
asb->addAction(a);
}
void JointTreeWidget::dockWidget(QDockWidget *dock)
{
dock_ = dock;
......
......@@ -61,6 +61,8 @@ signals:
void resize (const QModelIndex index);
private:
void initSearchActions();
/// Reset the tree.
void reset ();
......
......@@ -6,12 +6,17 @@
#include "gepetto/gui/mainwindow.hh"
#include <gepetto/gui/windows-manager.hh>
#include <gepetto/gui/osgwidget.hh>
#include <gepetto/gui/action-search-bar.hh>
#include "hppwidgetsplugin/conversions.hh"
#include "hppwidgetsplugin/ui_pathplayerwidget.h"
#include "hppwidgetsplugin/joint-action.hh"
namespace hpp {
namespace gui {
using gepetto::gui::MainWindow;
using gepetto::gui::ActionSearchBar;
PathPlayer::PathPlayer (HppWidgetsPlugin *plugin, QWidget *parent) :
QWidget (parent)
, ui_ (new ::Ui::PathPlayerWidget)
......@@ -36,6 +41,8 @@ namespace hpp {
showPOutput_->setModal(false);
showPOutput_->setLayout(new QHBoxLayout ());
showPOutput_->layout()->addWidget(pOutput_);
initSearchActions();
}
PathPlayer::~PathPlayer()
......@@ -48,6 +55,20 @@ namespace hpp {
delete ui_;
}
void PathPlayer::initSearchActions()
{
ActionSearchBar* asb = MainWindow::instance()->actionSearchBar();
JointAction* a;
a = new JointAction (tr("Display &waypoints of selected path"), plugin_->jointTreeWidget(), this);
connect (a, SIGNAL (triggered(std::string)), SLOT (displayWaypointsOfPath(std::string)));
asb->addAction(a);
a = new JointAction (tr("Display selected &path"), plugin_->jointTreeWidget(), this);
connect (a, SIGNAL (triggered(std::string)), SLOT (displayPath(std::string)));
asb->addAction(a);
}
void PathPlayer::displayWaypointsOfPath(const std::string jointName)
{
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance();
......
......@@ -61,6 +61,7 @@ signals:
void readyReadProcessOutput ();
private:
void initSearchActions();
void updateConfiguration ();
double sliderToLength (int v) const;
int lengthToSlider (double l) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment