Debian Codegraph @

src/operationClass.h

raw symbols SCIP
1 /* ------------------ operationClass.h --------------------------------------------------------------------------------------
2 header file for luckyBackup project
3
4 ===============================================================================================================================
5 ===============================================================================================================================
6 This file is part of "luckyBackup" project
7 Copyright, Loukas Avgeriou
8 luckyBackup is distributed under the terms of the GNU General Public License
9 luckyBackup is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 luckyBackup is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with luckyBackup. If not, see <http://www.gnu.org/licenses/>.
21
22
23 project version : Please see "main.cpp" for project version
24
25 developer : luckyb
26 last modified : 22 May 2016
27 ===============================================================================================================================
28 ===============================================================================================================================
29 */
30
31
32 #ifndef OPERATIONCLASS_H
33 #define OPERATIONCLASS_H
34 #include <QDateTime>
35 #include <QStringList>
36
37 //==============================================================================================================
38 //Declaration of operation class (this is the class that holds operation's name & arguments)
39 class operation
40 {
41 public:
42 operation() //constructor
43 {
44 itsName = "";
45 itsArguments.clear(); //itsArguments << "";
46 itsDescription = "";
47 itsSource = "";
48 itsDestination = "";
49 itsConnectRestore = "";
50 itsLastExecutionErrors = -1;
51 itsExclude = false;
52 itsInclude = false;
53 itsIncludeModeNormal = false;
54 itsByPassWARNING = false;
55 itsCloneWARNING = true;
56 itsRepeatOnFail = 0;
57 itsKeepSnapshots = 1;
58 itsSnapshotsList.clear();
59 itsOptionsFATntfs = false;
60 itsOptionsSuper = false;
61 itsOptionsNumericIDs = false;
62 itsOptionsVss = false;
63 itsOptionsRestorent = false;
64 itsIncludeFromFile = false;
65 itsExcludeFromFile = false;
66 itsExcludeGVFS = false;
67 itsExecuteBeforeList.clear();
68 itsExecuteBeforeListState.clear();
69 itsExecuteAfterList.clear();
70 itsExecuteAfterListState.clear();
71 }
72 ~operation() {} //destructor
73
74 //Functions - get class operation data--------------------------------------------------------------------------------------
75 QString GetName() const {return itsName;}
76 QString GetDescription() const {return itsDescription;}
77 QStringList GetArgs() const {return itsArguments;}
78 bool GetIncluded () const {return itsIncluded;}
79 bool GetCRITICAL () const {return itsCRITICAL;}
80 bool GetWARNING () const {return itsWARNING;}
81 bool GetOK () const {return itsOK;}
82 bool GetDestMounted () const {return itsDestMounted;}
83 bool GetSourceMounted () const {return itsSourceMounted;}
84 bool GetSourcePerms() const {return itsSourcePerms;}
85 bool GetDestPerms () const {return itsDestPerms;}
86 bool GetPerform () const {return itsPerform;}
87 bool GetByPassWARNING () const {return itsByPassWARNING;}
88 bool GetCloneWARNING () const {return itsCloneWARNING;}
89 int GetRepeatOnFail() const {return itsRepeatOnFail;}
90
91 QDateTime GetLastExecutionTime() const {return itsLastExecutionTime;}
92 int GetLastExecutionErrors() const {return itsLastExecutionErrors;}
93 int GetSnapshotsListSize () const {return itsSnapshotsList.size();}
94 QStringList GetSnapshotsList () const {return itsSnapshotsList;}
95 QString GetSnapshotsListItem (int itemPosition) const {return itsSnapshotsList.value(itemPosition);}
96 int GetKeepSnapshots () const {return itsKeepSnapshots;}
97
98 QString GetConnectRestore () const {return itsConnectRestore;}
99
100 bool GetTypeDirContents () const {return itsTypeDirContents;}
101 bool GetTypeDirName () const {return itsTypeDirName;}
102 bool GetTypeSync () const {return itsTypeSync;}
103
104 QString GetSource() const {return itsSource;}
105 QString GetDestination() const {return itsDestination;}
106
107 bool GetExclude() const {return itsExclude;}
108 bool GetExcludeFromFile() const {return itsExcludeFromFile;}
109 QString GetExcludeFile() const {return itsExcludeFile;}
110 bool GetExcludeTemp() const {return itsExcludeTemp;}
111 bool GetExcludeCache () const {return itsExcludeCache;}
112 bool GetExcludeBackup () const {return itsExcludeBackup;}
113 bool GetExcludeMount() const {return itsExcludeMount;}
114 bool GetExcludeLostFound() const {return itsExcludeLostFound;}
115 bool GetExcludeSystem() const {return itsExcludeSystem;}
116 bool GetExcludeTrash() const {return itsExcludeTrash;}
117 bool GetExcludeGVFS() const {return itsExcludeGVFS;}
118 int GetExcludeListSize () const {return itsExcludeList.size();}
119 QString GetExcludeListItem (int itemPosition) const {return itsExcludeList.value(itemPosition);}
120
121 bool GetInclude() const {return itsInclude;}
122 bool GetIncludeFromFile() const {return itsIncludeFromFile;}
123 bool GetIncludeModeNormal() const {return itsIncludeModeNormal;}
124 QString GetIncludeFile() const {return itsIncludeFile;}
125 int GetIncludeListSize () const {return itsIncludeList.size();}
126 QString GetIncludeListItem (int itemPosition) const {return itsIncludeList.value(itemPosition);}
127
128 bool GetRemote () const {return itsRemote;}
129 bool GetRemoteModule () const {return itsRemoteModule;}
130 bool GetRemoteDestination () const {return itsRemoteDestination;}
131 bool GetRemoteSource () const {return itsRemoteSource;}
132 bool GetRemoteSSH () const {return itsRemoteSSH;}
133 QString GetRemoteHost () const {return itsRemoteHost;}
134 QString GetRemoteUser () const {return itsRemoteUser;}
135 QString GetRemotePassword () const {return itsRemotePassword;}
136 QString GetRemoteSSHPassword () const {return itsRemoteSSHPassword;}
137 QString GetRemoteSSHPasswordStr () const{return itsRemoteSSHPasswordStr;}
138 QString GetRemoteSSHOptions () const {return itsRemoteSSHOptions;}
139 int GetRemoteSSHPort () const {return itsRemoteSSHPort;}
140
141 bool GetOptionsUpdate () const {return itsOptionsUpdate;}
142 bool GetOptionsDelete () const {return itsOptionsDelete;}
143 bool GetOptionsRecurse () const {return itsOptionsRecurse;}
144 bool GetOptionsOwnership () const {return itsOptionsOwnership;}
145 bool GetOptionsSymlinks () const {return itsOptionsSymlinks;}
146 bool GetOptionsPermissions () const {return itsOptionsPermissions;}
147 bool GetOptionsDevices () const {return itsOptionsDevices;}
148 bool GetOptionsCVS () const {return itsOptionsCVS;}
149 bool GetOptionsHardLinks () const {return itsOptionsHardLinks;}
150 bool GetOptionsFATntfs() const {return itsOptionsFATntfs;}
151 bool GetOptionsSuper() const {return itsOptionsSuper;}
152 bool GetOptionsNumericIDs() const {return itsOptionsNumericIDs;}
153 //windows related
154 bool GetOptionsVss () const {return itsOptionsVss;}
155 bool GetOptionsRestorent () const {return itsOptionsRestorent;}
156 QString GetTempPath () const {return itsTempPath;}
157 QString GetLuckyBackupDir ( ) {return itsAppDir;}
158 QString GetVshadowDir () const {return itsVshadowDir;}
159 QString GetRsyncCommand () const {return itsRsyncCommand;}
160 QString GetDosdevCommand () const {return itsDosdevCommand;}
161 QString GetCygpathCommand () const {return itsCygpathCommand;}
162 QString GetSshCommand () const {return itsSshCommand;}
163 // user options
164 int GetOptionsListSize () const {return itsOptionsList.size();}
165 QString GetOptionsListItem (int itemPosition) const {return itsOptionsList.value(itemPosition);}
166
167 int GetExecuteBeforeListSize () const {return itsExecuteBeforeList.size();}
168 QString GetExecuteBeforeListItem (int itemPosition) const {return itsExecuteBeforeList.value(itemPosition);}
169 bool GetExecuteBeforeListItemState (int itemPosition) const {return itsExecuteBeforeListState.value(itemPosition);}
170 int GetExecuteAfterListSize () const {return itsExecuteAfterList.size();}
171 QString GetExecuteAfterListItem (int itemPosition) const {return itsExecuteAfterList.value(itemPosition);}
172 bool GetExecuteAfterListItemState (int itemPosition) const {return itsExecuteAfterListState.value(itemPosition);}
173
174 //Functions - set class operation data --------------------------------------------------------------------------------------
175 void SetName(QString name) {itsName = name;}
176 void SetDescription(QString description) {itsDescription = description;}
177
178 // Task state & general properties
179 void SetIncluded(bool included) {itsIncluded = included;}
180 void SetWARNING(bool warning) {itsWARNING = warning;}
181 void SetCRITICAL(bool critical) {itsCRITICAL = critical;}
182 void SetOK(bool ok) {itsOK = ok;}
183 void SetSourceMounted(bool mounted) {itsSourceMounted = mounted;}
184 void SetDestMounted(bool mounted) {itsDestMounted = mounted;}
185 void SetSourcePerms(bool sourceperms) {itsSourcePerms = sourceperms;}
186 void SetDestPerms(bool destperms) {itsDestPerms = destperms;}
187 void SetPerform(bool perform) {itsPerform = perform;}
188 void SetByPassWARNING(bool ByPassWARNING) {itsByPassWARNING = ByPassWARNING;}
189 void SetCloneWARNING(bool CloneWARNING) {itsCloneWARNING = CloneWARNING;}
190 void SetRepeatOnFail(int RepeatOnFail) {itsRepeatOnFail = RepeatOnFail;}
191
192 // last execution time & errors
193 void SetLastExecutionTime(QDateTime lastTime) {itsLastExecutionTime = lastTime;}
194 void SetLastExecutionErrors(int LastExecutionErrors){itsLastExecutionErrors = LastExecutionErrors;}
195
196 // snapshots list
197 void SetSnapshotsList (QStringList snapslist) {itsSnapshotsList = snapslist;}
198 void AddSnapshotsListItem (QString itemText) {itsSnapshotsList.append(itemText);}
199 void ReplaceSnapshotsListItem (int position,QString text) {itsSnapshotsList.replace(position,text);}
200 void RemoveSnapshotsListItem (int position) {itsSnapshotsList.removeAt(position);}
201 void ClearSnapshotsList () {itsSnapshotsList.clear();}
202 bool SnapshotsListIsEmpty () {return itsSnapshotsList.isEmpty();}
203 void SetKeepSnapshots(int keepsnapshots) {itsKeepSnapshots = keepsnapshots;}
204
205 // Arguments list
206 void SetArgs (QStringList arguments) {itsArguments = arguments;}
207 void AppendArg (QString argument) {if (argument!="") itsArguments.append(argument);}
208 void InsertDryRunArg () {itsArguments.insert(itsArguments.size()-2,"--dry-run");}
209
210 // connection with other task
211 void SetConnectRestore (QString Connection) { itsConnectRestore = Connection;}
212
213 // Task type
214 void SetTypeDirContents (bool TypeDirContents) { itsTypeDirContents = TypeDirContents;}
215 void SetTypeDirName (bool TypeDirName) { itsTypeDirName = TypeDirName;}
216 void SetTypeSync (bool TypeSync) { itsTypeSync = TypeSync;}
217
218 // source & destination
219 void SetSource(QString source) {itsSource = source;}
220 void SetDestination(QString destination) {itsDestination = destination;}
221
222 // Exclude ~~~~~~~~~~~
223 // Exclude boolean
224 void SetExclude() { if ( ((itsExcludeFromFile) && !(itsExcludeFile=="")) || (itsExcludeTemp)||(itsExcludeCache)||(itsExcludeBackup)||
225 (itsExcludeMount)||(itsExcludeLostFound)||(itsExcludeSystem)||
226 (itsExcludeTrash)||(itsExcludeGVFS)||(itsExcludeList.size()>0) )
227 itsExclude = true;
228 else itsExclude = false; }
229 // Exclude templates
230 void SetExcludeTemp(bool ExcludeTemp) { itsExcludeTemp = ExcludeTemp;}
231 void SetExcludeCache (bool ExcludeCache) { itsExcludeCache = ExcludeCache;}
232 void SetExcludeBackup (bool ExcludeBackup) { itsExcludeBackup = ExcludeBackup;}
233 void SetExcludeMount(bool ExcludeMount) { itsExcludeMount = ExcludeMount;}
234 void SetExcludeLostFound(bool ExcludeLostFound) { itsExcludeLostFound = ExcludeLostFound;}
235 void SetExcludeSystem(bool ExcludeSystem) { itsExcludeSystem = ExcludeSystem;}
236 void SetExcludeTrash(bool ExcludeTrash) { itsExcludeTrash = ExcludeTrash;}
237 void SetExcludeGVFS(bool ExcludeGVFS) { itsExcludeGVFS = ExcludeGVFS;}
238 // Exclude from file
239 void SetExcludeFromFile(bool ExcludeFromFile) { itsExcludeFromFile = ExcludeFromFile;}
240 void SetExcludeFile(QString ExcludeFile) { itsExcludeFile = ExcludeFile;}
241 //Exclude list - user defined
242 void AddExcludeListItem (QString itemText) { itsExcludeList.append(itemText);}
243
244 // Include ~~~~~~~~~~~~~
245 // Include boolean
246 void SetInclude() { if ( ((itsIncludeFromFile) && !(itsIncludeFile=="")) ||
247 (itsIncludeList.size()>0) )
248 itsInclude = true;
249 else itsInclude = false;}
250 // Include from file
251 void SetIncludeFromFile(bool IncludeFromFile) { itsIncludeFromFile = IncludeFromFile;}
252 // Include mode
253 void SetIncludeModeNormal(bool IncludeModeNormal) { itsIncludeModeNormal = IncludeModeNormal;}
254
255 void SetIncludeFile(QString IncludeFile) { itsIncludeFile = IncludeFile;}
256 // Include list
257 void AddIncludeListItem (QString itemText) { itsIncludeList.append(itemText);}
258
259 // Remote
260 void SetRemote (bool Remote) { itsRemote = Remote;}
261 void SetRemoteModule (bool RemoteModule) { itsRemoteModule = RemoteModule;}
262 void SetRemoteDestination (bool RemoteDestination) { itsRemoteDestination = RemoteDestination;}
263 void SetRemoteSource (bool RemoteSource) { itsRemoteSource = RemoteSource;}
264 void SetRemoteSSH (bool RemoteSSH) { itsRemoteSSH = RemoteSSH;}
265 void SetRemoteHost (QString RemoteHost) { itsRemoteHost = RemoteHost;}
266 void SetRemoteUser (QString RemoteUser) { itsRemoteUser = RemoteUser;}
267 void SetRemotePassword (QString RemotePassword) { itsRemotePassword = RemotePassword;}
268 void SetRemoteSSHPassword (QString RemoteSSHPassword) { itsRemoteSSHPassword = RemoteSSHPassword;}
269 void SetRemoteSSHPasswordStr (QString RemoteSSHPassword) { itsRemoteSSHPasswordStr = RemoteSSHPassword;}
270 void SetRemoteSSHOptions (QString RemoteSSHOptions) { itsRemoteSSHOptions = RemoteSSHOptions;}
271 void SetRemoteSSHPort (int RemoteSSHPort) { itsRemoteSSHPort = RemoteSSHPort;}
272
273 // Command options - templates
274 void SetOptionsUpdate (bool OptionsUpdate) { itsOptionsUpdate = OptionsUpdate;}
275 void SetOptionsDelete (bool OptionsDelete) { itsOptionsDelete = OptionsDelete;}
276 void SetOptionsRecurse (bool OptionsRecurse) { itsOptionsRecurse = OptionsRecurse;}
277 void SetOptionsOwnership (bool OptionsOwnership) { itsOptionsOwnership = OptionsOwnership;}
278 void SetOptionsSymlinks (bool OptionsSymlinks) { itsOptionsSymlinks = OptionsSymlinks;}
279 void SetOptionsPermissions (bool OptionsPermissions){ itsOptionsPermissions = OptionsPermissions;}
280 void SetOptionsDevices (bool OptionsDevices) { itsOptionsDevices = OptionsDevices;}
281 void SetOptionsCVS (bool OptionsCVS) { itsOptionsCVS = OptionsCVS;}
282 void SetOptionsHardLinks (bool OptionsHardLinks) { itsOptionsHardLinks = OptionsHardLinks;}
283 void SetOptionsFATntfs (bool OptionsFATntfs) { itsOptionsFATntfs = OptionsFATntfs;}
284 void SetOptionsSuper (bool OptionsSuper) { itsOptionsSuper = OptionsSuper;}
285 void SetOptionsNumericIDs (bool OptionsNumeriIDs) { itsOptionsNumericIDs = OptionsNumeriIDs;}
286 // windows related options
287 void SetOptionsRestorent (bool Options) { itsOptionsRestorent = Options;}
288 void SetOptionsVss (bool Options) { itsOptionsVss = Options;}
289 void SetTempPath (QString s) {itsTempPath = s;}
290 void SetLuckyBackupDir (QString s) { itsAppDir = s; }
291 void SetVshadowDir (QString s) {itsVshadowDir = s;}
292 void SetRsyncCommand (QString s) {itsRsyncCommand = s;}
293 void SetDosdevCommand (QString s) {itsDosdevCommand = s;}
294 void SetCygpathCommand (QString s) {itsCygpathCommand = s;}
295 void SetSshCommand (QString s) {itsSshCommand = s;}
296 // Command options list - user defined
297 void AddOptionsListItem (QString itemText) { itsOptionsList.append(itemText);}
298
299 // Execute before/after list
300 void AddExecuteBeforeListItem (QString itemText) { itsExecuteBeforeList.append(itemText);}
301 void AddExecuteBeforeListItemState (bool itemState) { itsExecuteBeforeListState.append(itemState);}
302 void AddExecuteAfterListItem (QString itemText) { itsExecuteAfterList.append(itemText);}
303 void AddExecuteAfterListItemState (bool itemState) { itsExecuteAfterListState.append(itemState);}
304
305 private:
306 QString itsName;
307 QStringList itsArguments;
308 QString itsDescription;
309 bool itsIncluded;
310 bool itsCRITICAL;
311 bool itsWARNING;
312 bool itsOK;
313 bool itsSourceMounted;
314 bool itsDestMounted;
315 bool itsSourcePerms;
316 bool itsDestPerms;
317 bool itsPerform;
318 bool itsByPassWARNING;
319 bool itsCloneWARNING;
320 int itsRepeatOnFail;
321 QDateTime itsLastExecutionTime;
322 int itsLastExecutionErrors;
323 QStringList itsSnapshotsList;
324 int itsKeepSnapshots;
325
326 QString itsConnectRestore;
327
328 bool itsTypeDirName;
329 bool itsTypeDirContents;
330 bool itsTypeSync;
331
332 QString itsDestination;
333 QString itsSource;
334
335 bool itsExclude;
336 bool itsExcludeTemp;
337 bool itsExcludeCache;
338 bool itsExcludeBackup;
339 bool itsExcludeMount;
340 bool itsExcludeLostFound;
341 bool itsExcludeSystem;
342 bool itsExcludeTrash;
343 bool itsExcludeGVFS;
344 bool itsExcludeFromFile;
345 QString itsExcludeFile;
346 QStringList itsExcludeList;
347
348 bool itsInclude;
349 bool itsIncludeFromFile;
350 bool itsIncludeModeNormal;
351 QString itsIncludeFile;
352 QStringList itsIncludeList;
353
354 bool itsRemote;
355 bool itsRemoteModule;
356 bool itsRemoteDestination;
357 bool itsRemoteSource;
358 bool itsRemoteSSH;
359 QString itsRemoteHost;
360 QString itsRemoteUser;
361 QString itsRemotePassword;
362 QString itsRemoteSSHPassword;
363 QString itsRemoteSSHPasswordStr;
364 QString itsRemoteSSHOptions;
365 int itsRemoteSSHPort;
366
367 bool itsOptionsUpdate;
368 bool itsOptionsDelete;
369 bool itsOptionsRecurse;
370 bool itsOptionsOwnership;
371 bool itsOptionsSymlinks;
372 bool itsOptionsPermissions;
373 bool itsOptionsDevices;
374 bool itsOptionsCVS;
375 bool itsOptionsHardLinks;
376 bool itsOptionsFATntfs;
377 bool itsOptionsSuper;
378 bool itsOptionsNumericIDs;
379 //windows related variables
380 bool itsOptionsVss;
381 bool itsOptionsRestorent;
382 QString itsTempPath;
383 QString itsAppDir;
384 QString itsVshadowDir;
385 QString itsRsyncCommand;
386 QString itsDosdevCommand;
387 QString itsCygpathCommand;
388 QString itsSshCommand;
389 //user defined options list
390 QStringList itsOptionsList;
391
392 QStringList itsExecuteBeforeList;
393 QList<bool> itsExecuteBeforeListState;
394 QStringList itsExecuteAfterList;
395 QList<bool> itsExecuteAfterListState;
396 };
397
398 #endif
399
400 // end of operationClass.h--------------------------------------------------------------