ListeningManager.hpp
1 #pragma once
2 #include <Device/Node/DeviceNode.hpp>
3 
4 #include <score_plugin_deviceexplorer_export.h>
5 namespace Device
6 {
7 class DeviceInterface;
8 }
9 namespace Explorer
10 {
11 class DeviceExplorerModel;
12 class DeviceExplorerWidget;
13 class ListeningHandler;
14 class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT ListeningManager : public QObject
15 {
16  DeviceExplorerModel& m_model;
17  const DeviceExplorerWidget& m_widget;
18 
19 public:
21 
22  void enableListening(Device::Node& node);
23  void setListening(const QModelIndex& idx, bool b);
24  void resetListening(Device::Node& idx);
25 
26  // Will do it for all devices
27  void stopListening();
28 
29  // Sets the listening state with the expanded nodes
30  void setDeviceWidgetListening();
31 
32 private:
33  void disableListening_rec(
35  void enableListening_rec(
36  const QModelIndex& index, Device::DeviceInterface&, ListeningHandler& lm);
37 
38  Device::DeviceInterface& deviceFromNode(const Device::Node&);
39  Device::DeviceInterface& deviceFromProxyModelIndex(const QModelIndex&);
40  Device::DeviceInterface& deviceFromModelIndex(const QModelIndex& idx);
41 
42  Device::Node& nodeFromProxyModelIndex(const QModelIndex&);
43  Device::Node& nodeFromModelIndex(const QModelIndex&);
44 
45  ListeningHandler& m_handler;
46 };
47 }
Definition: DeviceInterface.hpp:66
Definition: DeviceExplorerModel.hpp:67
Definition: DeviceExplorerWidget.hpp:44
Definition: ListeningHandler.hpp:21
Definition: ListeningManager.hpp:15
Manipulation of Devices from Qt.
Definition: AddressSettings.cpp:14