Ref T456, user statistics monitored at backend

* values for simulator/network
* changed concept a bit so crash handler values are used for statistics as well
This commit is contained in:
Klaus Basan
2018-12-15 12:39:07 +01:00
parent d5ebd91c55
commit a09d7191f3
8 changed files with 77 additions and 25 deletions

View File

@@ -1669,17 +1669,27 @@ namespace BlackCore
void CApplication::setCrashInfo(const CCrashInfo &info) void CApplication::setCrashInfo(const CCrashInfo &info)
{ {
m_crashInfo = info; m_crashAndLogInfo = info;
} }
void CApplication::setCrashInfoUserName(const QString &name) void CApplication::crashAndLogInfoUserName(const QString &name)
{ {
m_crashInfo.setUserName(name); m_crashAndLogInfo.setUserName(name);
} }
void CApplication::appendCrashInfo(const QString &info) void CApplication::crashAndLogInfoSimulator(const QString &simulator)
{ {
m_crashInfo.appendInfo(info); m_crashAndLogInfo.setSimulatorString(simulator);
}
void CApplication::crashAndLogInfoFlightNetwork(const QString &flightNetwork)
{
m_crashAndLogInfo.setFlightNetworkString(flightNetwork);
}
void CApplication::crashAndLogAppendInfo(const QString &info)
{
m_crashAndLogInfo.appendInfo(info);
} }
void CApplication::httpRequestImplInQAMThread(const QNetworkRequest &request, int logId, const CallbackSlot &callback, int maxRedirects, NetworkRequestOrPostFunction requestOrPostMethod) void CApplication::httpRequestImplInQAMThread(const QNetworkRequest &request, int logId, const CallbackSlot &callback, int maxRedirects, NetworkRequestOrPostFunction requestOrPostMethod)

View File

@@ -306,13 +306,19 @@ namespace BlackCore
void setCrashInfo(const BlackMisc::CCrashInfo &info); void setCrashInfo(const BlackMisc::CCrashInfo &info);
//! User name for crash info //! User name for crash info
void setCrashInfoUserName(const QString &name); void crashAndLogInfoUserName(const QString &name);
//! Simulator string
void crashAndLogInfoSimulator(const QString &simulator);
//! Flight network
void crashAndLogInfoFlightNetwork(const QString &flightNetwork);
//! Append crash info //! Append crash info
void appendCrashInfo(const QString &info); void crashAndLogAppendInfo(const QString &info);
//! Get the crash info //! Get the crash info
const BlackMisc::CCrashInfo &getCrashInfo() const { return m_crashInfo; } const BlackMisc::CCrashInfo &getCrashInfo() const { return m_crashAndLogInfo; }
// ----------------------- Input ---------------------------------------- // ----------------------- Input ----------------------------------------
@@ -592,12 +598,12 @@ namespace BlackCore
// cmd parsing // cmd parsing
QList<QCommandLineOption> m_allOptions; //!< all registered options QList<QCommandLineOption> m_allOptions; //!< all registered options
QCommandLineParser m_parser; //!< cmd parser QCommandLineParser m_parser; //!< cmd parser
QCommandLineOption m_cmdHelp {"help"}; //!< help option QCommandLineOption m_cmdHelp {"help"}; //!< help option
QCommandLineOption m_cmdVersion {"version"}; //!< version option QCommandLineOption m_cmdVersion {"version"}; //!< version option
QCommandLineOption m_cmdDBusAddress {"emptyDBus"}; //!< DBus address QCommandLineOption m_cmdDBusAddress {"emptyDBus"}; //!< DBus address
QCommandLineOption m_cmdDevelopment {"dev"}; //!< Development flag QCommandLineOption m_cmdDevelopment {"dev"}; //!< Development flag
QCommandLineOption m_cmdSharedDir {"shared"}; //!< Shared directory QCommandLineOption m_cmdSharedDir {"shared"}; //!< Shared directory
QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache
QCommandLineOption m_cmdTestCrashpad {"testcrashpad"}; //!< Test a crasphpad upload QCommandLineOption m_cmdTestCrashpad {"testcrashpad"}; //!< Test a crasphpad upload
bool m_parsed = false; //!< Parsing accomplished? bool m_parsed = false; //!< Parsing accomplished?
bool m_started = false; //!< started with success? bool m_started = false; //!< started with success?
@@ -692,7 +698,7 @@ namespace BlackCore
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase; std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;
BlackMisc::CSettingReadOnly<Application::TCrashDumpSettings> m_crashDumpSettings { this, &CApplication::onCrashDumpUploadEnabledChanged }; BlackMisc::CSettingReadOnly<Application::TCrashDumpSettings> m_crashDumpSettings { this, &CApplication::onCrashDumpUploadEnabledChanged };
#endif #endif
BlackMisc::CCrashInfo m_crashInfo; //!< info representing details BlackMisc::CCrashInfo m_crashAndLogInfo; //!< info representing details
}; };
} // namespace } // namespace

