Ref T401, update functions for crashpad info in CApplication

This commit is contained in:
Klaus Basan
2018-11-01 16:04:42 +01:00
parent bb34bc7939
commit 17382a0019
4 changed files with 34 additions and 3 deletions

View File

@@ -1646,6 +1646,16 @@ namespace BlackCore
m_crashInfo = info;
}
void CApplication::setCrashInfoUserName(const QString &name)
{
m_crashInfo.setUserName(name);
}
void CApplication::appendCrashInfo(const QString &info)
{
m_crashInfo.appendInfo(info);
}
void CApplication::httpRequestImplInQAMThread(const QNetworkRequest &request, int logId, const CallbackSlot &callback, int maxRedirects, NetworkRequestOrPostFunction requestOrPostMethod)
{
// run in QAM thread

View File

@@ -300,6 +300,20 @@ namespace BlackCore
virtual QString cmdLineArgumentsAsString(bool withExecutable = true);
//! @}
// ----------------------- CrashPad info ---------------------------------
//! Extra annotation for crash to easier identify annotation
void setCrashInfo(const BlackMisc::CCrashInfo &info);
//! User name for crash info
void setCrashInfoUserName(const QString &name);
//! Append crash info
void appendCrashInfo(const QString &info);
//! Get the crash info
const BlackMisc::CCrashInfo &getCrashInfo() const { return m_crashInfo; }
// ----------------------- Input ----------------------------------------
//! The input manager, if available
@@ -670,9 +684,6 @@ namespace BlackCore
//! Upload settings changed
void onCrashDumpUploadEnabledChanged();
//! Extra annotation for crash to easier identify annotation
void setCrashInfo(const BlackMisc::CCrashInfo &info);
#ifdef BLACK_USE_CRASHPAD
std::unique_ptr<crashpad::CrashpadClient> m_crashpadClient;
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;

View File

@@ -20,6 +20,13 @@ namespace BlackMisc
return QStringLiteral("{ %1, %2 }").arg(this->getInfo(), this->getUserName());
}
void CCrashInfo::appendInfo(const QString &extraInfo)
{
if (extraInfo.isEmpty()) { return; }
if (m_info.isEmpty()) { this->setInfo(extraInfo); return; }
m_info += QStringLiteral(" ") % extraInfo;
}
CVariant CCrashInfo::propertyByIndex(const CPropertyIndex &index) const
{
if (index.isMyself()) { return CVariant::from(*this); }

View File

@@ -45,6 +45,9 @@ namespace BlackMisc
//! Set info
void setInfo(const QString &info) { m_info = info; }
//! Append some info
void appendInfo(const QString &extraInfo);
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;