2021-01-05 13:17:11 +03:00
|
|
|
/*
|
2022-03-09 17:56:42 +03:00
|
|
|
* Copyright (C) 2018-2022 QuasarApp.
|
2021-01-05 13:17:11 +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.
|
|
|
|
*/
|
|
|
|
|
2020-01-04 16:39:25 +03:00
|
|
|
#ifndef PACKING_H
|
|
|
|
#define PACKING_H
|
|
|
|
|
2020-01-05 13:58:38 +03:00
|
|
|
#include <QObject>
|
|
|
|
#include <QProcess>
|
|
|
|
#include "deploy_global.h"
|
2020-08-15 14:38:03 +03:00
|
|
|
#include "packagecontrol.h"
|
2020-01-05 13:58:38 +03:00
|
|
|
|
2020-01-04 16:39:25 +03:00
|
|
|
/**
|
|
|
|
* @brief The Packing class - this class have interface for configure package and
|
|
|
|
* create package from deployment distibution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ConfigParser;
|
|
|
|
class iDistribution;
|
2020-08-15 14:38:03 +03:00
|
|
|
class FileManager;
|
2020-01-04 16:39:25 +03:00
|
|
|
|
2020-08-15 14:38:03 +03:00
|
|
|
class DEPLOYSHARED_EXPORT Packing : public QObject, public PackageControl
|
2020-01-04 16:39:25 +03:00
|
|
|
{
|
2020-01-05 13:58:38 +03:00
|
|
|
Q_OBJECT
|
2020-01-04 16:39:25 +03:00
|
|
|
public:
|
2020-08-15 14:38:03 +03:00
|
|
|
Packing(FileManager *fileManager);
|
2020-12-14 10:52:22 +03:00
|
|
|
~Packing() override;
|
2020-08-14 17:47:34 +03:00
|
|
|
void setDistribution(const QList<iDistribution*> &pakages);
|
2020-01-20 16:40:18 +03:00
|
|
|
bool create();
|
2020-08-15 14:38:03 +03:00
|
|
|
|
2020-12-10 11:12:04 +03:00
|
|
|
bool movePackage(const QString &package, const QString &newLocation) override;
|
|
|
|
bool copyPackage(const QString &package, const QString &newLocation) override;
|
2020-12-14 10:52:22 +03:00
|
|
|
|
2021-01-10 20:25:22 +03:00
|
|
|
/**
|
|
|
|
* @brief extractTemplates This method extract all default temlates. See the getDefaultTemplate for get more information.
|
|
|
|
* @return true if function finished successful.
|
|
|
|
*/
|
|
|
|
bool extractTemplates();
|
|
|
|
|
2020-12-14 10:52:22 +03:00
|
|
|
protected:
|
|
|
|
QStringList availablePackages() const override;
|
2020-08-15 14:38:03 +03:00
|
|
|
|
2020-01-04 16:39:25 +03:00
|
|
|
private:
|
2020-08-14 17:47:34 +03:00
|
|
|
|
2020-08-15 14:38:03 +03:00
|
|
|
bool collectPackages();
|
2021-01-10 20:25:22 +03:00
|
|
|
bool prepareTemplatesForExtract();
|
|
|
|
|
2020-08-15 14:38:03 +03:00
|
|
|
bool moveData(const QString& from, const QString& to,
|
|
|
|
const QString &ignore = "") const;
|
|
|
|
|
|
|
|
bool restorePackagesLocations();
|
2020-08-14 17:47:34 +03:00
|
|
|
|
2021-05-20 11:42:18 +03:00
|
|
|
/**
|
|
|
|
* @brief calcDistributiveHash This method calc md hashes for all pacakges of the @a distro distributive
|
|
|
|
* @param distro This is pointer to the distributive object.
|
|
|
|
*/
|
|
|
|
void calcDistributiveHash(const iDistribution* distro);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief calcHash This method calc md5 hash of the file.
|
|
|
|
* @param file This is a file path
|
|
|
|
* @return string value of the file hash. Using the hex.
|
|
|
|
*/
|
|
|
|
QByteArray calcHash(const QString& file);
|
|
|
|
|
2020-08-15 19:29:17 +03:00
|
|
|
QList<iDistribution*> _pakages;
|
2020-01-05 14:55:57 +03:00
|
|
|
QProcess *_proc = nullptr;
|
2020-08-15 14:38:03 +03:00
|
|
|
QHash<QString, QString> _packagesLocations;
|
|
|
|
QHash<QString, QString> _defaultPackagesLocations;
|
|
|
|
|
|
|
|
FileManager* _fileManager = nullptr;
|
2020-01-05 13:58:38 +03:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void handleOutputUpdate();
|
2020-01-20 13:24:01 +03:00
|
|
|
|
2020-01-04 16:39:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKING_H
|