View File

@@ -158,10 +158,18 @@ namespace BlackCore
uuid.remove('}'); uuid.remove('}');
pingUrl.appendQuery("uuid", uuid); pingUrl.appendQuery("uuid", uuid);
pingUrl.appendQuery("application", sApp->getApplicationNameAndVersion());
if (type.testFlag(PingLogoff)) { pingUrl.appendQuery("logoff", "true"); } if (type.testFlag(PingLogoff)) { pingUrl.appendQuery("logoff", "true"); }
if (type.testFlag(PingShutdown)) { pingUrl.appendQuery("shutdown", "true"); } if (type.testFlag(PingShutdown)) { pingUrl.appendQuery("shutdown", "true"); }
if (type.testFlag(PingStarted)) { pingUrl.appendQuery("started", "true"); } if (type.testFlag(PingStarted)) { pingUrl.appendQuery("started", "true"); }
pingUrl.appendQuery("os", CBuildConfig::getPlatformString());
if (CBuildConfig::isLocalDeveloperDebugBuild()) { pingUrl.appendQuery("dev", "true"); }
if (sApp)
{
const CCrashInfo ci = sApp->getCrashInfo();
pingUrl.appendQuery("application", sApp->getApplicationNameAndVersion());
if (!ci.getSimulatorString().isEmpty()) { pingUrl.appendQuery("fs", ci.getSimulatorString()); }
if (!ci.getFlightNetworkString().isEmpty()) { pingUrl.appendQuery("network", ci.getFlightNetworkString()); }
}
return pingUrl; return pingUrl;
} }

View File

