mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
solid: parent the QSocketNotifier to UdevQt::Client
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8d3250d896
commit
e6aef8e5d5
2 changed files with 10 additions and 7 deletions
|
@ -70,20 +70,20 @@ class Client : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Client(const QList<QByteArray> &subsystems, QObject *parent = 0);
|
||||
Client(const QList<QByteArray> &subsystems, QObject *parent = nullptr);
|
||||
~Client();
|
||||
|
||||
DeviceList allDevices();
|
||||
Device deviceBySysfsPath(const QString &sysfsPath);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void deviceAdded(const UdevQt::Device &dev);
|
||||
void deviceRemoved(const UdevQt::Device &dev);
|
||||
void deviceChanged(const UdevQt::Device &dev);
|
||||
void deviceOnlined(const UdevQt::Device &dev);
|
||||
void deviceOfflined(const UdevQt::Device &dev);
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void monitorReadyRead(int fd);
|
||||
|
||||
private:
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
namespace UdevQt {
|
||||
|
||||
Client::Client(const QList<QByteArray> &subsystems, QObject *parent)
|
||||
: QObject(parent), m_udev(udev_new()), m_monitor(0), m_monitorNotifier(0)
|
||||
: QObject(parent),
|
||||
m_udev(udev_new()),
|
||||
m_monitor(nullptr),
|
||||
m_monitorNotifier(nullptr)
|
||||
{
|
||||
// create a listener
|
||||
m_monitor = udev_monitor_new_from_netlink(m_udev, "udev");
|
||||
|
@ -39,8 +42,8 @@ Client::Client(const QList<QByteArray>& subsystems, QObject *parent)
|
|||
|
||||
// start the monitor receiving
|
||||
udev_monitor_enable_receiving(m_monitor);
|
||||
m_monitorNotifier = new QSocketNotifier(udev_monitor_get_fd(m_monitor), QSocketNotifier::Read);
|
||||
QObject::connect(m_monitorNotifier, SIGNAL(activated(int)), this, SLOT(monitorReadyRead(int)));
|
||||
m_monitorNotifier = new QSocketNotifier(udev_monitor_get_fd(m_monitor), QSocketNotifier::Read, this);
|
||||
connect(m_monitorNotifier, SIGNAL(activated(int)), this, SLOT(monitorReadyRead(int)));
|
||||
}
|
||||
|
||||
Client::~Client()
|
||||
|
|
Loading…
Add table
Reference in a new issue