2020-03-25 16:08:12 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
|
|
|
*
|
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
|
|
|
* Copyright 2020, Camilo Higuita <milo.h@aol.com>
|
|
|
|
*
|
|
|
|
* 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 "KeyboardQmlViewStep.h"
|
|
|
|
|
|
|
|
#include "GlobalStorage.h"
|
2020-03-26 15:57:02 +01:00
|
|
|
#include "JobQueue.h"
|
2020-03-25 16:08:12 +01:00
|
|
|
#include "utils/Variant.h"
|
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( KeyboardQmlViewStepFactory, registerPlugin< KeyboardQmlViewStep >(); )
|
2020-03-25 16:08:12 +01:00
|
|
|
|
|
|
|
KeyboardQmlViewStep::KeyboardQmlViewStep( QObject* parent )
|
2020-03-26 15:57:02 +01:00
|
|
|
: Calamares::QmlViewStep( parent )
|
|
|
|
, m_config( new Config( this ) )
|
2020-03-25 16:08:12 +01:00
|
|
|
, m_nextEnabled( false )
|
|
|
|
, m_writeEtcDefaultKeyboard( true )
|
|
|
|
{
|
|
|
|
m_config->init();
|
|
|
|
m_nextEnabled = true;
|
|
|
|
emit nextStatusChanged( m_nextEnabled );
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
KeyboardQmlViewStep::prettyName() const
|
|
|
|
{
|
|
|
|
return tr( "Keyboard" );
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
KeyboardQmlViewStep::prettyStatus() const
|
|
|
|
{
|
|
|
|
return m_prettyStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
KeyboardQmlViewStep::isNextEnabled() const
|
|
|
|
{
|
|
|
|
return m_nextEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
KeyboardQmlViewStep::isBackEnabled() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
KeyboardQmlViewStep::isAtBeginning() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
KeyboardQmlViewStep::isAtEnd() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Calamares::JobList
|
|
|
|
KeyboardQmlViewStep::jobs() const
|
|
|
|
{
|
|
|
|
return m_jobs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
KeyboardQmlViewStep::onActivate()
|
|
|
|
{
|
|
|
|
m_config->onActivate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
KeyboardQmlViewStep::onLeave()
|
|
|
|
{
|
|
|
|
m_config->finalize();
|
2020-03-26 15:57:02 +01:00
|
|
|
m_jobs = m_config->createJobs( m_xOrgConfFileName, m_convertedKeymapPath, m_writeEtcDefaultKeyboard );
|
2020-03-25 16:08:12 +01:00
|
|
|
m_prettyStatus = m_config->prettyStatus();
|
|
|
|
}
|
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
QObject*
|
2020-03-25 16:08:12 +01:00
|
|
|
KeyboardQmlViewStep::getConfig()
|
|
|
|
{
|
|
|
|
return m_config;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
KeyboardQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|
|
|
{
|
|
|
|
using namespace CalamaresUtils;
|
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
if ( configurationMap.contains( "xOrgConfFileName" )
|
|
|
|
&& configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String
|
|
|
|
&& !getString( configurationMap, "xOrgConfFileName" ).isEmpty() )
|
2020-03-25 16:08:12 +01:00
|
|
|
{
|
|
|
|
m_xOrgConfFileName = getString( configurationMap, "xOrgConfFileName" );
|
|
|
|
}
|
|
|
|
else
|
2020-03-26 15:57:02 +01:00
|
|
|
{
|
2020-03-25 16:08:12 +01:00
|
|
|
m_xOrgConfFileName = "00-keyboard.conf";
|
2020-03-26 15:57:02 +01:00
|
|
|
}
|
2020-03-25 16:08:12 +01:00
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
if ( configurationMap.contains( "convertedKeymapPath" )
|
|
|
|
&& configurationMap.value( "convertedKeymapPath" ).type() == QVariant::String
|
|
|
|
&& !getString( configurationMap, "convertedKeymapPath" ).isEmpty() )
|
2020-03-25 16:08:12 +01:00
|
|
|
{
|
|
|
|
m_convertedKeymapPath = getString( configurationMap, "convertedKeymapPath" );
|
|
|
|
}
|
|
|
|
else
|
2020-03-26 15:57:02 +01:00
|
|
|
{
|
2020-03-25 16:08:12 +01:00
|
|
|
m_convertedKeymapPath = QString();
|
2020-03-26 15:57:02 +01:00
|
|
|
}
|
2020-03-25 16:08:12 +01:00
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
if ( configurationMap.contains( "writeEtcDefaultKeyboard" )
|
|
|
|
&& configurationMap.value( "writeEtcDefaultKeyboard" ).type() == QVariant::Bool )
|
|
|
|
{
|
|
|
|
m_writeEtcDefaultKeyboard = getBool( configurationMap, "writeEtcDefaultKeyboard", true );
|
|
|
|
}
|
2020-03-25 16:08:12 +01:00
|
|
|
else
|
2020-03-26 15:57:02 +01:00
|
|
|
{
|
2020-03-25 16:08:12 +01:00
|
|
|
m_writeEtcDefaultKeyboard = true;
|
2020-03-26 15:57:02 +01:00
|
|
|
}
|
2020-03-25 16:08:12 +01:00
|
|
|
|
|
|
|
Calamares::QmlViewStep::setConfigurationMap( configurationMap );
|
|
|
|
}
|