81 lines
2.0 KiB
C++
Raw Normal View History

2020-01-04 16:39:25 +03:00
#include "qif.h"
#include "quasarapp.h"
2020-01-13 18:25:03 +03:00
#include "deploycore.h"
#include "deployconfig.h"
2020-01-04 16:39:25 +03:00
2020-01-14 15:48:35 +03:00
#include <QDateTime>
2020-01-12 16:43:03 +03:00
QIF::QIF()= default;
2020-01-04 16:39:25 +03:00
Envirement QIF::toolKitLocation() const {
// SNAP
Envirement result;
2020-01-04 16:39:25 +03:00
QString AppPath = QuasarAppUtils::Params::getStrArg("appPath", "");
result.addEnv(AppPath);
//Installer
result.addEnvRec(AppPath + "../../QIF/", 2);
return result;
2020-01-04 16:39:25 +03:00
}
QString QIF::getConfig() const {
return ":/Distro/Distributions/configures/QIF.json";
2020-01-04 16:39:25 +03:00
}
QString QIF::runCmd() const {
2020-01-04 16:39:25 +03:00
return "binarycreator";
}
2020-01-14 15:48:35 +03:00
bool QIF::deployTemplate() const {
auto customTemplate = QuasarAppUtils::Params::getStrArg("qif", "");
2020-01-13 18:25:03 +03:00
const DeployConfig *cfg = DeployCore::_config;
if (customTemplate.isEmpty()) {
// default template
for (auto it = cfg->prefixes().cbegin(); it != cfg->prefixes().cend(); ++it) {
2020-01-14 15:48:35 +03:00
auto location = cfg->getTargetDir() + "/" + getLocation() + "/" + it.key();
auto package = it.value();
2020-01-13 18:25:03 +03:00
2020-01-14 15:48:35 +03:00
TemplateInfo info;
info.Name = it.key();
if (!package.name().isEmpty())
info.Name = package.name();
info.Description = "This package contains the " + info.Name;
if (!package.description().isEmpty())
info.Description = package.description();
info.Version = "1.0";
if (!package.version().isEmpty())
info.Version = package.version();
info.ReleaseData = QDate::currentDate().toString();
if (!package.releaseData().isEmpty())
info.ReleaseData = package.releaseData();
2020-01-14 15:48:35 +03:00
info.Icon = "";
if (!package.icon().isEmpty())
info.Icon = package.icon();
2020-01-14 15:48:35 +03:00
if (!unpackDir(":/Templates/QIF/Distributions/Templates/qif", location, info)) {
return false;
}
2020-01-14 15:48:35 +03:00
}
return true;
}
2020-01-14 15:48:35 +03:00
// custom template
return true;
}
QStringList QIF::runArg() const {
return {};
}