2012-01-04 16:24:53 +01:00
|
|
|
#ifndef MACFSLISTENER_H
|
|
|
|
#define MACFSLISTENER_H
|
|
|
|
|
|
|
|
#include <CoreServices/CoreServices.h>
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSet>
|
|
|
|
|
2012-01-05 15:51:23 +01:00
|
|
|
#include "filesystemwatcherinterface.h"
|
|
|
|
|
|
|
|
class MacFSListener : public FileSystemWatcherInterface {
|
2012-01-04 16:24:53 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-01-04 16:26:22 +01:00
|
|
|
explicit MacFSListener(QObject* parent = 0);
|
2012-01-04 16:24:53 +01:00
|
|
|
void Init();
|
|
|
|
void AddPath(const QString& path);
|
2012-01-05 16:01:43 +01:00
|
|
|
void Clear();
|
2012-01-04 16:24:53 +01:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void PathChanged(const QString& path);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void UpdateStream();
|
|
|
|
|
|
|
|
static void EventStreamCallback(
|
|
|
|
ConstFSEventStreamRef stream,
|
|
|
|
void* user_data,
|
|
|
|
size_t num_events,
|
|
|
|
void* event_paths,
|
|
|
|
const FSEventStreamEventFlags event_flags[],
|
|
|
|
const FSEventStreamEventId event_ids[]);
|
|
|
|
|
|
|
|
CFRunLoopRef run_loop_;
|
|
|
|
FSEventStreamRef stream_;
|
|
|
|
|
|
|
|
QSet<QString> paths_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|