[finished] Simplify configuration code
This commit is contained in:
parent
1aa87da4b8
commit
ef4196dbd8
@ -1,7 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
* Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||||
* Copyright 2019, Collabora Ltd <arnaud.ferraris@collabora.com>
|
* Copyright 2019, Collabora Ltd <arnaud.ferraris@collabora.com>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/Variant.h"
|
||||||
|
|
||||||
#include <QtDBus/QDBusConnection>
|
#include <QtDBus/QDBusConnection>
|
||||||
#include <QtDBus/QDBusInterface>
|
#include <QtDBus/QDBusInterface>
|
||||||
@ -156,28 +157,21 @@ FinishedViewStep::onInstallationFailed( const QString& message, const QString& d
|
|||||||
void
|
void
|
||||||
FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
if ( configurationMap.contains( "restartNowEnabled" ) &&
|
bool restartNowEnabled = CalamaresUtils::getBool( configurationMap, "restartNowEnabled", false );
|
||||||
configurationMap.value( "restartNowEnabled" ).type() == QVariant::Bool )
|
m_widget->setRestartNowEnabled( restartNowEnabled );
|
||||||
|
|
||||||
|
bool restartNowChecked = restartNowEnabled && CalamaresUtils::getBool( configurationMap, "restartNowChecked", false );
|
||||||
|
m_widget->setRestartNowChecked( restartNowChecked );
|
||||||
|
|
||||||
|
if ( restartNowEnabled )
|
||||||
{
|
{
|
||||||
bool restartNowEnabled = configurationMap.value( "restartNowEnabled" ).toBool();
|
QString restartNowCommand = CalamaresUtils::getString( configurationMap, "restartNowCommand" );
|
||||||
|
if ( restartNowCommand.isEmpty() )
|
||||||
m_widget->setRestartNowEnabled( restartNowEnabled );
|
restartNowCommand = QStringLiteral( "shutdown -r now" );
|
||||||
if ( restartNowEnabled )
|
m_widget->setRestartNowCommand( restartNowCommand );
|
||||||
{
|
|
||||||
if ( configurationMap.contains( "restartNowChecked" ) &&
|
|
||||||
configurationMap.value( "restartNowChecked" ).type() == QVariant::Bool )
|
|
||||||
m_widget->setRestartNowChecked( configurationMap.value( "restartNowChecked" ).toBool() );
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "restartNowCommand" ) &&
|
|
||||||
configurationMap.value( "restartNowCommand" ).type() == QVariant::String )
|
|
||||||
m_widget->setRestartNowCommand( configurationMap.value( "restartNowCommand" ).toString() );
|
|
||||||
else
|
|
||||||
m_widget->setRestartNowCommand( "shutdown -r now" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( configurationMap.contains( "notifyOnFinished" ) &&
|
|
||||||
configurationMap.value( "notifyOnFinished" ).type() == QVariant::Bool )
|
m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false );
|
||||||
m_notifyOnFinished = configurationMap.value( "notifyOnFinished" ).toBool();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin<FinishedViewStep>(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin<FinishedViewStep>(); )
|
||||||
|
Loading…
Reference in New Issue
Block a user