mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 03:35:38 +08:00
Ref T125, allow to get distribution list by JSON string. Also setup value object directly using JSON string now.
This commit is contained in:
committed by
Mathew Sutcliffe
parent
15f5a7f489
commit
8c032fb4d7
@@ -13,7 +13,6 @@
|
|||||||
#include "blackmisc/compare.h"
|
#include "blackmisc/compare.h"
|
||||||
#include "blackmisc/fileutils.h"
|
#include "blackmisc/fileutils.h"
|
||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/json.h"
|
|
||||||
#include "blackmisc/logcategory.h"
|
#include "blackmisc/logcategory.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
@@ -331,7 +330,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
const CGlobalSetup currentSetup = m_setup.get();
|
const CGlobalSetup currentSetup = m_setup.get();
|
||||||
CGlobalSetup loadedSetup;
|
CGlobalSetup loadedSetup;
|
||||||
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
loadedSetup.convertFromJson(setupJson);
|
||||||
loadedSetup.markAsLoaded(true);
|
loadedSetup.markAsLoaded(true);
|
||||||
if (lastModified > 0 && lastModified > loadedSetup.getMSecsSinceEpoch()) { loadedSetup.setMSecsSinceEpoch(lastModified); }
|
if (lastModified > 0 && lastModified > loadedSetup.getMSecsSinceEpoch()) { loadedSetup.setMSecsSinceEpoch(lastModified); }
|
||||||
bool sameVersionLoaded = (loadedSetup == currentSetup);
|
bool sameVersionLoaded = (loadedSetup == currentSetup);
|
||||||
@@ -422,9 +421,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const CDistributionList loadedDistributions = CDistributionList::fromDatabaseJson(
|
const CDistributionList loadedDistributions = CDistributionList::fromDatabaseJson(distributionJson);
|
||||||
Json::jsonArrayFromString(distributionJson)
|
|
||||||
);
|
|
||||||
if (loadedDistributions.isEmpty())
|
if (loadedDistributions.isEmpty())
|
||||||
{
|
{
|
||||||
CLogMessage(this).error("Loading of distribution yielded no data");
|
CLogMessage(this).error("Loading of distribution yielded no data");
|
||||||
|
|||||||
@@ -70,5 +70,11 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
return distributions;
|
return distributions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDistributionList CDistributionList::fromDatabaseJson(const QString &json)
|
||||||
|
{
|
||||||
|
if (json.isEmpty()) { return CDistributionList(); }
|
||||||
|
return CDistributionList::fromDatabaseJson(Json::jsonArrayFromString(json));
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! From database JSON
|
//! From database JSON
|
||||||
static CDistributionList fromDatabaseJson(const QJsonArray &array);
|
static CDistributionList fromDatabaseJson(const QJsonArray &array);
|
||||||
|
|
||||||
|
//! From database JSON
|
||||||
|
static CDistributionList fromDatabaseJson(const QString &json);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Trait for global setup data
|
//! Trait for global setup data
|
||||||
|
|||||||
Reference in New Issue
Block a user