2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2015-01-29 22:45:39 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2019 Collabora Ltd <arnaud.ferraris@collabora.com>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2015-01-29 22:45:39 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2015-01-29 22:45:39 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "FinishedPage.h"
|
2021-02-23 15:42:14 +01:00
|
|
|
|
|
|
|
#include "Config.h"
|
2021-02-03 17:14:49 +01:00
|
|
|
#include "ui_FinishedPage.h"
|
2015-01-29 22:45:39 +01:00
|
|
|
|
2021-02-03 17:14:49 +01:00
|
|
|
#include "Branding.h"
|
2021-02-03 17:16:22 +01:00
|
|
|
#include "Settings.h"
|
2015-01-29 22:45:39 +01:00
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
|
|
|
#include <QFocusEvent>
|
|
|
|
|
|
|
|
|
2021-02-23 15:03:16 +01:00
|
|
|
FinishedPage::FinishedPage( Config* config, QWidget* parent )
|
2015-01-29 22:45:39 +01:00
|
|
|
: QWidget( parent )
|
|
|
|
, ui( new Ui::FinishedPage )
|
|
|
|
{
|
|
|
|
ui->setupUi( this );
|
|
|
|
|
|
|
|
ui->mainText->setAlignment( Qt::AlignCenter );
|
|
|
|
ui->mainText->setWordWrap( true );
|
|
|
|
ui->mainText->setOpenExternalLinks( true );
|
|
|
|
|
2021-02-23 15:03:16 +01:00
|
|
|
connect( config, &Config::restartModeChanged, [this]( Config::RestartMode mode ) {
|
|
|
|
using Mode = Config::RestartMode;
|
|
|
|
|
|
|
|
ui->restartCheckBox->setVisible( mode != Mode::Never );
|
|
|
|
ui->restartCheckBox->setEnabled( mode != Mode::Always );
|
|
|
|
} );
|
|
|
|
connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked );
|
|
|
|
connect( ui->restartCheckBox, &QCheckBox::stateChanged, [config]( int state ) {
|
|
|
|
config->setRestartNowWanted( state != 0 );
|
|
|
|
} );
|
|
|
|
|
|
|
|
CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate );
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedPage::focusInEvent( QFocusEvent* e )
|
|
|
|
{
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedPage::onInstallationFailed( const QString& message, const QString& details )
|
|
|
|
{
|
|
|
|
m_failure = !message.isEmpty() ? message : details;
|
|
|
|
retranslate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedPage::retranslate()
|
|
|
|
{
|
|
|
|
|
|
|
|
const auto* branding = Calamares::Branding::instance();
|
|
|
|
|
|
|
|
ui->retranslateUi( this );
|
|
|
|
if ( !m_failure.has_value() )
|
|
|
|
{
|
|
|
|
if ( Calamares::Settings::instance()->isSetupMode() )
|
|
|
|
{
|
2019-04-08 17:55:03 +02:00
|
|
|
ui->mainText->setText( tr( "<h1>All done.</h1><br/>"
|
|
|
|
"%1 has been set up on your computer.<br/>"
|
|
|
|
"You may now start using your new system." )
|
2020-05-04 12:47:18 +02:00
|
|
|
.arg( branding->versionedName() ) );
|
|
|
|
ui->restartCheckBox->setToolTip( tr( "<html><head/><body>"
|
|
|
|
"<p>When this box is checked, your system will "
|
|
|
|
"restart immediately when you click on "
|
|
|
|
"<span style=\"font-style:italic;\">Done</span> "
|
|
|
|
"or close the setup program.</p></body></html>" ) );
|
2021-02-23 15:03:16 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-04-08 17:55:03 +02:00
|
|
|
ui->mainText->setText( tr( "<h1>All done.</h1><br/>"
|
|
|
|
"%1 has been installed on your computer.<br/>"
|
|
|
|
"You may now restart into your new system, or continue "
|
|
|
|
"using the %2 Live environment." )
|
2020-05-04 12:47:18 +02:00
|
|
|
.arg( branding->versionedName(), branding->productName() ) );
|
|
|
|
ui->restartCheckBox->setToolTip( tr( "<html><head/><body>"
|
|
|
|
"<p>When this box is checked, your system will "
|
|
|
|
"restart immediately when you click on "
|
|
|
|
"<span style=\"font-style:italic;\">Done</span> "
|
|
|
|
"or close the installer.</p></body></html>" ) );
|
2021-02-23 15:03:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const QString message = m_failure.value();
|
2020-05-04 12:47:18 +02:00
|
|
|
|
2021-02-23 15:03:16 +01:00
|
|
|
if ( Calamares::Settings::instance()->isSetupMode() )
|
2020-05-04 12:47:18 +02:00
|
|
|
{
|
2021-02-23 15:03:16 +01:00
|
|
|
ui->mainText->setText( tr( "<h1>Setup Failed</h1><br/>"
|
|
|
|
"%1 has not been set up on your computer.<br/>"
|
|
|
|
"The error message was: %2." )
|
|
|
|
.arg( branding->versionedName() )
|
|
|
|
.arg( message ) );
|
2020-05-04 12:47:18 +02:00
|
|
|
}
|
2021-02-23 15:03:16 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->mainText->setText( tr( "<h1>Installation Failed</h1><br/>"
|
|
|
|
"%1 has not been installed on your computer.<br/>"
|
|
|
|
"The error message was: %2." )
|
|
|
|
.arg( branding->versionedName() )
|
|
|
|
.arg( message ) );
|
|
|
|
}
|
|
|
|
}
|
2017-07-03 17:04:23 +02:00
|
|
|
}
|