From 8cce5dafcd2e96a4059b3c51faad1de130e68593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20G=C3=BCntner?= Date: Tue, 15 May 2012 02:40:26 +0200 Subject: [PATCH] added "Send this report" and "Don't send" buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most users probably do not disable crash reporting. Adding two simple buttons will give them a chance to abort if they do not want to send their crash report. Signed-off-by: Maximilian Güntner --- src/breakpad/CrashReporter/CrashReporter.cpp | 36 ++++++---- src/breakpad/CrashReporter/CrashReporter.h | 2 + src/breakpad/CrashReporter/CrashReporter.ui | 72 ++++++++++++++------ 3 files changed, 79 insertions(+), 31 deletions(-) diff --git a/src/breakpad/CrashReporter/CrashReporter.cpp b/src/breakpad/CrashReporter/CrashReporter.cpp index ede0aa2b5..42b6a4927 100644 --- a/src/breakpad/CrashReporter/CrashReporter.cpp +++ b/src/breakpad/CrashReporter/CrashReporter.cpp @@ -36,7 +36,6 @@ CrashReporter::CrashReporter( const QStringList& args ) setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); ui.setupUi( this ); - ui.logoLabel->setPixmap( QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ).scaled( QSize( 55, 55 ), Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); ui.progressBar->setRange( 0, 100 ); ui.progressBar->setValue( 0 ); @@ -51,20 +50,11 @@ CrashReporter::CrashReporter( const QStringList& args ) ui.progressLabel->setIndent( 3 ); #else ui.vboxLayout->setSpacing( 16 ); + ui.hboxLayout1->setSpacing( 16 ); ui.progressBar->setTextVisible( false ); ui.progressLabel->setIndent( 1 ); ui.bottomLabel->setDisabled( true ); ui.bottomLabel->setIndent( 1 ); - - // adjust the spacer since we adjusted the spacing above - for ( int x = 0; x < ui.vboxLayout->count(); ++x ) - { - if ( QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem() ) - { - spacer->changeSize( 6, 2, QSizePolicy::Minimum, QSizePolicy::Fixed ); - break; - } - } #endif //Q_WS_MAC m_http = new QHttp( "oops.tomahawk-player.org", 80, this ); @@ -78,7 +68,18 @@ CrashReporter::CrashReporter( const QStringList& args ) setFixedSize( sizeHint() ); - QTimer::singleShot( 0, this, SLOT( send() ) ); + //hide until "send report" has been clicked + ui.progressBar->setVisible( false ); + ui.button->setVisible( false ); + ui.progressLabel->setVisible( false ); + connect( ui.sendButton, SIGNAL( clicked() ), SLOT( onSendButton() )); + + +} + +CrashReporter::~CrashReporter() +{ + delete m_http; } @@ -184,3 +185,14 @@ CrashReporter::onFail( int error, const QString& errorString ) ui.progressLabel->setText( tr( "Failed to send crash info." ) ); qDebug() << "Error:" << error << errorString; } + +void +CrashReporter::onSendButton() +{ + ui.progressBar->setVisible( true ); + ui.button->setVisible( true ); + ui.progressLabel->setVisible( true ); + ui.sendButton->setEnabled( false ); + ui.dontSendButton->setEnabled( false ); + QTimer::singleShot( 0, this, SLOT( send() ) ); +} diff --git a/src/breakpad/CrashReporter/CrashReporter.h b/src/breakpad/CrashReporter/CrashReporter.h index bb526a1a6..e6ee32c2f 100644 --- a/src/breakpad/CrashReporter/CrashReporter.h +++ b/src/breakpad/CrashReporter/CrashReporter.h @@ -31,6 +31,7 @@ class CrashReporter : public QDialog public: CrashReporter( const QStringList& argv ); + ~CrashReporter( ); private: Ui::CrashReporter ui; @@ -47,6 +48,7 @@ private slots: void onDone(); void onProgress( int done, int total ); void onFail( int error, const QString& errorString ); + void onSendButton(); }; #endif // CRASHREPORTER_H diff --git a/src/breakpad/CrashReporter/CrashReporter.ui b/src/breakpad/CrashReporter/CrashReporter.ui index 91e98b16b..10d1d406f 100644 --- a/src/breakpad/CrashReporter/CrashReporter.ui +++ b/src/breakpad/CrashReporter/CrashReporter.ui @@ -10,7 +10,7 @@ 0 0 438 - 196 + 246 @@ -33,7 +33,7 @@ 9 - + 12 @@ -77,7 +77,7 @@ - <p><b>Sorry!</b>&nbsp;Tomahawk crashed. Information about the crash is now being sent to Tomahawk HQ so that we can fix the bug.</p> + <html><head/><body><p><span style=" font-weight:600;">Sorry!</span> Tomahawk crashed. Please tell us about it! Tomahawk has created an error report for you that can help improve the stability in the future. You can now send the this report directly to the Tomahawk developers.</p></body></html> Qt::RichText @@ -106,23 +106,41 @@ - - - Qt::Vertical + + + -1 - - QSizePolicy::Fixed - - - - 20 - 16 - - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Send this report + + + + + + + Don't send + + + + - + 0 @@ -210,8 +228,8 @@ accept() - 424 - 154 + 426 + 203 247 @@ -219,5 +237,21 @@ + + dontSendButton + clicked() + CrashReporter + reject() + + + 380 + 117 + + + 218 + 122 + + +