From 2846cbdcbcf701f0a2c2258ce4086eeb023f948c Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 10 Apr 2015 17:46:42 +0200 Subject: [PATCH] Report a prettyDescription for FillGlobalStorageJob. --- .../partition/jobs/FillGlobalStorageJob.cpp | 63 ++++++++++++++++++- .../partition/jobs/FillGlobalStorageJob.h | 6 +- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.cpp b/src/modules/partition/jobs/FillGlobalStorageJob.cpp index 83783c4bc..61fbee95a 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.cpp +++ b/src/modules/partition/jobs/FillGlobalStorageJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Aurélien Gâteau + * Copyright 2015, Teo Mrnjavac * * 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 #include #include +#include "Branding.h" // CalaPM #include @@ -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 new %2 system partition." ) + .arg( Calamares::Branding::instance()->string( + Calamares::Branding::ShortProductName ) ) + .arg( fsType ) ); + else + lines.append( tr( "Set up new %2 partition with mount point " + "%1." ) + .arg( mountPoint ) + .arg( fsType ) ); + } + else + { + if ( mountPoint == "/" ) + lines.append( tr( "Install %2 on %3 system partition %1." ) + .arg( path ) + .arg( Calamares::Branding::instance()->string( + Calamares::Branding::ShortProductName ) ) + .arg( fsType ) ); + else + lines.append( tr( "Set up %3 partition %1 with mount point " + "%2." ) + .arg( path ) + .arg( mountPoint ) + .arg( fsType ) ); + } + } + } + + QVariant bootloaderMap = createBootLoaderMap(); + if ( !m_bootLoaderPath.isEmpty() ) + { + lines.append( tr( "Install boot loader on %1." ) + .arg( m_bootLoaderPath ) ); + } + return lines.join( "
" ); +} + 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; diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.h b/src/modules/partition/jobs/FillGlobalStorageJob.h index 5ed87f06f..c514e624b 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.h +++ b/src/modules/partition/jobs/FillGlobalStorageJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Aurélien Gâteau + * Copyright 2015, Teo Mrnjavac * * 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 */