Report a prettyDescription for FillGlobalStorageJob.

main
Teo Mrnjavac 10 years ago
parent f8995bc8e5
commit 2846cbdcbc

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Aurélien Gâteau <agateau@kde.org> * 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 * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,6 +24,7 @@
#include <core/PartitionInfo.h> #include <core/PartitionInfo.h>
#include <core/PartitionIterator.h> #include <core/PartitionIterator.h>
#include <core/PMUtils.h> #include <core/PMUtils.h>
#include "Branding.h"
// CalaPM // CalaPM
#include <core/device.h> #include <core/device.h>
@ -75,6 +77,63 @@ FillGlobalStorageJob::prettyName() const
return tr( "Set partition information" ); 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 Calamares::JobResult
FillGlobalStorageJob::exec() FillGlobalStorageJob::exec()
{ {
@ -88,7 +147,7 @@ FillGlobalStorageJob::exec()
} }
QVariant QVariant
FillGlobalStorageJob::createPartitionList() FillGlobalStorageJob::createPartitionList() const
{ {
UuidForPartitionHash hash = findPartitionUuids(); UuidForPartitionHash hash = findPartitionUuids();
QVariantList lst; QVariantList lst;
@ -99,7 +158,7 @@ FillGlobalStorageJob::createPartitionList()
} }
QVariant QVariant
FillGlobalStorageJob::createBootLoaderMap() FillGlobalStorageJob::createBootLoaderMap() const
{ {
QVariantMap map; QVariantMap map;
QString path = m_bootLoaderPath; QString path = m_bootLoaderPath;

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Aurélien Gâteau <agateau@kde.org> * 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 * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -40,13 +41,14 @@ class FillGlobalStorageJob : public Calamares::Job
public: public:
FillGlobalStorageJob( QList< Device* > devices, const QString& bootLoaderPath ); FillGlobalStorageJob( QList< Device* > devices, const QString& bootLoaderPath );
QString prettyName() const override; QString prettyName() const override;
QString prettyDescription() const override;
Calamares::JobResult exec() override; Calamares::JobResult exec() override;
private: private:
QList< Device* > m_devices; QList< Device* > m_devices;
QString m_bootLoaderPath; QString m_bootLoaderPath;
QVariant createPartitionList(); QVariant createPartitionList() const;
QVariant createBootLoaderMap(); QVariant createBootLoaderMap() const;
}; };
#endif /* FILLGLOBALSTORAGEJOB_H */ #endif /* FILLGLOBALSTORAGEJOB_H */

Loading…
Cancel
Save