GUI changes as per requested by Kaetemi.

--HG--
branch : feature-crashreport
This commit is contained in:
dfighter1985 2015-03-02 19:52:39 +01:00
parent 8bf372056f
commit 9d92e2d0d3
3 changed files with 91 additions and 29 deletions

View file

@ -25,18 +25,21 @@
#include <QFile>
#include <QMessageBox>
#include <QFile>
#include <QPushButton>
#include <QHBoxLayout>
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 );

View file

@ -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

View file

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>407</height>
<width>406</width>
<height>430</height>
</rect>
</property>
<property name="windowTitle">
@ -24,9 +24,6 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QPlainTextEdit" name="descriptionEdit"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
@ -34,24 +31,17 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPlainTextEdit" name="reportEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
<item row="1" column="0" colspan="3">
<widget class="QPlainTextEdit" name="descriptionEdit"/>
</item>
<item row="4" column="0" colspan="2">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="emailCB">
<property name="text">
<string>Email me if you have further questions, or updates on this issue</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="5" column="0" colspan="3">
<widget class="QLineEdit" name="emailEdit">
<property name="enabled">
<bool>false</bool>
@ -61,17 +51,13 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="sendButton">
<property name="text">
<string>Send</string>
<item row="3" column="0" colspan="3">
<widget class="QPlainTextEdit" name="reportEdit">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="canceButton">
<property name="text">
<string>Cancel</string>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>