mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15: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 "network.h"
|
||||||
|
#include "blackcore/application.h"
|
||||||
#include "blackmisc/fileutils.h"
|
#include "blackmisc/fileutils.h"
|
||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
@@ -115,4 +116,15 @@ namespace BlackCore
|
|||||||
return CFileUtils::writeStringToFile(s, fp);
|
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
|
} // ns
|
||||||
|
|||||||
@@ -603,6 +603,9 @@ namespace BlackCore
|
|||||||
//! Save the statistics
|
//! Save the statistics
|
||||||
bool saveNetworkStatistics(const QString &server);
|
bool saveNetworkStatistics(const QString &server);
|
||||||
|
|
||||||
|
//! Connected to network
|
||||||
|
void connectedToNewtork();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_statistics = false;
|
bool m_statistics = false;
|
||||||
QMap <QString, int> m_callStatistics;
|
QMap <QString, int> m_callStatistics;
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
m_server.setConnectedSinceNow();
|
m_server.setConnectedSinceNow();
|
||||||
this->setCurrentEcosystem(m_server.getEcosystem());
|
this->setCurrentEcosystem(m_server.getEcosystem());
|
||||||
|
this->connectedToNewtork();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -418,6 +418,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QSet<QString> CFsCommonUtil::findP3dConfigFiles(const QString &configFile, const QString &versionHint)
|
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);
|
const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
|
||||||
QSet<QString> files;
|
QSet<QString> files;
|
||||||
for (const QString &path : locations)
|
for (const QString &path : locations)
|
||||||
@@ -425,6 +426,7 @@ namespace BlackMisc
|
|||||||
const QString pathUp = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Lockheed Martin");
|
const QString pathUp = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Lockheed Martin");
|
||||||
const QDir d(pathUp);
|
const QDir d(pathUp);
|
||||||
if (!d.exists()) { continue; }
|
if (!d.exists()) { continue; }
|
||||||
|
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D config dir: '%1'") << d.absolutePath(); }
|
||||||
|
|
||||||
// all versions sub directories
|
// all versions sub directories
|
||||||
// looking for "add-ons.cfg" or simobjects.cfg
|
// looking for "add-ons.cfg" or simobjects.cfg
|
||||||
@@ -657,7 +659,10 @@ namespace BlackMisc
|
|||||||
return CFsCommonUtil::validateSimObjectsPath(simObjectDirs, models, validModels, invalidModels, ignoreEmptyFileNames, stopAtFailedFiles, stopped);
|
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);
|
CAircraftModelList sorted(models);
|
||||||
sorted.sortByFileName();
|
sorted.sortByFileName();
|
||||||
|
|||||||
Reference in New Issue
Block a user