1 #pragma once
2 #include <QListWidget>
3 #include <qexception.h>
4 #include <quuid.h>
5 
6 class JobOptions {
7 public:
8   explicit JobOptions(bool isDownload);
9   JobOptions();
10 
11   ~JobOptions();
12 
13   enum Operation { UnknownOp, Copy, Move, Sync };
14   enum JobType { UnknownJobType, Upload, Download };
15 
16   /*
17    * The following enums have their int values synchronized with the
18    * list indexes on the gui.  Changes needed to be synchronized.
19    */
20   enum SyncTiming { During, After, Before, UnknownTiming };
21   enum CompareOption {
22     SizeAndModTime,
23     Checksum,
24     IgnoreSize,
25     SizeOnly,
26     ChecksumIgnoreSize
27   };
28 
29   QString description;
30 
31   JobType jobType;
32   Operation operation;
33   bool dryRun; // not persisted
34   bool sync;
35   SyncTiming syncTiming;
36   bool skipNewer;
37   bool skipExisting;
38   bool compare;
39   CompareOption compareOption;
40   bool verbose;
41   bool sameFilesystem;
42   bool dontUpdateModified;
43   QString transfers;
44   QString checkers;
45   QString bandwidth;
46   QString minSize;
47   QString minAge;
48   QString maxAge;
49   int maxDepth;
50   QString connectTimeout;
51   QString idleTimeout;
52   QString retries;
53   QString lowLevelRetries;
54   bool deleteExcluded;
55   QString excluded;
56   QString extra;
57   QString source;
58   QString dest;
59   bool isFolder;
60   QUuid uniqueId;
61   bool DriveSharedWithMe;
62 
setJobType(bool isDownload)63   void setJobType(bool isDownload) {
64     jobType = (isDownload) ? Download : Upload;
65   }
66 
myName()67   QString myName() const {
68     return "JobOptions"; // this->staticQtMetaObject.myName();
69   }
70   QStringList getOptions() const;
71 
72   bool operator==(const JobOptions &other) const {
73     return uniqueId == other.uniqueId;
74   }
75 
76   /*
77    * This allows the de-serialization method to accomodate changes
78    * to the class structure, especially (most easily) added members.
79    *
80    * Increment the value each time a change is made, emit the new field(s)
81    * in the operator<< function, and in operator>> add conditional logic
82    * based on the version for reading in the new field(s)
83    */
84   static const qint32 classVersion;
85 };
86 
87 class JobOptionsListWidgetItem : public QListWidgetItem {
88 public:
JobOptionsListWidgetItem(JobOptions * jo,const QIcon & icon,const QString & text)89   JobOptionsListWidgetItem(JobOptions *jo, const QIcon &icon,
90                            const QString &text)
91       : QListWidgetItem(icon, text), mJobData(jo) {}
92 
SetData(JobOptions * jo)93   void SetData(JobOptions *jo) { mJobData = jo; }
GetData()94   JobOptions *GetData() { return mJobData; }
95 
96 private:
97   JobOptions *mJobData;
98 };
99 
100 class SerializationException : public QException {
101 public:
102   QString Message;
103   explicit SerializationException(QString msg);
104 };
105