Krita Source Code Documentation
Loading...
Searching...
No Matches
KisKBugReport Class Reference

A dialog box for sending bug reports. More...

#include <kbugreport.h>

+ Inheritance diagram for KisKBugReport:

Public Member Functions

void accept () override
 
 KisKBugReport (const KAboutData &aboutData, QWidget *parent=0L)
 
 ~KisKBugReport () override
 

Private Attributes

KisKBugReportPrivate *const d
 

Friends

class KisKBugReportPrivate
 

Detailed Description

A dialog box for sending bug reports.

All the information needed by the dialog box (program name, version, bug-report address, etc.) comes from the KAboutData class. Make sure you create an instance of KAboutData and pass it to KCmdLineArgs.

KDE Bug Report Dialog
Author
David Faure faure.nosp@m.@kde.nosp@m..org

Definition at line 28 of file kbugreport.h.

Constructor & Destructor Documentation

◆ KisKBugReport()

KisKBugReport::KisKBugReport ( const KAboutData & aboutData,
QWidget * parent = 0L )
explicit

Creates a bug-report dialog. Note that you shouldn't have to do this manually, since KisKHelpMenu takes care of the menu item for "Report Bug..." and of creating a KisKBugReport dialog.

Definition at line 81 of file kbugreport.cpp.

