diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index 2d67f6009..5863c4046 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -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) diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 1d88c5eb9..48d349a02 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -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 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 m_crashReportDatabase; BlackMisc::CSettingReadOnly m_crashDumpSettings { this, &CApplication::onCrashDumpUploadEnabledChanged }; #endif - BlackMisc::CCrashInfo m_crashInfo; //!< info representing details + BlackMisc::CCrashInfo m_crashAndLogInfo; //!< info representing details }; } // namespace diff --git a/src/blackcore/data/globalsetup.cpp b/src/blackcore/data/globalsetup.cpp index 6fd4b6160..1f84f61c0 100644 --- a/src/blackcore/data/globalsetup.cpp +++ b/src/blackcore/data/globalsetup.cpp @@ -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; } diff --git a/src/blackgui/components/dblogincomponent.cpp b/src/blackgui/components/dblogincomponent.cpp index 3ae703730..bc19da651 100644 --- a/src/blackgui/components/dblogincomponent.cpp +++ b/src/blackgui/components/dblogincomponent.cpp @@ -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 { diff --git a/src/blackgui/components/logincomponent.cpp b/src/blackgui/components/logincomponent.cpp index 2e1bdc898..5b060c919 100644 --- a/src/blackgui/components/logincomponent.cpp +++ b/src/blackgui/components/logincomponent.cpp @@ -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 { diff --git a/src/blackmisc/crashinfo.cpp b/src/blackmisc/crashinfo.cpp index 67e786e5f..39056efc0 100644 --- a/src/blackmisc/crashinfo.cpp +++ b/src/blackmisc/crashinfo.cpp @@ -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); } } diff --git a/src/blackmisc/crashinfo.h b/src/blackmisc/crashinfo.h index 6bf2b21f9..9c9fae188 100644 --- a/src/blackmisc/crashinfo.h +++ b/src/blackmisc/crashinfo.h @@ -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, diff --git a/src/blackmisc/simulation/simulatorinternals.h b/src/blackmisc/simulation/simulatorinternals.h index c1195b963..5b24b625a 100644 --- a/src/blackmisc/simulation/simulatorinternals.h +++ b/src/blackmisc/simulation/simulatorinternals.h @@ -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;