mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T698, enable network stats for restricted distributions
This commit is contained in:
committed by
Mat Sutcliffe
parent
25dc43f19c
commit
891a058f17
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "network.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
@@ -115,4 +116,15 @@ namespace BlackCore
|
||||
return CFileUtils::writeStringToFile(s, fp);
|
||||
}
|
||||
|
||||
void INetwork::connectedToNewtork()
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||
if (!m_statistics && (CBuildConfig::isLocalDeveloperDebugBuild() || sApp->getOwnDistribution().isRestricted()))
|
||||
{
|
||||
// enable for local and restricted versions (alpha, ...)
|
||||
CLogMessage("Enabled network statistics");
|
||||
m_statistics = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -603,6 +603,9 @@ namespace BlackCore
|
||||
//! Save the statistics
|
||||
bool saveNetworkStatistics(const QString &server);
|
||||
|
||||
//! Connected to network
|
||||
void connectedToNewtork();
|
||||
|
||||
private:
|
||||
bool m_statistics = false;
|
||||
QMap <QString, int> m_callStatistics;
|
||||
|
||||
@@ -293,6 +293,7 @@ namespace BlackCore
|
||||
{
|
||||
m_server.setConnectedSinceNow();
|
||||
this->setCurrentEcosystem(m_server.getEcosystem());
|
||||
this->connectedToNewtork();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -418,6 +418,7 @@ namespace BlackMisc
|
||||
|
||||
QSet<QString> CFsCommonUtil::findP3dConfigFiles(const QString &configFile, const QString &versionHint)
|
||||
{
|
||||
// locations will be swift paths, I will go one level up and then search for Lockheed Martin
|
||||
const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
|
||||
QSet<QString> files;
|
||||
for (const QString &path : locations)
|
||||
@@ -425,6 +426,7 @@ namespace BlackMisc
|
||||
const QString pathUp = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Lockheed Martin");
|
||||
const QDir d(pathUp);
|
||||
if (!d.exists()) { continue; }
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D config dir: '%1'") << d.absolutePath(); }
|
||||
|
||||
// all versions sub directories
|
||||
// looking for "add-ons.cfg" or simobjects.cfg
|
||||
@@ -657,7 +659,10 @@ namespace BlackMisc
|
||||
return CFsCommonUtil::validateSimObjectsPath(simObjectDirs, models, validModels, invalidModels, ignoreEmptyFileNames, stopAtFailedFiles, stopped);
|
||||
}
|
||||
|
||||
CStatusMessageList CFsCommonUtil::validateSimObjectsPath(const QSet<QString> &simObjectDirs, const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels, bool ignoreEmptyFileNames, int stopAtFailedFiles, bool &stopped)
|
||||
CStatusMessageList CFsCommonUtil::validateSimObjectsPath(
|
||||
const QSet<QString> &simObjectDirs, const CAircraftModelList &models,
|
||||
CAircraftModelList &validModels, CAircraftModelList &invalidModels,
|
||||
bool ignoreEmptyFileNames, int stopAtFailedFiles, bool &stopped)
|
||||
{
|
||||
CAircraftModelList sorted(models);
|
||||
sorted.sortByFileName();
|
||||
|
||||
Reference in New Issue
Block a user