2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2014-07-02 17:59:24 +02:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-07-02 17:59:24 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2014-07-02 17:59:24 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "LocaleViewStep.h"
|
|
|
|
|
|
|
|
#include "LocalePage.h"
|
2014-09-03 18:01:39 +02:00
|
|
|
#include "widgets/WaitingWidget.h"
|
2014-07-02 17:59:24 +02:00
|
|
|
|
2019-05-01 12:31:31 +02:00
|
|
|
#include "GlobalStorage.h"
|
|
|
|
#include "JobQueue.h"
|
|
|
|
|
2019-05-02 19:48:19 +02:00
|
|
|
#include "geoip/Handler.h"
|
2019-09-10 14:18:47 +02:00
|
|
|
#include "network/Manager.h"
|
2014-07-03 13:13:38 +02:00
|
|
|
#include "utils/CalamaresUtilsGui.h"
|
2014-11-26 17:46:54 +01:00
|
|
|
#include "utils/Logger.h"
|
2019-04-29 11:51:27 +02:00
|
|
|
#include "utils/Variant.h"
|
2019-04-29 12:04:55 +02:00
|
|
|
#include "utils/Yaml.h"
|
2014-07-03 13:13:38 +02:00
|
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
|
#include <QLabel>
|
|
|
|
|
2015-09-09 18:52:47 +02:00
|
|
|
|
2019-09-07 16:58:37 +02:00
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( LocaleViewStepFactory, registerPlugin< LocaleViewStep >(); )
|
2015-09-09 18:52:47 +02:00
|
|
|
|
2014-07-02 17:59:24 +02:00
|
|
|
LocaleViewStep::LocaleViewStep( QObject* parent )
|
|
|
|
: Calamares::ViewStep( parent )
|
2014-07-03 13:13:38 +02:00
|
|
|
, m_widget( new QWidget() )
|
2019-09-10 12:18:55 +02:00
|
|
|
, m_actualWidget( nullptr )
|
2014-07-03 13:19:32 +02:00
|
|
|
, m_nextEnabled( false )
|
2020-07-20 12:37:27 +02:00
|
|
|
, m_config( std::make_unique< Config >() )
|
2014-07-02 17:59:24 +02:00
|
|
|
{
|
2014-07-03 13:13:38 +02:00
|
|
|
QBoxLayout* mainLayout = new QHBoxLayout;
|
|
|
|
m_widget->setLayout( mainLayout );
|
|
|
|
CalamaresUtils::unmarginLayout( mainLayout );
|
|
|
|
|
2014-07-03 13:19:32 +02:00
|
|
|
emit nextStatusChanged( m_nextEnabled );
|
2014-07-02 17:59:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LocaleViewStep::~LocaleViewStep()
|
|
|
|
{
|
|
|
|
if ( m_widget && m_widget->parent() == nullptr )
|
2019-09-07 16:58:37 +02:00
|
|
|
{
|
2014-07-02 17:59:24 +02:00
|
|
|
m_widget->deleteLater();
|
2019-09-07 16:58:37 +02:00
|
|
|
}
|
2014-07-02 17:59:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-08-18 15:38:41 +02:00
|
|
|
void
|
|
|
|
LocaleViewStep::setUpPage()
|
|
|
|
{
|
2020-07-22 14:47:43 +02:00
|
|
|
m_config->setCurrentLocation();
|
2019-09-10 12:18:55 +02:00
|
|
|
if ( !m_actualWidget )
|
|
|
|
{
|
2020-07-20 12:58:35 +02:00
|
|
|
m_actualWidget = new LocalePage( m_config.get() );
|
2019-09-10 12:18:55 +02:00
|
|
|
}
|
2016-08-18 15:38:41 +02:00
|
|
|
m_widget->layout()->addWidget( m_actualWidget );
|
2019-09-10 12:18:55 +02:00
|
|
|
|
2020-04-17 12:54:31 +02:00
|
|
|
ensureSize( m_actualWidget->sizeHint() );
|
|
|
|
|
2016-08-18 15:38:41 +02:00
|
|
|
m_nextEnabled = true;
|
|
|
|
emit nextStatusChanged( m_nextEnabled );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-02 17:59:24 +02:00
|
|
|
QString
|
|
|
|
LocaleViewStep::prettyName() const
|
|
|
|
{
|
|
|
|
return tr( "Location" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-08 18:25:54 +02:00
|
|
|
QString
|
|
|
|
LocaleViewStep::prettyStatus() const
|
|
|
|
{
|
2020-07-24 11:53:32 +02:00
|
|
|
return m_config->prettyStatus();
|
2014-07-08 18:25:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-02 17:59:24 +02:00
|
|
|
QWidget*
|
|
|
|
LocaleViewStep::widget()
|
|
|
|
{
|
|
|
|
return m_widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
LocaleViewStep::isNextEnabled() const
|
|
|
|
{
|
2014-07-03 13:19:32 +02:00
|
|
|
return m_nextEnabled;
|
2014-07-02 17:59:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-29 20:24:09 +01:00
|
|
|
bool
|
|
|
|
LocaleViewStep::isBackEnabled() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-02 17:59:24 +02:00
|
|
|
bool
|
|
|
|
LocaleViewStep::isAtBeginning() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
LocaleViewStep::isAtEnd() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2014-07-08 14:02:21 +02:00
|
|
|
|
|
|
|
|
2019-11-25 10:52:22 +01:00
|
|
|
Calamares::JobList
|
2014-07-08 14:02:21 +02:00
|
|
|
LocaleViewStep::jobs() const
|
|
|
|
{
|
2020-07-22 00:23:50 +02:00
|
|
|
return m_config->createJobs();
|
2014-07-08 14:02:21 +02:00
|
|
|
}
|
2014-07-08 18:25:54 +02:00
|
|
|
|
|
|
|
|
2014-11-26 18:52:44 +01:00
|
|
|
void
|
|
|
|
LocaleViewStep::onActivate()
|
|
|
|
{
|
2020-08-06 18:32:51 +02:00
|
|
|
m_config->setCurrentLocation(); // Finalize the location
|
2019-09-10 14:18:47 +02:00
|
|
|
if ( !m_actualWidget )
|
2019-09-10 12:18:55 +02:00
|
|
|
{
|
2019-09-10 14:18:47 +02:00
|
|
|
setUpPage();
|
2019-09-10 12:18:55 +02:00
|
|
|
}
|
2019-09-10 14:18:47 +02:00
|
|
|
m_actualWidget->onActivate();
|
2014-11-26 18:52:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-08 18:25:54 +02:00
|
|
|
void
|
|
|
|
LocaleViewStep::onLeave()
|
|
|
|
{
|
2020-08-06 18:32:51 +02:00
|
|
|
m_config->finalizeGlobalStorage();
|
2014-07-08 18:25:54 +02:00
|
|
|
}
|
2014-07-15 11:35:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
LocaleViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|
|
|
{
|
2020-07-20 12:37:27 +02:00
|
|
|
m_config->setConfigurationMap( configurationMap );
|
2014-07-15 11:35:05 +02:00
|
|
|
}
|