blob: ae7a0eaf276cbe9433aeacb2bf842c45eb93f209 (
plain)
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
|
#ifndef DISTFOLDER_H
#define DISTFOLDER_H
#include <QtCore/QObject>
#include <QtCore/QDir>
#include <QtCore/QUuid>
#include <QtCore/QFileSystemWatcher>
#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
|