API Documentation
Loading...
Searching...
No Matches
DeviceWatcher.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <QtCore/QEvent>
4#include <QtCore/QObject>
5namespace NDEVR
6{
7 class DeviceWatcherPrivate;
8 class NDEVR_WIDGETS_API DeviceWatcher : public QObject
9 {
10 Q_OBJECT
11 Q_DECLARE_PRIVATE(DeviceWatcher)
12 public:
13 explicit DeviceWatcher(QObject* parent = 0);
15
16 bool start();
17 bool stop();
18 bool isRunning() const;
19
20 void appendEventReceiver(QObject* receiver);
21 static DeviceWatcher& DefaultWatcher();
22 signals:
23 void deviceAdded(const QString& dev);
24 void deviceChanged(const QString& dev); //when umounting the device
25 void deviceRemoved(const QString& dev);
26
27 protected:
28 bool running;
30 };
31
33 {
34 public:
35 enum Action { Add, Remove, Change };
36 //static const Type EventType; //VC link error
37
38 explicit QDeviceChangeEvent(Action action, const QString& device);
39
40 Action action() const { return m_action; }
41 QString device() const { return m_device; }
42 static Type registeredType()
43 {
44 static Type EventType = static_cast<Type>(registerEventType());
45 return EventType;
46 }
47
48 private:
49 Action m_action;
50 QString m_device;
51 };
52}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
Definition DeviceWatcher.h:9
bool running
Definition DeviceWatcher.h:28
void deviceAdded(const QString &dev)
void deviceRemoved(const QString &dev)
void deviceChanged(const QString &dev)
DeviceWatcherPrivate * d_ptr
Definition DeviceWatcher.h:29
Definition DeviceWatcher_p.h:45
Definition DeviceWatcher.h:33
QString device() const
Definition DeviceWatcher.h:41
Action
Definition DeviceWatcher.h:35
static Type registeredType()
Definition DeviceWatcher.h:42
Action action() const
Definition DeviceWatcher.h:40
Definition ACIColor.h:37