GUI changes as per requested by Kaetemi.

--HG--
branch : feature-crashreport
hg/feature/cef3
dfighter1985 10 years ago
parent 8bf372056f
commit 9d92e2d0d3

@ -25,18 +25,21 @@
#include <QFile> #include <QFile>
#include <QMessageBox> #include <QMessageBox>
#include <QFile> #include <QFile>
#include <QPushButton>
#include <QHBoxLayout>
CCrashReportWidget::CCrashReportWidget( QWidget *parent ) : CCrashReportWidget::CCrashReportWidget( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
m_developerMode = false;
m_forceSend = false;
m_ui.setupUi( this ); m_ui.setupUi( this );
m_socket = new CCrashReportSocket( this ); m_socket = new CCrashReportSocket( this );
QTimer::singleShot( 1, this, SLOT( onLoad() ) ); 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_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) ); 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() ); 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() void CCrashReportWidget::onLoad()
{ {
return;
if( !checkSettings() ) if( !checkSettings() )
{ {
close(); close();
@ -99,7 +151,6 @@ void CCrashReportWidget::onLoad()
void CCrashReportWidget::onSendClicked() void CCrashReportWidget::onSendClicked()
{ {
m_ui.sendButton->setEnabled( false );
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
SCrashReportData data; SCrashReportData data;
@ -120,6 +171,23 @@ void CCrashReportWidget::onCBClicked()
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() ); m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
} }
void CCrashReportWidget::onAlwaysIgnoreClicked()
{
}
void CCrashReportWidget::onIgnoreClicked()
{
}
void CCrashReportWidget::onAbortClicked()
{
}
void CCrashReportWidget::onBreakClicked()
{
}
void CCrashReportWidget::onReportSent() void CCrashReportWidget::onReportSent()
{ {
QApplication::setOverrideCursor( Qt::ArrowCursor ); QApplication::setOverrideCursor( Qt::ArrowCursor );

@ -44,6 +44,11 @@ private Q_SLOTS:
void onCancelClicked(); void onCancelClicked();
void onCBClicked(); void onCBClicked();
void onAlwaysIgnoreClicked();
void onIgnoreClicked();
void onAbortClicked();
void onBreakClicked();
void onReportSent(); void onReportSent();
void onReportFailed(); void onReportFailed();
@ -54,6 +59,9 @@ private:
Ui::CrashReportWidget m_ui; Ui::CrashReportWidget m_ui;
QString m_fileName; QString m_fileName;
CCrashReportSocket *m_socket; CCrashReportSocket *m_socket;
bool m_developerMode;
bool m_forceSend;
}; };
#endif #endif

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

Loading…
Cancel
Save