82 : QDialog(_parent), d(new KisKBugReportPrivate(this))
83{
84 setWindowTitle(i18n("Submit Bug Report"));
85
86 QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
87 buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
88 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
89 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
90 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
91 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
92
93 d->m_aboutData = aboutData;
94 d->m_process = 0;
95 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::close());
96
97 QLabel *tmpLabel;
98 QVBoxLayout *lay = new QVBoxLayout(this);
99
100 KTitleWidget *title = new KTitleWidget(this);
101 title->setText(i18n("Submit Bug Report"));
102
103#if KWIDGETSADDONS_VERSION_MAJOR > 5 || (KWIDGETSADDONS_VERSION_MAJOR == 5 && KWIDGETSADDONS_VERSION_MINOR >= 72)
104 title->setIcon(KisIconUtils::loadIcon(QStringLiteral("tools-report-bug")));
105#else
106 title->setPixmap(KisIconUtils::loadIcon(QStringLiteral("tools-report-bug")).pixmap(32));
107#endif
108
109 lay->addWidget(title);
110
111 QGridLayout *glay = new QGridLayout();
112 lay->addLayout(glay);
113
114 int row = 0;
115
116 // Program name
117 QString qwtstr = i18n("The application for which you wish to submit a bug report - if incorrect, please use the Report Bug menu item of the correct application");
118 tmpLabel = new QLabel(i18n("Application: "), this);
119 glay->addWidget(tmpLabel, row, 0);
120 tmpLabel->setWhatsThis(qwtstr);
121 d->lblApplicationName = new QLabel(this);
122 d->lblApplicationName->setWhatsThis(qwtstr);
123
124 d->appname = d->m_aboutData.productName();
125 d->lblApplicationName->setText(d->appname);
126
127 glay->addWidget(d->lblApplicationName, row, 1);
128
129 tmpLabel->setWhatsThis(qwtstr);
130
131 // Version
132 qwtstr = i18n("The version of this application - please make sure that no newer version is available before sending a bug report");
133 tmpLabel = new QLabel(i18n("Version:"), this);
134 glay->addWidget(tmpLabel, ++row, 0);
135 tmpLabel->setWhatsThis(qwtstr);
136 d->m_strVersion = d->m_aboutData.version();
137 if (d->m_strVersion.isEmpty()) {
138 d->m_strVersion = i18n("no version set (programmer error)");
139 }
140 d->m_version = new QLabel(d->m_strVersion, this);
141 d->m_version->setTextInteractionFlags(Qt::TextBrowserInteraction);
142 //glay->addWidget( d->m_version, row, 1 );
143 glay->addWidget(d->m_version, row, 1, 1, 2);
144 d->m_version->setWhatsThis(qwtstr);
145
146 tmpLabel = new QLabel(i18n("OS:"), this);
147 glay->addWidget(tmpLabel, ++row, 0);
149
150 tmpLabel = new QLabel(d->os, this);
151 tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
152 glay->addWidget(tmpLabel, row, 1, 1, 2);
153
154 // Point to the web form
155
156 lay->addSpacing(10);
157 QString text = i18n("<qt>"
158 "<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>"
159 "<p>To submit a bug report, click on the button below. This will open a web browser "
160 "window on <a href=\"https://bugs.kde.org\">https://bugs.kde.org</a> where you will find "
161 "a form to fill in. </p>"
162 "<p><b>Please paste the following information into the bug report!</b></p>"
163 "</qt>");
164 QLabel *label = new QLabel(text, this);
165 label->setOpenExternalLinks(true);
166 label->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
167 label->setWordWrap(true);
168 lay->addWidget(label);
169 lay->addSpacing(10);
170
171 QByteArray additionalInformation;
172 QFile sysinfo(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita-sysinfo.log");
173 if (sysinfo.exists()) {
174 sysinfo.open(QFile::ReadOnly);
175 additionalInformation += sysinfo.readAll();
176 sysinfo.close();
177 }
178
179 additionalInformation += "\n---------------------\n";
180
181 QFile log(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita.log");
182 if (log.exists()) {
183 log.open(QFile::ReadOnly);
184 additionalInformation += log.readAll();
185 log.close();
186 }
187
188 additionalInformation += "\n---------------------\n";
189
190 QFile crashes(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kritacrash.log");
191 if (crashes.exists()) {
192 crashes.open(QFile::ReadOnly);
193 additionalInformation += crashes.readAll();
194 crashes.close();
195 }
196
197 QTextEdit *buginfo = new QTextEdit(this);
198 buginfo->setText(QString::fromUtf8(additionalInformation));
199 lay->addWidget(buginfo);
200
201 QClipboard *clipboard = QGuiApplication::clipboard();
202 clipboard->setText(QString::fromUtf8(additionalInformation));
203
204 d->_k_updateUrl();
205
206 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
207 okButton->setText(i18n("&Submit Bug Report"));
208 okButton->setIcon(KisIconUtils::loadIcon(QStringLiteral("tools-report-bug")));
209 lay->addWidget(buttonBox);
210 setMinimumHeight(sizeHint().height() + 20); // WORKAROUND: prevent "cropped" qcombobox
211}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
QLabel * lblApplicationName
void accept() override
friend class KisKBugReportPrivate
Definition kbugreport.h:60
KisKBugReportPrivate *const d
Definition kbugreport.h:61
QIcon loadIcon(const QString &name)

References KisKBugReportPrivate::_k_updateUrl(), accept(), KisKBugReportPrivate::appname, connect(), d, KisKBugReportPrivate::lblApplicationName, KisIconUtils::loadIcon(), KisKBugReportPrivate::m_aboutData, KisKBugReportPrivate::m_process, KisKBugReportPrivate::m_strVersion, KisKBugReportPrivate::m_version, SystemInformation::operatingSystemVersion(), and KisKBugReportPrivate::os.

◆ ~KisKBugReport()

KisKBugReport::~KisKBugReport ( )
override

Destructor

Definition at line 213 of file kbugreport.cpp.

214{
215 delete d;
216}

References d.

Member Function Documentation

◆ accept()

void KisKBugReport::accept ( )
override

OK has been clicked

Definition at line 242 of file kbugreport.cpp.

243{
244 QDesktopServices::openUrl(d->url);
245}

References d, and KisKBugReportPrivate::url.

Friends And Related Symbol Documentation

◆ KisKBugReportPrivate

friend class KisKBugReportPrivate
friend

Update the url to match the current os, compiler, selected app, etc

Definition at line 60 of file kbugreport.h.

Member Data Documentation

◆ d

KisKBugReportPrivate* const KisKBugReport::d
private

Definition at line 61 of file kbugreport.h.


The documentation for this class was generated from the following files: