mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
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:
@@ -1669,17 +1669,27 @@ namespace BlackCore
|
||||
|
||||
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)
|
||||
|
||||
@@ -306,13 +306,19 @@ namespace BlackCore
|
||||
void setCrashInfo(const BlackMisc::CCrashInfo &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
|
||||
void appendCrashInfo(const QString &info);
|
||||
void crashAndLogAppendInfo(const QString &info);
|
||||
|
||||
//! Get the crash info
|
||||
const BlackMisc::CCrashInfo &getCrashInfo() const { return m_crashInfo; }
|
||||
const BlackMisc::CCrashInfo &getCrashInfo() const { return m_crashAndLogInfo; }
|
||||
|
||||
// ----------------------- Input ----------------------------------------
|
||||
|
||||
@@ -592,12 +598,12 @@ namespace BlackCore
|
||||
// cmd parsing
|
||||
QList<QCommandLineOption> m_allOptions; //!< all registered options
|
||||
QCommandLineParser m_parser; //!< cmd parser
|
||||
QCommandLineOption m_cmdHelp {"help"}; //!< help option
|
||||
QCommandLineOption m_cmdVersion {"version"}; //!< version option
|
||||
QCommandLineOption m_cmdDBusAddress {"emptyDBus"}; //!< DBus address
|
||||
QCommandLineOption m_cmdDevelopment {"dev"}; //!< Development flag
|
||||
QCommandLineOption m_cmdSharedDir {"shared"}; //!< Shared directory
|
||||
QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache
|
||||
QCommandLineOption m_cmdHelp {"help"}; //!< help option
|
||||
QCommandLineOption m_cmdVersion {"version"}; //!< version option
|
||||
QCommandLineOption m_cmdDBusAddress {"emptyDBus"}; //!< DBus address
|
||||
QCommandLineOption m_cmdDevelopment {"dev"}; //!< Development flag
|
||||
QCommandLineOption m_cmdSharedDir {"shared"}; //!< Shared directory
|
||||
QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache
|
||||
QCommandLineOption m_cmdTestCrashpad {"testcrashpad"}; //!< Test a crasphpad upload
|
||||
bool m_parsed = false; //!< Parsing accomplished?
|
||||
bool m_started = false; //!< started with success?
|
||||
@@ -692,7 +698,7 @@ namespace BlackCore
|
||||
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;
|
||||
BlackMisc::CSettingReadOnly<Application::TCrashDumpSettings> m_crashDumpSettings { this, &CApplication::onCrashDumpUploadEnabledChanged };
|
||||
#endif
|
||||
BlackMisc::CCrashInfo m_crashInfo; //!< info representing details
|
||||
BlackMisc::CCrashInfo m_crashAndLogInfo; //!< info representing details
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -158,10 +158,18 @@ namespace BlackCore
|
||||
uuid.remove('}');
|
||||
|
||||
pingUrl.appendQuery("uuid", uuid);
|
||||
pingUrl.appendQuery("application", sApp->getApplicationNameAndVersion());
|
||||
if (type.testFlag(PingLogoff)) { pingUrl.appendQuery("logoff", "true"); }
|
||||
if (type.testFlag(PingShutdown)) { pingUrl.appendQuery("shutdown", "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;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,8 +155,8 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// crashpad info
|
||||
sGui->setCrashInfoUserName(user.getRealNameAndId());
|
||||
sGui->appendCrashInfo(QStringLiteral("Login as user %1 %2").arg(user.getRealNameAndId(), user.getRolesAsString()));
|
||||
sGui->crashAndLogInfoUserName(user.getRealNameAndId());
|
||||
sGui->crashAndLogAppendInfo(QStringLiteral("Login as user %1 %2").arg(user.getRealNameAndId(), user.getRolesAsString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/simulation/simulatorinternals.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
@@ -311,10 +312,10 @@ namespace BlackGui
|
||||
{
|
||||
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
|
||||
static const QString extraInfo("[%1]");
|
||||
sGui->setCrashInfoUserName(currentServer.getUser().getRealNameAndId());
|
||||
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_lastAircraftModel.set(ownAircraft.getModel());
|
||||
ui->le_LoginCallsign->setText(ownAircraft.getCallsignAsString());
|
||||
@@ -517,6 +518,11 @@ namespace BlackGui
|
||||
ui->le_SimulatorModel->setText(modelAndKey);
|
||||
ui->le_SimulatorModel->home(false);
|
||||
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
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace BlackMisc
|
||||
{
|
||||
case IndexUserName: return CVariant::fromValue(m_userName);
|
||||
case IndexInfo: return CVariant::fromValue(m_info);
|
||||
case IndexSimulatorString: return CVariant::fromValue(m_simulatorString);
|
||||
case IndexFlightNetworkInfo: return CVariant::fromValue(m_flightNetwork);
|
||||
default: break;
|
||||
}
|
||||
return CValueObject::propertyByIndex(index);
|
||||
@@ -48,6 +50,8 @@ namespace BlackMisc
|
||||
{
|
||||
case IndexUserName: 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;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +64,8 @@ namespace BlackMisc
|
||||
{
|
||||
case IndexUserName: return this->getUserName().compare(compareValue.getUserName());
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ namespace BlackMisc
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexUserName = CPropertyIndex::GlobalIndexCCrashInfo,
|
||||
IndexInfo
|
||||
IndexInfo,
|
||||
IndexSimulatorString,
|
||||
IndexFlightNetworkInfo
|
||||
};
|
||||
|
||||
//! Default constructor.
|
||||
@@ -45,6 +47,18 @@ namespace BlackMisc
|
||||
//! Set 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
|
||||
void appendInfo(const QString &extraInfo);
|
||||
|
||||
@@ -63,6 +77,8 @@ namespace BlackMisc
|
||||
private:
|
||||
QString m_userName;
|
||||
QString m_info;
|
||||
QString m_simulatorString;
|
||||
QString m_flightNetwork;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CCrashInfo,
|
||||
|
||||
@@ -95,12 +95,12 @@ namespace BlackMisc
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
private:
|
||||
BlackMisc::CNameVariantPairList m_data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user