EmergencyStopWidget.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 ArmarXCore::ArmarXObjects::EmergencyStop
17  * @author Stefan Reither ( stef dot reither at web dot de )
18  * @date 2016
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <QAction>
26 #include <QPushButton>
27 #include <QToolButton>
28 #include <QWidget>
29 
30 #include <IceUtil/UUID.h>
31 
34 
36 
37 class QLabel;
38 class QGridLayout;
39 class QShortcut;
40 
41 namespace armarx
42 {
43  class ArmarXMainWindow;
44 
46  public ArmarXComponentWidgetControllerTemplate<EmergencyStopWidget>,
47  public armarx::EmergencyStopListener
48 
49  {
50  Q_OBJECT
51  public:
52  explicit EmergencyStopWidget(QWidget* parent = 0, ArmarXMainWindow* mainWindow = 0);
53  QWidget* getButtonWidget();
54  // void reportEmergencyStopState(EmergencyStopState, const Ice::Current&) override;
55 
56  signals:
59 
60  public slots:
61  void enableSS2();
62  void releaseSS2();
63  void clicked(bool = true);
64 
65  // ManagedIceObject interface
66  protected:
67  void onInitComponent() override;
68  void onConnectComponent() override;
69  void onDisconnectComponent() override;
70  std::string getDefaultName() const override;
71 
72  EmergencyStopState
73  releaseSS2OnMaster() const;
74 
75  private slots:
76  void setChecked(const EmergencyStopState);
77  void updateEmergencyStopState();
78 
79  private:
80  ArmarXMainWindow* mainWindow;
81  QPixmap iconNormal;
82  QPixmap iconDark;
83 
84  QToolButton* button;
85  QAction* emergencyStopAction;
86 
87  EmergencyStopMasterInterfacePrx emergencyStopMasterPrx;
88  EmergencyStopState lastKnownEmergencyStopState;
89  QTimer* timer;
90 
91  // ArmarXWidgetController interface
92  public:
93  static QString
95  {
96  return "EmergencyStopWidget";
97  }
98 
99  void loadSettings(QSettings* settings) override;
100  void saveSettings(QSettings* settings) override;
101  std::string iceNameUUID = IceUtil::generateUUID();
102  // EmergencyStopListener interface
103 
104  void reportEmergencyStopState(EmergencyStopState, const Ice::Current&) override;
105  };
106 
108 } // namespace armarx
armarx::EmergencyStopWidget::releaseSS2
void releaseSS2()
Definition: EmergencyStopWidget.cpp:184
armarx::EmergencyStopWidget::GetWidgetName
static QString GetWidgetName()
Definition: EmergencyStopWidget.h:94
armarx::EmergencyStopWidget::enableSS2
void enableSS2()
Definition: EmergencyStopWidget.cpp:164
armarx::EmergencyStopWidget::EmergencyStopWidget
EmergencyStopWidget(QWidget *parent=0, ArmarXMainWindow *mainWindow=0)
Definition: EmergencyStopWidget.cpp:43
armarx::EmergencyStopWidget::stopPeriodicStateUpdate
void stopPeriodicStateUpdate()
armarx::ArmarXMainWindow
The ArmarXMainWindow class.
Definition: ArmarXMainWindow.h:76
PeriodicTask.h
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::EmergencyStopWidget::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: EmergencyStopWidget.cpp:151
armarx::EmergencyStopWidget::reportEmergencyStopState
void reportEmergencyStopState(EmergencyStopState, const Ice::Current &) override
Definition: EmergencyStopWidget.cpp:157
armarx::EmergencyStopWidget::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: EmergencyStopWidget.cpp:112
IceInternal::Handle< EmergencyStopWidget >
armarx::EmergencyStopWidget::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: EmergencyStopWidget.cpp:135
ArmarXComponentWidgetController.h
armarx::EmergencyStopWidget::releaseSS2OnMaster
EmergencyStopState releaseSS2OnMaster() const
Definition: EmergencyStopWidget.cpp:238
armarx::EmergencyStopWidget::getButtonWidget
QWidget * getButtonWidget()
Definition: EmergencyStopWidget.cpp:99
EmergencyStop.h
armarx::EmergencyStopWidget::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: EmergencyStopWidget.cpp:105
armarx::EmergencyStopWidget::clicked
void clicked(bool=true)
Definition: EmergencyStopWidget.cpp:203
armarx::EmergencyStopWidget
Definition: EmergencyStopWidget.h:45
armarx::EmergencyStopWidget::iceNameUUID
std::string iceNameUUID
Definition: EmergencyStopWidget.h:101
armarx::EmergencyStopWidget::startPeriodicStateUpdate
void startPeriodicStateUpdate()
armarx::EmergencyStopWidget::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: EmergencyStopWidget.cpp:145
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::EmergencyStopWidget::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: EmergencyStopWidget.cpp:231