Some Web readers adjustemnts

* do not init shared URLs before needed
* do not load info objects when DB is unavailable
* adjust reader flags when DB is down
* airport URL available in setup
This commit is contained in:
Klaus Basan
2016-07-03 01:01:36 +02:00
parent 773f318a07
commit 8d5020d78e
10 changed files with 103 additions and 29 deletions

View File

@@ -40,12 +40,24 @@ namespace BlackMisc
{
QStringList list;
if (mode.testFlag(Unspecified)) list << "Unspecified";
if (mode.testFlag(Canceled)) list << "Unspecified";
if (mode.testFlag(DbDirect)) list << "Direct DB access";
if (mode.testFlag(Shared)) list << "Shared data";
if (mode.testFlag(Cached)) list << "Cached data";
return list.join(',');
}
CDbFlags::DataRetrievalMode CDbFlags::adjustWhenDbIsDown(DataRetrievalMode mode)
{
switch (mode)
{
case DbDirect: return Canceled;
case CacheThenDb: return Cached;
default: return mode;
}
}
void CDbFlags::registerMetadata()
{
// this is no value class and I register enums here,

View File

@@ -35,10 +35,10 @@ namespace BlackMisc
DbDirect = 1 << 0, //!< directly from DB
Shared = 1 << 1, //!< shared directory
Cached = 1 << 2, //!< from cache
DbFailover = 1 << 3, //!< read from DB if cache (and only if) cache is empty
SharedFailover = 1 << 4, //!< read shared if cache (and only if) cache is empty
Canceled = 1 << 3, //!< cancel DB reading
CacheThenDb = DbDirect | Cached, //!< Cache when possible, otherwise DB
CacheThenShared = Shared | Cached //!< Cache when possible, otherwise shared
};
Q_DECLARE_FLAGS(DataRetrievalMode, DataRetrievalModeFlag)
@@ -51,6 +51,9 @@ namespace BlackMisc
//! Convert to string
static QString flagToString(CDbFlags::DataRetrievalMode mode);
//! Adjust flag as we alread know DB is down
static DataRetrievalMode adjustWhenDbIsDown(DataRetrievalMode mode);
//! Register metadata
static void registerMetadata();
};