mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 06:25:33 +08:00
Ref T135, utility functions for platform guessing and channels
* using QSet * platform guessing * Doxygen * word size in CBuildConfig * renamed to BlackMisc::Db::TDistributionsInfo
This commit is contained in:
committed by
Mathew Sutcliffe
parent
9770792a91
commit
97f687077c
@@ -20,9 +20,9 @@ namespace BlackMisc
|
||||
CSequence<CDistribution>(other)
|
||||
{ }
|
||||
|
||||
QStringList CDistributionList::getChannels() const
|
||||
QSet<QString> CDistributionList::getChannels() const
|
||||
{
|
||||
QStringList channels;
|
||||
QSet<QString> channels;
|
||||
for (const CDistribution &distribution : *this)
|
||||
{
|
||||
if (distribution.getChannel().isEmpty()) { continue; }
|
||||
@@ -31,6 +31,32 @@ namespace BlackMisc
|
||||
return channels;
|
||||
}
|
||||
|
||||
QSet<QString> CDistributionList::findChannelsForPlatform(const QString &platform) const
|
||||
{
|
||||
QSet<QString> channels;
|
||||
if (platform.isEmpty()) { return channels; }
|
||||
for (const CDistribution &distribution : *this)
|
||||
{
|
||||
if (distribution.getChannel().isEmpty()) { continue; }
|
||||
if (distribution.supportsPlatform(platform))
|
||||
{
|
||||
channels.insert(distribution.getChannel());
|
||||
}
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
|
||||
QSet<QString> CDistributionList::getPlatforms() const
|
||||
{
|
||||
QSet<QString> platforms;
|
||||
for (const CDistribution &distribution : *this)
|
||||
{
|
||||
if (distribution.getChannel().isEmpty()) { continue; }
|
||||
platforms << distribution.getChannel();
|
||||
}
|
||||
return platforms;
|
||||
}
|
||||
|
||||
CDistribution CDistributionList::findByChannelOrDefault(const QString &channel) const
|
||||
{
|
||||
return this->findFirstByOrDefault(&CDistribution::getChannel, channel);
|
||||
@@ -60,6 +86,12 @@ namespace BlackMisc
|
||||
return this->getQVersionForChannelAndPlatform(channelPlatform.first(), channelPlatform.last());
|
||||
}
|
||||
|
||||
QStringList CDistributionList::guessMyDefaultChannelAndPlatform() const
|
||||
{
|
||||
//! \fixme will be further improved when we have added a public server and have more channels
|
||||
return QStringList({"ALPHA", BlackConfig::CBuildConfig::guessMyPlatformString()}); // guessing
|
||||
}
|
||||
|
||||
CDistributionList CDistributionList::fromDatabaseJson(const QJsonArray &array)
|
||||
{
|
||||
CDistributionList distributions;
|
||||
|
||||
Reference in New Issue
Block a user