1 | /* |
2 | * Copyright (C) by Klaas Freitag <freitag@owncloud.com> |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, but |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12 | * for more details. |
13 | */ |
14 | |
15 | #ifndef SYNCFILESTATUS_H |
16 | #define SYNCFILESTATUS_H |
17 | |
18 | #include <QMetaType> |
19 | #include <QObject> |
20 | #include <QString> |
21 | |
22 | #include "owncloudlib.h" |
23 | |
24 | namespace OCC { |
25 | |
26 | /** |
27 | * @brief The SyncFileStatus class |
28 | * @ingroup libsync |
29 | */ |
30 | class OWNCLOUDSYNC_EXPORT SyncFileStatus |
31 | { |
32 | public: |
33 | enum SyncFileStatusTag { |
34 | StatusNone, |
35 | StatusSync, |
36 | StatusWarning, |
37 | StatusUpToDate, |
38 | StatusError, |
39 | }; |
40 | |
41 | SyncFileStatus(); |
42 | SyncFileStatus(SyncFileStatusTag); |
43 | |
44 | void set(SyncFileStatusTag tag); |
45 | SyncFileStatusTag tag() const; |
46 | |
47 | void setShared(bool isShared); |
48 | bool shared() const; |
49 | |
50 | QString toSocketAPIString() const; |
51 | |
52 | private: |
53 | SyncFileStatusTag _tag; |
54 | bool _shared; |
55 | }; |
56 | |
57 | inline bool operator==(const SyncFileStatus &a, const SyncFileStatus &b) |
58 | { |
59 | return a.tag() == b.tag() && a.shared() == b.shared(); |
60 | } |
61 | |
62 | inline bool operator!=(const SyncFileStatus &a, const SyncFileStatus &b) |
63 | { |
64 | return !(a == b); |
65 | } |
66 | } |
67 | |
68 | Q_DECLARE_METATYPE(OCC::SyncFileStatus) |
69 | |
70 | #endif // SYNCFILESTATUS_H |
71 | |