[libcalamaresui] Run clang-format
This commit is contained in:
parent
2dd77ee828
commit
2f2a418cc4
@ -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 \
|
||||
@ -161,24 +161,27 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
|
||||
cDebug() << Logger::SubEntry << "- details:" << Logger::NoQuote << details;
|
||||
|
||||
QString heading
|
||||
= Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" );
|
||||
= Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" );
|
||||
|
||||
ErrorDialog* errorDialog = new ErrorDialog();
|
||||
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 ) {
|
||||
if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() )
|
||||
{
|
||||
CalamaresUtils::Paste::doLogUploadUI( errorDialog );
|
||||
}
|
||||
QApplication::quit();
|
||||
} );
|
||||
connect( errorDialog,
|
||||
&QDialog::finished,
|
||||
[ errorDialog ]( int result )
|
||||
{
|
||||
if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() )
|
||||
{
|
||||
CalamaresUtils::Paste::doLogUploadUI( errorDialog );
|
||||
}
|
||||
QApplication::quit();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,68 +25,75 @@ 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)
|
||||
return;
|
||||
ui->detailsBrowser->setPlainText(newDetails);
|
||||
|
||||
ui->detailsWidget->setVisible(!ui->detailsBrowser->toPlainText().trimmed().isEmpty());
|
||||
|
||||
if ( ui->detailsBrowser->toPlainText() == newDetails )
|
||||
return;
|
||||
ui->detailsBrowser->setPlainText( newDetails );
|
||||
|
||||
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->buttonBox->setStandardButtons( m_shouldOfferWebPaste
|
||||
? (QDialogButtonBox::Yes | QDialogButtonBox::No)
|
||||
: QDialogButtonBox::Close );
|
||||
|
||||
fixButtonLabels(ui->buttonBox);
|
||||
|
||||
|
||||
ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste );
|
||||
|
||||
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No )
|
||||
: QDialogButtonBox::Close );
|
||||
|
||||
fixButtonLabels( ui->buttonBox );
|
||||
|
||||
emit shouldOfferWebPasteChanged();
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
||||
} // namespace Calamares
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class ErrorDialog;
|
||||
}
|
||||
class QDialogButtonBox;
|
||||
@ -13,45 +14,46 @@ namespace Calamares
|
||||
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;
|
||||
|
||||
|
||||
QString informativeText() const;
|
||||
|
||||
|
||||
QString details() const;
|
||||
|
||||
void setHeading(const QString &newHeading);
|
||||
|
||||
void setInformativeText(const QString &newInformativeText);
|
||||
|
||||
void setDetails(const QString &newDetails);
|
||||
|
||||
|
||||
void setHeading( const QString& newHeading );
|
||||
|
||||
void setInformativeText( const QString& newInformativeText );
|
||||
|
||||
void setDetails( const QString& newDetails );
|
||||
|
||||
bool shouldOfferWebPaste() const;
|
||||
void setShouldOfferWebPaste(bool newShouldOfferWebPaste);
|
||||
|
||||
void setShouldOfferWebPaste( bool newShouldOfferWebPaste );
|
||||
|
||||
signals:
|
||||
void headingChanged();
|
||||
|
||||
|
||||
void informativeTextChanged();
|
||||
|
||||
|
||||
void detailsChanged();
|
||||
|
||||
|
||||
void shouldOfferWebPasteChanged();
|
||||
|
||||
|
||||
private:
|
||||
Ui::ErrorDialog *ui;
|
||||
Ui::ErrorDialog* ui;
|
||||
bool m_shouldOfferWebPaste = false;
|
||||
};
|
||||
|
||||
}; // namespace Calamares
|
||||
}; // namespace Calamares
|
||||
|
||||
#endif // ERRORDIALOG_H
|
||||
#endif // ERRORDIALOG_H
|
||||
|
Loading…
Reference in New Issue
Block a user