jointtreewidget.hh 2.21 KB
Newer Older
1
2
3
4
5
//
// Copyright (c) CNRS
// Author: Joseph Mirabel and Heidy Dallard
//

Joseph Mirabel's avatar
Joseph Mirabel committed
6
7
#ifndef HPP_GUI_JOINTTREEWIDGET_HH
#define HPP_GUI_JOINTTREEWIDGET_HH
8
9
10

#include <QWidget>

11
#include <hppwidgetsplugin/hppwidgetsplugin.hh>
12
13
14
15
16

namespace Ui {
  class JointTreeWidget;
}

Joseph Mirabel's avatar
Joseph Mirabel committed
17
18
19
20
21
namespace hpp {
  namespace gui {
    class JointTreeWidget : public QWidget
    {
      Q_OBJECT
22

Joseph Mirabel's avatar
Joseph Mirabel committed
23
24
      public:
        explicit JointTreeWidget(HppWidgetsPlugin *plugin, QWidget *parent = 0);
25

Joseph Mirabel's avatar
Joseph Mirabel committed
26
        virtual ~JointTreeWidget ();
27

hdallard's avatar
hdallard committed
28
29
        /// Set the dock widget.
        /// \param dock new dock widget
Joseph Mirabel's avatar
Joseph Mirabel committed
30
        void dockWidget (QDockWidget* dock);
31

hdallard's avatar
hdallard committed
32
        /// Get the currently selected joint.
33
        std::string selectedJoint () const;
34

35
36
signals:

Joseph Mirabel's avatar
Joseph Mirabel committed
37
        public slots:
hdallard's avatar
hdallard committed
38
39
          /// Display the context menu for a givent joint.
          /// \param pos poistion of the joint in the tree
Joseph Mirabel's avatar
Joseph Mirabel committed
40
          void customContextMenu (const QPoint& pos);
hdallard's avatar
hdallard committed
41
42
43

        /// select the joint in the tree.
        /// \param jointName name of the joint selected
Joseph Mirabel's avatar
Joseph Mirabel committed
44
        void selectJoint (const std::string& jointName);
hdallard's avatar
hdallard committed
45

46
47
48
        /// Get the currently selected joint name.
        QString getSelectedJoint () const;

hdallard's avatar
hdallard committed
49
50
        /// Open a dialog to set a joint bounds.
        /// \param jointName name of the joint
Joseph Mirabel's avatar
Joseph Mirabel committed
51
        void openJointBoundDialog (const std::string jointName);
hdallard's avatar
hdallard committed
52
53
54

        /// Open a dialog to move a joint.
        /// \param jointName name of the joint
55
        void openJointMoveDialog(const std::string jointName);
hdallard's avatar
hdallard committed
56
57
58
59
60
61
62

        /// Call the corba function to move the joint in hpp.
        /// \param transform transform to apply
        /// \param jointName name of the joint
        void moveJoint(hpp::Transform__slice* transform, std::string const& jointName);

        /// Reload the joint in the tree.
Joseph Mirabel's avatar
Joseph Mirabel committed
63
        void reload ();
64

Joseph Mirabel's avatar
Joseph Mirabel committed
65
66
        private slots:
          void resize (const QModelIndex index);
Joseph Mirabel's avatar
Joseph Mirabel committed
67

Joseph Mirabel's avatar
Joseph Mirabel committed
68
      private:
Joseph Mirabel's avatar
Joseph Mirabel committed
69
70
        void initSearchActions();

hdallard's avatar
hdallard committed
71
        /// Reset the tree.
Joseph Mirabel's avatar
Joseph Mirabel committed
72
        void reset ();
73

74
        JointTreeItem* buildJointTreeItem (const char* name, std::size_t& rkConfig);
75

Joseph Mirabel's avatar
Joseph Mirabel committed
76
77
        HppWidgetsPlugin* plugin_;
        ::Ui::JointTreeWidget* ui_;
78

Joseph Mirabel's avatar
Joseph Mirabel committed
79
80
81
82
83
        QStandardItemModel* model_;
        QDockWidget* dock_;
    };
  } // namespace gui
} // namespace hpp
84

Joseph Mirabel's avatar
Joseph Mirabel committed
85
#endif // HPP_GUI_JOINTTREEWIDGET_HH