forked from DinCahill/RcloneBrowser
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kapitainsky/kptsky_tasks
Kptsky tasks
- Loading branch information
Showing
14 changed files
with
1,211 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ debian/files | |
debian/debhelper-build-stamp | ||
debian/rclone-browser* | ||
|
||
/bs0.cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
#include "job_options.h" | ||
#include <qexception.h> | ||
#include <qdebug.h> | ||
#include <qlogging.h> | ||
#ifdef _WIN32 | ||
#pragma warning(disable:4505) | ||
#endif | ||
JobOptions::JobOptions(bool isDownload) : JobOptions() | ||
{ | ||
setJobType(isDownload); | ||
uniqueId = QUuid::createUuid(); | ||
} | ||
|
||
JobOptions::JobOptions(): | ||
jobType(UnknownJobType), operation(UnknownOp), dryRun(false), sync(false), | ||
syncTiming(UnknownTiming), skipNewer(false), skipExisting(false), | ||
compare(false), compareOption(), verbose(false), sameFilesystem(false), | ||
dontUpdateModified(false), maxDepth(0), deleteExcluded(false), isFolder(false) | ||
{ | ||
} | ||
|
||
const qint32 JobOptions::classVersion = 3; | ||
|
||
|
||
JobOptions::~JobOptions() | ||
{ | ||
} | ||
|
||
/* | ||
* Turn the options held here into a string list for | ||
* use in the rclone command. | ||
* | ||
* This logic was originally in transfer_dialog.cpp. | ||
* | ||
* This needs to change whenever e.g. new options are | ||
* added to the dialog. | ||
*/ | ||
QStringList JobOptions::getOptions() const | ||
{ | ||
QStringList list; | ||
|
||
if (operation == Copy) | ||
{ | ||
list << "copy"; | ||
} | ||
else if (operation == Move) | ||
{ | ||
list << "move"; | ||
} | ||
else if (operation == Sync) | ||
{ | ||
list << "sync"; | ||
} | ||
|
||
if (dryRun) | ||
{ | ||
list << "--dry-run"; | ||
} | ||
|
||
if (sync) | ||
{ | ||
switch (syncTiming) | ||
{ | ||
case During: | ||
list << "--delete-during"; | ||
break; | ||
case After: | ||
list << "--delete-after"; | ||
break; | ||
case Before: | ||
list << "--delete-before"; | ||
break; | ||
default: | ||
break;; | ||
} | ||
} | ||
|
||
if (skipNewer) | ||
{ | ||
list << "--update"; | ||
} | ||
if (skipExisting) | ||
{ | ||
list << "--ignore-existing"; | ||
} | ||
|
||
if (compare) | ||
{ | ||
switch (compareOption) | ||
{ | ||
case Checksum: | ||
list << "--checksum"; | ||
break; | ||
case IgnoreSize: | ||
list << "--ignore-size"; | ||
break; | ||
case SizeOnly: | ||
list << "--size-only"; | ||
break; | ||
case ChecksumIgnoreSize: | ||
list << "--checksum" << "--ignore-size"; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
//always verbose | ||
list << "--verbose"; | ||
if (sameFilesystem) | ||
{ | ||
list << "--one-file-system"; | ||
} | ||
if (dontUpdateModified) | ||
{ | ||
list << "--no-update-modtime"; | ||
} | ||
|
||
list << "--transfers" << transfers; | ||
list << "--checkers" << checkers; | ||
|
||
if (!bandwidth.isEmpty()) | ||
{ | ||
list << "--bwlimit" << bandwidth; | ||
} | ||
if (!minSize.isEmpty()) | ||
{ | ||
list << "--min-size" << minSize; | ||
} | ||
if (!minAge.isEmpty()) | ||
{ | ||
list << "--min-age" << minAge; | ||
} | ||
if (!maxAge.isEmpty()) | ||
{ | ||
list << "--max-age" << maxAge; | ||
} | ||
|
||
if (maxDepth != 0) | ||
{ | ||
list << "--max-depth" << QString::number(maxDepth); | ||
} | ||
|
||
list << "--contimeout" << (connectTimeout + "s"); | ||
list << "--timeout" << (idleTimeout + "s"); | ||
list << "--retries" << retries; | ||
list << "--low-level-retries" << lowLevelRetries; | ||
|
||
if (deleteExcluded) | ||
{ | ||
list << "--delete-excluded"; | ||
} | ||
|
||
if (!excluded.isEmpty()) | ||
{ | ||
for (auto line : excluded.split('\n')) | ||
{ | ||
list << "--exclude" << line; | ||
} | ||
} | ||
|
||
if (!extra.isEmpty()) | ||
{ | ||
for (auto arg : extra.split(' ')) | ||
{ | ||
list << arg; | ||
} | ||
} | ||
|
||
|
||
if (DriveSharedWithMe) | ||
{ | ||
list << "--drive-shared-with-me"; | ||
} | ||
|
||
list << "--stats" << "1s"; | ||
|
||
list << source; | ||
list << dest; | ||
|
||
return list; | ||
} | ||
|
||
SerializationException::SerializationException(QString msg) : QException(), Message(msg) | ||
{ | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#pragma once | ||
#include <qexception.h> | ||
#include <QListWidget> | ||
#include <quuid.h> | ||
|
||
class JobOptions | ||
{ | ||
public: | ||
explicit JobOptions(bool isDownload); | ||
JobOptions(); | ||
|
||
~JobOptions(); | ||
|
||
enum Operation { UnknownOp, Copy, Move, Sync }; | ||
enum JobType {UnknownJobType, Upload, Download}; | ||
|
||
/* | ||
* The following enums have their int values synchronized with the | ||
* list indexes on the gui. Changes needed to be synchronized. | ||
*/ | ||
enum SyncTiming { During, After, Before, UnknownTiming}; | ||
enum CompareOption {SizeAndModTime, Checksum, IgnoreSize, SizeOnly, ChecksumIgnoreSize}; | ||
|
||
QString description; | ||
|
||
JobType jobType; | ||
Operation operation; | ||
bool dryRun; // not persisted | ||
bool sync; | ||
SyncTiming syncTiming; | ||
bool skipNewer; | ||
bool skipExisting; | ||
bool compare; | ||
CompareOption compareOption; | ||
bool verbose; | ||
bool sameFilesystem; | ||
bool dontUpdateModified; | ||
QString transfers; | ||
QString checkers; | ||
QString bandwidth; | ||
QString minSize; | ||
QString minAge; | ||
QString maxAge; | ||
int maxDepth; | ||
QString connectTimeout; | ||
QString idleTimeout; | ||
QString retries; | ||
QString lowLevelRetries; | ||
bool deleteExcluded; | ||
QString excluded; | ||
QString extra; | ||
QString source; | ||
QString dest; | ||
bool isFolder; | ||
QUuid uniqueId; | ||
bool DriveSharedWithMe; | ||
|
||
void setJobType (bool isDownload) | ||
{ | ||
jobType = (isDownload) ? Download : Upload; | ||
} | ||
|
||
QString myName() const | ||
{ | ||
return "JobOptions"; //this->staticQtMetaObject.myName(); | ||
} | ||
QStringList getOptions() const; | ||
|
||
|
||
bool operator==(const JobOptions &other) const | ||
{ | ||
return uniqueId == other.uniqueId; | ||
} | ||
|
||
|
||
/* | ||
* This allows the de-serialization method to accomodate changes | ||
* to the class structure, especially (most easily) added members. | ||
* | ||
* Increment the value each time a change is made, emit the new field(s) | ||
* in the operator<< function, and in operator>> add conditional logic | ||
* based on the version for reading in the new field(s) | ||
*/ | ||
static const qint32 classVersion; | ||
|
||
}; | ||
|
||
class JobOptionsListWidgetItem : public QListWidgetItem | ||
{ | ||
public: | ||
|
||
JobOptionsListWidgetItem(JobOptions *jo, const QIcon &icon, const QString &text) : QListWidgetItem(icon, text), mJobData(jo) {} | ||
|
||
void SetData(JobOptions *jo) { mJobData = jo; } | ||
JobOptions *GetData() { return mJobData; } | ||
|
||
private: | ||
JobOptions *mJobData; | ||
}; | ||
|
||
class SerializationException : public QException | ||
{ | ||
public: | ||
QString Message; | ||
explicit SerializationException(QString msg); | ||
}; | ||
|
Oops, something went wrong.