calamares/src/modules/finishedq/FinishedQmlViewStep.cpp
demmm 7acc8bcec3 [finishedq] adding QML finished module
module builds & runs, config connections are not registering
no errors
finishedq.qml is offering a different option though, running commands directly in qml
plasma-framework executer is used for that
2021-02-27 22:04:30 +01:00

101 lines
2.1 KiB
C++

/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2019 Collabora Ltd <arnaud.ferraris@collabora.com>
* SPDX-FileCopyrightText: 2021 Anke Boersma <demm@kaosx.us>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "FinishedQmlViewStep.h"
#include "Config.h"
#include "JobQueue.h"
#include <QApplication>
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedQmlViewStepFactory, registerPlugin< FinishedQmlViewStep >(); )
FinishedQmlViewStep::FinishedQmlViewStep( QObject* parent )
: Calamares::QmlViewStep( parent )
, m_config( new Config( this ) )
, m_installFailed( false )
{
auto jq = Calamares::JobQueue::instance();
connect( jq, &Calamares::JobQueue::failed, this, &FinishedQmlViewStep::onInstallationFailed );
emit nextStatusChanged( true );
}
QString
FinishedQmlViewStep::prettyName() const
{
return tr( "Finish" );
}
bool
FinishedQmlViewStep::isNextEnabled() const
{
return false;
}
bool
FinishedQmlViewStep::isBackEnabled() const
{
return false;
}
bool
FinishedQmlViewStep::isAtBeginning() const
{
return true;
}
bool
FinishedQmlViewStep::isAtEnd() const
{
return true;
}
void
FinishedQmlViewStep::onActivate()
{
m_config->doNotify( m_installFailed );
//connect( qApp, &QApplication::aboutToQuit, m_config, &Config::doRestart );
QmlViewStep::onActivate();
}
Calamares::JobList
FinishedQmlViewStep::jobs() const
{
return Calamares::JobList();
}
QObject*
FinishedQmlViewStep::getConfig()
{
return m_config;
}
void
FinishedQmlViewStep::onInstallationFailed( const QString& message, const QString& details )
{
m_installFailed = true;
m_config->setRestartNowMode( Config::RestartMode::Never );
}
void
FinishedQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
m_config->setConfigurationMap( configurationMap );
Calamares::QmlViewStep::setConfigurationMap( configurationMap );
}