mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 10:55:37 -04:00
[partition] Shuffle new conveniences into partition service
- the general stuff from KPMHelpers ends up in the partition service; that only gets compiled when KPMCore is available anyway.
This commit is contained in:
parent
e72ecaafd3
commit
d931b146e3
9 changed files with 55 additions and 37 deletions
|
@ -33,6 +33,32 @@ namespace CalamaresUtils
|
||||||
namespace Partition
|
namespace Partition
|
||||||
{
|
{
|
||||||
QString prettyNameForFileSystemType( FileSystem::Type t );
|
QString prettyNameForFileSystemType( FileSystem::Type t );
|
||||||
|
|
||||||
|
static inline QString
|
||||||
|
untranslatedFS( FileSystem& fs )
|
||||||
|
{
|
||||||
|
return fs.name( { QStringLiteral( "C" ) } );
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline QString
|
||||||
|
untranslatedFS( FileSystem* fs )
|
||||||
|
{
|
||||||
|
return fs ? untranslatedFS( *fs ) : QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline QString
|
||||||
|
userVisibleFS( FileSystem& fs )
|
||||||
|
{
|
||||||
|
return fs.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline QString
|
||||||
|
userVisibleFS( FileSystem* fs )
|
||||||
|
{
|
||||||
|
return fs ? userVisibleFS( *fs ) : QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Partition
|
} // namespace Partition
|
||||||
} // namespace CalamaresUtils
|
} // namespace CalamaresUtils
|
||||||
|
|
||||||
|
|
|
@ -79,30 +79,6 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
|
||||||
|
|
||||||
Partition* clonePartition( Device* device, Partition* partition );
|
Partition* clonePartition( Device* device, Partition* partition );
|
||||||
|
|
||||||
static inline QString
|
|
||||||
untranslatedFS( FileSystem& fs )
|
|
||||||
{
|
|
||||||
return fs.name( { QStringLiteral( "C" ) } );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QString
|
|
||||||
untranslatedFS( FileSystem* fs )
|
|
||||||
{
|
|
||||||
return fs ? untranslatedFS( *fs ) : QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QString
|
|
||||||
userVisibleFS( FileSystem& fs )
|
|
||||||
{
|
|
||||||
return fs.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QString
|
|
||||||
userVisibleFS( FileSystem* fs )
|
|
||||||
{
|
|
||||||
return fs ? userVisibleFS( *fs ) : QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* KPMHELPERS_H */
|
#endif /* KPMHELPERS_H */
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "partition/PartitionQuery.h"
|
#include "partition/PartitionQuery.h"
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
|
@ -52,6 +53,9 @@
|
||||||
#include <QRegularExpressionValidator>
|
#include <QRegularExpressionValidator>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
|
|
||||||
static QSet< FileSystem::Type > s_unmountableFS(
|
static QSet< FileSystem::Type > s_unmountableFS(
|
||||||
{
|
{
|
||||||
FileSystem::Unformatted,
|
FileSystem::Unformatted,
|
||||||
|
@ -113,7 +117,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
||||||
if ( fs->supportCreate() != FileSystem::cmdSupportNone &&
|
if ( fs->supportCreate() != FileSystem::cmdSupportNone &&
|
||||||
fs->type() != FileSystem::Extended )
|
fs->type() != FileSystem::Extended )
|
||||||
{
|
{
|
||||||
fsNames << KPMHelpers::userVisibleFS( fs ); // This is put into the combobox
|
fsNames << userVisibleFS( fs ); // This is put into the combobox
|
||||||
if ( fs->type() == defaultFSType )
|
if ( fs->type() == defaultFSType )
|
||||||
defaultFsIndex = fsCounter;
|
defaultFsIndex = fsCounter;
|
||||||
fsCounter++;
|
fsCounter++;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
|
@ -48,6 +49,9 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
|
|
||||||
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
|
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
|
||||||
: QDialog( parentWidget )
|
: QDialog( parentWidget )
|
||||||
, m_ui( new Ui_EditExistingPartitionDialog )
|
, m_ui( new Ui_EditExistingPartitionDialog )
|
||||||
|
@ -77,7 +81,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
||||||
m_ui->fileSystemComboBox->setEnabled( doFormat );
|
m_ui->fileSystemComboBox->setEnabled( doFormat );
|
||||||
|
|
||||||
if ( !doFormat )
|
if ( !doFormat )
|
||||||
m_ui->fileSystemComboBox->setCurrentText( KPMHelpers::userVisibleFS( m_partition->fileSystem() ) );
|
m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) );
|
||||||
|
|
||||||
updateMountPointPicker();
|
updateMountPointPicker();
|
||||||
} );
|
} );
|
||||||
|
@ -93,7 +97,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
||||||
for ( auto fs : FileSystemFactory::map() )
|
for ( auto fs : FileSystemFactory::map() )
|
||||||
{
|
{
|
||||||
if ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended )
|
if ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended )
|
||||||
fsNames << KPMHelpers::userVisibleFS( fs ); // For the combo box
|
fsNames << userVisibleFS( fs ); // For the combo box
|
||||||
}
|
}
|
||||||
m_ui->fileSystemComboBox->addItems( fsNames );
|
m_ui->fileSystemComboBox->addItems( fsNames );
|
||||||
|
|
||||||
|
@ -107,7 +111,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
||||||
defaultFSType = FileSystem::Type::Ext4;
|
defaultFSType = FileSystem::Type::Ext4;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString thisFSNameForUser = KPMHelpers::userVisibleFS( m_partition->fileSystem() );
|
QString thisFSNameForUser = userVisibleFS( m_partition->fileSystem() );
|
||||||
if ( fsNames.contains( thisFSNameForUser ) )
|
if ( fsNames.contains( thisFSNameForUser ) )
|
||||||
m_ui->fileSystemComboBox->setCurrentText( thisFSNameForUser );
|
m_ui->fileSystemComboBox->setCurrentText( thisFSNameForUser );
|
||||||
else
|
else
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
|
||||||
|
@ -38,6 +39,9 @@
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
|
|
||||||
ReplaceWidget::ReplaceWidget( PartitionCoreModule* core,
|
ReplaceWidget::ReplaceWidget( PartitionCoreModule* core,
|
||||||
QComboBox* devicesComboBox,
|
QComboBox* devicesComboBox,
|
||||||
QWidget* parent )
|
QWidget* parent )
|
||||||
|
@ -193,7 +197,7 @@ ReplaceWidget::onPartitionSelected()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fsNameForUser = KPMHelpers::userVisibleFS( partition->fileSystem() );
|
QString fsNameForUser = userVisibleFS( partition->fileSystem() );
|
||||||
QString prettyName = tr( "Data partition (%1)" ).arg( fsNameForUser );
|
QString prettyName = tr( "Data partition (%1)" ).arg( fsNameForUser );
|
||||||
for ( const QString& line : osproberLines )
|
for ( const QString& line : osproberLines )
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
|
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
|
|
||||||
|
@ -34,8 +35,8 @@
|
||||||
#include <kpmcore/ops/newoperation.h>
|
#include <kpmcore/ops/newoperation.h>
|
||||||
#include <kpmcore/util/report.h>
|
#include <kpmcore/util/report.h>
|
||||||
|
|
||||||
using KPMHelpers::untranslatedFS;
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
using KPMHelpers::userVisibleFS;
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
|
|
||||||
CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
|
CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
|
||||||
: PartitionJob( partition )
|
: PartitionJob( partition )
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "partition/PartitionIterator.h"
|
#include "partition/PartitionIterator.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
|
@ -44,8 +45,8 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
using KPMHelpers::untranslatedFS;
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
using KPMHelpers::userVisibleFS;
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
using CalamaresUtils::Partition::PartitionIterator;
|
using CalamaresUtils::Partition::PartitionIterator;
|
||||||
|
|
||||||
typedef QHash< QString, QString > UuidForPartitionHash;
|
typedef QHash< QString, QString > UuidForPartitionHash;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
|
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
|
@ -31,8 +32,8 @@
|
||||||
#include <kpmcore/ops/createfilesystemoperation.h>
|
#include <kpmcore/ops/createfilesystemoperation.h>
|
||||||
#include <kpmcore/util/report.h>
|
#include <kpmcore/util/report.h>
|
||||||
|
|
||||||
using KPMHelpers::untranslatedFS;
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
using KPMHelpers::userVisibleFS;
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
|
|
||||||
FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
|
FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
|
||||||
: PartitionJob( partition )
|
: PartitionJob( partition )
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
|
|
||||||
|
#include "partition/FileSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
|
|
||||||
|
@ -34,8 +35,8 @@
|
||||||
#include <kpmcore/util/report.h>
|
#include <kpmcore/util/report.h>
|
||||||
|
|
||||||
using CalamaresUtils::BytesToMiB;
|
using CalamaresUtils::BytesToMiB;
|
||||||
using KPMHelpers::untranslatedFS;
|
using CalamaresUtils::Partition::untranslatedFS;
|
||||||
using KPMHelpers::userVisibleFS;
|
using CalamaresUtils::Partition::userVisibleFS;
|
||||||
|
|
||||||
SetPartFlagsJob::SetPartFlagsJob( Device* device,
|
SetPartFlagsJob::SetPartFlagsJob( Device* device,
|
||||||
Partition* partition,
|
Partition* partition,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue