Some more GUI changes.
This commit is contained in:
parent
50be8e3ba2
commit
a3b7496baf
3 changed files with 66 additions and 40 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
CCrashReportWidget::CCrashReportWidget( QWidget *parent ) :
|
CCrashReportWidget::CCrashReportWidget( QWidget *parent ) :
|
||||||
QWidget( parent )
|
QWidget( parent )
|
||||||
|
@ -85,10 +86,38 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_fileName.isEmpty() )
|
||||||
|
{
|
||||||
|
m_ui.reportLabel->hide();
|
||||||
|
m_ui.reportEdit->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// When no -host specified no custom entry and email fields
|
||||||
|
if( m_socket->url().isEmpty() )
|
||||||
|
{
|
||||||
|
m_ui.descriptionEdit->hide();
|
||||||
|
m_ui.emailCB->hide();
|
||||||
|
m_ui.emailEdit->hide();
|
||||||
|
m_ui.descrLabel->hide();
|
||||||
|
}
|
||||||
|
|
||||||
QHBoxLayout *hbl = new QHBoxLayout( this );
|
QHBoxLayout *hbl = new QHBoxLayout( this );
|
||||||
|
|
||||||
if( m_developerMode )
|
if( m_developerMode )
|
||||||
{
|
{
|
||||||
|
if( !m_socket->url().isEmpty() )
|
||||||
|
{
|
||||||
|
m_ui.emailCB->setEnabled( false );
|
||||||
|
|
||||||
|
QCheckBox *cb = new QCheckBox( tr( "Send report" ), this );
|
||||||
|
m_ui.gridLayout->addWidget( cb, 4, 0, 1, 1 );
|
||||||
|
|
||||||
|
m_ui.gridLayout->addWidget( m_ui.emailCB, 5, 0, 1, 1 );
|
||||||
|
m_ui.gridLayout->addWidget( m_ui.emailEdit, 6, 0, 1, 1 );
|
||||||
|
|
||||||
|
connect( cb, SIGNAL( stateChanged( int ) ), this, SLOT( onSendCBClicked() ) );
|
||||||
|
}
|
||||||
|
|
||||||
QPushButton *alwaysIgnoreButton = new QPushButton( tr( "Always Ignore" ), this );
|
QPushButton *alwaysIgnoreButton = new QPushButton( tr( "Always Ignore" ), this );
|
||||||
QPushButton *ignoreButton = new QPushButton( tr( "Ignore" ), this );
|
QPushButton *ignoreButton = new QPushButton( tr( "Ignore" ), this );
|
||||||
QPushButton *abortButton = new QPushButton( tr( "Abort" ), this );
|
QPushButton *abortButton = new QPushButton( tr( "Abort" ), this );
|
||||||
|
@ -99,7 +128,7 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
||||||
hbl->addWidget( abortButton );
|
hbl->addWidget( abortButton );
|
||||||
hbl->addWidget( breakButton );
|
hbl->addWidget( breakButton );
|
||||||
|
|
||||||
m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 );
|
m_ui.gridLayout->addLayout( hbl, 7, 0, 1, 3 );
|
||||||
|
|
||||||
connect( alwaysIgnoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onAlwaysIgnoreClicked() ) );
|
connect( alwaysIgnoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onAlwaysIgnoreClicked() ) );
|
||||||
connect( ignoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onIgnoreClicked() ) );
|
connect( ignoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onIgnoreClicked() ) );
|
||||||
|
@ -108,15 +137,26 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QPushButton *sendButton = new QPushButton( tr( "Send report" ), this );
|
// If -host is specified, offer the send function
|
||||||
connect( sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) );
|
if( !m_socket->url().isEmpty() )
|
||||||
hbl->addWidget( sendButton );
|
|
||||||
|
|
||||||
if( !m_forceSend )
|
|
||||||
{
|
{
|
||||||
QPushButton *cancelButton = new QPushButton( tr( "Don't send report" ), this );
|
QPushButton *sendButton = new QPushButton( tr( "Send report" ), this );
|
||||||
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
connect( sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) );
|
||||||
hbl->addWidget( cancelButton );
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Otherwise only offer exit
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QPushButton *exitButton = new QPushButton( tr( "Exit" ), this );
|
||||||
|
connect( exitButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
||||||
|
hbl->addWidget( exitButton );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 );
|
m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 );
|
||||||
|
@ -125,13 +165,8 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
||||||
|
|
||||||
void CCrashReportWidget::onLoad()
|
void CCrashReportWidget::onLoad()
|
||||||
{
|
{
|
||||||
return;
|
if( m_fileName.isEmpty() )
|
||||||
|
|
||||||
if( !checkSettings() )
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QFile f( m_fileName );
|
QFile f( m_fileName );
|
||||||
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
||||||
|
@ -171,6 +206,18 @@ void CCrashReportWidget::onCBClicked()
|
||||||
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
|
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCrashReportWidget::onSendCBClicked()
|
||||||
|
{
|
||||||
|
bool b = m_ui.emailCB->isEnabled();
|
||||||
|
|
||||||
|
if( b )
|
||||||
|
{
|
||||||
|
m_ui.emailCB->setChecked( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui.emailCB->setEnabled( !b );
|
||||||
|
}
|
||||||
|
|
||||||
void CCrashReportWidget::onAlwaysIgnoreClicked()
|
void CCrashReportWidget::onAlwaysIgnoreClicked()
|
||||||
{
|
{
|
||||||
m_returnValue = ERET_ALWAYS_IGNORE;
|
m_returnValue = ERET_ALWAYS_IGNORE;
|
||||||
|
@ -218,27 +265,6 @@ void CCrashReportWidget::onReportFailed()
|
||||||
removeAndQuit();
|
removeAndQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCrashReportWidget::checkSettings()
|
|
||||||
{
|
|
||||||
if( m_fileName.isEmpty() )
|
|
||||||
{
|
|
||||||
QMessageBox::information( this,
|
|
||||||
tr( "No log file specified." ),
|
|
||||||
tr( "No log file specified. Exiting..." ) );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_socket->url().isEmpty() )
|
|
||||||
{
|
|
||||||
QMessageBox::information( this,
|
|
||||||
tr( "No host specified." ),
|
|
||||||
tr( "No host specified. Exiting..." ) );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCrashReportWidget::removeAndQuit()
|
void CCrashReportWidget::removeAndQuit()
|
||||||
{
|
{
|
||||||
QFile::remove( m_fileName );
|
QFile::remove( m_fileName );
|
||||||
|
|
|
@ -49,12 +49,13 @@ public:
|
||||||
void setup( const std::vector< std::pair< std::string, std::string > > ¶ms );
|
void setup( const std::vector< std::pair< std::string, std::string > > ¶ms );
|
||||||
|
|
||||||
EReturnValue getReturnValue() const{ return m_returnValue; }
|
EReturnValue getReturnValue() const{ return m_returnValue; }
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onLoad();
|
void onLoad();
|
||||||
void onSendClicked();
|
void onSendClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
void onCBClicked();
|
void onCBClicked();
|
||||||
|
void onSendCBClicked();
|
||||||
|
|
||||||
void onAlwaysIgnoreClicked();
|
void onAlwaysIgnoreClicked();
|
||||||
void onIgnoreClicked();
|
void onIgnoreClicked();
|
||||||
|
@ -65,7 +66,6 @@ private Q_SLOTS:
|
||||||
void onReportFailed();
|
void onReportFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkSettings();
|
|
||||||
void removeAndQuit();
|
void removeAndQuit();
|
||||||
|
|
||||||
Ui::CrashReportWidget m_ui;
|
Ui::CrashReportWidget m_ui;
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="descrLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>What were you doing when the crash occured?</string>
|
<string>What were you doing when the crash occured?</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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="reportLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Contents of the report ( automatically generated )</string>
|
<string>Contents of the report ( automatically generated )</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in a new issue