calamares/src/modules/tracking/TrackingViewStep.cpp

125 lines
2.8 KiB
C++
Raw Normal View History

/* === This file is part of Calamares - <https://github.com/calamares> ===
2017-08-29 14:00:37 +02:00
*
* Copyright 2017, Adriaan de Groot <groot@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 "TrackingViewStep.h"
#include "Config.h"
#include "TrackingJobs.h"
#include "TrackingPage.h"
2017-08-29 14:00:37 +02:00
#include "GlobalStorage.h"
2019-08-01 23:05:42 +02:00
#include "JobQueue.h"
#include "utils/CalamaresUtilsSystem.h"
2019-08-01 23:05:42 +02:00
#include "utils/Logger.h"
#include "utils/Variant.h"
2017-08-29 14:00:37 +02:00
#include <QDesktopServices>
2017-08-29 14:00:37 +02:00
#include <QVariantMap>
2019-08-01 23:05:42 +02:00
CALAMARES_PLUGIN_FACTORY_DEFINITION( TrackingViewStepFactory, registerPlugin< TrackingViewStep >(); )
2017-08-29 14:00:37 +02:00
TrackingViewStep::TrackingViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_config( new Config( this ) )
, m_widget( new TrackingPage( m_config ) )
2017-08-29 14:00:37 +02:00
{
emit nextStatusChanged( false );
}
TrackingViewStep::~TrackingViewStep()
{
if ( m_widget && m_widget->parent() == nullptr )
2019-08-01 23:05:42 +02:00
{
2017-08-29 14:00:37 +02:00
m_widget->deleteLater();
2019-08-01 23:05:42 +02:00
}
2017-08-29 14:00:37 +02:00
}
QString
TrackingViewStep::prettyName() const
{
return tr( "Feedback" );
2017-08-29 14:00:37 +02:00
}
QWidget*
TrackingViewStep::widget()
{
return m_widget;
}
bool
TrackingViewStep::isNextEnabled() const
{
return true;
2017-08-29 14:00:37 +02:00
}
bool
TrackingViewStep::isBackEnabled() const
{
return true;
}
bool
TrackingViewStep::isAtBeginning() const
{
return true;
}
bool
TrackingViewStep::isAtEnd() const
{
return true;
}
2019-08-01 23:05:42 +02:00
void
TrackingViewStep::onLeave()
{
cDebug() << "Install tracking:" << m_config->installTracking()->isEnabled();
cDebug() << Logger::SubEntry << "Machine tracking:" << m_config->machineTracking()->isEnabled();
cDebug() << Logger::SubEntry << " User tracking:" << m_config->userTracking()->isEnabled();
}
Calamares::JobList
2017-08-29 14:00:37 +02:00
TrackingViewStep::jobs() const
{
cDebug() << "Creating tracking jobs ..";
Calamares::JobList l;
TrackingInstallJob::addJob( l, m_config->installTracking() );
TrackingMachineJob::addJob( l, m_config->machineTracking() );
TrackingUserJob::addJob( l, m_config->userTracking() );
cDebug() << Logger::SubEntry << l.count() << "jobs queued.";
return l;
2017-08-29 14:00:37 +02:00
}
2017-08-29 14:00:37 +02:00
void
TrackingViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
m_config->setConfigurationMap( configurationMap );
2017-08-29 14:00:37 +02:00
}