Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip Müller 2020-02-14 00:22:06 +01:00
commit 039940a131
16 changed files with 215 additions and 109 deletions

View File

@ -7,6 +7,8 @@ website will have to do for older versions.
This release contains contributions from (alphabetically by first name):
- Anke Boersma
- Camilo Higuita
- Gabriel Craciunescu
## Core ##
- *Assamese* translation has been completed.

View File

@ -24,23 +24,16 @@ namespace CalamaresUtils
namespace Locale
{
Label::Label()
: m_locale( QLocale() )
Label::Label( QObject* parent )
: Label( QString(), LabelFormat::IfNeededWithCountry, parent )
{
m_localeId = m_locale.name();
setLabels( QString(), LabelFormat::IfNeededWithCountry );
}
Label::Label( const QString& locale, LabelFormat format )
: m_locale( Label::getLocale( locale ) )
, m_localeId( locale )
{
setLabels( locale, format );
}
Label::Label( const QString& locale, LabelFormat format, QObject* parent )
: QObject( parent )
, m_locale( Label::getLocale( locale ) )
, m_localeId( locale.isEmpty() ? m_locale.name() : locale )
void
Label::setLabels( const QString& locale, LabelFormat format )
{
//: language[name] (country[name])
QString longFormat = QObject::tr( "%1 (%2)" );
@ -69,6 +62,10 @@ Label::setLabels( const QString& locale, LabelFormat format )
QLocale
Label::getLocale( const QString& localeName )
{
if ( localeName.isEmpty() )
{
return QLocale();
}
if ( localeName.contains( "@latin" ) )
{
QLocale loc( localeName ); // Ignores @latin

View File

@ -21,6 +21,7 @@
#define LOCALE_LABEL_H
#include <QLocale>
#include <QObject>
#include <QString>
namespace CalamaresUtils
@ -35,8 +36,14 @@ namespace Locale
* translation system) into QLocales, and also into consistent
* human-readable text labels.
*/
class Label
class Label : public QObject
{
Q_OBJECT
Q_PROPERTY( QString label READ label CONSTANT FINAL )
Q_PROPERTY( QString englishLabel READ englishLabel CONSTANT FINAL )
Q_PROPERTY( QString localeId MEMBER m_localeId CONSTANT FINAL )
public:
/** @brief Formatting option for label -- add (country) to label. */
enum class LabelFormat
@ -46,7 +53,7 @@ public:
};
/** @brief Empty locale. This uses the system-default locale. */
Label();
Label( QObject* parent = nullptr );
/** @brief Construct from a locale name.
*
@ -54,7 +61,9 @@ public:
* The @p format determines whether the country name is always present
* in the label (human-readable form) or only if needed for disambiguation.
*/
Label( const QString& localeName, LabelFormat format = LabelFormat::IfNeededWithCountry );
Label( const QString& localeName,
LabelFormat format = LabelFormat::IfNeededWithCountry,
QObject* parent = nullptr );
/** @brief Define a sorting order.
*
@ -94,8 +103,6 @@ public:
static QLocale getLocale( const QString& localeName );
protected:
void setLabels( const QString& name, LabelFormat format );
QLocale m_locale;
QString m_localeId; // the locale identifier, e.g. "en_GB"
QString m_label; // the native name of the locale

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2019, Adriaan de Groot <groot@kde.org>
* Copyright 2019-2020 Adriaan de Groot <groot@kde.org>
* Copyright 2019, 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
@ -36,7 +37,7 @@ LabelModel::LabelModel( const QStringList& locales, QObject* parent )
for ( const auto& l : locales )
{
m_locales.push_back( Label( l ) );
m_locales.push_back( new Label( l, Label::LabelFormat::IfNeededWithCountry, this ) );
}
}
@ -65,27 +66,33 @@ LabelModel::data( const QModelIndex& index, int role ) const
switch ( role )
{
case LabelRole:
return locale.label();
return locale->label();
case EnglishLabelRole:
return locale.englishLabel();
return locale->englishLabel();
default:
return QVariant();
}
}
QHash< int, QByteArray >
LabelModel::roleNames() const
{
return { { LabelRole, "label" }, { EnglishLabelRole, "englishLabel" } };
}
const Label&
LabelModel::locale( int row ) const
{
if ( ( row < 0 ) || ( row >= m_locales.count() ) )
{
for ( const auto& l : m_locales )
if ( l.isEnglish() )
if ( l->isEnglish() )
{
return l;
return *l;
}
return m_locales[ 0 ];
return *m_locales[ 0 ];
}
return m_locales[ row ];
return *m_locales[ row ];
}
int
@ -93,7 +100,7 @@ LabelModel::find( std::function< bool( const Label& ) > predicate ) const
{
for ( int row = 0; row < m_locales.count(); ++row )
{
if ( predicate( m_locales[ row ] ) )
if ( predicate( *m_locales[ row ] ) )
{
return row;
}

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2019, Adriaan de Groot <groot@kde.org>
* Copyright 2019-2020, Adriaan de Groot <groot@kde.org>
* Copyright 2019, 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
@ -33,6 +34,8 @@ namespace Locale
class DLLEXPORT LabelModel : public QAbstractListModel
{
Q_OBJECT
public:
enum
{
@ -46,6 +49,7 @@ public:
int rowCount( const QModelIndex& parent ) const override;
QVariant data( const QModelIndex& index, int role ) const override;
QHash< int, QByteArray > roleNames() const override;
/** @brief Gets locale information for entry #n
*
@ -69,7 +73,7 @@ public:
int find( const QString& countryCode ) const;
private:
QVector< Label > m_locales;
QVector< Label* > m_locales;
QStringList m_localeIds;
};

View File

@ -3,6 +3,7 @@
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017-2019, Adriaan de Groot <groot@kde.org>
* Copyright 2018, Raul Rodrigo Segura (raurodse)
* Copyright 2019, 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
@ -74,7 +75,8 @@ const QStringList Branding::s_imageEntryStrings =
{
"productLogo",
"productIcon",
"productWelcome"
"productWelcome",
"productWallpaper"
};
const QStringList Branding::s_styleEntryStrings =

View File

@ -3,6 +3,7 @@
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
* Copyright 2018, Raul Rodrigo Segura (raurodse)
* Copyright 2019, 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
@ -48,7 +49,7 @@ public:
* e.g. *Branding::ProductName to get the string value for
* the product name.
*/
enum StringEntry : short
enum StringEntry
{
ProductName,
Version,
@ -62,13 +63,16 @@ public:
KnownIssuesUrl,
ReleaseNotesUrl
};
Q_ENUM( StringEntry )
enum ImageEntry : short
{
ProductLogo,
ProductIcon,
ProductWelcome
ProductWelcome,
ProductWallpaper
};
Q_ENUM( ImageEntry )
enum StyleEntry : short
{
@ -77,6 +81,7 @@ public:
SidebarTextSelect,
SidebarTextHighlight
};
Q_ENUM( StyleEntry )
/** @brief Setting for how much the main window may expand. */
enum class WindowExpansion
@ -85,6 +90,7 @@ public:
Fullscreen,
Fixed
};
Q_ENUM( WindowExpansion )
/** @brief Setting for the main window size.
*
* The units are pixels (Pixies) or something-based-on-fontsize (Fonties), which
@ -96,6 +102,7 @@ public:
Pixies,
Fonties
};
Q_ENUM( WindowDimensionUnit )
class WindowDimension : public NamedSuffix< WindowDimensionUnit, WindowDimensionUnit::None >
{
public:

View File

@ -114,6 +114,31 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
Partition* clonePartition( Device* device, Partition* partition );
QString prettyNameForFileSystemType( FileSystem::Type t );
static inline QString
untranslatedFS( FileSystem& fs )
{
return fs.name( { QStringLiteral( "C" ) } );
}
static inline QString
untranslatedFS( FileSystem* fs )
{
return fs ? untranslatedFS( *fs ) : QString();
}
static inline QString
userVisibleFS( FileSystem& fs )
{
return fs.name();
}
static inline QString
userVisibleFS( FileSystem* fs )
{
return fs ? userVisibleFS( *fs ) : QString();
}
}
#endif /* KPMHELPERS_H */

View File

@ -2,7 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2018, Adriaan de Groot <groot@kde.org>
* Copyright 2018, 2020, Adriaan de Groot <groot@kde.org>
* Copyright 2018, Andrius Štikonas <andrius@stikonas.eu>
* Copyright 2018, Caio Carvalho <caiojcarvalho@gmail.com>
*
@ -93,11 +93,17 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
else
initGptPartitionTypeUi();
// File system
FileSystem::Type defaultFsType = FileSystem::typeForName(
// File system; the config value is translated (best-effort) to a type
FileSystem::Type defaultFSType;
QString untranslatedFSName = PartUtils::findFS(
Calamares::JobQueue::instance()->
globalStorage()->
value( "defaultFileSystemType" ).toString() );
value( "defaultFileSystemType" ).toString(), &defaultFSType );
if ( defaultFSType == FileSystem::Type::Unknown )
{
defaultFSType = FileSystem::Type::Ext4;
}
int defaultFsIndex = -1;
int fsCounter = 0;
QStringList fsNames;
@ -106,8 +112,8 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
if ( fs->supportCreate() != FileSystem::cmdSupportNone &&
fs->type() != FileSystem::Extended )
{
fsNames << fs->name();
if ( fs->type() == defaultFsType )
fsNames << KPMHelpers::userVisibleFS( fs ); // This is put into the combobox
if ( fs->type() == defaultFSType )
defaultFsIndex = fsCounter;
fsCounter++;
}
@ -232,6 +238,7 @@ CreatePartitionDialog::updateMountPointUi()
bool enabled = m_ui->primaryRadioButton->isChecked();
if ( enabled )
{
// This maps translated (user-visible) FS names to a type
FileSystem::Type type = FileSystem::typeForName( m_ui->fsComboBox->currentText() );
enabled = !s_unmountableFS.contains( type );

View File

@ -2,7 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2018, Adriaan de Groot <groot@kde.org>
* Copyright 2018, 2020, Adriaan de Groot <groot@kde.org>
*
* Flags handling originally from KDE Partition Manager,
* Copyright 2008-2009, Volker Lanz <vl@fidra.de>
@ -22,21 +22,21 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gui/EditExistingPartitionDialog.h>
#include "EditExistingPartitionDialog.h"
#include <core/ColorUtils.h>
#include <core/PartitionCoreModule.h>
#include <core/PartitionInfo.h>
#include "core/ColorUtils.h"
#include "core/PartitionCoreModule.h"
#include "core/PartitionInfo.h"
#include "core/PartUtils.h"
#include <core/KPMHelpers.h>
#include "core/KPMHelpers.h"
#include "gui/PartitionDialogHelpers.h"
#include <gui/PartitionSizeController.h>
#include "gui/PartitionSizeController.h"
#include <ui_EditExistingPartitionDialog.h>
#include "ui_EditExistingPartitionDialog.h"
#include <utils/Logger.h>
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "utils/Logger.h"
// KPMcore
#include <kpmcore/core/device.h>
@ -77,7 +77,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
m_ui->fileSystemComboBox->setEnabled( doFormat );
if ( !doFormat )
m_ui->fileSystemComboBox->setCurrentText( m_partition->fileSystem().name() );
m_ui->fileSystemComboBox->setCurrentText( KPMHelpers::userVisibleFS( m_partition->fileSystem() ) );
updateMountPointPicker();
} );
@ -93,16 +93,25 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
for ( auto fs : FileSystemFactory::map() )
{
if ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended )
fsNames << fs->name();
fsNames << KPMHelpers::userVisibleFS( fs ); // For the combo box
}
m_ui->fileSystemComboBox->addItems( fsNames );
if ( fsNames.contains( m_partition->fileSystem().name() ) )
m_ui->fileSystemComboBox->setCurrentText( m_partition->fileSystem().name() );
FileSystem::Type defaultFSType;
QString untranslatedFSName = PartUtils::findFS(
Calamares::JobQueue::instance()->
globalStorage()->
value( "defaultFileSystemType" ).toString(), &defaultFSType );
if ( defaultFSType == FileSystem::Type::Unknown )
{
defaultFSType = FileSystem::Type::Ext4;
}
QString thisFSNameForUser = KPMHelpers::userVisibleFS( m_partition->fileSystem() );
if ( fsNames.contains( thisFSNameForUser ) )
m_ui->fileSystemComboBox->setCurrentText( thisFSNameForUser );
else
m_ui->fileSystemComboBox->setCurrentText( Calamares::JobQueue::instance()->
globalStorage()->
value( "defaultFileSystemType" ).toString() );
m_ui->fileSystemComboBox->setCurrentText( FileSystem::nameForType( defaultFSType ) );
m_ui->fileSystemLabel->setEnabled( m_ui->formatRadioButton->isChecked() );
m_ui->fileSystemComboBox->setEnabled( m_ui->formatRadioButton->isChecked() );

View File

@ -600,7 +600,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
else if ( fsType != FileSystem::Unknown )
cWarning() << "Partition-module setting *defaultFileSystemType* changed" << fsRealName;
else
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsRealName << ") using ext4.";
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName << ") using" << fsRealName << "instead.";
gs->insert( "defaultFileSystemType", fsRealName );

View File

@ -22,6 +22,7 @@
#include "ui_ReplaceWidget.h"
#include "core/DeviceModel.h"
#include "core/KPMHelpers.h"
#include "core/PartitionCoreModule.h"
#include "core/PartitionActions.h"
#include "core/PartitionInfo.h"
@ -192,8 +193,8 @@ ReplaceWidget::onPartitionSelected()
return;
}
QString prettyName = tr( "Data partition (%1)" )
.arg( partition->fileSystem().name() );
QString fsNameForUser = KPMHelpers::userVisibleFS( partition->fileSystem() );
QString prettyName = tr( "Data partition (%1)" ).arg( fsNameForUser );
for ( const QString& line : osproberLines )
{
QStringList lineColumns = line.split( ':' );
@ -210,13 +211,13 @@ ReplaceWidget::onPartitionSelected()
if ( osName.isEmpty() )
{
prettyName = tr( "Unknown system partition (%1)" )
.arg( partition->fileSystem().name() );
.arg( fsNameForUser );
}
else
{
prettyName = tr ( "%1 system partition (%2)" )
.arg( osName.replace( 0, 1, osName.at( 0 ).toUpper() ) )
.arg( partition->fileSystem().name() );
.arg( fsNameForUser );
}
break;
}

