2015-01-29 22:45:39 +01:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "FinishedViewStep.h"
|
|
|
|
|
|
|
|
#include "FinishedPage.h"
|
|
|
|
|
|
|
|
#include <QVariantMap>
|
|
|
|
|
|
|
|
FinishedViewStep::FinishedViewStep( QObject* parent )
|
|
|
|
: Calamares::ViewStep( parent )
|
|
|
|
, m_widget( new FinishedPage() )
|
|
|
|
{
|
|
|
|
emit nextStatusChanged( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FinishedViewStep::~FinishedViewStep()
|
|
|
|
{
|
|
|
|
if ( m_widget && m_widget->parent() == nullptr )
|
|
|
|
m_widget->deleteLater();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
FinishedViewStep::prettyName() const
|
|
|
|
{
|
2015-09-09 18:45:52 +02:00
|
|
|
return tr( "Finish" );
|
2015-01-29 22:45:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget*
|
|
|
|
FinishedViewStep::widget()
|
|
|
|
{
|
|
|
|
return m_widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedViewStep::next()
|
|
|
|
{
|
|
|
|
emit done();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedViewStep::back()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
FinishedViewStep::isNextEnabled() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
FinishedViewStep::isBackEnabled() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
FinishedViewStep::isAtBeginning() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
FinishedViewStep::isAtEnd() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedViewStep::onActivate()
|
|
|
|
{
|
|
|
|
m_widget->setUpRestart();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QList< Calamares::job_ptr >
|
|
|
|
FinishedViewStep::jobs() const
|
|
|
|
{
|
|
|
|
return QList< Calamares::job_ptr >();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|
|
|
{
|
|
|
|
if ( configurationMap.contains( "restartNowEnabled" ) &&
|
|
|
|
configurationMap.value( "restartNowEnabled" ).type() == QVariant::Bool )
|
|
|
|
{
|
|
|
|
bool restartNowEnabled = configurationMap.value( "restartNowEnabled" ).toBool();
|
|
|
|
|
2015-11-06 14:57:01 +01:00
|
|
|
m_widget->setRestartNowEnabled( restartNowEnabled );
|
2015-01-29 22:45:39 +01:00
|
|
|
if ( restartNowEnabled )
|
|
|
|
{
|
|
|
|
if ( configurationMap.contains( "restartNowChecked" ) &&
|
2016-06-09 17:23:40 +02:00
|
|
|
configurationMap.value( "restartNowChecked" ).type() == QVariant::Bool )
|
2015-01-29 22:45:39 +01:00
|
|
|
{
|
|
|
|
m_widget->setRestartNowChecked( configurationMap.value( "restartNowChecked" ).toBool() );
|
2016-06-09 17:23:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( configurationMap.contains( "restartNowCommand" ) &&
|
|
|
|
configurationMap.value( "restartNowCommand" ).type() == QVariant::String )
|
|
|
|
{
|
2015-01-29 22:45:39 +01:00
|
|
|
m_widget->setRestartNowCommand( configurationMap.value( "restartNowCommand" ).toString() );
|
|
|
|
}
|
2016-06-09 17:23:40 +02:00
|
|
|
else
|
|
|
|
{
|
2016-06-09 17:26:26 +02:00
|
|
|
m_widget->setRestartNowCommand( "systemctl -i reboot");
|
2016-06-09 17:23:40 +02:00
|
|
|
}
|
2015-01-29 22:45:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-09 18:45:52 +02:00
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin<FinishedViewStep>(); )
|