mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Ref T401, adjusted settings used in components
This commit is contained in:
@@ -1617,7 +1617,7 @@ namespace BlackCore
|
|||||||
QDir().mkpath(database);
|
QDir().mkpath(database);
|
||||||
m_crashReportDatabase = CrashReportDatabase::Initialize(qstringToFilePath(database));
|
m_crashReportDatabase = CrashReportDatabase::Initialize(qstringToFilePath(database));
|
||||||
auto settings = m_crashReportDatabase->GetSettings();
|
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 = std::make_unique<CrashpadClient>();
|
||||||
m_crashpadClient->StartHandler(qstringToFilePath(handler), qstringToFilePath(database), qstringToFilePath(metrics),
|
m_crashpadClient->StartHandler(qstringToFilePath(handler), qstringToFilePath(database), qstringToFilePath(metrics),
|
||||||
serverUrl.getFullUrl().toStdString(), annotations, {}, false, true);
|
serverUrl.getFullUrl().toStdString(), annotations, {}, false, true);
|
||||||
@@ -1627,15 +1627,20 @@ namespace BlackCore
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplication::crashDumpUploadEnabledChanged()
|
void CApplication::onCrashDumpUploadEnabledChanged()
|
||||||
{
|
{
|
||||||
#ifdef BLACK_USE_CRASHPAD
|
#ifdef BLACK_USE_CRASHPAD
|
||||||
if (!m_crashReportDatabase) { return; }
|
if (!m_crashReportDatabase) { return; }
|
||||||
auto settings = m_crashReportDatabase->GetSettings();
|
auto settings = m_crashReportDatabase->GetSettings();
|
||||||
settings->SetUploadsEnabled(CBuildConfig::isReleaseBuild() && m_crashDumpUploadEnabled.getThreadLocal());
|
settings->SetUploadsEnabled(CBuildConfig::isReleaseBuild() && m_crashDumpSettings.getThreadLocal().isEnabled());
|
||||||
#endif
|
#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)
|
void CApplication::httpRequestImplInQAMThread(const QNetworkRequest &request, int logId, const CallbackSlot &callback, int maxRedirects, NetworkRequestOrPostFunction requestOrPostMethod)
|
||||||
{
|
{
|
||||||
// run in QAM thread
|
// run in QAM thread
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "blackmisc/slot.h"
|
#include "blackmisc/slot.h"
|
||||||
#include "blackmisc/applicationinfolist.h"
|
#include "blackmisc/applicationinfolist.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
|
#include "blackmisc/crashinfo.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QCommandLineOption>
|
#include <QCommandLineOption>
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
#include <QByteArray>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -654,14 +656,22 @@ namespace BlackCore
|
|||||||
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
||||||
|
|
||||||
// -------------- crashpad -----------------
|
// -------------- crashpad -----------------
|
||||||
|
//! Init the crash handler
|
||||||
BlackMisc::CStatusMessageList initCrashHandler();
|
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
|
#ifdef BLACK_USE_CRASHPAD
|
||||||
std::unique_ptr<crashpad::CrashpadClient> m_crashpadClient;
|
std::unique_ptr<crashpad::CrashpadClient> m_crashpadClient;
|
||||||
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;
|
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
|
#endif
|
||||||
|
BlackMisc::CCrashInfo m_crashInfo; //!< info representing details
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
#ifndef BLACKCORE_APPLICATION_APPLICATIONSETTINGS_H
|
#ifndef BLACKCORE_APPLICATION_APPLICATIONSETTINGS_H
|
||||||
#define 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/simulation/simulatorplugininfo.h"
|
||||||
|
#include "blackmisc/input/actionhotkeylist.h"
|
||||||
|
#include "blackmisc/settingscache.h"
|
||||||
|
#include "blackmisc/crashsettings.h"
|
||||||
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
@@ -76,16 +78,17 @@ namespace BlackCore
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Uploading of crash dumps is enabled or disabled
|
//! 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
|
//! \copydoc BlackMisc::TSettingTrait::key
|
||||||
static const char *key() { return "application/crashdumpuploadenabled"; }
|
static const char *key() { return "application/crashdump"; }
|
||||||
|
|
||||||
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
||||||
static const QString &humanReadable() { static const QString name("Crash dumps"); return name; }
|
static const QString &humanReadable() { static const QString name("Crash dumps"); return name; }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||||
static bool defaultValue() { return true; }
|
// static bool defaultValue() { return BlackMisc::Settings::CCrashSettings(); }
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -7,12 +7,14 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackmisc/crashsettings.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackconfig/buildconfig.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
#include "legalinfocomponent.h"
|
#include "legalinfocomponent.h"
|
||||||
#include "ui_legalinfocomponent.h"
|
#include "ui_legalinfocomponent.h"
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Settings;
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -24,8 +26,9 @@ namespace BlackGui
|
|||||||
ui(new Ui::CLegalInfoComponent)
|
ui(new Ui::CLegalInfoComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
const bool cd = m_crashDumpUploadEnabled.get();
|
|
||||||
ui->cb_CrashDumps->setChecked(cd);
|
const CCrashSettings settings = m_crashDumpSettings.get();
|
||||||
|
ui->cb_CrashDumps->setChecked(settings.isEnabled());
|
||||||
ui->cb_Agree->setChecked(CBuildConfig::isLocalDeveloperDebugBuild());
|
ui->cb_Agree->setChecked(CBuildConfig::isLocalDeveloperDebugBuild());
|
||||||
connect(ui->cb_CrashDumps, &QCheckBox::toggled, this, &CLegalInfoComponent::onAllowCrashDumps);
|
connect(ui->cb_CrashDumps, &QCheckBox::toggled, this, &CLegalInfoComponent::onAllowCrashDumps);
|
||||||
}
|
}
|
||||||
@@ -48,7 +51,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CLegalInfoComponent::onAllowCrashDumps(bool checked)
|
void CLegalInfoComponent::onAllowCrashDumps(bool checked)
|
||||||
{
|
{
|
||||||
m_crashDumpUploadEnabled.setAndSave(checked);
|
CCrashSettings settings = m_crashDumpSettings.get();
|
||||||
|
settings.setEnabled(checked);
|
||||||
|
m_crashDumpSettings.setAndSave(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLegalInfoWizardPage::validatePage()
|
bool CLegalInfoWizardPage::validatePage()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace BlackGui
|
|||||||
void onAllowCrashDumps(bool checked);
|
void onAllowCrashDumps(bool checked);
|
||||||
|
|
||||||
QScopedPointer<Ui::CLegalInfoComponent> ui;
|
QScopedPointer<Ui::CLegalInfoComponent> ui;
|
||||||
BlackMisc::CSetting<BlackCore::Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this };
|
BlackMisc::CSetting<BlackCore::Application::TCrashDumpSettings> m_crashDumpSettings { this };
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,10 +7,12 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackgui/components/settingsadvancedcomponent.h"
|
|
||||||
#include "ui_settingsadvancedcomponent.h"
|
#include "ui_settingsadvancedcomponent.h"
|
||||||
|
#include "blackgui/components/settingsadvancedcomponent.h"
|
||||||
|
#include "blackmisc/crashsettings.h"
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Settings;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -21,7 +23,9 @@ namespace BlackGui
|
|||||||
ui(new Ui::CSettingsAdvancedComponent)
|
ui(new Ui::CSettingsAdvancedComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->cb_crashDumpsUpload->setChecked(m_crashDumpUploadEnabled.getThreadLocal());
|
|
||||||
|
const CCrashSettings settings = m_crashDumpSettings.getThreadLocal();
|
||||||
|
ui->cb_crashDumpsUpload->setChecked(settings.isEnabled());
|
||||||
connect(ui->cb_crashDumpsUpload, &QCheckBox::stateChanged, this, &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged);
|
connect(ui->cb_crashDumpsUpload, &QCheckBox::stateChanged, this, &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +39,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->cb_crashDumpsUpload->setText(ui->cb_crashDumpsUpload->text() + " (restart needed)");
|
ui->cb_crashDumpsUpload->setText(ui->cb_crashDumpsUpload->text() + " (restart needed)");
|
||||||
}
|
}
|
||||||
m_crashDumpUploadEnabled.set(state == Qt::Checked);
|
|
||||||
|
CCrashSettings settings = m_crashDumpSettings.getThreadLocal();
|
||||||
|
settings.setEnabled(state == Qt::Checked);
|
||||||
|
m_crashDumpSettings.set(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace Ui { class CSettingsAdvancedComponent; }
|
namespace Ui { class CSettingsAdvancedComponent; }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -43,7 +41,7 @@ namespace BlackGui
|
|||||||
void crashDumpUploadEnabledChanged(int state);
|
void crashDumpUploadEnabledChanged(int state);
|
||||||
|
|
||||||
QScopedPointer<Ui::CSettingsAdvancedComponent> ui;
|
QScopedPointer<Ui::CSettingsAdvancedComponent> ui;
|
||||||
BlackMisc::CSetting<BlackCore::Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this };
|
BlackMisc::CSetting<BlackCore::Application::TCrashDumpSettings> m_crashDumpSettings { this };
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user