refs #485, further removed global setup traits from classes with read only

Use global setup from sGui/sApp
This commit is contained in:
Klaus Basan
2016-03-01 01:49:59 +01:00
committed by Mathew Sutcliffe
parent 30b5e5dade
commit aa96731143
20 changed files with 22 additions and 48 deletions

View File

@@ -51,7 +51,7 @@ namespace BlackCore
if (pw.isEmpty()) { msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, "No password")); }
if (!msgs.isEmpty()) { return msgs; }
CUrl url(this->m_setup.get().dbLoginServiceUrl());
const CUrl url(sApp->getGlobalSetup().dbLoginServiceUrl());
QString msg;
if (!CNetworkUtils::canConnect(url, msg))
{
@@ -62,7 +62,7 @@ namespace BlackCore
QUrlQuery params;
params.addQueryItem("username", un);
params.addQueryItem("password", pw);
if (m_setup.get().dbDebugFlag()) { CNetworkUtils::addDebugFlag(params); }
if (sApp->getGlobalSetup().dbDebugFlag()) { CNetworkUtils::addDebugFlag(params); }
QString query = params.toString();
const QNetworkRequest request(CNetworkUtils::getNetworkRequest(url, CNetworkUtils::PostUrlEncoded));
@@ -74,7 +74,7 @@ namespace BlackCore
void CDatabaseAuthenticationService::logoff()
{
CUrl url(this->m_setup.get().dbLoginServiceUrl());
CUrl url(sApp->getGlobalSetup().dbLoginServiceUrl());
url.setQuery("logoff=true");
QNetworkRequest request(CNetworkUtils::getNetworkRequest(url));
sApp->getFromNetwork(request, { this, &CDatabaseAuthenticationService::ps_parseServerResponse });

View File

@@ -59,7 +59,6 @@ namespace BlackCore
void ps_userChanged();
private:
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache
BlackMisc::CData<BlackCore::Data::AuthenticatedDbUser> m_swiftDbUser {this, &CDatabaseAuthenticationService::ps_userChanged};
bool m_shutdown = false;
};

View File

@@ -51,7 +51,7 @@ namespace BlackCore
CNetworkUtils::ignoreSslVerification(request);
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this);
multiPart->append(CNetworkUtils::getJsonTextMultipart(models.toDatabaseJson()));
if (m_setup.get().dbDebugFlag())
if (sApp->getGlobalSetup().dbDebugFlag())
{
multiPart->append(CNetworkUtils::getMultipartWithDebugFlag());
}

View File

@@ -47,7 +47,6 @@ namespace BlackCore
void ps_postResponse(QNetworkReply *nwReplyPtr);
private:
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< data cache
BlackMisc::Network::CUrl m_modelPublishUrl;
QNetworkReply *m_pendingReply = nullptr;
bool m_shutdown = false;

View File

@@ -45,7 +45,7 @@ namespace BlackCore
{
this->threadAssertCheck();
Q_ASSERT_X(sApp, Q_FUNC_INFO, "No application");
QUrl url(m_setup.get().vatsimBookingsUrl());
const QUrl url(sApp->getGlobalSetup().vatsimBookingsUrl());
if (url.isEmpty()) { return; }
sApp->getFromNetwork(url, { this, &CVatsimBookingReader::ps_parseBookings});

View File

@@ -54,9 +54,6 @@ namespace BlackCore
//! Do reading
void ps_read();
private:
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
};
}

View File

@@ -158,9 +158,9 @@ namespace BlackCore
// round robin for load balancing
// remark: Don't use QThread to run network operations in the background
// see http://qt-project.org/doc/qt-4.7/qnetworkaccessmanager.html
QUrl url(m_setup.get().vatsimDataFileUrls().getRandomUrl());
if (url.isEmpty()) { return; }
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing application");
const QUrl url(sApp->getGlobalSetup().vatsimDataFileUrls().getRandomUrl());
if (url.isEmpty()) { return; }
sApp->getFromNetwork(url, { this, &CVatsimDataFileReader::ps_parseVatsimFile});
}

View File

@@ -128,7 +128,6 @@ namespace BlackCore
BlackMisc::Aviation::CAtcStationList m_atcStations;
BlackMisc::Simulation::CSimulatedAircraftList m_aircraft;
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Network::CVoiceCapabilities> m_voiceCapabilities;
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
//! Split line and assign values to their corresponding attribute names
static const QMap<QString, QString> clientPartsToMap(const QString &currentLine, const QStringList &clientSectionAttributes);

View File

@@ -466,7 +466,7 @@ namespace BlackCore
void CWebDataServices::initWriters()
{
this->m_databaseWriter = new CDatabaseWriter(
m_setup.get().dbRootDirectoryUrl(),
sApp->getGlobalSetup().dbRootDirectoryUrl(),
this);
}

View File

@@ -281,7 +281,6 @@ namespace BlackCore
CWebReaderFlags::WebReader m_readerFlags = CWebReaderFlags::WebReaderFlag::None; //!< which readers are available
CWebReaderFlags::DbReaderHint m_dbHint = CWebReaderFlags::NoHint; //!< how to read DB data
bool m_initialRead = false; //!< Initial read conducted
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this, &CWebDataServices::ps_setupChanged}; //!< setup cache
// for reading XML and VATSIM data files
CVatsimBookingReader *m_vatsimBookingReader = nullptr;