Report a prettyDescription for FillGlobalStorageJob.

This commit is contained in:
Teo Mrnjavac 2015-04-10 17:46:42 +02:00
parent f8995bc8e5
commit 2846cbdcbc
2 changed files with 65 additions and 4 deletions

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@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
@ -23,6 +24,7 @@
#include <core/PartitionInfo.h>
#include <core/PartitionIterator.h>
#include <core/PMUtils.h>
#include "Branding.h"
// CalaPM
#include <core/device.h>
@ -75,6 +77,63 @@ FillGlobalStorageJob::prettyName() const
return tr( "Set partition information" );
}
QString
FillGlobalStorageJob::prettyDescription() const
{
QStringList lines;
foreach ( QVariant partitionItem, createPartitionList().toList() )
{
if ( partitionItem.type() == QVariant::Map )
{
QVariantMap partitionMap = partitionItem.toMap();
QString path = partitionMap.value( "device" ).toString();
QString mountPoint = partitionMap.value( "mountPoint" ).toString();
QString fsType = partitionMap.value( "fs" ).toString();
qDebug() << partitionMap.value( "uuid" ) << path << mountPoint << fsType;
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::instance()->string(
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 ) );
}
else
{
if ( mountPoint == "/" )
lines.append( tr( "Install %2 on %3 system partition <strong>%1</strong>." )
.arg( path )
.arg( Calamares::Branding::instance()->string(
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 ) );
}
}
}
QVariant bootloaderMap = createBootLoaderMap();
if ( !m_bootLoaderPath.isEmpty() )
{
lines.append( tr( "Install boot loader on <strong>%1</strong>." )
.arg( m_bootLoaderPath ) );
}
return lines.join( "<br/>" );
}
Calamares::JobResult
FillGlobalStorageJob::exec()
{
@ -88,7 +147,7 @@ FillGlobalStorageJob::exec()
}
QVariant
FillGlobalStorageJob::createPartitionList()
FillGlobalStorageJob::createPartitionList() const
{
UuidForPartitionHash hash = findPartitionUuids();
QVariantList lst;
@ -99,7 +158,7 @@ FillGlobalStorageJob::createPartitionList()
}
QVariant
FillGlobalStorageJob::createBootLoaderMap()
FillGlobalStorageJob::createBootLoaderMap() const
{
QVariantMap map;
QString path = m_bootLoaderPath;

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@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
@ -40,13 +41,14 @@ class FillGlobalStorageJob : public Calamares::Job
public:
FillGlobalStorageJob( QList< Device* > devices, const QString& bootLoaderPath );
QString prettyName() const override;
QString prettyDescription() const override;
Calamares::JobResult exec() override;
private:
QList< Device* > m_devices;
QString m_bootLoaderPath;
QVariant createPartitionList();
QVariant createBootLoaderMap();
QVariant createPartitionList() const;
QVariant createBootLoaderMap() const;
};
#endif /* FILLGLOBALSTORAGEJOB_H */