NJointControllerClassesWidget.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * \package RobotAPI::gui-plugins::RobotUnitPlugin
17  * \author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * \date 2017
19  * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <mutex>
26 #include <atomic>
27 
28 #include <QWidget>
29 #include <QLabel>
30 #include <QLineEdit>
31 #include <QHBoxLayout>
32 #include <QFormLayout>
33 #include <QPushButton>
34 #include <QTreeWidget>
35 #include <QTreeWidgetItem>
36 #include <QCheckBox>
37 #include <QComboBox>
38 
41 #include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
42 
43 #include "RobotUnitWidgetBase.h"
44 #include <RobotAPI/gui-plugins/RobotUnitPlugin/ui_NJointControllerClassesWidget.h>
45 
46 namespace armarx
47 {
48 
49  class NJointControllerClassesWidgetEntry;
50 
51  class NJointControllerClassesWidget : public RobotUnitWidgetTemplateBase<Ui::NJointControllerClassesWidget>
52  {
53  Q_OBJECT
54 
55  public:
56  explicit NJointControllerClassesWidget(QWidget* parent = 0);
58 
59  virtual void nJointControllerClassAdded(std::string name);
60 
61  virtual void updateDefaultNameOnControllerCreated(QString createdName, bool force = false);
62  QString getDefaultName() const;
63 
64  void loadSettings(QSettings* settings) override;
65  void saveSettings(QSettings* settings) override;
66  protected:
67  void clearAll() override;
68  void doContentUpdate() override;
69  void getResetData() override;
70  bool addOneFromResetData() override;
71 
72  private slots:
73  void filterUpdated();
74  void packageEditChanged();
75  void loadLibClicked();
76  private:
77  void add(const NJointControllerClassDescription& desc);
78  void addFilter() override;
79 
80  std::map<std::string, NJointControllerClassesWidgetEntry*> entries;
81  std::map<std::string, NJointControllerClassDescription> nJointControllerClassDescriptions;
82 
83  QComboBox* filterCombination;
84 
85  QLineEdit* filterName;
86  QCheckBox* filterNameActive;
87  QCheckBox* filterNameInverted;
88 
89  QComboBox* filterRemoteCreation;
90  QCheckBox* filterRemoteCreationActive;
91 
92  //selecting libs
93  enum class SelectLibsMode
94  {
95  LineEdit,
96  ComboBox
97  };
98  SelectLibsMode selectLibMode;
99  std::map<std::string, std::string> libShortNameToFileName;
100 
101  int defaultControllerName {0};
102  };
103 
104  //helper
105  class NJointControllerClassesWidgetEntry : public QObject
106  {
107  Q_OBJECT
108  public:
111  QTreeWidget& treeWidget,
112  const NJointControllerClassDescription& desc,
114  );
115 
116  bool matchName(const QString& name);
117  bool hasRemoteCreation();
118 
119  void updateDefaultName(const QString& oldName, const QString& newName);
120 
121  public slots:
122  void setVisible(bool vis);
123 
124  private slots:
125  void createCtrl();
126 
127  public:
128  std::string className;
129  QString classNameQStr;
131  QTreeWidgetItem* header {nullptr};
132  QLineEdit* nameEdit {nullptr};
135  };
136 }
RobotUnitWidgetBase.h
armarx::NJointControllerClassesWidget::clearAll
void clearAll() override
Definition: NJointControllerClassesWidget.cpp:142
armarx::NJointControllerClassesWidgetEntry::creator
WidgetDescription::DescribedWidgetBase * creator
Definition: NJointControllerClassesWidget.h:133
armarx::NJointControllerClassesWidgetEntry::nameEdit
QLineEdit * nameEdit
Definition: NJointControllerClassesWidget.h:132
armarx::NJointControllerClassesWidget::nJointControllerClassAdded
virtual void nJointControllerClassAdded(std::string name)
Definition: NJointControllerClassesWidget.cpp:90
armarx::NJointControllerClassesWidget::loadSettings
void loadSettings(QSettings *settings) override
Definition: NJointControllerClassesWidget.cpp:128
VariantWidget.h
armarx::NJointControllerClassesWidgetEntry
Definition: NJointControllerClassesWidget.h:105
armarx::NJointControllerClassesWidget::doContentUpdate
void doContentUpdate() override
Definition: NJointControllerClassesWidget.cpp:148
WidgetDescription.h
armarx::NJointControllerClassesWidget::saveSettings
void saveSettings(QSettings *settings) override
Definition: NJointControllerClassesWidget.cpp:135
armarx::NJointControllerClassesWidget::addOneFromResetData
bool addOneFromResetData() override
Definition: NJointControllerClassesWidget.cpp:169
armarx::NJointControllerClassesWidgetEntry::parent
NJointControllerClassesWidget * parent
Definition: NJointControllerClassesWidget.h:134
armarx::NJointControllerClassesWidget::getResetData
void getResetData() override
Definition: NJointControllerClassesWidget.cpp:157
armarx::NJointControllerClassesWidget::getDefaultName
QString getDefaultName() const
Definition: NJointControllerClassesWidget.cpp:123
armarx::WidgetDescription::DescribedWidgetBase
Definition: WidgetDescription.h:45
armarx::NJointControllerClassesWidgetEntry::robotUnit
RobotUnitInterfacePrx robotUnit
Definition: NJointControllerClassesWidget.h:130
armarx::NJointControllerClassesWidgetEntry::hasRemoteCreation
bool hasRemoteCreation()
Definition: NJointControllerClassesWidget.cpp:357
armarx::RemoteGui::Client::LineEdit
Definition: Widgets.h:40
armarx::RemoteGui::Client::ComboBox
Definition: Widgets.h:50
armarx::RobotUnitWidgetTemplateBase
Definition: RobotUnitWidgetBase.h:93
armarx::NJointControllerClassesWidget::~NJointControllerClassesWidget
~NJointControllerClassesWidget() override
Definition: NJointControllerClassesWidget.cpp:85
armarx::NJointControllerClassesWidgetEntry::classNameQStr
QString classNameQStr
Definition: NJointControllerClassesWidget.h:129
armarx::NJointControllerClassesWidgetEntry::NJointControllerClassesWidgetEntry
NJointControllerClassesWidgetEntry(NJointControllerClassesWidget &parent, QTreeWidget &treeWidget, const NJointControllerClassDescription &desc, RobotUnitInterfacePrx robotUnit)
Definition: NJointControllerClassesWidget.cpp:289
armarx::NJointControllerClassesWidgetEntry::updateDefaultName
void updateDefaultName(const QString &oldName, const QString &newName)
Definition: NJointControllerClassesWidget.cpp:362
armarx::NJointControllerClassesWidget::NJointControllerClassesWidget
NJointControllerClassesWidget(QWidget *parent=0)
Definition: NJointControllerClassesWidget.cpp:36
armarx::NJointControllerClassesWidget
Definition: NJointControllerClassesWidget.h:51
IceInternal::ProxyHandle<::IceProxy::armarx::RobotUnitInterface >
armarx::NJointControllerClassesWidgetEntry::matchName
bool matchName(const QString &name)
Definition: NJointControllerClassesWidget.cpp:352
armarx::NJointControllerClassesWidget::updateDefaultNameOnControllerCreated
virtual void updateDefaultNameOnControllerCreated(QString createdName, bool force=false)
Definition: NJointControllerClassesWidget.cpp:109
armarx::NJointControllerClassesWidgetEntry::className
std::string className
Definition: NJointControllerClassesWidget.h:128
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::NJointControllerClassesWidgetEntry::header
QTreeWidgetItem * header
Definition: NJointControllerClassesWidget.h:131
armarx::NJointControllerClassesWidgetEntry::setVisible
void setVisible(bool vis)
Definition: NJointControllerClassesWidget.cpp:370