Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dschmidt/libcrashreporter-qt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeo Mrnjavac <teo@kde.org>2016-03-24 17:47:05 +0300
committerTeo Mrnjavac <teo@kde.org>2016-03-24 17:47:05 +0300
commitf7603528f332a4636f8fdbd05d334ebcc8a2ae46 (patch)
tree383b2de098a637b9d544acdf14fc15706c761a00
parenta80d71ab852947ee398fc914dc3df83b99184502 (diff)
Notify the user about GDB run + UX improvements.
POSIX kill after GDB run. Send/Don't send buttons and progress/abort information alternatively visible on the same line. Option to view GDB backtrace before sending. Layout fixage.
-rw-r--r--src/libcrashreporter-gui/CrashReporter.cpp44
-rw-r--r--src/libcrashreporter-gui/CrashReporter.ui186
2 files changed, 139 insertions, 91 deletions
diff --git a/src/libcrashreporter-gui/CrashReporter.cpp b/src/libcrashreporter-gui/CrashReporter.cpp
index bc344bf..70dc6fc 100644
--- a/src/libcrashreporter-gui/CrashReporter.cpp
+++ b/src/libcrashreporter-gui/CrashReporter.cpp
@@ -23,6 +23,7 @@
#include "linux-backtrace-generator/backtracegenerator.h"
#include "linux-backtrace-generator/crashedapplication.h"
#include "CrashReporterGzip.h"
+#include <csignal> // POSIX kill
#endif
#include <QIcon>
@@ -73,9 +74,9 @@ CrashReporter::CrashReporter( const QUrl& url, const QStringList& args )
m_minidump_file_path = args.value( 1 );
//hide until "send report" has been clicked
- m_ui->progressBar->setVisible( false );
- m_ui->button->setVisible( false );
- m_ui->progressLabel->setVisible( false );
+ m_ui->progressBox->setVisible( false );
+ m_ui->progressLabel->setVisible( true );
+ m_ui->progressLabel->setText( QString() );
connect( m_ui->sendButton, SIGNAL( clicked() ), SLOT( onSendButton() ) );
adjustSize();
@@ -100,14 +101,18 @@ CrashReporter::CrashReporter( const QUrl& url, const QStringList& args )
app,
this );
connect( m_btg, &BacktraceGenerator::failedToStart,
- this, []
+ this, [ = ]
{
qDebug() << "Error: GDB failed to start.";
+ m_ui->progressLabel->setText( tr( "We cannot gather useful debug information on your system." ) );
+ m_ui->button->setText( tr( "Close" ) );
} );
connect( m_btg, &BacktraceGenerator::someError,
- this, []
+ this, [ = ]
{
qDebug() << "Error: GDB backtrace processing failed.";
+ m_ui->progressLabel->setText( tr( "We cannot gather useful debug information on your system." ) );
+ m_ui->button->setText( tr( "Close" ) );
} );
connect( m_btg, &BacktraceGenerator::done,
this, [ = ]
@@ -131,13 +136,28 @@ CrashReporter::CrashReporter( const QUrl& url, const QStringList& args )
gzip_compress( m_btg->backtrace().toLocal8Bit() ),
"application/x-gzip",
QFileInfo( btFile ).fileName().toUtf8() );
+ kill( app->pid(), SIGKILL );
+
+ m_ui->progressBox->setVisible( false );
+ m_ui->sendBox->setVisible( true );
+ m_ui->progressLabel->setText( tr( "Ready to send debug information (<a "
+ "href=\"%1\">view backtrace</a>)." )
+ .arg( QUrl::fromLocalFile( btPath ).toString( QUrl::FullyEncoded ) ) );
}
else
+ {
qDebug() << "Cannot open file" << btPath << "to save the backtrace.";
-
+ m_ui->progressLabel->setText( tr( "We cannot gather useful debug information on your system." ) );
+ m_ui->button->setText( tr( "Close" ) );
+ }
});
m_btg->start();
+ m_ui->progressBox->setVisible( true );
+ m_ui->sendBox->setVisible( false );
+
+ m_ui->progressLabel->setText( tr( "Gathering debug information..." ) );
+ m_ui->progressBar->setRange( 0, 0 );
}
#endif
}
@@ -161,6 +181,9 @@ void
CrashReporter::setText( const QString& text )
{
m_ui->topLabel->setText(text);
+ m_ui->topLabel->updateGeometry();
+ adjustSize();
+ resize( size() );
}
void
@@ -252,6 +275,7 @@ CrashReporter::onDone()
m_ui->button->setText( tr( "Close" ) );
QString const response = QString::fromUtf8( data );
+ qDebug() << "RESPONSE:" << response;
if ( ( m_reply->error() != QNetworkReply::NoError ) || !response.startsWith( "CrashID=" ) )
{
@@ -278,11 +302,9 @@ CrashReporter::onFail( int error, const QString& errorString )
void
CrashReporter::onSendButton()
{
- m_ui->progressBar->setVisible( true );
- m_ui->button->setVisible( true );
- m_ui->progressLabel->setVisible( true );
- m_ui->sendButton->setEnabled( false );
- m_ui->dontSendButton->setEnabled( false );
+ m_ui->progressBox->setVisible( true );
+ m_ui->sendBox->setVisible( false );
+
m_ui->commentTextEdit->setEnabled( false );
setReportData( "Comments", m_ui->commentTextEdit->toPlainText().toUtf8() );
diff --git a/src/libcrashreporter-gui/CrashReporter.ui b/src/libcrashreporter-gui/CrashReporter.ui
index bc78bcc..67a4563 100644
--- a/src/libcrashreporter-gui/CrashReporter.ui
+++ b/src/libcrashreporter-gui/CrashReporter.ui
@@ -133,40 +133,6 @@
<widget class="QPlainTextEdit" name="commentTextEdit"/>
</item>
<item>
- <layout class="QHBoxLayout" name="hboxLayout1">
- <property name="spacing">
- <number>6</number>
- </property>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="sendButton">
- <property name="text">
- <string>Send this report</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="dontSendButton">
- <property name="text">
- <string>Don't send</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
<layout class="QVBoxLayout" name="vboxLayout1">
<property name="spacing">
<number>0</number>
@@ -186,7 +152,7 @@
<item>
<widget class="QLabel" name="progressLabel">
<property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -194,52 +160,112 @@
<property name="text">
<string/>
</property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
- <layout class="QHBoxLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
- <number>9</number>
- </property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QProgressBar" name="progressBar">
- <property name="value">
- <number>24</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
+ <widget class="QWidget" name="progressBox" native="true">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>9</number>
+ </property>
+ <property name="leftMargin">
+ <number>1</number>
+ </property>
+ <property name="topMargin">
+ <number>1</number>
+ </property>
+ <property name="rightMargin">
+ <number>1</number>
+ </property>
+ <property name="bottomMargin">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>24</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="button">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Abort</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
<item>
- <widget class="QPushButton" name="button">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Abort</string>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
+ <widget class="QWidget" name="sendBox" native="true">
+ <layout class="QHBoxLayout" name="_2">
+ <property name="spacing">
+ <number>9</number>
+ </property>
+ <property name="leftMargin">
+ <number>1</number>
+ </property>
+ <property name="topMargin">
+ <number>1</number>
+ </property>
+ <property name="rightMargin">
+ <number>1</number>
+ </property>
+ <property name="bottomMargin">
+ <number>1</number>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="sendButton">
+ <property name="text">
+ <string>Send this report</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="dontSendButton">
+ <property name="text">
+ <string>Don't send</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
@@ -270,34 +296,34 @@
<resources/>
<connections>
<connection>
- <sender>button</sender>
+ <sender>dontSendButton</sender>
<signal>clicked()</signal>
<receiver>CrashReporter</receiver>
- <slot>accept()</slot>
+ <slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>426</x>
- <y>203</y>
+ <x>380</x>
+ <y>117</y>
</hint>
<hint type="destinationlabel">
- <x>247</x>
- <y>195</y>
+ <x>218</x>
+ <y>122</y>
</hint>
</hints>
</connection>
<connection>
- <sender>dontSendButton</sender>
+ <sender>button</sender>
<signal>clicked()</signal>
<receiver>CrashReporter</receiver>
- <slot>reject()</slot>
+ <slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>380</x>
- <y>117</y>
+ <x>426</x>
+ <y>203</y>
</hint>
<hint type="destinationlabel">
- <x>218</x>
- <y>122</y>
+ <x>247</x>
+ <y>195</y>
</hint>
</hints>
</connection>