mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-26 08:58:22 -04:00
Merge remote-tracking branch 'upstream/master' into partition-layout
This commit is contained in:
commit
5cacc0ddc6
39 changed files with 773 additions and 482 deletions
|
@ -3,6 +3,7 @@
|
|||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2019, Collabora Ltd
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -286,6 +287,7 @@ PartitionViewStep::next()
|
|||
if ( m_choicePage->currentChoice() == ChoicePage::Manual )
|
||||
{
|
||||
m_widget->setCurrentWidget( m_manualPartitionPage );
|
||||
m_manualPartitionPage->selectDeviceByIndex( m_choicePage->lastSelectedDeviceIndex() );
|
||||
if ( m_core->isDirty() )
|
||||
m_manualPartitionPage->onRevertClicked();
|
||||
}
|
||||
|
@ -315,7 +317,10 @@ void
|
|||
PartitionViewStep::back()
|
||||
{
|
||||
if ( m_widget->currentWidget() != m_choicePage )
|
||||
{
|
||||
m_widget->setCurrentWidget( m_choicePage );
|
||||
m_choicePage->setLastSelectedDeviceIndex( m_manualPartitionPage->selectedDeviceIndex() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -495,6 +500,61 @@ nameToChoice( QString name, bool& ok )
|
|||
return SwapChoice::NoSwap;
|
||||
}
|
||||
|
||||
/** @brief translate @p defaultFS into a recognized name
|
||||
*
|
||||
* Makes several attempts to translate the string into a
|
||||
* name that KPMCore will recognize.
|
||||
*/
|
||||
static QString
|
||||
findFS( QString defaultFS )
|
||||
{
|
||||
QStringList fsLanguage { QLatin1Literal( "C" ) }; // Required language list to turn off localization
|
||||
if ( defaultFS.isEmpty() )
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
if ( FileSystem::typeForName( defaultFS, fsLanguage ) != FileSystem::Unknown )
|
||||
{
|
||||
cDebug() << "Partition-module setting *defaultFileSystemType*" << defaultFS;
|
||||
return defaultFS;
|
||||
}
|
||||
|
||||
// First pass: try the default language instead of C locale
|
||||
auto fsType = FileSystem::typeForName( defaultFS );
|
||||
if ( fsType != FileSystem::Unknown )
|
||||
{
|
||||
defaultFS = FileSystem::nameForType( fsType, fsLanguage );
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << defaultFS;
|
||||
return defaultFS;
|
||||
}
|
||||
|
||||
// Second pass: try case-insensitive, both unlocalized and localized
|
||||
const auto fstypes = FileSystem::types();
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
{
|
||||
if ( ( 0 == QString::compare( defaultFS, FileSystem::nameForType( t, fsLanguage ), Qt::CaseInsensitive ) ) ||
|
||||
( 0 == QString::compare( defaultFS, FileSystem::nameForType( t ), Qt::CaseInsensitive ) ) )
|
||||
{
|
||||
defaultFS = FileSystem::nameForType( fsType, fsLanguage );
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << defaultFS;
|
||||
return defaultFS;
|
||||
}
|
||||
}
|
||||
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << defaultFS << ") using ext4.";
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
#ifdef DEBUG_FILESYSTEMS
|
||||
// This bit is for distro's debugging their settings, and shows
|
||||
// all the strings that KPMCore is matching against for FS type.
|
||||
{
|
||||
Logger::CLog d( Logger::LOGDEBUG );
|
||||
using TR = Logger::DebugRow< int, QString >;
|
||||
const auto fstypes = FileSystem::types();
|
||||
d << "Available types (" << fstypes.count() << ')';
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
d << TR( static_cast<int>( t ), FileSystem::nameForType( t, fsLanguage ) );
|
||||
}
|
||||
#endif
|
||||
return defaultFS;
|
||||
}
|
||||
|
||||
void
|
||||
PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
|
@ -571,30 +631,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||
gs->insert( "alwaysShowPartitionLabels", CalamaresUtils::getBool( configurationMap, "alwaysShowPartitionLabels", true ) );
|
||||
gs->insert( "enableLuksAutomatedPartitioning", CalamaresUtils::getBool( configurationMap, "enableLuksAutomatedPartitioning", true ) );
|
||||
gs->insert( "allowManualPartitioning", CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
|
||||
|
||||
QString defaultFS = CalamaresUtils::getString( configurationMap, "defaultFileSystemType" );
|
||||
if ( defaultFS.isEmpty() )
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
else
|
||||
cDebug() << "Partition-module setting *defaultFileSystemType*" << defaultFS;
|
||||
if ( FileSystem::typeForName( defaultFS ) == FileSystem::Unknown )
|
||||
{
|
||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << defaultFS << ") using ext4.";
|
||||
defaultFS = QStringLiteral( "ext4" );
|
||||
#ifdef DEBUG_FILESYSTEMS
|
||||
// This bit is for distro's debugging their settings, and shows
|
||||
// all the strings that KPMCore is matching against for FS type.
|
||||
{
|
||||
Logger::CLog d( Logger::LOGDEBUG );
|
||||
using TR = Logger::DebugRow< int, QString >;
|
||||
const auto fstypes = FileSystem::types();
|
||||
d << "Available types (" << fstypes.count() << ')';
|
||||
for ( FileSystem::Type t : fstypes )
|
||||
d << TR( static_cast<int>( t ), FileSystem::nameForType( t ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
gs->insert( "defaultFileSystemType", defaultFS );
|
||||
gs->insert( "defaultFileSystemType", findFS( CalamaresUtils::getString( configurationMap, "defaultFileSystemType" ) ) );
|
||||
|
||||
|
||||
// Now that we have the config, we load the PartitionCoreModule in the background
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue