CQtDeployer/Deploy/filemanager.h

72 lines
2.1 KiB
C
Raw Normal View History

2019-09-23 16:46:57 +03:00
//#
2019-12-08 13:57:20 +03:00
//# Copyright (C) 2018-2020 QuasarApp.
2019-09-23 16:46:57 +03:00
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
2019-09-03 18:15:05 +03:00
#ifndef COPYPASTEMANAGER_H
#define COPYPASTEMANAGER_H
#include <QFileInfo>
2019-09-03 19:36:06 +03:00
#include <QSet>
2019-09-03 18:15:05 +03:00
#include <QStringList>
#include <deploy_global.h>
2019-09-04 12:01:33 +03:00
class DEPLOYSHARED_EXPORT FileManager
2019-09-03 18:15:05 +03:00
{
private:
bool fileActionPrivate(const QString &file, const QString &target,
QStringList *mask, bool isMove, bool targetIsFile);
2019-09-03 18:15:05 +03:00
bool initDir(const QString &path);
2019-09-03 19:36:06 +03:00
QSet<QString> _deployedFiles;
2019-09-03 18:15:05 +03:00
public:
2019-09-04 12:01:33 +03:00
FileManager();
2019-09-03 18:15:05 +03:00
bool copyFile(const QString &file, const QString &target,
QStringList *mask = nullptr, bool targetIsFile = false);
2019-09-03 18:15:05 +03:00
bool removeFile(const QString &file);
bool removeFile(const QFileInfo &file);
/**
* @brief smartCopyFile
* @param file
* @param target
* @param mask
* @param ifFileTarget
2019-09-03 18:15:05 +03:00
* @return if file in target dir try move file else copy
*/
2019-09-25 12:32:05 +03:00
bool smartCopyFile(const QString &file, const QString &target,
QStringList *mask = nullptr, bool ifFileTarget = false);
2019-09-03 18:15:05 +03:00
bool moveFile(const QString &file, const QString &target,
QStringList *mask = nullptr, bool targetIsFile = false);
2019-09-03 18:15:05 +03:00
bool copyFolder(const QString &from, const QString &to,
const QStringList &filter = QStringList(),
QStringList *listOfCopiedItems = nullptr,
QStringList *mask = nullptr);
2020-01-18 20:01:14 +03:00
bool moveFolder(const QString &from, const QString &to, const QString &ignore);
2020-01-15 18:31:09 +03:00
2019-09-04 12:01:33 +03:00
void clear(const QString& targetDir, bool force);
2019-09-03 18:15:05 +03:00
2019-09-03 19:36:06 +03:00
QStringList getDeployedFilesStringList() const;
2019-09-04 12:01:33 +03:00
QSet<QString> getDeployedFiles() const;
2019-09-03 19:36:06 +03:00
bool strip(const QString &dir) const;
bool addToDeployed(const QString& path);
2020-04-25 16:59:20 +03:00
void removeFromDeployed(const QString& path);
2019-09-03 19:36:06 +03:00
2019-09-04 12:01:33 +03:00
void saveDeploymendFiles(const QString &targetDir);
void loadDeployemendFiles(const QString &targetDir);
2019-09-03 18:15:05 +03:00
};
#endif // COPYPASTEMANAGER_H