[libcalamaresui] Run clang-format

This commit is contained in:
Artem Grinev 2021-12-06 02:37:11 +04:00
parent 2dd77ee828
commit 2f2a418cc4
3 changed files with 91 additions and 78 deletions

View File

@ -17,6 +17,7 @@
#include "JobQueue.h"
#include "Settings.h"
#include "utils/ErrorDialog/ErrorDialog.h"
#include "utils/Logger.h"
#include "utils/Paste.h"
#include "utils/Retranslator.h"
@ -25,15 +26,14 @@
#include "viewpages/ExecutionViewStep.h"
#include "viewpages/ViewStep.h"
#include "widgets/TranslationFix.h"
#include "utils/ErrorDialog/ErrorDialog.h"
#include <QApplication>
#include <QBoxLayout>
#include <QClipboard>
#include <QDialogButtonBox>
#include <QFile>
#include <QMessageBox>
#include <QMetaObject>
#include <QDialogButtonBox>
#define UPDATE_BUTTON_PROPERTY( name, value ) \
do \
@ -167,12 +167,15 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
errorDialog->setWindowTitle( tr( "Error" ) );
errorDialog->setHeading( "<strong>" + heading + "</strong>" );
errorDialog->setInformativeText( message );
errorDialog->setShouldOfferWebPaste(shouldOfferWebPaste);
errorDialog->setDetails(details);
errorDialog->setShouldOfferWebPaste( shouldOfferWebPaste );
errorDialog->setDetails( details );
errorDialog->show();
cDebug() << "Calamares will quit when the dialog closes.";
connect( errorDialog, &QDialog::finished, [errorDialog]( int result ) {
connect( errorDialog,
&QDialog::finished,
[ errorDialog ]( int result )
{
if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() )
{
CalamaresUtils::Paste::doLogUploadUI( errorDialog );

View File

@ -1,19 +1,20 @@
#include "ErrorDialog.h"
#include "ui_ErrorDialog.h"
#include <QIcon>
#include <QDialogButtonBox>
#include "widgets/TranslationFix.h"
#include <QDialogButtonBox>
#include <QIcon>
namespace Calamares {
ErrorDialog::ErrorDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ErrorDialog)
namespace Calamares
{
ui->setupUi(this);
ui->iconLabel->setPixmap(QIcon::fromTheme("dialog-error").pixmap(64));
ErrorDialog::ErrorDialog( QWidget* parent )
: QDialog( parent )
, ui( new Ui::ErrorDialog )
{
ui->setupUi( this );
ui->iconLabel->setPixmap( QIcon::fromTheme( "dialog-error" ).pixmap( 64 ) );
ui->detailsWidget->hide();
ui->offerWebPasteLabel->hide();
}
@ -24,66 +25,73 @@ ErrorDialog::~ErrorDialog()
}
QString ErrorDialog::heading() const
QString
ErrorDialog::heading() const
{
return ui->headingLabel->text();
}
QString ErrorDialog::informativeText() const
QString
ErrorDialog::informativeText() const
{
return ui->informativeTextLabel->text();
}
QString ErrorDialog::details() const
QString
ErrorDialog::details() const
{
return ui->detailsBrowser->toPlainText();
}
void ErrorDialog::setHeading(const QString &newHeading)
void
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();
}
void ErrorDialog::setInformativeText(const QString &newInformativeText)
void
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();
}
void ErrorDialog::setDetails(const QString &newDetails)
void
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();
}
bool ErrorDialog::shouldOfferWebPaste() const
bool
ErrorDialog::shouldOfferWebPaste() const
{
return m_shouldOfferWebPaste;
}
void ErrorDialog::setShouldOfferWebPaste(bool newShouldOfferWebPaste)
void
ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste )
{
if (m_shouldOfferWebPaste == newShouldOfferWebPaste)
if ( m_shouldOfferWebPaste == newShouldOfferWebPaste )
return;
m_shouldOfferWebPaste = newShouldOfferWebPaste;
ui->offerWebPasteLabel->setVisible(m_shouldOfferWebPaste);
ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste );
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste
? (QDialogButtonBox::Yes | QDialogButtonBox::No)
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No )
: QDialogButtonBox::Close );
fixButtonLabels(ui->buttonBox);
fixButtonLabels( ui->buttonBox );
emit shouldOfferWebPasteChanged();
}

View File

@ -4,7 +4,8 @@
#include <QDialog>
namespace Ui {
namespace Ui
{
class ErrorDialog;
}
class QDialogButtonBox;
@ -14,13 +15,14 @@ class ErrorDialog : public QDialog
{
Q_OBJECT
Q_PROPERTY(QString heading READ heading WRITE setHeading NOTIFY headingChanged)
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged)
Q_PROPERTY(QString details READ details WRITE setDetails NOTIFY detailsChanged)
Q_PROPERTY(bool shouldOfferWebPaste READ shouldOfferWebPaste WRITE setShouldOfferWebPaste NOTIFY shouldOfferWebPasteChanged)
Q_PROPERTY( QString heading READ heading WRITE setHeading NOTIFY headingChanged )
Q_PROPERTY( QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged )
Q_PROPERTY( QString details READ details WRITE setDetails NOTIFY detailsChanged )
Q_PROPERTY( bool shouldOfferWebPaste READ shouldOfferWebPaste WRITE setShouldOfferWebPaste NOTIFY
shouldOfferWebPasteChanged )
public:
explicit ErrorDialog(QWidget *parent = nullptr);
explicit ErrorDialog( QWidget* parent = nullptr );
~ErrorDialog();
QString heading() const;
@ -29,14 +31,14 @@ public:
QString details() const;
void setHeading(const QString &newHeading);
void setHeading( const QString& newHeading );
void setInformativeText(const QString &newInformativeText);
void setInformativeText( const QString& newInformativeText );
void setDetails(const QString &newDetails);
void setDetails( const QString& newDetails );
bool shouldOfferWebPaste() const;
void setShouldOfferWebPaste(bool newShouldOfferWebPaste);
void setShouldOfferWebPaste( bool newShouldOfferWebPaste );
signals:
void headingChanged();
@ -48,7 +50,7 @@ signals:
void shouldOfferWebPasteChanged();
private:
Ui::ErrorDialog *ui;
Ui::ErrorDialog* ui;
bool m_shouldOfferWebPaste = false;
};