Debian Codegraph @

src/RsyncDirModel_p.h

raw symbols SCIP
1 /****************************************************************************
2 Copyright (C) VCreate Logic Private Limited, Bangalore
3 Contact: [email protected]
4
5 This file is developed by VCreate Logic Private Limited and used as part of the "luckyBackup" project
6 It is distributed under the terms of the GNU General Public License
7 It is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 It is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with the luckyBackup project. If not, see <http://www.gnu.org/licenses/>.
19
20 ****************************************************************************/
21 // modified on 22 May 2016
22 // by luckyb after Lothar's fixes
23
24 #ifndef Rsync_DIR_MODEL_P_H
25 #define Rsync_DIR_MODEL_P_H
26
27 #include <QObject>
28 #include <QMetaType>
29 #include <QList>
30 #include <QString>
31 #include <QUrl>
32 #include <QIcon>
33 #include <QProcess>
34 #include <QTextStream>
35
36 #include "qurlinfo.h"
37
38 class RsyncEntry;
39 class RsyncDirLister;
40 class RsyncDirListerOperation;
41
42 struct RsyncEntryData;
43 class RsyncEntry
44 {
45 public:
46 ~RsyncEntry();
47
48 RsyncEntry* parentEntry() const;
49 QList<RsyncEntry*> childEntries() const;
50 bool isChildrenFetched() const;
51 bool isFetching() const;
52
53 QString path() const;
54 // QUrlInfo urlInfo() const;
55 QIcon icon() const;
56
57 //protected:
58 QUrlInfo urlInfo() const;
59 RsyncEntry(const QUrlInfo& info);
60 RsyncEntry* addUrlInfo(const QUrlInfo& urlInfo);
61 void removeUrlInfo(const QUrlInfo& urlInfo);
62 void setChildrenFetched(bool val=true);
63 void clear();
64 void setFetching(bool val=true);
65
66 private:
67 friend class RsyncDirModel;
68 RsyncEntryData* d;
69 };
70 Q_DECLARE_METATYPE(RsyncEntry*);
71
72
73 struct RsyncDirListerOperationData;
74 class RsyncDirListerOperation : public QObject
75 {
76 Q_OBJECT
77
78 public:
79 RsyncDirListerOperation(RsyncDirLister* parent);
80 RsyncDirListerOperation(RsyncDirLister* parent,RsyncEntry* entry);
81 ~RsyncDirListerOperation();
82 void setParentEntry(RsyncEntry* entry);
83 RsyncEntry* parentEntry() const;
84
85
86
87
88 int id() const;
89 bool isExecuting() const;
90 bool isFinished() const;
91 bool isSuccessfullyFinished() const;
92
93 public:
94 void execute();
95 void abort();
96
97 protected:
98 QString path() const;
99
100 signals:
101 void started();
102 void finished();
103 void aborted();
104
105 protected slots:
106 void procFinished();
107 void procError();
108
109 private:
110 friend class RsyncDirLister;
111 RsyncDirListerOperationData* d;
112 };
113
114 struct RsyncDirListerData;
115 class RsyncDirLister : public QObject
116 {
117 Q_OBJECT
118
119 public:
120 RsyncDirLister(QObject* parent=0);
121 ~RsyncDirLister();
122
123 void setUrl(const QUrl& url);
124 QUrl url() const;
125
126 QList<RsyncEntry*> topLevelEntries() const;
127 bool topLevelEntriesFetched() const;
128 QString lastError() const;
129
130 void list();
131 void list(RsyncEntry* entry);
132 void refresh();
133 void refresh(RsyncEntry* entry);
134 void abort();
135 void setChildrenFetched(RsyncEntry* entry);
136 void setUrl(const QUrl& url,const QString& cpath);
137 void setUrl(const QUrl& url,const QString& cpath, const QStringList& cargs);
138 void cleanOperations();
139 QStringList arguments() const;
140 QString command() const;
141
142 signals:
143 void listingDone(RsyncEntry* entry=0);
144 void listingAborted(RsyncEntry* entry=0);
145 void listingError(const QString& error, RsyncEntry* entry=0);
146
147 //protected slots:
148 // void slotOperationFinished();
149
150 protected:
151 void setTopLevelEntries(const QList<RsyncEntry*>& entries);
152
153 private:
154 friend class RsyncDirListerOperation;
155 RsyncDirListerData* d;
156 };
157
158
159 struct FileIconCacheData;
160 class FileIconCache
161 {
162 public:
163 static FileIconCache& instance();
164 ~FileIconCache();
165
166 QIcon icon(const QUrlInfo& info) const;
167
168 private:
169 FileIconCache();
170
171 private:
172 FileIconCacheData* d;
173 };
174
175 #endif