mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
Revert "Ref T401, adjusted settings used in components"
This reverts commit 705a56b1cb.
Only the bool member of the CrashSettings class was used.
For simplification, use only the bool that was already used
previously to store this setting.
This commit is contained in:
@@ -1369,7 +1369,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CApplication::onCrashDumpUploadEnabledChanged()
|
void CApplication::onCrashDumpUploadEnabledChanged()
|
||||||
{
|
{
|
||||||
const bool enabled = CBuildConfig::isReleaseBuild() && m_crashDumpSettings.getThreadLocal().isEnabled();
|
const bool enabled = CBuildConfig::isReleaseBuild() && m_crashDumpUploadEnabled.getThreadLocal();
|
||||||
this->enableCrashDumpUpload(enabled);
|
this->enableCrashDumpUpload(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ namespace BlackCore
|
|||||||
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
bool m_localSettingsLoaded = false; //!< local settings loaded?
|
||||||
|
|
||||||
// -------------- crashpad -----------------
|
// -------------- crashpad -----------------
|
||||||
BlackMisc::CSettingReadOnly<Application::TCrashDumpSettings> m_crashDumpSettings { this, &CApplication::onCrashDumpUploadEnabledChanged };
|
BlackMisc::CSettingReadOnly<Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this, &CApplication::onCrashDumpUploadEnabledChanged };
|
||||||
|
|
||||||
//! Upload settings changed
|
//! Upload settings changed
|
||||||
void onCrashDumpUploadEnabledChanged();
|
void onCrashDumpUploadEnabledChanged();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||||
#include "blackmisc/input/actionhotkeylist.h"
|
#include "blackmisc/input/actionhotkeylist.h"
|
||||||
#include "blackmisc/settingscache.h"
|
#include "blackmisc/settingscache.h"
|
||||||
#include "blackmisc/crashsettings.h"
|
|
||||||
#include "blackconfig/buildconfig.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@@ -78,11 +77,10 @@ namespace BlackCore::Application
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Uploading of crash dumps is enabled or disabled
|
//! Uploading of crash dumps is enabled or disabled
|
||||||
//! \deprecated remove after changing to
|
struct TCrashDumpUploadEnabled : public BlackMisc::TSettingTrait<bool>
|
||||||
struct TCrashDumpSettings : public BlackMisc::TSettingTrait<BlackMisc::Settings::CCrashSettings>
|
|
||||||
{
|
{
|
||||||
//! \copydoc BlackMisc::TSettingTrait::key
|
//! \copydoc BlackMisc::TSettingTrait::key
|
||||||
static const char *key() { return "application/crashdump"; }
|
static const char *key() { return "application/crashdumpuploadenabled"; }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||||
static const QString &humanReadable()
|
static const QString &humanReadable()
|
||||||
@@ -92,7 +90,7 @@ namespace BlackCore::Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||||
// static bool defaultValue() { return BlackMisc::Settings::CCrashSettings(); }
|
static bool defaultValue() { return true; }
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackmisc/network/url.h"
|
#include "blackmisc/network/url.h"
|
||||||
#include "blackmisc/crashsettings.h"
|
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackconfig/buildconfig.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Settings;
|
|
||||||
using namespace BlackCore::Data;
|
using namespace BlackCore::Data;
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
|
|
||||||
@@ -28,8 +26,8 @@ namespace BlackGui::Components
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setChecklistInfo();
|
this->setChecklistInfo();
|
||||||
|
|
||||||
const CCrashSettings settings = m_crashDumpSettings.get();
|
const bool crashDumpUploadEnabled = m_crashDumpUploadEnabled.getThreadLocal();
|
||||||
ui->cb_CrashDumps->setChecked(settings.isEnabled());
|
ui->cb_CrashDumps->setChecked(crashDumpUploadEnabled);
|
||||||
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);
|
||||||
@@ -59,9 +57,7 @@ namespace BlackGui::Components
|
|||||||
|
|
||||||
void CLegalInfoComponent::onAllowCrashDumps(bool checked)
|
void CLegalInfoComponent::onAllowCrashDumps(bool checked)
|
||||||
{
|
{
|
||||||
CCrashSettings settings = m_crashDumpSettings.get();
|
CLogMessage::preformatted(m_crashDumpUploadEnabled.setAndSave(checked));
|
||||||
settings.setEnabled(checked);
|
|
||||||
CLogMessage::preformatted(m_crashDumpSettings.setAndSave(settings));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLegalInfoComponent::showCrashDumpHint()
|
void CLegalInfoComponent::showCrashDumpHint()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace BlackGui::Components
|
|||||||
void setChecklistInfo();
|
void setChecklistInfo();
|
||||||
|
|
||||||
QScopedPointer<Ui::CLegalInfoComponent> ui;
|
QScopedPointer<Ui::CLegalInfoComponent> ui;
|
||||||
BlackMisc::CSetting<BlackCore::Application::TCrashDumpSettings> m_crashDumpSettings { this };
|
BlackMisc::CSetting<BlackCore::Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this };
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
|
|
||||||
#include "ui_settingsadvancedcomponent.h"
|
#include "ui_settingsadvancedcomponent.h"
|
||||||
#include "blackgui/components/settingsadvancedcomponent.h"
|
#include "blackgui/components/settingsadvancedcomponent.h"
|
||||||
#include "blackmisc/crashsettings.h"
|
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Settings;
|
|
||||||
|
|
||||||
namespace BlackGui::Components
|
namespace BlackGui::Components
|
||||||
{
|
{
|
||||||
@@ -15,8 +13,8 @@ namespace BlackGui::Components
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
const CCrashSettings settings = m_crashDumpSettings.getThreadLocal();
|
const bool crashDumpUploadEnabled = m_crashDumpUploadEnabled.getThreadLocal();
|
||||||
ui->cb_crashDumpsUpload->setChecked(settings.isEnabled());
|
ui->cb_crashDumpsUpload->setChecked(crashDumpUploadEnabled);
|
||||||
connect(ui->cb_crashDumpsUpload, &QCheckBox::stateChanged, this, &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged);
|
connect(ui->cb_crashDumpsUpload, &QCheckBox::stateChanged, this, &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,9 +29,7 @@ namespace BlackGui::Components
|
|||||||
ui->cb_crashDumpsUpload->setText(ui->cb_crashDumpsUpload->text() + " (restart needed)");
|
ui->cb_crashDumpsUpload->setText(ui->cb_crashDumpsUpload->text() + " (restart needed)");
|
||||||
}
|
}
|
||||||
|
|
||||||
CCrashSettings settings = m_crashDumpSettings.getThreadLocal();
|
m_crashDumpUploadEnabled.set(state == Qt::Checked);
|
||||||
settings.setEnabled(state == Qt::Checked);
|
|
||||||
m_crashDumpSettings.set(settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace BlackGui::Components
|
|||||||
void crashDumpUploadEnabledChanged(int state);
|
void crashDumpUploadEnabledChanged(int state);
|
||||||
|
|
||||||
QScopedPointer<Ui::CSettingsAdvancedComponent> ui;
|
QScopedPointer<Ui::CSettingsAdvancedComponent> ui;
|
||||||
BlackMisc::CSetting<BlackCore::Application::TCrashDumpSettings> m_crashDumpSettings { this };
|
BlackMisc::CSetting<BlackCore::Application::TCrashDumpUploadEnabled> m_crashDumpUploadEnabled { this };
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -196,8 +196,6 @@ add_library(misc SHARED
|
|||||||
crashhandler.h
|
crashhandler.h
|
||||||
crashinfo.cpp
|
crashinfo.cpp
|
||||||
crashinfo.h
|
crashinfo.h
|
||||||
crashsettings.cpp
|
|
||||||
crashsettings.h
|
|
||||||
datacache.cpp
|
datacache.cpp
|
||||||
datacache.h
|
datacache.h
|
||||||
datastream.h
|
datastream.h
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
#include "blackmisc/crashsettings.h"
|
|
||||||
#include "blackmisc/stringutils.h"
|
|
||||||
#include "blackmisc/comparefunctions.h"
|
|
||||||
|
|
||||||
#include <QStringBuilder>
|
|
||||||
|
|
||||||
BLACK_DEFINE_VALUEOBJECT_MIXINS(BlackMisc::Settings, CCrashSettings)
|
|
||||||
|
|
||||||
namespace BlackMisc::Settings
|
|
||||||
{
|
|
||||||
CCrashSettings::CCrashSettings() {}
|
|
||||||
|
|
||||||
QString CCrashSettings::convertToQString(bool i18n) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(i18n);
|
|
||||||
return QStringLiteral("{ %1, %2 }").arg(boolToYesNo(this->isEnabled()), boolToYesNo(this->withPrivacyInfo()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant CCrashSettings::propertyByIndex(CPropertyIndexRef index) const
|
|
||||||
{
|
|
||||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case IndexEnabled: return QVariant::fromValue(this->isEnabled());
|
|
||||||
case IndexPrivateInfo: return QVariant::fromValue(this->withPrivacyInfo());
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
return CValueObject::propertyByIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCrashSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
|
||||||
{
|
|
||||||
if (index.isMyself())
|
|
||||||
{
|
|
||||||
(*this) = variant.value<CCrashSettings>();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case IndexEnabled: this->setEnabled(variant.toBool()); break;
|
|
||||||
case IndexPrivateInfo: this->setPrivacyInfo(variant.toBool()); break;
|
|
||||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int CCrashSettings::comparePropertyByIndex(CPropertyIndexRef index, const CCrashSettings &compareValue) const
|
|
||||||
{
|
|
||||||
if (index.isMyself()) { return this->convertToQString().compare(compareValue.convertToQString()); }
|
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case IndexEnabled: return Compare::compare(this->isEnabled(), compareValue.isEnabled());
|
|
||||||
case IndexPrivateInfo: return Compare::compare(this->withPrivacyInfo(), compareValue.withPrivacyInfo());
|
|
||||||
default: return CValueObject::comparePropertyByIndex(index.copyFrontRemoved(), compareValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // ns
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
//! \file
|
|
||||||
|
|
||||||
#ifndef BLACKMISC_CRASHSETTINGS_H
|
|
||||||
#define BLACKMISC_CRASHSETTINGS_H
|
|
||||||
|
|
||||||
#include "blackmisc/valueobject.h"
|
|
||||||
|
|
||||||
BLACK_DECLARE_VALUEOBJECT_MIXINS(BlackMisc::Settings, CCrashSettings)
|
|
||||||
|
|
||||||
namespace BlackMisc::Settings
|
|
||||||
{
|
|
||||||
/*!
|
|
||||||
* Crash info. Details about crash context.
|
|
||||||
*/
|
|
||||||
class BLACKMISC_EXPORT CCrashSettings : public CValueObject<CCrashSettings>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! Properties by index
|
|
||||||
enum ColumnIndex
|
|
||||||
{
|
|
||||||
IndexEnabled = CPropertyIndexRef::GlobalIndexCCrashSettings,
|
|
||||||
IndexPrivateInfo
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Default constructor.
|
|
||||||
CCrashSettings();
|
|
||||||
|
|
||||||
//! Is enabled?
|
|
||||||
bool isEnabled() const { return m_enabled; }
|
|
||||||
|
|
||||||
//! Set enabled
|
|
||||||
void setEnabled(bool enabled) { m_enabled = enabled; }
|
|
||||||
|
|
||||||
//! With privacy info
|
|
||||||
bool withPrivacyInfo() const { return m_privacyInfo; }
|
|
||||||
|
|
||||||
//! Set privacy info
|
|
||||||
void setPrivacyInfo(bool privacy) { m_privacyInfo = privacy; }
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
|
||||||
QString convertToQString(bool i18n = false) const;
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
|
||||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
|
||||||
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
|
||||||
int comparePropertyByIndex(CPropertyIndexRef index, const CCrashSettings &compareValue) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_enabled = false;
|
|
||||||
bool m_privacyInfo = false;
|
|
||||||
|
|
||||||
BLACK_METACLASS(
|
|
||||||
CCrashSettings,
|
|
||||||
BLACK_METAMEMBER(enabled),
|
|
||||||
BLACK_METAMEMBER(privacyInfo)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
} // ns
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Settings::CCrashSettings)
|
|
||||||
|
|
||||||
#endif // guard
|
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "blackmisc/sharedstate/passiveobserver.h"
|
#include "blackmisc/sharedstate/passiveobserver.h"
|
||||||
#include "blackmisc/applicationinfolist.h"
|
#include "blackmisc/applicationinfolist.h"
|
||||||
#include "blackmisc/countrylist.h"
|
#include "blackmisc/countrylist.h"
|
||||||
#include "blackmisc/crashsettings.h"
|
|
||||||
#include "blackmisc/directories.h"
|
#include "blackmisc/directories.h"
|
||||||
#include "blackmisc/iconlist.h"
|
#include "blackmisc/iconlist.h"
|
||||||
#include "blackmisc/identifierlist.h"
|
#include "blackmisc/identifierlist.h"
|
||||||
@@ -91,7 +90,6 @@ namespace BlackMisc
|
|||||||
Network::registerMetadata();
|
Network::registerMetadata();
|
||||||
PhysicalQuantities::registerMetadata();
|
PhysicalQuantities::registerMetadata();
|
||||||
Simulation::registerMetadata();
|
Simulation::registerMetadata();
|
||||||
Settings::CCrashSettings::registerMetadata();
|
|
||||||
Weather::registerMetadata();
|
Weather::registerMetadata();
|
||||||
|
|
||||||
SharedState::CAnyMatch::registerMetadata();
|
SharedState::CAnyMatch::registerMetadata();
|
||||||
|
|||||||
Reference in New Issue
Block a user