Crash settings must be disabled/empty when application doesn't support sending automatic crash reports to avoid user confusion.

This commit is contained in:
Roman Telezhynskyi 2024-04-08 09:23:13 +03:00
parent cbc137f4e9
commit 0eef58f2cf
4 changed files with 18 additions and 8 deletions

View File

@ -119,8 +119,9 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
#if !defined(CRASH_REPORTING) #if !defined(CRASH_REPORTING)
ui->groupBoxCrashReports->setDisabled(true); ui->groupBoxCrashReports->setDisabled(true);
#endif ui->checkBoxSendCrashReports->setChecked(false);
ui->lineEditCrashUserEmail->setText(QString());
#else
ui->checkBoxSendCrashReports->setChecked(settings->IsSendCrashReport()); ui->checkBoxSendCrashReports->setChecked(settings->IsSendCrashReport());
connect(ui->checkBoxSendCrashReports, &QCheckBox::stateChanged, this, connect(ui->checkBoxSendCrashReports, &QCheckBox::stateChanged, this,
[this]() { m_sendCrashReportsChanged = true; }); [this]() { m_sendCrashReportsChanged = true; });
@ -131,6 +132,7 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail()); ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail());
connect(ui->lineEditCrashUserEmail, &QLineEdit::editingFinished, this, connect(ui->lineEditCrashUserEmail, &QLineEdit::editingFinished, this,
[this]() { m_crashUserEmailChanged = true; }); [this]() { m_crashUserEmailChanged = true; });
#endif
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -118,8 +118,9 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
#if !defined(CRASH_REPORTING) #if !defined(CRASH_REPORTING)
ui->groupBoxCrashReports->setDisabled(true); ui->groupBoxCrashReports->setDisabled(true);
#endif ui->checkBoxSendCrashReports->setChecked(false);
ui->lineEditCrashUserEmail->setText(QString());
#else
ui->checkBoxSendCrashReports->setChecked(settings->IsSendCrashReport()); ui->checkBoxSendCrashReports->setChecked(settings->IsSendCrashReport());
connect(ui->checkBoxSendCrashReports, &QCheckBox::stateChanged, this, connect(ui->checkBoxSendCrashReports, &QCheckBox::stateChanged, this,
[this]() { m_sendCrashReportsChanged = true; }); [this]() { m_sendCrashReportsChanged = true; });
@ -130,6 +131,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail()); ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail());
connect(ui->lineEditCrashUserEmail, &QLineEdit::editingFinished, this, connect(ui->lineEditCrashUserEmail, &QLineEdit::editingFinished, this,
[this]() { m_crashUserEmailChanged = true; }); [this]() { m_crashUserEmailChanged = true; });
#endif
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -180,8 +180,9 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
#if !defined(CRASH_REPORTING) #if !defined(CRASH_REPORTING)
ui->groupBoxCrashReports->setDisabled(true); ui->groupBoxCrashReports->setDisabled(true);
#endif ui->checkBoxSendCrashReports->setChecked(false);
ui->lineEditCrashUserEmail->setText(QString());
#else
ui->checkBoxSendCrashReports->setChecked(settings->IsSendCrashReport()); ui->checkBoxSendCrashReports->setChecked(settings->IsSendCrashReport());
connect(ui->checkBoxSendCrashReports, &QCheckBox::stateChanged, this, connect(ui->checkBoxSendCrashReports, &QCheckBox::stateChanged, this,
[this]() { m_sendCrashReportsChanged = true; }); [this]() { m_sendCrashReportsChanged = true; });
@ -192,6 +193,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail()); ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail());
connect(ui->lineEditCrashUserEmail, &QLineEdit::editingFinished, this, connect(ui->lineEditCrashUserEmail, &QLineEdit::editingFinished, this,
[this]() { m_crashUserEmailChanged = true; }); [this]() { m_crashUserEmailChanged = true; });
#endif
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -31,7 +31,9 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QRegularExpressionValidator> #include <QRegularExpressionValidator>
#if defined(CRASH_REPORTING)
#include "../vabstractapplication.h" #include "../vabstractapplication.h"
#endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogAskCollectStatistic::DialogAskCollectStatistic(QWidget *parent) DialogAskCollectStatistic::DialogAskCollectStatistic(QWidget *parent)
@ -42,14 +44,16 @@ DialogAskCollectStatistic::DialogAskCollectStatistic(QWidget *parent)
#if !defined(CRASH_REPORTING) #if !defined(CRASH_REPORTING)
ui->groupBoxCrashReports->setDisabled(true); ui->groupBoxCrashReports->setDisabled(true);
#endif ui->checkBoxSendCrashReports->setChecked(false);
ui->lineEditCrashUserEmail->setText(QString());
#else
VCommonSettings *settings = VAbstractApplication::VApp()->Settings(); VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
QRegularExpression const rx(QStringLiteral("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b"), QRegularExpression const rx(QStringLiteral("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b"),
QRegularExpression::CaseInsensitiveOption); QRegularExpression::CaseInsensitiveOption);
ui->lineEditCrashUserEmail->setValidator(new QRegularExpressionValidator(rx, this)); ui->lineEditCrashUserEmail->setValidator(new QRegularExpressionValidator(rx, this));
ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail()); ui->lineEditCrashUserEmail->setText(settings->GetCrashEmail());
#endif
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------