calamares/0018-Report-a-prettyDescription-for-FillGlobalStorageJob.patch
2015-04-10 18:20:30 +02:00

144 lines
5.4 KiB
Diff

From 39462ed7273e0c70d48ccce980d439bf09c8ce25 Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Fri, 10 Apr 2015 17:46:42 +0200
Subject: [PATCH 18/18] Report a prettyDescription for FillGlobalStorageJob.
---
.../partition/jobs/FillGlobalStorageJob.cpp | 63 +++++++++++++++++++++-
src/modules/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 83783c4..61fbee9 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 - <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;
diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.h b/src/modules/partition/jobs/FillGlobalStorageJob.h
index 5ed87f0..c514e62 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 - <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 */
--
1.9.0