View File

@ -2,7 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
* Copyright 2017, 2020, 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
@ -20,6 +20,8 @@
#include "jobs/CreatePartitionJob.h"
#include "core/KPMHelpers.h"
#include "utils/Logger.h"
#include "utils/Units.h"
@ -32,6 +34,9 @@
#include <kpmcore/ops/newoperation.h>
#include <kpmcore/util/report.h>
using KPMHelpers::untranslatedFS;
using KPMHelpers::userVisibleFS;
CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
: PartitionJob( partition )
, m_device( device )
@ -42,7 +47,7 @@ QString
CreatePartitionJob::prettyName() const
{
return tr( "Create new %2MiB partition on %4 (%3) with file system %1." )
.arg( m_partition->fileSystem().name() )
.arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() )
.arg( m_device->deviceNode() );
@ -54,7 +59,7 @@ CreatePartitionJob::prettyDescription() const
{
return tr( "Create new <strong>%2MiB</strong> partition on <strong>%4</strong> "
"(%3) with file system <strong>%1</strong>." )
.arg( m_partition->fileSystem().name() )
.arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) )
.arg( m_device->name() )
.arg( m_device->deviceNode() );
@ -65,7 +70,7 @@ QString
CreatePartitionJob::prettyStatusMessage() const
{
return tr( "Creating new %1 partition on %2." )
.arg( m_partition->fileSystem().name() )
.arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( m_device->deviceNode() );
}

