[graphics/krita/krita/4.3] libs/widgetutils/xmlgui: Add logs to the bug report dialog

Boudewijn Rempt null at kde.org
Wed Oct 7 09:48:57 BST 2020


Git commit 31b00a47a487ced1f44619cfeecd5494a8886b31 by Boudewijn Rempt.
Committed on 07/10/2020 at 08:47.
Pushed by rempt into branch 'krita/4.3'.

Add logs to the bug report dialog

Remove the compiler label; it's not filled in. And add a text
edit field with the combined sysinfo, log and crash log files,
and place the contents on the clipboard for easy pasting.

It's a pity we cannot use the bugzilla REST api to automatically
add these files as an attachment.

>From now on, we can simply ask people to report bugs using the
dialog and add this information.

CCMAIL:kimageshop at kde.org

M  +42   -7    libs/widgetutils/xmlgui/kbugreport.cpp

https://invent.kde.org/graphics/krita/commit/31b00a47a487ced1f44619cfeecd5494a8886b31

diff --git a/libs/widgetutils/xmlgui/kbugreport.cpp b/libs/widgetutils/xmlgui/kbugreport.cpp
index 3ba99a225b..92bbba72b5 100644
--- a/libs/widgetutils/xmlgui/kbugreport.cpp
+++ b/libs/widgetutils/xmlgui/kbugreport.cpp
@@ -37,6 +37,9 @@
 #include <QDebug>
 #include <QTextEdit>
 #include <QDesktopServices>
+#include <QStandardPaths>
+#include <QClipboard>
+#include <QGuiApplication>
 
 #include <kaboutdata.h>
 #include <kconfig.h>
@@ -163,12 +166,6 @@ KBugReport::KBugReport(const KAboutData &aboutData, QWidget *_parent)
     tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
     glay->addWidget(tmpLabel, row, 1, 1, 2);
 
-    tmpLabel = new QLabel(i18n("Compiler:"), this);
-    glay->addWidget(tmpLabel, ++row, 0);
-    tmpLabel = new QLabel(QString::fromLatin1(XMLGUI_COMPILER_VERSION), this);
-    tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
-    glay->addWidget(tmpLabel, row, 1, 1, 2);
-
     // Point to the web form
 
     lay->addSpacing(10);
@@ -176,7 +173,9 @@ KBugReport::KBugReport(const KAboutData &aboutData, QWidget *_parent)
                         "<p>Please read <b><a href=\"https://docs.krita.org/en/untranslatable_pages/reporting_bugs.html\">this guide</a></b> for reporting bugs first!</p>"
                         "<p>To submit a bug report, click on the button below. This will open a web browser "
                         "window on <a href=\"https://bugs.kde.org\">https://bugs.kde.org</a> where you will find "
-                        "a form to fill in. The information displayed above will be transferred to that server.</p></qt>");
+                        "a form to fill in. </p>"
+                        "<p><b>Please paste the Additional Information contents into the bug report!</b></p>"
+                        "</qt>");
     QLabel *label = new QLabel(text, this);
     label->setOpenExternalLinks(true);
     label->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
@@ -184,6 +183,42 @@ KBugReport::KBugReport(const KAboutData &aboutData, QWidget *_parent)
     lay->addWidget(label);
     lay->addSpacing(10);
 
+    tmpLabel = new QLabel(i18n("Additional Information. Please add this to the bug report!"), this);
+    lay->addWidget(label);
+
+    QByteArray additionalInformation;
+    QFile sysinfo(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita-sysinfo.log");
+    if (sysinfo.exists()) {
+        sysinfo.open(QFile::ReadOnly);
+        additionalInformation += sysinfo.readAll();
+        sysinfo.close();
+    }
+
+    additionalInformation += "\n---------------------\n";
+
+    QFile log(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita.log");
+    if (log.exists()) {
+        log.open(QFile::ReadOnly);
+        additionalInformation += log.readAll();
+        log.close();
+    }
+
+    additionalInformation += "\n---------------------\n";
+
+    QFile crashes(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita-crash.log");
+    if (crashes.exists()) {
+        crashes.open(QFile::ReadOnly);
+        additionalInformation += crashes.readAll();
+        crashes.close();
+    }
+
+    QTextEdit *buginfo = new QTextEdit(this);
+    buginfo->setText(QString::fromUtf8(additionalInformation));
+    lay->addWidget(buginfo);
+
+    QClipboard *clipboard = QGuiApplication::clipboard();
+    clipboard->setText(QString::fromUtf8(additionalInformation));
+
     d->appcombo->setFocus();
 
     d->_k_updateUrl();


More information about the kimageshop mailing list