[libcalamaresui] Code style

This commit is contained in:
Adriaan de Groot 2021-12-07 12:44:19 +01:00
parent ca7f288488
commit 2f9edb3e08

View File

@ -17,7 +17,6 @@
namespace Calamares namespace Calamares
{ {
ErrorDialog::ErrorDialog( QWidget* parent ) ErrorDialog::ErrorDialog( QWidget* parent )
: QDialog( parent ) : QDialog( parent )
, ui( new Ui::ErrorDialog ) , ui( new Ui::ErrorDialog )
@ -33,7 +32,6 @@ ErrorDialog::~ErrorDialog()
delete ui; delete ui;
} }
QString QString
ErrorDialog::heading() const ErrorDialog::heading() const
{ {
@ -55,31 +53,32 @@ ErrorDialog::details() const
void void
ErrorDialog::setHeading( const QString& newHeading ) ErrorDialog::setHeading( const QString& newHeading )
{ {
if ( ui->headingLabel->text() == newHeading ) if ( ui->headingLabel->text() != newHeading )
return; {
ui->headingLabel->setText( newHeading ); ui->headingLabel->setText( newHeading );
emit headingChanged(); emit headingChanged();
}
} }
void void
ErrorDialog::setInformativeText( const QString& newInformativeText ) ErrorDialog::setInformativeText( const QString& newInformativeText )
{ {
if ( ui->informativeTextLabel->text() == newInformativeText ) if ( ui->informativeTextLabel->text() != newInformativeText )
return; {
ui->informativeTextLabel->setText( newInformativeText ); ui->informativeTextLabel->setText( newInformativeText );
emit informativeTextChanged(); emit informativeTextChanged();
}
} }
void void
ErrorDialog::setDetails( const QString& newDetails ) ErrorDialog::setDetails( const QString& newDetails )
{ {
if ( ui->detailsBrowser->toPlainText() == newDetails ) if ( ui->detailsBrowser->toPlainText() != newDetails )
return; {
ui->detailsBrowser->setPlainText( newDetails ); ui->detailsBrowser->setPlainText( newDetails );
ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() );
ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() ); emit detailsChanged();
}
emit detailsChanged();
} }
bool bool
@ -91,18 +90,17 @@ ErrorDialog::shouldOfferWebPaste() const
void void
ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste ) ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste )
{ {
if ( m_shouldOfferWebPaste == newShouldOfferWebPaste ) if ( m_shouldOfferWebPaste != newShouldOfferWebPaste )
return; {
m_shouldOfferWebPaste = newShouldOfferWebPaste; m_shouldOfferWebPaste = newShouldOfferWebPaste;
ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste ); ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste );
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No )
: QDialogButtonBox::Close );
fixButtonLabels( ui->buttonBox );
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No ) emit shouldOfferWebPasteChanged();
: QDialogButtonBox::Close ); }
fixButtonLabels( ui->buttonBox );
emit shouldOfferWebPasteChanged();
} }
} // namespace Calamares } // namespace Calamares