View File

@ -2,7 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
* Copyright 2017, 2019-2020, 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
@ -20,12 +20,13 @@
#include "jobs/FillGlobalStorageJob.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "core/KPMHelpers.h"
#include "core/PartitionInfo.h"
#include "core/PartitionIterator.h"
#include "core/KPMHelpers.h"
#include "Branding.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "utils/Logger.h"
// KPMcore
@ -40,16 +41,18 @@
#include <QFileInfo>
#include <QProcess>
typedef QHash<QString, QString> UuidForPartitionHash;
using KPMHelpers::untranslatedFS;
using KPMHelpers::userVisibleFS;
typedef QHash< QString, QString > UuidForPartitionHash;
static UuidForPartitionHash
findPartitionUuids( QList < Device* > devices )
findPartitionUuids( QList< Device* > devices )
{
UuidForPartitionHash hash;
foreach ( Device* device, devices )
{
for ( auto it = PartitionIterator::begin( device );
it != PartitionIterator::end( device ); ++it )
for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it )
{
Partition* p = *it;
QString path = p->partitionPath();
@ -59,7 +62,9 @@ findPartitionUuids( QList < Device* > devices )
}
if ( hash.isEmpty() )
{
cDebug() << "No UUIDs found for existing partitions.";
}
return hash;
}
@ -73,7 +78,9 @@ getLuksUuid( const QString& path )
process.start();
process.waitForFinished();
if ( process.exitStatus() != QProcess::NormalExit || process.exitCode() )
{
return QString();
}
QString uuid = QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed();
return uuid;
}
@ -85,22 +92,22 @@ mapForPartition( Partition* partition, const QString& uuid )
QVariantMap map;
map[ "device" ] = partition->partitionPath();
map[ "mountPoint" ] = PartitionInfo::mountPoint( partition );
map[ "fsName" ] = partition->fileSystem().name();
map[ "fs" ] = partition->fileSystem().name( { QStringLiteral("C") } ); // Untranslated
if ( partition->fileSystem().type() == FileSystem::Luks &&
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
map[ "fsName" ] = userVisibleFS( partition->fileSystem() );
map[ "fs" ] = untranslatedFS( partition->fileSystem() );
if ( partition->fileSystem().type() == FileSystem::Luks
&& dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
{
map[ "fs" ] = untranslatedFS( dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() );
}
map[ "uuid" ] = uuid;
// Debugging for inside the loop in createPartitionList(),
// so indent a bit
Logger::CDebug deb;
using TR = Logger::DebugRow<const char *const, const QString&>;
using TR = Logger::DebugRow< const char* const, const QString& >;
deb << Logger::SubEntry << "mapping for" << partition->partitionPath() << partition->deviceNode()
<< TR( "mtpoint:", PartitionInfo::mountPoint( partition ) )
<< TR( "fs:", map[ "fs" ].toString() )
<< TR( "fsname", map[ "fsName" ].toString() )
<< TR( "uuid", uuid );
<< TR( "mtpoint:", PartitionInfo::mountPoint( partition ) ) << TR( "fs:", map[ "fs" ].toString() )
<< TR( "fsName", map[ "fsName" ].toString() ) << TR( "uuid", uuid );
if ( partition->roles().has( PartitionRole::Luks ) )
{
@ -137,7 +144,7 @@ FillGlobalStorageJob::prettyDescription() const
QStringList lines;
const auto partitionList = createPartitionList().toList();
for ( const QVariant &partitionItem : partitionList )
for ( const QVariant& partitionItem : partitionList )
{
if ( partitionItem.type() == QVariant::Map )
{
@ -146,32 +153,42 @@ FillGlobalStorageJob::prettyDescription() const
QString mountPoint = partitionMap.value( "mountPoint" ).toString();
QString fsType = partitionMap.value( "fs" ).toString();
if ( mountPoint.isEmpty() || fsType.isEmpty() )
{
continue;
}
if ( path.isEmpty() )
{
if ( mountPoint == "/" )
{
lines.append( tr( "Install %1 on <strong>new</strong> %2 system partition." )
.arg( *Calamares::Branding::ShortProductName )
.arg( fsType ) );
.arg( *Calamares::Branding::ShortProductName )
.arg( fsType ) );
}
else
{
lines.append( tr( "Set up <strong>new</strong> %2 partition with mount point "
"<strong>%1</strong>." )
.arg( mountPoint )
.arg( fsType ) );
.arg( mountPoint )
.arg( fsType ) );
}
}
else
{
if ( mountPoint == "/" )
{
lines.append( tr( "Install %2 on %3 system partition <strong>%1</strong>." )
.arg( path )
.arg( *Calamares::Branding::ShortProductName )
.arg( fsType ) );
.arg( path )
.arg( *Calamares::Branding::ShortProductName )
.arg( fsType ) );
}
else
{
lines.append( tr( "Set up %3 partition <strong>%1</strong> with mount point "
"<strong>%2</strong>." )
.arg( path )
.arg( mountPoint )
.arg( fsType ) );
.arg( path )
.arg( mountPoint )
.arg( fsType ) );
}
}
}
}
@ -179,8 +196,7 @@ FillGlobalStorageJob::prettyDescription() const
QVariant bootloaderMap = createBootLoaderMap();
if ( !m_bootLoaderPath.isEmpty() )
{
lines.append( tr( "Install boot loader on <strong>%1</strong>." )
.arg( m_bootLoaderPath ) );
lines.append( tr( "Install boot loader on <strong>%1</strong>." ).arg( m_bootLoaderPath ) );
}
return lines.join( "<br/>" );
}
@ -201,7 +217,9 @@ FillGlobalStorageJob::exec()
{
QVariant var = createBootLoaderMap();
if ( !var.isValid() )
{
cDebug() << "Failed to find path for boot loader";
}
cDebug() << "FillGlobalStorageJob writing bootLoader path:" << var;
storage->insert( "bootLoader", var );
}
@ -222,8 +240,7 @@ FillGlobalStorageJob::createPartitionList() const
for ( auto device : m_devices )
{
cDebug() << Logger::SubEntry << "partitions on" << device->deviceNode();
for ( auto it = PartitionIterator::begin( device );
it != PartitionIterator::end( device ); ++it )
for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it )
{
// Debug-logging is done when creating the map
lst << mapForPartition( *it, hash.value( ( *it )->partitionPath() ) );
@ -241,7 +258,9 @@ FillGlobalStorageJob::createBootLoaderMap() const
{
Partition* partition = KPMHelpers::findPartitionByMountPoint( m_devices, path );
if ( !partition )
{
return QVariant();
}
path = partition->partitionPath();
}
map[ "installPath" ] = path;

View File

@ -19,6 +19,8 @@
#include "jobs/FormatPartitionJob.h"
#include "core/KPMHelpers.h"
#include "utils/Logger.h"
// KPMcore
@ -29,6 +31,9 @@
#include <ops/createfilesystemoperation.h>
#include <util/report.h>
using KPMHelpers::untranslatedFS;
using KPMHelpers::userVisibleFS;
FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
: PartitionJob( partition )
, m_device( device )
@ -40,7 +45,7 @@ FormatPartitionJob::prettyName() const
{
return tr( "Format partition %1 (file system: %2, size: %3 MiB) on %4." )
.arg( m_partition->partitionPath() )
.arg( m_partition->fileSystem().name() )
.arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( m_partition->capacity() / 1024 / 1024 )
.arg( m_device->name() );
}
@ -52,7 +57,7 @@ FormatPartitionJob::prettyDescription() const
return tr( "Format <strong>%3MiB</strong> partition <strong>%1</strong> with "
"file system <strong>%2</strong>." )
.arg( m_partition->partitionPath() )
.arg( m_partition->fileSystem().name() )
.arg( userVisibleFS( m_partition->fileSystem() ) )
.arg( m_partition->capacity() / 1024 / 1024 );
}
@ -63,7 +68,7 @@ FormatPartitionJob::prettyStatusMessage() const
return tr( "Formatting partition %1 with "
"file system %2." )
.arg( m_partition->partitionPath() )
.arg( m_partition->fileSystem().name() );
.arg( userVisibleFS( m_partition->fileSystem() ) );
}

