StudioWelcome: Show combobox for crash reporter

This highlights to the user if the crash reporter is enabled.
The patch also includes some adjustments for the design.

Change-Id: I1a0be0d2b98df937dbeeb6bf8063f1aaa78793f5
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Thomas Hartmann
2022-01-13 19:46:28 +01:00
parent cbcdf4c2f2
commit 17deadf5c3
2 changed files with 108 additions and 55 deletions

View File

@@ -38,8 +38,8 @@ Rectangle {
gradient: Gradient { gradient: Gradient {
orientation: Gradient.Horizontal orientation: Gradient.Horizontal
GradientStop { position: 0.0; color: "#333d56" } GradientStop { position: 0.0; color: "#1d212a" }
GradientStop { position: 1.0; color: "#000728" } GradientStop { position: 1.0; color: "#232c56" }
} }
signal goNext signal goNext
@@ -56,33 +56,36 @@ Rectangle {
if (crashReportingEnabled) { if (crashReportingEnabled) {
var configureButton = "<a href='#' style='text-decoration:none;color:#ffff00'>" var configureButton = "<a href='#' style='text-decoration:none;color:#ffff00'>"
+ qsTr("[Configure]") + "</a>"; + qsTr("[Configure]") + "</a>";
var settingPath = Qt.platform.os === "osx" var settingPath = Qt.platform.os === "osx"
? qsTr("Qt Creator > Preferences > Environment > System") ? qsTr("Qt Creator > Preferences > Environment > System")
: qsTr("Tools > Options > Environment > System") : qsTr("Tools > Options > Environment > System")
var strOn = qsTr("Qt Design Studio collects crash reports for the sole purpose of fixing bugs. " var strOn = qsTr("Qt Design Studio collects crash reports for the sole purpose of fixing bugs. "
+ "You can disable this feature under %1. %2").arg(settingPath).arg(configureButton) + "You can disable this feature under %1. %2").arg(settingPath).arg(configureButton)
var strOff = qsTr("Qt Design Studio can collect crash reports for the sole purpose of fixing bugs. " var strOff = qsTr("Qt Design Studio can collect crash reports for the sole purpose of fixing bugs. "
+ "You can enable this feature under %1. %2").arg(settingPath).arg(configureButton) + "You can enable this feature under %1. %2").arg(settingPath).arg(configureButton)
crash_reporting_text.text = crashReportingOn ? strOn : strOff; crash_reporting_text.text = crashReportingOn ? strOn : strOff;
crashReportCheckBox.visible = true
} }
} }
Image { Image {
id: logo id: logo
x: 16 x: 15
y: 16 y: 11
width: 66
height: 50
source: "welcome_windows/logo.png" source: "welcome_windows/logo.png"
} }
Text { Text {
id: qt_design_studio id: qt_design_studio
x: 16 x: 13
y: 93 y: 81
width: 250 width: 336
height: 55 height: 46
color: "#4cd265" color: "#25709a"
text: qsTr("Qt Design Studio") text: qsTr("Qt Design Studio")
font.pixelSize: 36 font.pixelSize: 36
font.family: StudioFonts.titilliumWeb_light font.family: StudioFonts.titilliumWeb_light
@@ -90,46 +93,46 @@ Rectangle {
Text { Text {
id: software_for_ui id: software_for_ui
x: 16 x: 15
y: 141 y: 124
width: 250 width: 300
height: 30 height: 30
color: "#ffffff" color: "#ffffff"
text: qsTr("Software for UI and UX Designers") text: qsTr("Software for UI and UX Designers")
renderType: Text.QtRendering renderType: Text.QtRendering
font.pixelSize: 18 font.pixelSize: 15
font.family: StudioFonts.titilliumWeb_light font.family: StudioFonts.titilliumWeb_light
} }
Text { Text {
id: copyright id: copyright
x: 16 x: 15
y: 183 y: 155
width: 270 width: 270
height: 24 height: 24
color: "#ffffff" color: "#ffffff"
text: qsTr("Copyright 2008 - 2021 The Qt Company") text: qsTr("Copyright 2008 - 2022 The Qt Company")
font.pixelSize: 16 font.pixelSize: 14
font.family: StudioFonts.titilliumWeb_light font.family: StudioFonts.titilliumWeb_light
} }
Text { Text {
id: all_rights_reserved id: all_rights_reserved
x: 16 x: 15
y: 207 y: 174
width: 250 width: 250
height: 24 height: 24
color: "#ffffff" color: "#ffffff"
text: qsTr("All Rights Reserved") text: qsTr("All Rights Reserved")
font.pixelSize: 16 font.pixelSize: 14
font.family: StudioFonts.titilliumWeb_light font.family: StudioFonts.titilliumWeb_light
} }
Text { Text {
id: marketing_1 id: marketing_1
x: 16 x: 15
y: 252 y: 206
width: 355 width: 406
height: 31 height: 31
color: "#ffffff" color: "#ffffff"
text: qsTr("Multi-paradigm language for creating highly dynamic applications.") text: qsTr("Multi-paradigm language for creating highly dynamic applications.")
@@ -141,9 +144,9 @@ Rectangle {
Text { Text {
id: marketing_2 id: marketing_2
x: 16 x: 15
y: 273 y: 229
width: 311 width: 341
height: 31 height: 31
color: "#ffffff" color: "#ffffff"
text: qsTr("Run your concepts and prototypes on your final hardware.") text: qsTr("Run your concepts and prototypes on your final hardware.")
@@ -155,9 +158,9 @@ Rectangle {
Text { Text {
id: marketing_3 id: marketing_3
x: 16 x: 15
y: 294 y: 252
width: 311 width: 336
height: 31 height: 31
color: "#ffffff" color: "#ffffff"
text: qsTr("Seamless integration between designer and developer.") text: qsTr("Seamless integration between designer and developer.")
@@ -171,8 +174,8 @@ Rectangle {
id: crash_reporting_text id: crash_reporting_text
color: "#ffffff" color: "#ffffff"
textFormat: Text.RichText textFormat: Text.RichText
x: 16 x: 15
y: 330 y: 280
width: 311 width: 311
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.family: StudioFonts.titilliumWeb_light font.family: StudioFonts.titilliumWeb_light
@@ -229,20 +232,9 @@ Rectangle {
ColumnLayout { ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 16 anchors.leftMargin: 16
anchors.bottomMargin: 10
CheckBox { spacing: 3
id: doNotShowCheckBox
text: qsTr("Do not show this again")
padding: 0
spacing: 12
contentItem: Text {
text: doNotShowCheckBox.text
color: "#ffffff"
leftPadding: doNotShowCheckBox.indicator.width + doNotShowCheckBox.spacing
}
}
CheckBox { CheckBox {
id: usageStatisticCheckBox id: usageStatisticCheckBox
@@ -257,13 +249,49 @@ Rectangle {
text: usageStatisticCheckBox.text text: usageStatisticCheckBox.text
color: "#ffffff" color: "#ffffff"
leftPadding: usageStatisticCheckBox.indicator.width + usageStatisticCheckBox.spacing leftPadding: usageStatisticCheckBox.indicator.width + usageStatisticCheckBox.spacing
font.pixelSize: 12
}
}
CheckBox {
id: crashReportCheckBox
text: qsTr("Enable Crash Reports")
spacing: 12
checked: usageStatisticModel.crashReporterEnabled
visible: false
onCheckedChanged: {
usageStatisticModel.setCrashReporterEnabled(crashReportCheckBox.checked)
welcome_splash.onPluginInitialized(true, crashReportCheckBox.checked)
}
contentItem: Text {
color: "#ffffff"
text: crashReportCheckBox.text
leftPadding: crashReportCheckBox.indicator.width + crashReportCheckBox.spacing
font.pixelSize: 12
}
padding: 0
}
CheckBox {
id: doNotShowCheckBox
text: qsTr("Do not show this again")
padding: 0
spacing: 12
contentItem: Text {
text: doNotShowCheckBox.text
color: "#ffffff"
leftPadding: doNotShowCheckBox.indicator.width + doNotShowCheckBox.spacing
font.pixelSize: 12
} }
} }
} }
RowLayout { RowLayout {
x: 16 x: 16
y: 330 y: 277
visible: welcome_splash.loadingPlugins visible: welcome_splash.loadingPlugins
Text { Text {
@@ -309,8 +337,8 @@ Rectangle {
Text { Text {
id: all_rights_reserved1 id: all_rights_reserved1
x: 16 x: 15
y: 75 y: 65
color: "#ffffff" color: "#ffffff"
text: qsTr("Community Edition") text: qsTr("Community Edition")
font.pixelSize: 13 font.pixelSize: 13

View File

@@ -88,6 +88,7 @@ const char DO_NOT_SHOW_SPLASHSCREEN_AGAIN_KEY[] = "StudioSplashScreen";
const char DETAILED_USAGE_STATISTICS[] = "DetailedUsageStatistics"; const char DETAILED_USAGE_STATISTICS[] = "DetailedUsageStatistics";
const char STATISTICS_COLLECTION_MODE[] = "StatisticsCollectionMode"; const char STATISTICS_COLLECTION_MODE[] = "StatisticsCollectionMode";
const char NO_TELEMETRY[] = "NoTelemetry"; const char NO_TELEMETRY[] = "NoTelemetry";
const char CRASH_REPORTER_SETTING[] = "CrashReportingEnabled";
QPointer<QQuickWidget> s_view = nullptr; QPointer<QQuickWidget> s_view = nullptr;
static StudioWelcomePlugin *s_pluginInstance = nullptr; static StudioWelcomePlugin *s_pluginInstance = nullptr;
@@ -122,6 +123,8 @@ class UsageStatisticPluginModel : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool usageStatisticEnabled MEMBER m_usageStatisticEnabled NOTIFY usageStatisticChanged) Q_PROPERTY(bool usageStatisticEnabled MEMBER m_usageStatisticEnabled NOTIFY usageStatisticChanged)
Q_PROPERTY(bool crashReporterEnabled MEMBER m_crashReporterEnabled NOTIFY crashReporterEnabledChanged)
public: public:
explicit UsageStatisticPluginModel(QObject *parent = nullptr) explicit UsageStatisticPluginModel(QObject *parent = nullptr)
: QObject(parent) : QObject(parent)
@@ -135,7 +138,27 @@ public:
QVariant value = settings->value(STATISTICS_COLLECTION_MODE); QVariant value = settings->value(STATISTICS_COLLECTION_MODE);
m_usageStatisticEnabled = value.isValid() && value.toString() == DETAILED_USAGE_STATISTICS; m_usageStatisticEnabled = value.isValid() && value.toString() == DETAILED_USAGE_STATISTICS;
m_crashReporterEnabled = Core::ICore::settings()->value(CRASH_REPORTER_SETTING, false).toBool();
emit usageStatisticChanged(); emit usageStatisticChanged();
emit crashReporterEnabledChanged();
}
Q_INVOKABLE void setCrashReporterEnabled(bool b)
{
if (m_crashReporterEnabled == b)
return;
Core::ICore::settings()->setValue(CRASH_REPORTER_SETTING, b);
s_pluginInstance->pauseRemoveSplashTimer();
const QString restartText = tr("The change will take effect after restart.");
Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText);
restartDialog.exec();
s_pluginInstance->resumeRemoveSplashTimer();
setupModel();
} }
Q_INVOKABLE void setTelemetryEnabled(bool b) Q_INVOKABLE void setTelemetryEnabled(bool b)
@@ -160,9 +183,11 @@ public:
signals: signals:
void usageStatisticChanged(); void usageStatisticChanged();
void crashReporterEnabledChanged();
private: private:
bool m_usageStatisticEnabled = false; bool m_usageStatisticEnabled = false;
bool m_crashReporterEnabled = false;
}; };
class ProjectModel : public QAbstractListModel class ProjectModel : public QAbstractListModel
@@ -564,7 +589,7 @@ bool StudioWelcomePlugin::delayedInitialize()
#ifdef ENABLE_CRASHPAD #ifdef ENABLE_CRASHPAD
const bool crashReportingEnabled = true; const bool crashReportingEnabled = true;
const bool crashReportingOn = Core::ICore::settings()->value("CrashReportingEnabled", false).toBool(); const bool crashReportingOn = Core::ICore::settings()->value(CRASH_REPORTER_SETTING, false).toBool();
#else #else
const bool crashReportingEnabled = false; const bool crashReportingEnabled = false;
const bool crashReportingOn = false; const bool crashReportingOn = false;