From c3a1946675855b299a2b36550cdf2c2f69d153aa Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 17 Sep 2012 23:03:03 +0200 Subject: initial import --- distfoldd/distfolder.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 distfoldd/distfolder.h (limited to 'distfoldd/distfolder.h') diff --git a/distfoldd/distfolder.h b/distfoldd/distfolder.h new file mode 100644 index 0000000..ae7a0ea --- /dev/null +++ b/distfoldd/distfolder.h @@ -0,0 +1,57 @@ +#ifndef DISTFOLDER_H +#define DISTFOLDER_H + +#include +#include +#include +#include + +#include "watcher.h" +#include "server.h" +#include "agent.h" +#include "discoverer.h" + +class DistFolder : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool readOnlySync READ readOnlySync WRITE setReadOnlySync) + Q_PROPERTY(bool pullMode READ pullMode WRITE setPullMode) + Q_PROPERTY(bool compress READ compress WRITE setCompress) + +public: + explicit DistFolder(const QUuid& uuid, const QString& path, QObject *parent = 0); + + bool readOnlySync() const; + void setReadOnlySync(bool read_only); + bool pullMode() const; + void setPullMode(bool pull_mode); + bool compress() const; + void setCompress(bool compress); + +private: + QDateTime scanLastModTime(); + QDateTime scanLastModTime(const QDir& dir); + void updateLastModTime(const QDateTime& dt = QDateTime()); + +private slots: + void handleNewConnection(); + void handlePathAdded(const QString& path); + void handlePathChanged(const QString& path); + void handlePathRemoved(const QString& path); + void handleMoreRecentHost(const QHostAddress& address, uint port, const QDateTime& dateTime); + void handleClientFinished(); + void handleDestroyedAgent(); + +private: + QUuid _uuid; + QDir _localPath; + QDateTime _mtime; + bool _mtimeChanged; + Watcher *_watcher; + Server *_server; + Discoverer *_discoverer; + Agent::SyncFlags _syncFlags; + int _numAgents; +}; + +#endif // DISTFOLDER_H -- cgit v1.2.3