From a761910a787b7e0de7901375162d5def8beef9dd Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 3 Mar 2015 02:30:39 +0100 Subject: [PATCH] Send report in dev mode if the CB is checked. --- .../misc/crash_report/crash_report_widget.cpp | 40 +++++++++++++------ .../misc/crash_report/crash_report_widget.h | 1 + 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.cpp b/code/nel/tools/misc/crash_report/crash_report_widget.cpp index 350a35ff8..e176bb2be 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.cpp +++ b/code/nel/tools/misc/crash_report/crash_report_widget.cpp @@ -34,6 +34,7 @@ QWidget( parent ) { m_developerMode = false; m_forceSend = false; + m_devSendReport = false; m_ui.setupUi( this ); @@ -63,6 +64,8 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std:: if( k == "log" ) { m_fileName = v.c_str(); + if( !QFile::exists( m_fileName ) ) + m_fileName.clear(); } else if( k == "host" ) @@ -92,8 +95,8 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std:: m_ui.reportEdit->hide(); } - // When no -host specified no custom entry and email fields - if( m_socket->url().isEmpty() ) + + if( m_socket->url().isEmpty() || m_fileName.isEmpty() ) { m_ui.descriptionEdit->hide(); m_ui.emailCB->hide(); @@ -105,7 +108,7 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std:: if( m_developerMode ) { - if( !m_socket->url().isEmpty() ) + if( !m_socket->url().isEmpty() && !m_fileName.isEmpty() ) { m_ui.emailCB->setEnabled( false ); @@ -172,10 +175,7 @@ void CCrashReportWidget::onLoad() bool b = f.open( QFile::ReadOnly | QFile::Text ); if( !b ) { - QMessageBox::information( this, - tr( "No log file found" ), - tr( "There was no log file found, therefore nothing to report. Exiting..." ) ); - close(); + m_fileName.clear(); return; } @@ -186,6 +186,18 @@ void CCrashReportWidget::onLoad() void CCrashReportWidget::onSendClicked() { + if( m_developerMode && !m_devSendReport ) + { + close(); + return; + } + + if( m_socket->url().isEmpty() || m_fileName.isEmpty() ) + { + close(); + return; + } + QApplication::setOverrideCursor( Qt::WaitCursor ); SCrashReportData data; @@ -216,30 +228,32 @@ void CCrashReportWidget::onSendCBClicked() } m_ui.emailCB->setEnabled( !b ); + + m_devSendReport = !m_devSendReport; } void CCrashReportWidget::onAlwaysIgnoreClicked() { m_returnValue = ERET_ALWAYS_IGNORE; - close(); + onSendClicked(); } void CCrashReportWidget::onIgnoreClicked() { m_returnValue = ERET_IGNORE; - close(); + onSendClicked(); } void CCrashReportWidget::onAbortClicked() { m_returnValue = ERET_ABORT; - close(); + onSendClicked(); } void CCrashReportWidget::onBreakClicked() { m_returnValue = ERET_BREAK; - close(); + onSendClicked(); } @@ -267,7 +281,9 @@ void CCrashReportWidget::onReportFailed() void CCrashReportWidget::removeAndQuit() { - QFile::remove( m_fileName ); + if( !m_fileName.isEmpty() ) + QFile::remove( m_fileName ); + close(); } diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.h b/code/nel/tools/misc/crash_report/crash_report_widget.h index a0468a565..f40e40854 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.h +++ b/code/nel/tools/misc/crash_report/crash_report_widget.h @@ -73,6 +73,7 @@ private: CCrashReportSocket *m_socket; bool m_developerMode; bool m_forceSend; + bool m_devSendReport; EReturnValue m_returnValue; };