2019-12-11 18:06:54 +03:00
|
|
|
#include "deployconfig.h"
|
2020-07-02 16:00:34 +03:00
|
|
|
#include "quasarapp.h"
|
2019-12-11 18:06:54 +03:00
|
|
|
|
|
|
|
void DeployConfig::reset() {
|
|
|
|
*this = DeployConfig{};
|
|
|
|
}
|
|
|
|
|
|
|
|
QHash<QString, TargetInfo*>
|
|
|
|
DeployConfig::getTargetsListByFilter(const QString &filter) {
|
|
|
|
QHash<QString, TargetInfo*> result;
|
|
|
|
|
2020-01-02 19:27:40 +03:00
|
|
|
for( auto it = _targets.begin(); it != _targets.end(); ++it) {
|
2019-12-11 18:06:54 +03:00
|
|
|
if (it.key().contains(filter, Qt::CaseInsensitive)) {
|
|
|
|
result.insert(it.key(), &(*it));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2019-12-12 22:50:04 +03:00
|
|
|
QString DeployConfig::getTargetDir(const QString &target) const {
|
2020-01-02 19:27:40 +03:00
|
|
|
if (_targets.contains(target))
|
2020-02-26 16:51:28 +03:00
|
|
|
return targetDir + "/" + _targets.value(target).getPackage();
|
2020-02-27 10:50:11 +03:00
|
|
|
return targetDir;
|
2019-12-11 18:06:54 +03:00
|
|
|
}
|
|
|
|
|
2019-12-14 17:38:43 +03:00
|
|
|
void DeployConfig::setTargetDir(const QString &target) {
|
|
|
|
targetDir = target;
|
2020-04-25 18:16:02 +03:00
|
|
|
|
|
|
|
if (targetDir.right(1) != "/" ) {
|
|
|
|
ignoreList.addRule(targetDir + "/");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ignoreList.addRule(targetDir);
|
|
|
|
}
|
|
|
|
|
2019-12-14 17:38:43 +03:00
|
|
|
}
|
|
|
|
|
2020-01-02 19:27:40 +03:00
|
|
|
DistroModule DeployConfig::getDistro(const QString &target) const {
|
2020-02-26 16:51:28 +03:00
|
|
|
return _packages.value(_targets.value(target).getPackage());
|
2019-12-14 17:38:43 +03:00
|
|
|
}
|
|
|
|
|
2020-01-27 20:02:25 +03:00
|
|
|
DistroModule DeployConfig::getDistroFromPackage(const QString &package) const {
|
|
|
|
if (_packages.contains(package)) {
|
|
|
|
return _packages[package];
|
2019-12-15 18:30:24 +03:00
|
|
|
}
|
|
|
|
|
2020-01-27 20:02:25 +03:00
|
|
|
return _packages.value("");
|
2019-12-15 18:30:24 +03:00
|
|
|
}
|
2020-01-02 19:27:40 +03:00
|
|
|
|
2020-08-14 10:29:56 +03:00
|
|
|
QMultiHash<QString, TargetInfo> &DeployConfig::targetsEdit() {
|
2020-01-02 19:27:40 +03:00
|
|
|
return _targets;
|
|
|
|
}
|
|
|
|
|
2020-01-27 20:02:25 +03:00
|
|
|
QHash<QString, DistroModule> &DeployConfig::packagesEdit() {
|
|
|
|
return _packages;
|
2020-01-02 19:27:40 +03:00
|
|
|
}
|
|
|
|
|
2020-07-04 18:13:32 +03:00
|
|
|
Platform DeployConfig::getPlatform(const QString& package) const {
|
2020-07-02 16:00:34 +03:00
|
|
|
Platform result = Platform::UnknownPlatform;
|
2020-07-04 18:13:32 +03:00
|
|
|
|
|
|
|
if (_packages.contains(package)) {
|
|
|
|
auto disto = getDistroFromPackage(package);
|
|
|
|
|
2020-07-04 23:08:41 +03:00
|
|
|
for( auto it = disto.targets().cbegin(); it != disto.targets().cend(); ++it) {
|
2020-07-04 18:13:32 +03:00
|
|
|
result = result | _targets.value(*it).getPlatform();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-14 13:17:26 +03:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
Platform DeployConfig::getPlatformOfAll() const {
|
|
|
|
Platform result = Platform::UnknownPlatform;
|
2020-07-04 18:13:32 +03:00
|
|
|
|
2020-07-04 23:08:41 +03:00
|
|
|
for( auto it = _targets.cbegin(); it != _targets.cend(); ++it) {
|
2020-07-02 16:00:34 +03:00
|
|
|
result = result | it.value().getPlatform();
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-08-15 19:29:17 +03:00
|
|
|
QString DeployConfig::getDefaultPackage() const {
|
|
|
|
return defaultPackage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeployConfig::setDefaultPackage(const QString &value)
|
|
|
|
{
|
|
|
|
defaultPackage = value;
|
|
|
|
}
|
|
|
|
|
2020-01-02 19:27:40 +03:00
|
|
|
const QHash<QString, TargetInfo> &DeployConfig::targets() const {
|
|
|
|
return _targets;
|
|
|
|
}
|
|
|
|
|
2020-01-27 20:02:25 +03:00
|
|
|
const QHash<QString, DistroModule> &DeployConfig::packages() const {
|
|
|
|
return _packages;
|
2020-01-02 19:27:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|