mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T148, renamed/added hasConnectedSwiftDb / canConnectSwiftDb
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a2e888546e
commit
961f47b700
@@ -21,6 +21,7 @@
|
||||
#include "blackcore/vatsim/vatsimmetarreader.h"
|
||||
#include "blackcore/vatsim/vatsimstatusfilereader.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/logcategory.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
@@ -164,7 +165,7 @@ namespace BlackCore
|
||||
initSharedInfoObjectReaderAndTriggerRead();
|
||||
}
|
||||
|
||||
bool CWebDataServices::canConnectSwiftDb() const
|
||||
bool CWebDataServices::hasConnectedSwiftDb() const
|
||||
{
|
||||
if (!m_icaoDataReader && !m_modelDataReader && !m_airportDataReader && !m_dbInfoDataReader) { return false; }
|
||||
|
||||
@@ -176,6 +177,12 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CWebDataServices::canConnectSwiftDb(bool strict) const
|
||||
{
|
||||
if (!strict && this->hasConnectedSwiftDb()) { return true; }
|
||||
return CNetworkUtils::canConnect(sApp->getGlobalSetup().getDbHomePageUrl());
|
||||
}
|
||||
|
||||
void CWebDataServices::resetSignalFlags()
|
||||
{
|
||||
m_signalledEntities.clear();
|
||||
|
||||
@@ -395,8 +395,11 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
int getSharedInfoObjectCount(BlackMisc::Network::CEntityFlags::Entity entity) const;
|
||||
|
||||
//! Can connect to swift DB?
|
||||
bool canConnectSwiftDb() const;
|
||||
//! Has already connect swift DB?
|
||||
bool hasConnectedSwiftDb() const;
|
||||
|
||||
//! Can connect swift DB?
|
||||
bool canConnectSwiftDb(bool strict = false) const;
|
||||
|
||||
//! Reset the flags what was already signaled
|
||||
void resetSignalFlags();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace BlackGui
|
||||
|
||||
bool CDataInfoAreaComponent::writeDbDataToResourceDir() const
|
||||
{
|
||||
if (!sGui || !sGui->getWebDataServices()->canConnectSwiftDb())
|
||||
if (!sGui || !sGui->getWebDataServices()->hasConnectedSwiftDb())
|
||||
{
|
||||
CLogMessage(this).warning("No connection to DB yet, no new data loaded which can be written");
|
||||
return false;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace BlackGui
|
||||
const bool swift =
|
||||
sGui &&
|
||||
sGui->hasWebDataServices() &&
|
||||
sGui->getWebDataServices()->canConnectSwiftDb();
|
||||
sGui->getWebDataServices()->hasConnectedSwiftDb();
|
||||
this->led_SwiftDb->setOn(swift);
|
||||
|
||||
bool allData = hasAllData();
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace BlackGui
|
||||
CMenuAction CMenuActions::addMenuStash()
|
||||
{
|
||||
if (this->containsMenu(CMenuAction::pathStash())) { return CMenuAction(); }
|
||||
const bool canConnectDb = sGui->getWebDataServices()->canConnectSwiftDb();
|
||||
const bool canConnectDb = sGui->getWebDataServices()->hasConnectedSwiftDb();
|
||||
const QString txt(canConnectDb ? "Stash tools" : "Stash tools (Warning: no DB!)");
|
||||
return this->addMenu(CIcons::appDbStash16(), txt, CMenuAction::pathStash());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user