From 9d92e2d0d3ae191bcc9431a86dd8c002ea9a1f9b Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 2 Mar 2015 19:52:39 +0100 Subject: [PATCH] GUI changes as per requested by Kaetemi. --HG-- branch : feature-crashreport --- .../misc/crash_report/crash_report_widget.cpp | 74 ++++++++++++++++++- .../misc/crash_report/crash_report_widget.h | 8 ++ .../misc/crash_report/crash_report_widget.ui | 38 +++------- 3 files changed, 91 insertions(+), 29 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 968978f94..889606d99 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.cpp +++ b/code/nel/tools/misc/crash_report/crash_report_widget.cpp @@ -25,18 +25,21 @@ #include #include #include +#include +#include CCrashReportWidget::CCrashReportWidget( QWidget *parent ) : QWidget( parent ) { + m_developerMode = false; + m_forceSend = false; + m_ui.setupUi( this ); m_socket = new CCrashReportSocket( this ); QTimer::singleShot( 1, this, SLOT( onLoad() ) ); - connect( m_ui.sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) ); - connect( m_ui.canceButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) ); connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) ); @@ -70,11 +73,60 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std:: { setWindowTitle( v.c_str() ); } + else + if( k == "dev" ) + { + m_developerMode = true; + } + else + if( k == "sendreport" ) + { + m_forceSend = true; + } + } + + QHBoxLayout *hbl = new QHBoxLayout( this ); + + if( m_developerMode ) + { + QPushButton *alwaysIgnoreButton = new QPushButton( tr( "Always Ignore" ), this ); + QPushButton *ignoreButton = new QPushButton( tr( "Ignore" ), this ); + QPushButton *abortButton = new QPushButton( tr( "Abort" ), this ); + QPushButton *breakButton = new QPushButton( tr( "Break" ), this ); + + hbl->addWidget( alwaysIgnoreButton ); + hbl->addWidget( ignoreButton ); + hbl->addWidget( abortButton ); + hbl->addWidget( breakButton ); + + m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 ); + + connect( alwaysIgnoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onAlwaysIgnoreClicked() ) ); + connect( ignoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onIgnoreClicked() ) ); + connect( abortButton, SIGNAL( clicked( bool ) ), this, SLOT( onAbortClicked() ) ); + connect( breakButton, SIGNAL( clicked( bool ) ), this, SLOT( onBreakClicked() ) ); + } + else + { + QPushButton *sendButton = new QPushButton( tr( "Send report" ), this ); + connect( sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) ); + hbl->addWidget( sendButton ); + + if( !m_forceSend ) + { + QPushButton *cancelButton = new QPushButton( tr( "Don't send report" ), this ); + connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); + hbl->addWidget( cancelButton ); + } + + m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 ); } } void CCrashReportWidget::onLoad() { + return; + if( !checkSettings() ) { close(); @@ -99,7 +151,6 @@ void CCrashReportWidget::onLoad() void CCrashReportWidget::onSendClicked() { - m_ui.sendButton->setEnabled( false ); QApplication::setOverrideCursor( Qt::WaitCursor ); SCrashReportData data; @@ -120,6 +171,23 @@ void CCrashReportWidget::onCBClicked() m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() ); } +void CCrashReportWidget::onAlwaysIgnoreClicked() +{ +} + +void CCrashReportWidget::onIgnoreClicked() +{ +} + +void CCrashReportWidget::onAbortClicked() +{ +} + +void CCrashReportWidget::onBreakClicked() +{ +} + + void CCrashReportWidget::onReportSent() { QApplication::setOverrideCursor( Qt::ArrowCursor ); 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 61b56e340..b0039e0e2 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.h +++ b/code/nel/tools/misc/crash_report/crash_report_widget.h @@ -43,6 +43,11 @@ private Q_SLOTS: void onSendClicked(); void onCancelClicked(); void onCBClicked(); + + void onAlwaysIgnoreClicked(); + void onIgnoreClicked(); + void onAbortClicked(); + void onBreakClicked(); void onReportSent(); void onReportFailed(); @@ -54,6 +59,9 @@ private: Ui::CrashReportWidget m_ui; QString m_fileName; CCrashReportSocket *m_socket; + bool m_developerMode; + bool m_forceSend; + }; #endif diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.ui b/code/nel/tools/misc/crash_report/crash_report_widget.ui index 589810578..ed252eb07 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.ui +++ b/code/nel/tools/misc/crash_report/crash_report_widget.ui @@ -9,8 +9,8 @@ 0 0 - 400 - 407 + 406 + 430 @@ -24,9 +24,6 @@ - - - @@ -34,24 +31,17 @@ - - - - true - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - + + - + Email me if you have further questions, or updates on this issue - + false @@ -61,17 +51,13 @@ - - - - Send + + + + true - - - - - - Cancel + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse