Some more GUI changes.
This commit is contained in:
parent
da6391ec1e
commit
a579fbc924
3 changed files with 66 additions and 40 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <QFile>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QCheckBox>
|
||||
|
||||
CCrashReportWidget::CCrashReportWidget( 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 );
|
||||
|
||||
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 *ignoreButton = new QPushButton( tr( "Ignore" ), 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( 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( ignoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onIgnoreClicked() ) );
|
||||
|
@ -107,6 +136,9 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
|||
connect( breakButton, SIGNAL( clicked( bool ) ), this, SLOT( onBreakClicked() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If -host is specified, offer the send function
|
||||
if( !m_socket->url().isEmpty() )
|
||||
{
|
||||
QPushButton *sendButton = new QPushButton( tr( "Send report" ), this );
|
||||
connect( sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) );
|
||||
|
@ -118,6 +150,14 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
|||
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 );
|
||||
}
|
||||
|
@ -125,14 +165,9 @@ void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::
|
|||
|
||||
void CCrashReportWidget::onLoad()
|
||||
{
|
||||
if( m_fileName.isEmpty() )
|
||||
return;
|
||||
|
||||
if( !checkSettings() )
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
QFile f( m_fileName );
|
||||
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
||||
if( !b )
|
||||
|
@ -171,6 +206,18 @@ void CCrashReportWidget::onCBClicked()
|
|||
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()
|
||||
{
|
||||
m_returnValue = ERET_ALWAYS_IGNORE;
|
||||
|
@ -218,27 +265,6 @@ void CCrashReportWidget::onReportFailed()
|
|||
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()
|
||||
{
|
||||
QFile::remove( m_fileName );
|
||||
|
|
|
@ -55,6 +55,7 @@ private Q_SLOTS:
|
|||
void onSendClicked();
|
||||
void onCancelClicked();
|
||||
void onCBClicked();
|
||||
void onSendCBClicked();
|
||||
|
||||
void onAlwaysIgnoreClicked();
|
||||
void onIgnoreClicked();
|
||||
|
@ -65,7 +66,6 @@ private Q_SLOTS:
|
|||
void onReportFailed();
|
||||
|
||||
private:
|
||||
bool checkSettings();
|
||||
void removeAndQuit();
|
||||
|
||||
Ui::CrashReportWidget m_ui;
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="descrLabel">
|
||||
<property name="text">
|
||||
<string>What were you doing when the crash occured?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="reportLabel">
|
||||
<property name="text">
|
||||
<string>Contents of the report ( automatically generated )</string>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue