-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinotify.h
60 lines (41 loc) · 1.49 KB
/
inotify.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef __INOTIFY_HH__
#define __INOTIFY_HH__
// Simplme inotify wrapper that spams with Qt signals on inotify events.
// Watches descriptors are hidden behind INotify::Watch class that can be
// used to store recursive directory information.
#include <QObject>
// TODO: needs to be checked whether QObject based classes can be global
// singletons like this ...
class INotify : public QObject
{
Q_OBJECT
public:
class Watch;
~INotify();
static INotify *instance();
// TODO: consider what would be most meaningful user data here ...
// takes ownership of the data for now (in the case of data != 0)
Watch *addWatch(const char *path, unsigned flags, QObject *data = 0);
void removeWatch(Watch *watch);
signals:
void fileEvent(INotify::Watch *watch, const char *name, unsigned eventmask);
private:
INotify();
class Private;
Private *hidden;
static INotify g_inst;
private slots:
void flush();
};
#endif // __INOTIFY_HH__