blob: c3ba57ada4ef69a1282d24511ea024b881d48a01 (
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
58
59
60
61
|
#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(QString password READ password WRITE setPassword)
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);
void setPassword(const QString& passwd);
QString password() const;
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;
QString _password;
Agent::SyncFlags _syncFlags;
int _numAgents;
};
#endif // DISTFOLDER_H
|