CQtDeployer/Deploy/configparser.h

97 lines
2.3 KiB
C
Raw Normal View History

2019-09-23 16:46:57 +03:00
//#
//# Copyright (C) 2018-2019 QuasarApp.
//# 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-04 21:27:29 +03:00
#ifndef CQT_H
#define CQT_H
2019-09-15 17:38:47 +03:00
#include "distrostruct.h"
2019-09-07 12:36:20 +03:00
#include "envirement.h"
2019-09-23 10:06:22 +03:00
#include "ignorerule.h"
2019-09-07 12:36:20 +03:00
2019-09-04 21:27:29 +03:00
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
2019-09-07 12:01:20 +03:00
#include <QStringList>
#include <QMap>
#include <QDir>
2019-09-09 21:19:44 +03:00
#include "deploy_global.h"
2019-09-04 21:27:29 +03:00
2019-09-16 09:44:19 +03:00
#define DISTRO_DIR QString("DistributionKit")
2019-09-09 21:19:44 +03:00
class FileManager;
2019-09-04 21:27:29 +03:00
2019-09-09 21:19:44 +03:00
struct DEPLOYSHARED_EXPORT DeployConfig {
2019-09-07 12:01:20 +03:00
QString qmake = "";
QString targetDir = "";
QString qmlDir = "";
int depchLimit = 0;
bool deployQml = false;
2019-09-23 10:06:22 +03:00
IgnoreRule ignoreList;
2019-09-07 12:01:20 +03:00
QStringList extraPlugins;
QString appDir;
QString qtDir;
QStringList extraPaths;
/**
* @brief targets
* key - path
* value - create wrapper
*/
QMap<QString, bool> targets;
2019-09-07 12:36:20 +03:00
Envirement envirement;
2019-09-15 17:38:47 +03:00
DistroStruct distroStruct;
QString translationDir;
2019-09-08 19:30:01 +03:00
2019-09-07 12:01:20 +03:00
};
2019-09-14 13:59:11 +03:00
class DEPLOYSHARED_EXPORT ConfigParser
2019-09-04 21:27:29 +03:00
{
private:
2019-09-07 12:01:20 +03:00
DeployConfig _config;
2019-09-08 13:37:33 +03:00
FileManager *_fileManager;
2019-09-10 15:40:12 +03:00
bool createFromDeploy(const QString& file) const;
bool loadFromFile(const QString& file);
2019-09-07 12:01:20 +03:00
bool parseQtDeployMode();
bool parseQtInfoMode();
bool parseQtClearMode();
2019-09-07 12:36:20 +03:00
void setTargetDir(const QString &target = "");
2019-09-07 12:01:20 +03:00
bool setTargets(const QStringList &value);
bool setTargetsRecursive(const QString &dir);
2019-09-07 12:36:20 +03:00
bool setBinDir(const QString &dir, bool recursive = false);
2019-09-07 12:01:20 +03:00
void initIgnoreList();
void initIgnoreEnvList();
void setQmake(const QString &value);
void setQtDir(const QString &value);
void setExtraPath(const QStringList &value);
void setExtraPlugins(const QStringList &value);
QString recursiveInvairement(int depch, QDir &dir);
2019-09-23 10:06:22 +03:00
QString recursiveInvairement(int depch, const QString &dir);
2019-09-07 12:01:20 +03:00
void initEnvirement();
2019-09-04 21:27:29 +03:00
2019-09-14 15:51:23 +03:00
QStringList getDirsRecursive(const QString &path, int maxDepch = -1, int depch = 0);
2019-09-08 13:37:33 +03:00
2019-09-10 15:40:12 +03:00
void writeKey(const QString &key, QJsonObject &) const;
void readKey(const QString &key, const QJsonObject &obj) const;
2019-09-04 21:27:29 +03:00
public:
2019-09-14 13:59:11 +03:00
ConfigParser(FileManager *filemanager);
2019-09-07 12:01:20 +03:00
bool parseParams();
bool smartMoveTargets();
2019-09-04 21:27:29 +03:00
2019-09-08 13:37:33 +03:00
const DeployConfig* config() const;
2019-09-08 19:30:01 +03:00
friend class deploytest;
2019-09-04 21:27:29 +03:00
};
#endif // CQT_H