mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:28:15 +08:00
Ref T401, adjusted settings used in components
This commit is contained in:
@@ -1617,7 +1617,7 @@ namespace BlackCore
|
||||
QDir().mkpath(database);
|
||||
m_crashReportDatabase = CrashReportDatabase::Initialize(qstringToFilePath(database));
|
||||
auto settings = m_crashReportDatabase->GetSettings();
|
||||
settings->SetUploadsEnabled(CBuildConfig::isReleaseBuild() && m_crashDumpUploadEnabled.getThreadLocal());
|
||||
settings->SetUploadsEnabled(CBuildConfig::isReleaseBuild() && m_crashDumpSettings.getThreadLocal().isEnabled());
|
||||
m_crashpadClient = std::make_unique<CrashpadClient>();
|
||||
m_crashpadClient->StartHandler(qstringToFilePath(handler), qstringToFilePath(database), qstringToFilePath(metrics),
|
||||
serverUrl.getFullUrl().toStdString(), annotations, {}, false, true);
|
||||
@@ -1627,15 +1627,20 @@ namespace BlackCore
|
||||
#endif
|
||||
}
|
||||
|
||||
void CApplication::crashDumpUploadEnabledChanged()
|
||||
void CApplication::onCrashDumpUploadEnabledChanged()
|
||||
{
|
||||
#ifdef BLACK_USE_CRASHPAD
|
||||
if (!m_crashReportDatabase) { return; }
|
||||
auto settings = m_crashReportDatabase->GetSettings();
|
||||
settings->SetUploadsEnabled(CBuildConfig::isReleaseBuild() && m_crashDumpUploadEnabled.getThreadLocal());
|
||||
settings->SetUploadsEnabled(CBuildConfig::isReleaseBuild() && m_crashDumpSettings.getThreadLocal().isEnabled());
|
||||
#endif
|
||||
}
|
||||
|
||||
void CApplication::setCrashInfo(const CCrashInfo &info)
|
||||
{
|
||||
m_crashInfo = info;
|
||||
}
|
||||
|
||||
void CApplication::httpRequestImplInQAMThread(const QNetworkRequest &request, int logId, const CallbackSlot &callback, int maxRedirects, NetworkRequestOrPostFunction requestOrPostMethod)
|
||||
{
|
||||
// run in QAM thread
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "blackmisc/slot.h"
|
||||
#include "blackmisc/applicationinfolist.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/crashinfo.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QCommandLineOption>
|
||||
@@ -37,6 +38,7 @@
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
#include <QByteArray>
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
@@ -631,20 +633,20 @@ namespace BlackCore
|
||||
//! Write meta information into the application directory so other swift versions can display them
|
||||
void tagApplicationDataDirectory();
|
||||
|
||||
QNetworkConfigurationManager *m_networkConfigManager = nullptr; //!< configuration
|
||||
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
|
||||
Db::CNetworkWatchdog *m_networkWatchDog = nullptr; //!< checking DB/internet access
|
||||
BlackMisc::CApplicationInfo m_applicationInfo; //!< Application if specified
|
||||
QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any
|
||||
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
||||
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
|
||||
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
|
||||
QPointer<CCookieManager> m_cookieManager; //!< single cookie manager for our access manager
|
||||
const QString m_applicationName; //!< application name
|
||||
QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe
|
||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||
QNetworkConfigurationManager *m_networkConfigManager = nullptr; //!< configuration
|
||||
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
|
||||
Db::CNetworkWatchdog *m_networkWatchDog = nullptr; //!< checking DB/internet access
|
||||
BlackMisc::CApplicationInfo m_applicationInfo; //!< Application if specified
|
||||
QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any
|
||||
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
||||
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
|
||||
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
|
||||
QPointer<CCookieManager> m_cookieManager; //!< single cookie manager for our access manager
|
||||
const QString m_applicationName; //!< application name
|
||||
QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe
|
||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||
bool m_noNwAccessPoint = false; //!< no network access point?
|
||||
bool m_useContexts = false; //!< use contexts
|
||||
bool m_useWebData = false; //!< use web data
|
||||
@@ -654,14 +656,22 @@ namespace BlackCore
|
||||
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
||||
|
||||
// -------------- crashpad -----------------
|
||||
//! Init the crash handler
|
||||
BlackMisc::CStatusMessageList initCrashHandler();
|
||||
void crashDumpUploadEnabledChanged();
|
||||
|
||||
//! 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;
|
||||
BlackMisc::CSettingReadOnly<Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this, &CApplication::crashDumpUploadEnabledChanged };
|
||||
BlackMisc::CSettingReadOnly<Application::TCrashDumpSettings> m_crashDumpSettings { this, &CApplication::onCrashDumpUploadEnabledChanged };
|
||||
#endif
|
||||
BlackMisc::CCrashInfo m_crashInfo; //!< info representing details
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
#ifndef BLACKCORE_APPLICATION_APPLICATIONSETTINGS_H
|
||||
#define BLACKCORE_APPLICATION_APPLICATIONSETTINGS_H
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/input/actionhotkeylist.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/input/actionhotkeylist.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/crashsettings.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackCore
|
||||
@@ -76,16 +78,17 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
//! Uploading of crash dumps is enabled or disabled
|
||||
struct TCrashDumpUploadEnabled : public BlackMisc::TSettingTrait<bool>
|
||||
//! \deprecated remove after changing to
|
||||
struct TCrashDumpSettings : public BlackMisc::TSettingTrait<BlackMisc::Settings::CCrashSettings>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "application/crashdumpuploadenabled"; }
|
||||
static const char *key() { return "application/crashdump"; }
|
||||
|
||||
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("Crash dumps"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static bool defaultValue() { return true; }
|
||||
// static bool defaultValue() { return BlackMisc::Settings::CCrashSettings(); }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user