mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #509,renamed CDownload to CUpdateInfo
* as discussed in meeting * follow up adjustments (file renaming, msg. renaming)
This commit is contained in:
@@ -87,12 +87,12 @@ namespace BlackCore
|
||||
CGlobalSetup::versionString() + "/productive/bootstrap/bootstrap.json");
|
||||
}
|
||||
|
||||
CUrlList CGlobalSetup::downloadInfoUrls() const
|
||||
CUrlList CGlobalSetup::updateInfoUrls() const
|
||||
{
|
||||
CUrlList urls(m_sharedUrls);
|
||||
return urls.appendPath(isDevelopment() ?
|
||||
CGlobalSetup::versionString() + "/development/download/download.json" :
|
||||
CGlobalSetup::versionString() + "/productive/download/download.json");
|
||||
CGlobalSetup::versionString() + "/development/updateinfo/updateinfo.json" :
|
||||
CGlobalSetup::versionString() + "/productive/updateinfo/updateinfo.json");
|
||||
}
|
||||
|
||||
CUrlList CGlobalSetup::swiftDbDataFileLocationUrls() const
|
||||
@@ -117,8 +117,8 @@ namespace BlackCore
|
||||
s.append(boolToYesNo(isDevelopment()));
|
||||
s.append(separator);
|
||||
|
||||
s.append("Download URLs: ");
|
||||
s.append(downloadInfoUrls().toQString(i18n));
|
||||
s.append("Update info URLs: ");
|
||||
s.append(updateInfoUrls().toQString(i18n));
|
||||
s.append(separator);
|
||||
s.append("Bootstrap URLs: ");
|
||||
s.append(bootstrapUrls().toQString(i18n));
|
||||
@@ -183,8 +183,8 @@ namespace BlackCore
|
||||
return CVariant::fromValue(this->m_vatsimDataFileUrls);
|
||||
case IndexVatsimMetars:
|
||||
return CVariant::fromValue(this->m_vatsimMetarsUrl);
|
||||
case IndexDownload:
|
||||
return CVariant::fromValue(this->downloadInfoUrls());
|
||||
case IndexUpdateInfo:
|
||||
return CVariant::fromValue(this->updateInfoUrls());
|
||||
case IndexBootstrap:
|
||||
return CVariant::fromValue(this->bootstrapUrls());
|
||||
case IndexSwiftDbFiles:
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackCore
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
//! Settings for readers
|
||||
//! Global settings for readers, debug flags, etc.
|
||||
class BLACKCORE_EXPORT CGlobalSetup :
|
||||
public BlackMisc::CValueObject<CGlobalSetup>,
|
||||
public BlackMisc::ITimestampBased
|
||||
@@ -42,7 +42,7 @@ namespace BlackCore
|
||||
IndexVatsimData,
|
||||
IndexSwiftDbFiles,
|
||||
IndexBootstrap,
|
||||
IndexDownload,
|
||||
IndexUpdateInfo,
|
||||
IndexShared
|
||||
};
|
||||
|
||||
@@ -94,8 +94,8 @@ namespace BlackCore
|
||||
//! Bootstrap URLs (where the data for the setup itself can be downloaded)
|
||||
BlackMisc::Network::CUrlList bootstrapUrls() const;
|
||||
|
||||
//! Version files and download locations
|
||||
BlackMisc::Network::CUrlList downloadInfoUrls() const;
|
||||
//! Version and download locations
|
||||
BlackMisc::Network::CUrlList updateInfoUrls() const;
|
||||
|
||||
//! Alternative locations of swift DB data files
|
||||
BlackMisc::Network::CUrlList swiftDbDataFileLocationUrls() const;
|
||||
@@ -149,7 +149,7 @@ namespace BlackCore
|
||||
struct GlobalSetup : public BlackCore::CDataTrait<CGlobalSetup>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "readers/global/bootstrap"; }
|
||||
static const char *key() { return "readers/global/setup"; }
|
||||
|
||||
//! Default value
|
||||
static const CGlobalSetup &defaultValue()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "download.h"
|
||||
#include "updateinfo.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include <QStringList>
|
||||
@@ -19,7 +19,7 @@ namespace BlackCore
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
CDownload::CDownload() :
|
||||
CUpdateInfo::CUpdateInfo() :
|
||||
ITimestampBased(0),
|
||||
m_downloadsStableUrls(QStringList {"http://swift-project.org/"}),
|
||||
m_downloadsBetaUrls(QStringList {"http://swift-project.org/"}),
|
||||
@@ -29,27 +29,27 @@ namespace BlackCore
|
||||
m_lastSupportedVersionBeta("0.6")
|
||||
{ }
|
||||
|
||||
CUrlList CDownload::getDownloadUrls() const
|
||||
CUrlList CUpdateInfo::getDownloadUrls() const
|
||||
{
|
||||
return CProject::isBetaTest() ? getDownloadUrlsBeta() : getDownloadUrlsStable();
|
||||
}
|
||||
|
||||
QString CDownload::getLatestVersion() const
|
||||
QString CUpdateInfo::getLatestVersion() const
|
||||
{
|
||||
return CProject::isBetaTest() ? getLatestVersionBeta() : getLatestVersionStable();
|
||||
}
|
||||
|
||||
bool CDownload::hasSameType(const CDownload &otherDownload) const
|
||||
bool CUpdateInfo::hasSameType(const CUpdateInfo &otherDownload) const
|
||||
{
|
||||
return this->isDevelopment() == otherDownload.isDevelopment();
|
||||
}
|
||||
|
||||
QString CDownload::convertToQString(bool i18n) const
|
||||
QString CUpdateInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
return convertToQString(", ", i18n);
|
||||
}
|
||||
|
||||
QString CDownload::convertToQString(const QString &separator, bool i18n) const
|
||||
QString CUpdateInfo::convertToQString(const QString &separator, bool i18n) const
|
||||
{
|
||||
QString s("timestamp: ");
|
||||
s.append(this->getFormattedUtcTimestampYmdhms());
|
||||
@@ -75,7 +75,7 @@ namespace BlackCore
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CDownload::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
CVariant CUpdateInfo::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||
@@ -100,9 +100,9 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CDownload::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CUpdateInfo::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CDownload>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.to<CUpdateInfo>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
ITimestampBased::setPropertyByIndex(variant, index);
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_DATA_DOWNLOAD_H
|
||||
#define BLACKCORE_DATA_DOWNLOAD_H
|
||||
#ifndef BLACKCORE_DATA_UPDATEINFO_H
|
||||
#define BLACKCORE_DATA_UPDATEINFO_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/datacache.h"
|
||||
@@ -23,15 +23,15 @@ namespace BlackCore
|
||||
namespace Data
|
||||
{
|
||||
//! Download locations and versions
|
||||
class BLACKCORE_EXPORT CDownload :
|
||||
public BlackMisc::CValueObject<CDownload>,
|
||||
class BLACKCORE_EXPORT CUpdateInfo :
|
||||
public BlackMisc::CValueObject<CUpdateInfo>,
|
||||
public BlackMisc::ITimestampBased
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexDownloadUrlsStable = BlackMisc::CPropertyIndex::GlobalIndexCDownload,
|
||||
IndexDownloadUrlsStable = BlackMisc::CPropertyIndex::GlobalIndexCUpdateInfo,
|
||||
IndexDownloadUrlsBeta,
|
||||
IndexLatestVersionStable,
|
||||
IndexLastSupportedVersionStable,
|
||||
@@ -40,10 +40,10 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
//! Default constructor
|
||||
CDownload();
|
||||
CUpdateInfo();
|
||||
|
||||
//! Destructor.
|
||||
~CDownload() {}
|
||||
~CUpdateInfo() {}
|
||||
|
||||
//! Download URLs, ie here one can download installer
|
||||
const BlackMisc::Network::CUrlList &getDownloadUrlsBeta() const { return m_downloadsBetaUrls; }
|
||||
@@ -73,7 +73,7 @@ namespace BlackCore
|
||||
bool isDevelopment() const { return m_development; }
|
||||
|
||||
//! Same type
|
||||
bool hasSameType(const CDownload &otherDownload) const;
|
||||
bool hasSameType(const CUpdateInfo &otherDownload) const;
|
||||
|
||||
//! Productive settings?
|
||||
void setDevelopment(bool development) { m_development = development; }
|
||||
@@ -91,7 +91,7 @@ namespace BlackCore
|
||||
void setPropertyByIndex(const BlackMisc::CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(BlackCore::Data::CDownload)
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(BlackCore::Data::CUpdateInfo)
|
||||
|
||||
bool m_development = false; //!< for development
|
||||
BlackMisc::Network::CUrlList m_downloadsStableUrls; //!< Download URLs, here I get the installer
|
||||
@@ -103,15 +103,15 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
//! Trait for global setup data
|
||||
struct Download : public BlackCore::CDataTrait<CDownload>
|
||||
struct UpdateInfo : public BlackCore::CDataTrait<CUpdateInfo>
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "readers/global/download"; }
|
||||
static const char *key() { return "readers/global/updateinfo"; }
|
||||
|
||||
//! Default value
|
||||
static const CDownload &defaultValue()
|
||||
static const CUpdateInfo &defaultValue()
|
||||
{
|
||||
static const CDownload defaultValue;
|
||||
static const CUpdateInfo defaultValue;
|
||||
return defaultValue;
|
||||
}
|
||||
};
|
||||
@@ -119,8 +119,8 @@ namespace BlackCore
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_METATYPE(BlackCore::Data::CDownload)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackCore::Data::CDownload, (
|
||||
Q_DECLARE_METATYPE(BlackCore::Data::CUpdateInfo)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackCore::Data::CUpdateInfo, (
|
||||
attr(o.m_timestampMSecsSinceEpoch),
|
||||
attr(o.m_development),
|
||||
attr(o.m_downloadsStableUrls),
|
||||
Reference in New Issue
Block a user