From 8568c2c81600a69e64d6cf8383baf0807eff37d7 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 9 Apr 2015 15:16:09 +0200 Subject: [PATCH] Add prettyDescription to most Partitioning jobs. --- .../partition/jobs/CreatePartitionJob.cpp | 19 +++++++++++++++---- .../partition/jobs/CreatePartitionJob.h | 2 ++ .../jobs/CreatePartitionTableJob.cpp | 10 +++++++++- .../partition/jobs/CreatePartitionTableJob.h | 2 ++ .../partition/jobs/DeletePartitionJob.cpp | 10 +++++++++- .../partition/jobs/DeletePartitionJob.h | 2 ++ .../partition/jobs/FormatPartitionJob.cpp | 13 ++++++++++++- .../partition/jobs/FormatPartitionJob.h | 2 ++ .../partition/jobs/ResizePartitionJob.cpp | 11 +++++++++++ .../partition/jobs/ResizePartitionJob.h | 2 ++ 10 files changed, 66 insertions(+), 7 deletions(-) diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index f2eef3d3f..517d238f9 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.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 @@ -44,10 +45,20 @@ CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition ) QString CreatePartitionJob::prettyName() const { - return tr( "Create partition (file system: %1, size: %2 MB) on %3." ) - .arg( m_partition->fileSystem().name() ) - .arg( m_partition->capacity() / 1024 / 1024 ) - .arg( m_device->name() ); + return tr( "Create new %2MB partition on %3 with file system %1." ) + .arg( m_partition->fileSystem().name() ) + .arg( m_partition->capacity() / 1024 / 1024 ) + .arg( m_device->name() ); +} + + +QString +CreatePartitionJob::prettyDescription() const +{ + return tr( "Create new %2MB partition on %3 with file system %1." ) + .arg( m_partition->fileSystem().name() ) + .arg( m_partition->capacity() / 1024 / 1024 ) + .arg( m_device->name() ); } Calamares::JobResult diff --git a/src/modules/partition/jobs/CreatePartitionJob.h b/src/modules/partition/jobs/CreatePartitionJob.h index 648043440..33ad161b8 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.h +++ b/src/modules/partition/jobs/CreatePartitionJob.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 @@ -38,6 +39,7 @@ class CreatePartitionJob : public PartitionJob public: CreatePartitionJob( Device* device, Partition* partition ); QString prettyName() const override; + QString prettyDescription() const override; Calamares::JobResult exec() override; void updatePreview(); diff --git a/src/modules/partition/jobs/CreatePartitionTableJob.cpp b/src/modules/partition/jobs/CreatePartitionTableJob.cpp index b238a262e..ba0ac8a62 100644 --- a/src/modules/partition/jobs/CreatePartitionTableJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionTableJob.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 @@ -45,7 +46,14 @@ CreatePartitionTableJob::CreatePartitionTableJob( Device* device, PartitionTable QString CreatePartitionTableJob::prettyName() const { - return tr( "Create partition table" ); // FIXME + return tr( "Create partition table" ); +} + +QString CreatePartitionTableJob::prettyDescription() const +{ + return tr( "Create new %1 partition table on %2." ) + .arg( PartitionTable::tableTypeToName( m_type ) ) + .arg( m_device->deviceNode() ); } Calamares::JobResult diff --git a/src/modules/partition/jobs/CreatePartitionTableJob.h b/src/modules/partition/jobs/CreatePartitionTableJob.h index 93a6cd19f..92235e798 100644 --- a/src/modules/partition/jobs/CreatePartitionTableJob.h +++ b/src/modules/partition/jobs/CreatePartitionTableJob.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 @@ -38,6 +39,7 @@ class CreatePartitionTableJob : public Calamares::Job public: CreatePartitionTableJob( Device* device, PartitionTable::TableType type ); QString prettyName() const override; + QString prettyDescription() const override; Calamares::JobResult exec() override; void updatePreview(); diff --git a/src/modules/partition/jobs/DeletePartitionJob.cpp b/src/modules/partition/jobs/DeletePartitionJob.cpp index d9ec56f84..b29dc2b23 100644 --- a/src/modules/partition/jobs/DeletePartitionJob.cpp +++ b/src/modules/partition/jobs/DeletePartitionJob.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 @@ -38,7 +39,14 @@ DeletePartitionJob::DeletePartitionJob( Device* device, Partition* partition ) QString DeletePartitionJob::prettyName() const { - return tr( "Delete partition %1" ).arg( m_partition->partitionPath() ); + return tr( "Delete partition %1." ).arg( m_partition->partitionPath() ); +} + + +QString +DeletePartitionJob::prettyDescription() const +{ + return tr( "Delete partition %1." ).arg( m_partition->partitionPath() ); } Calamares::JobResult diff --git a/src/modules/partition/jobs/DeletePartitionJob.h b/src/modules/partition/jobs/DeletePartitionJob.h index aabacc9c0..3d4771e72 100644 --- a/src/modules/partition/jobs/DeletePartitionJob.h +++ b/src/modules/partition/jobs/DeletePartitionJob.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 @@ -38,6 +39,7 @@ class DeletePartitionJob : public PartitionJob public: DeletePartitionJob( Device* device, Partition* partition ); QString prettyName() const override; + QString prettyDescription() const override; Calamares::JobResult exec() override; void updatePreview(); diff --git a/src/modules/partition/jobs/FormatPartitionJob.cpp b/src/modules/partition/jobs/FormatPartitionJob.cpp index d3817beec..b70625171 100644 --- a/src/modules/partition/jobs/FormatPartitionJob.cpp +++ b/src/modules/partition/jobs/FormatPartitionJob.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 @@ -48,7 +49,17 @@ FormatPartitionJob::prettyName() const .arg( m_partition->partitionPath() ) .arg( m_partition->fileSystem().name() ) .arg( m_partition->capacity() / 1024 / 1024 ) - .arg( m_device->name() ); + .arg( m_device->name() ); +} + + +QString +FormatPartitionJob::prettyDescription() const +{ + return tr( "Format %3MB partition %1 with file system %2." ) + .arg( m_partition->partitionPath() ) + .arg( m_partition->fileSystem().name() ) + .arg( m_partition->capacity() / 1024 / 1024 ); } Calamares::JobResult diff --git a/src/modules/partition/jobs/FormatPartitionJob.h b/src/modules/partition/jobs/FormatPartitionJob.h index e014389a0..1bb8453a5 100644 --- a/src/modules/partition/jobs/FormatPartitionJob.h +++ b/src/modules/partition/jobs/FormatPartitionJob.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 @@ -37,6 +38,7 @@ class FormatPartitionJob : public PartitionJob public: FormatPartitionJob( Device* device, Partition* partition ); QString prettyName() const override; + QString prettyDescription() const override; Calamares::JobResult exec() override; Device* device() const diff --git a/src/modules/partition/jobs/ResizePartitionJob.cpp b/src/modules/partition/jobs/ResizePartitionJob.cpp index 4f9bd2ea2..6fca1fb2d 100644 --- a/src/modules/partition/jobs/ResizePartitionJob.cpp +++ b/src/modules/partition/jobs/ResizePartitionJob.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 @@ -186,6 +187,16 @@ ResizePartitionJob::prettyName() const return tr( "Resize partition %1." ).arg( partition()->partitionPath() ); } + +QString +ResizePartitionJob::prettyDescription() const +{ + return tr( "Resize %2MB partition %1 to %3MB." ) + .arg( partition()->partitionPath() ) + .arg( partition()->capacity() / 1024 / 1024 ) + .arg( ( m_newLastSector - m_newFirstSector + 1 ) * partition()->sectorSize() / 1024 / 1024 ); +} + Calamares::JobResult ResizePartitionJob::exec() { diff --git a/src/modules/partition/jobs/ResizePartitionJob.h b/src/modules/partition/jobs/ResizePartitionJob.h index d1b55938b..8952745f3 100644 --- a/src/modules/partition/jobs/ResizePartitionJob.h +++ b/src/modules/partition/jobs/ResizePartitionJob.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 @@ -36,6 +37,7 @@ class ResizePartitionJob : public PartitionJob public: ResizePartitionJob( Device* device, Partition* partition, qint64 firstSector, qint64 lastSector ); QString prettyName() const override; + QString prettyDescription() const override; Calamares::JobResult exec() override; void updatePreview();