NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
FootpedalHotkeyView.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef FootpedalHotkeyView_h
16 #define FootpedalHotkeyView_h
17 
18 #include <niftkBaseView.h>
19 #include <service/event/ctkEvent.h>
20 #include "ui_FootpedalHotkeyViewWidget.h"
21 #include <QTimer>
22 
23 namespace niftk
24 {
25  class WindowsHotkeyHandler;
26 }
27 
34 class FootpedalHotkeyView : public niftk::BaseView, public Ui::FootpedalHotkeyViewWidget
35 {
36  Q_OBJECT
37 
38 public:
39 
41  virtual ~FootpedalHotkeyView();
42 
46  static const char* VIEW_ID;
47 
52  virtual std::string GetViewID() const;
53 
54 signals:
55  void OnFootSwitch1Start(ctkDictionary d);
56  void OnFootSwitch1Stop(ctkDictionary d);
57  void OnFootSwitch2Start(ctkDictionary d);
58  void OnFootSwitch2Stop(ctkDictionary d);
59  void OnFootSwitch3Start(ctkDictionary d);
60  void OnFootSwitch3Stop(ctkDictionary d);
61 
62 protected:
63 
67  virtual void CreateQtPartControl(QWidget *parent);
68 
72  virtual void SetFocus();
73 
74 
76  void WriteCurrentConfig(const QString& directory) const;
77 
78 protected slots:
79 
80 
81 private slots:
82 
84  void OnRecordingStarted(const ctkEvent& event);
85 
86  void OnHotkeyPressed(niftk::WindowsHotkeyHandler* sender, int hotkey);
87 
88  void OnTimer1();
89  void OnTimer2();
90  void OnTimer3();
91 
92 private:
93  niftk::WindowsHotkeyHandler* m_Footswitch1;
94  QTimer* m_Footswitch1OffTimer; // to emulate hotkey-release events.
95  niftk::WindowsHotkeyHandler* m_Footswitch2;
96  QTimer* m_Footswitch2OffTimer;
97  niftk::WindowsHotkeyHandler* m_Footswitch3;
98  QTimer* m_Footswitch3OffTimer;
99 
100 
101  // these are coming from the ctk event bus admin. we use them to explicitly unregister ourself.
102  qlonglong m_IGIRecordingStartedSubscriptionID;
103 };
104 
105 #endif // FootpedalHotkeyView_h
void OnFootSwitch2Start(ctkDictionary d)
void OnFootSwitch1Start(ctkDictionary d)
static const char * VIEW_ID
Static view ID = uk.ac.ucl.cmic.igifootpedalhotkey.
Definition: FootpedalHotkeyView.h:46
virtual void CreateQtPartControl(QWidget *parent)
Called by framework, this method creates all the controls for this view.
Definition: FootpedalHotkeyView.cxx:87
Definition: FootpedalHotkeyView.h:34
virtual ~FootpedalHotkeyView()
Definition: FootpedalHotkeyView.cxx:49
void OnFootSwitch2Stop(ctkDictionary d)
void WriteCurrentConfig(const QString &directory) const
Definition: FootpedalHotkeyView.cxx:225
Definition: niftkWindowsHotkeyHandler.h:34
Base view component for plugins listening to visibility change events, focus changed events and so on...
Definition: niftkBaseView.h:47
FootpedalHotkeyView()
Definition: FootpedalHotkeyView.cxx:36
virtual std::string GetViewID() const
Returns the view ID.
Definition: FootpedalHotkeyView.cxx:80
void OnFootSwitch1Stop(ctkDictionary d)
cl_event event
Definition: glew.h:3231
virtual void SetFocus()
Called by framework, sets the focus on a specific widget.
Definition: FootpedalHotkeyView.cxx:219
void OnFootSwitch3Stop(ctkDictionary d)
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194
void OnFootSwitch3Start(ctkDictionary d)