aboutsummaryrefslogtreecommitdiff
path: root/launcher/FileSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/FileSystem.h')
-rw-r--r--launcher/FileSystem.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/launcher/FileSystem.h b/launcher/FileSystem.h
index b7e175fd..a9a81123 100644
--- a/launcher/FileSystem.h
+++ b/launcher/FileSystem.h
@@ -40,6 +40,7 @@
#include <QDir>
#include <QFlags>
+#include <QObject>
namespace FS {
@@ -76,9 +77,10 @@ bool ensureFilePathExists(QString filenamepath);
bool ensureFolderPathExists(QString filenamepath);
/// @brief Copies a directory and it's contents from src to dest
-class copy {
+class copy : public QObject {
+ Q_OBJECT
public:
- copy(const QString& src, const QString& dst)
+ copy(const QString& src, const QString& dst, QObject* parent = nullptr) : QObject(parent)
{
m_src.setPath(src);
m_dst.setPath(dst);
@@ -88,21 +90,35 @@ class copy {
m_followSymlinks = follow;
return *this;
}
- copy& blacklist(const IPathMatcher* filter)
+ copy& matcher(const IPathMatcher* filter)
{
- m_blacklist = filter;
+ m_matcher = filter;
return *this;
}
- bool operator()() { return operator()(QString()); }
+ copy& whitelist(bool whitelist)
+ {
+ m_whitelist = whitelist;
+ return *this;
+ }
+
+ bool operator()(bool dryRun = false) { return operator()(QString(), dryRun); }
+
+ int totalCopied() { return m_copied; }
+
+ signals:
+ void fileCopied(const QString& relativeName);
+ // TODO: maybe add a "shouldCopy" signal in the future?
private:
- bool operator()(const QString& offset);
+ bool operator()(const QString& offset, bool dryRun = false);
private:
bool m_followSymlinks = true;
- const IPathMatcher* m_blacklist = nullptr;
+ const IPathMatcher* m_matcher = nullptr;
+ bool m_whitelist = false;
QDir m_src;
QDir m_dst;
+ int m_copied;
};
/**