@@ -155,8 +155,8 @@ namespace BlackGui
} }
// crashpad info // crashpad info
sGui->setCrashInfoUserName(user.getRealNameAndId()); sGui->crashAndLogInfoUserName(user.getRealNameAndId());
sGui->appendCrashInfo(QStringLiteral("Login as user %1 %2").arg(user.getRealNameAndId(), user.getRolesAsString())); sGui->crashAndLogAppendInfo(QStringLiteral("Login as user %1 %2").arg(user.getRealNameAndId(), user.getRolesAsString()));
} }
else else
{ {

View File

@@ -32,6 +32,7 @@
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/network/entityflags.h" #include "blackmisc/network/entityflags.h"
#include "blackmisc/network/serverlist.h" #include "blackmisc/network/serverlist.h"
#include "blackmisc/simulation/simulatorinternals.h"
#include "blackmisc/simulation/aircraftmodel.h" #include "blackmisc/simulation/aircraftmodel.h"
#include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/simulation/simulatedaircraft.h"
#include "blackmisc/statusmessage.h" #include "blackmisc/statusmessage.h"
@@ -311,10 +312,10 @@ namespace BlackGui
{ {
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server"); Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
static const QString extraInfo("[%1]"); static const QString extraInfo("[%1]");
sGui->setCrashInfoUserName(currentServer.getUser().getRealNameAndId());
sGui->setExtraWindowTitle(extraInfo.arg(ownAircraft.getCallsignAsString())); sGui->setExtraWindowTitle(extraInfo.arg(ownAircraft.getCallsignAsString()));
sGui->appendCrashInfo(currentServer.getServerSessionId()); sGui->crashAndLogInfoUserName(currentServer.getUser().getRealNameAndId());
sGui->crashAndLogInfoFlightNetwork(currentServer.getEcosystem().toQString(true));
sGui->crashAndLogAppendInfo(currentServer.getServerSessionId());
m_networkSetup.setLastServer(currentServer); m_networkSetup.setLastServer(currentServer);
m_lastAircraftModel.set(ownAircraft.getModel()); m_lastAircraftModel.set(ownAircraft.getModel());
ui->le_LoginCallsign->setText(ownAircraft.getCallsignAsString()); ui->le_LoginCallsign->setText(ownAircraft.getCallsignAsString());
@@ -517,6 +518,11 @@ namespace BlackGui
ui->le_SimulatorModel->setText(modelAndKey); ui->le_SimulatorModel->setText(modelAndKey);
ui->le_SimulatorModel->home(false); ui->le_SimulatorModel->home(false);
this->highlightModelField(model); this->highlightModelField(model);
const CSimulatorInfo sim = sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulator();
const CSimulatorInternals simulatorInternals = sGui->getIContextSimulator()->getSimulatorInternals();
const QString simStr = sim.toQString() + QStringLiteral(" ") + simulatorInternals.getSimulatorVersion();
sGui->crashAndLogInfoSimulator(simStr);
} }
else else
{ {

View File

@@ -35,6 +35,8 @@ namespace BlackMisc
{ {
case IndexUserName: return CVariant::fromValue(m_userName); case IndexUserName: return CVariant::fromValue(m_userName);
case IndexInfo: return CVariant::fromValue(m_info); case IndexInfo: return CVariant::fromValue(m_info);
case IndexSimulatorString: return CVariant::fromValue(m_simulatorString);
case IndexFlightNetworkInfo: return CVariant::fromValue(m_flightNetwork);
default: break; default: break;
} }
return CValueObject::propertyByIndex(index); return CValueObject::propertyByIndex(index);
@@ -48,6 +50,8 @@ namespace BlackMisc
{ {
case IndexUserName: this->setUserName(variant.toQString()); break; case IndexUserName: this->setUserName(variant.toQString()); break;
case IndexInfo: this->setUserName(variant.toQString()); break; case IndexInfo: this->setUserName(variant.toQString()); break;
case IndexSimulatorString: this->setSimulatorString(variant.toQString()); break;
case IndexFlightNetworkInfo: this->setFlightNetworkString(variant.toQString()); break;
default: CValueObject::setPropertyByIndex(index, variant); break; default: CValueObject::setPropertyByIndex(index, variant); break;
} }
} }
@@ -60,6 +64,8 @@ namespace BlackMisc
{ {
case IndexUserName: return this->getUserName().compare(compareValue.getUserName()); case IndexUserName: return this->getUserName().compare(compareValue.getUserName());
case IndexInfo: return this->getInfo().compare(compareValue.getInfo()); case IndexInfo: return this->getInfo().compare(compareValue.getInfo());
case IndexSimulatorString: return this->getSimulatorString().compare(compareValue.getInfo());
case IndexFlightNetworkInfo: return this->getFlightNetworkString().compare(compareValue.getFlightNetworkString());
default: return CValueObject::comparePropertyByIndex(index.copyFrontRemoved(), compareValue); default: return CValueObject::comparePropertyByIndex(index.copyFrontRemoved(), compareValue);
} }
} }

View File

@@ -27,7 +27,9 @@ namespace BlackMisc
enum ColumnIndex enum ColumnIndex
{ {
IndexUserName = CPropertyIndex::GlobalIndexCCrashInfo, IndexUserName = CPropertyIndex::GlobalIndexCCrashInfo,
IndexInfo IndexInfo,
IndexSimulatorString,
IndexFlightNetworkInfo
}; };
//! Default constructor. //! Default constructor.
@@ -45,6 +47,18 @@ namespace BlackMisc
//! Set info //! Set info
void setInfo(const QString &info) { m_info = info; } void setInfo(const QString &info) { m_info = info; }
//! Simulator string
const QString &getSimulatorString() const { return m_simulatorString; }
//! Simulator string
void setSimulatorString(const QString &simString) { m_simulatorString = simString; }
//! Network string
const QString &getFlightNetworkString() const { return m_flightNetwork; }
//! Network string
void setFlightNetworkString(const QString &network) { m_flightNetwork = network; }
//! Append some info //! Append some info
void appendInfo(const QString &extraInfo); void appendInfo(const QString &extraInfo);
@@ -63,6 +77,8 @@ namespace BlackMisc
private: private:
QString m_userName; QString m_userName;
QString m_info; QString m_info;
QString m_simulatorString;
QString m_flightNetwork;
BLACK_METACLASS( BLACK_METACLASS(
CCrashInfo, CCrashInfo,

View File

@@ -95,12 +95,12 @@ namespace BlackMisc
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! Register metadata
static void registerMetadata();
//! \copydoc BlackMisc::Mixin::String::toQString() //! \copydoc BlackMisc::Mixin::String::toQString()
QString convertToQString(bool i18n = false) const; QString convertToQString(bool i18n = false) const;
//! Register metadata
static void registerMetadata();
private: private:
BlackMisc::CNameVariantPairList m_data; BlackMisc::CNameVariantPairList m_data;