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