From 72659dc6e193d2098d9c9aaacacb0448276191da Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jul 2017 11:04:23 -0400 Subject: [PATCH 1/2] FinishedPage: don't reboot on failure If installation fails, and you end up on the last page, suppress the reboot-now checkbox. FIXES #605 --- src/modules/finished/FinishedPage.cpp | 13 +++++++++++++ src/modules/finished/FinishedPage.h | 3 +++ src/modules/finished/FinishedViewStep.cpp | 12 +++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 609856975..8ae459540 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -39,6 +39,7 @@ FinishedPage::FinishedPage( QWidget* parent ) , ui( new Ui::FinishedPage ) , m_restartSetUp( false ) { + cDebug() << "FinishedPage()"; ui->setupUi( this ); ui->mainText->setAlignment( Qt::AlignCenter ); @@ -83,6 +84,7 @@ FinishedPage::setRestartNowCommand( const QString& command ) void FinishedPage::setUpRestart() { + cDebug() << "FinishedPage::setUpRestart()"; if ( !m_restartSetUp ) { connect( qApp, &QApplication::aboutToQuit, @@ -102,3 +104,14 @@ FinishedPage::focusInEvent( QFocusEvent* e ) e->accept(); } +void +FinishedPage::onInstallationFailed( const QString& message, const QString& details ) +{ + ui->mainText->setText( tr( "

Installation Failed


" + "%1 has not been installed on your computer.
" + "The error message was: %2." ) + .arg(Calamares::Branding::instance()-> + string( Calamares::Branding::VersionedName ) ) + .arg( details ) ); + setRestartNowEnabled( false ); +} diff --git a/src/modules/finished/FinishedPage.h b/src/modules/finished/FinishedPage.h index 31930a6f1..1129c69ce 100644 --- a/src/modules/finished/FinishedPage.h +++ b/src/modules/finished/FinishedPage.h @@ -38,6 +38,9 @@ public: void setUpRestart(); +public slots: + void onInstallationFailed( const QString& message, const QString& details ); + protected: void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 1f5217f22..1c3688c59 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -17,8 +17,10 @@ */ #include "FinishedViewStep.h" - #include "FinishedPage.h" +#include "JobQueue.h" + +#include "utils/Logger.h" #include @@ -26,6 +28,11 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_widget( new FinishedPage() ) { + cDebug() << "FinishedViewStep()"; + + connect( Calamares::JobQueue::instance(), &Calamares::JobQueue::failed, + m_widget, &FinishedPage::onInstallationFailed ); + emit nextStatusChanged( true ); } @@ -47,6 +54,7 @@ FinishedViewStep::prettyName() const QWidget* FinishedViewStep::widget() { + cDebug() << "FinishedViewStep::widget()"; return m_widget; } @@ -94,6 +102,7 @@ FinishedViewStep::isAtEnd() const void FinishedViewStep::onActivate() { + cDebug() << "FinishedViewStep::onActivate()"; m_widget->setUpRestart(); } @@ -101,6 +110,7 @@ FinishedViewStep::onActivate() QList< Calamares::job_ptr > FinishedViewStep::jobs() const { + cDebug() << "FinishedViewStep::jobs"; return QList< Calamares::job_ptr >(); } From 09a79886227a1c47488944eb6c6db9dcfa8d889a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jul 2017 11:36:36 -0400 Subject: [PATCH 2/2] FinishedPage: add copyright, reduce warnings --- src/modules/finished/FinishedPage.cpp | 2 ++ src/modules/finished/FinishedPage.h | 1 + src/modules/finished/FinishedViewStep.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 8ae459540..87862e90c 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,6 +108,7 @@ FinishedPage::focusInEvent( QFocusEvent* e ) void FinishedPage::onInstallationFailed( const QString& message, const QString& details ) { + Q_UNUSED( message ); ui->mainText->setText( tr( "

Installation Failed


" "%1 has not been installed on your computer.
" "The error message was: %2." ) diff --git a/src/modules/finished/FinishedPage.h b/src/modules/finished/FinishedPage.h index 1129c69ce..ba3e75667 100644 --- a/src/modules/finished/FinishedPage.h +++ b/src/modules/finished/FinishedPage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 1c3688c59..3c9bc042c 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by