1 | /* |
2 | * Copyright (C) 2003-2008 Justin Karneges <justin@affinix.com> |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2.1 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library; if not, write to the Free Software |
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
17 | */ |
18 | |
19 | #pragma once |
20 | |
21 | #include <QDateTime> |
22 | #include <QList> |
23 | #include <QObject> |
24 | |
25 | namespace QCA { |
26 | |
27 | class SafeTimer; |
28 | class DirWatch; |
29 | |
30 | } |
31 | |
32 | namespace gpgQCAPlugin { |
33 | |
34 | class RingWatch : public QObject |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | class DirItem |
39 | { |
40 | public: |
41 | QCA::DirWatch *dirWatch; |
42 | QCA::SafeTimer *changeTimer; |
43 | }; |
44 | |
45 | class FileItem |
46 | { |
47 | public: |
48 | QCA::DirWatch *dirWatch; |
49 | QString fileName; |
50 | bool exists; |
51 | qint64 size; |
52 | QDateTime lastModified; |
53 | }; |
54 | |
55 | QList<DirItem> dirs; |
56 | QList<FileItem> files; |
57 | |
58 | RingWatch(QObject *parent = nullptr); |
59 | ~RingWatch() override; |
60 | |
61 | void add(const QString &filePath); |
62 | void clear(); |
63 | |
64 | Q_SIGNALS: |
65 | void changed(const QString &filePath); |
66 | |
67 | private Q_SLOTS: |
68 | void dirChanged(); |
69 | void handleChanged(); |
70 | }; |
71 | |
72 | } // end namespace gpgQCAPlugin |
73 | |