View File

@ -21,6 +21,8 @@
#include "SetPartitionFlagsJob.h"
#include "core/KPMHelpers.h"
#include "utils/Logger.h"
#include "utils/Units.h"
@ -32,6 +34,8 @@
#include <util/report.h>
using CalamaresUtils::BytesToMiB;
using KPMHelpers::untranslatedFS;
using KPMHelpers::userVisibleFS;
SetPartFlagsJob::SetPartFlagsJob( Device* device,
Partition* partition,
@ -48,10 +52,11 @@ SetPartFlagsJob::prettyName() const
if ( !partition()->partitionPath().isEmpty() )
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
if ( !partition()->fileSystem().name().isEmpty() )
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
if ( !fsNameForUser.isEmpty() )
return tr( "Set flags on %1MiB %2 partition." )
.arg( BytesToMiB( partition()->capacity() ) )
.arg( partition()->fileSystem().name() );
.arg( fsNameForUser );
return tr( "Set flags on new partition." );
}
@ -67,10 +72,11 @@ SetPartFlagsJob::prettyDescription() const
return tr( "Clear flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
if ( !partition()->fileSystem().name().isEmpty() )
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
if ( !fsNameForUser.isEmpty() )
return tr( "Clear flags on %1MiB <strong>%2</strong> partition." )
.arg( BytesToMiB( partition()->capacity() ) )
.arg( partition()->fileSystem().name() );
.arg( fsNameForUser );
return tr( "Clear flags on new partition." );
}
@ -81,11 +87,12 @@ SetPartFlagsJob::prettyDescription() const
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
if ( !fsNameForUser.isEmpty() )
return tr( "Flag %1MiB <strong>%2</strong> partition as "
"<strong>%3</strong>." )
.arg( BytesToMiB( partition()->capacity() ) )
.arg( partition()->fileSystem().name() )
.arg( fsNameForUser )
.arg( flagsList.join( ", " ) );
return tr( "Flag new partition as <strong>%1</strong>." )
@ -103,10 +110,11 @@ SetPartFlagsJob::prettyStatusMessage() const
return tr( "Clearing flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
if ( !partition()->fileSystem().name().isEmpty() )
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
if ( !fsNameForUser.isEmpty() )
return tr( "Clearing flags on %1MiB <strong>%2</strong> partition." )
.arg( BytesToMiB( partition()->capacity() ) )
.arg( partition()->fileSystem().name() );
.arg( fsNameForUser );
return tr( "Clearing flags on new partition." );
}
@ -117,11 +125,12 @@ SetPartFlagsJob::prettyStatusMessage() const
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
QString fsNameForUser = userVisibleFS( partition()->fileSystem() );
if ( !fsNameForUser.isEmpty() )
return tr( "Setting flags <strong>%3</strong> on "
"%1MiB <strong>%2</strong> partition." )
.arg( BytesToMiB( partition()->capacity() ) )
.arg( partition()->fileSystem().name() )
.arg( fsNameForUser )
.arg( flagsList.join( ", " ) );
return tr( "Setting flags <strong>%1</strong> on new partition." )