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
|
||||
{
|
||||
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 CalamaresUtils
|
||||
|
||||
|
|
|
@ -79,30 +79,6 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
|
|||
|
||||
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 */
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "partition/PartitionQuery.h"
|
||||
#include "partition/FileSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
// KPMcore
|
||||
|
@ -52,6 +53,9 @@
|
|||
#include <QRegularExpressionValidator>
|
||||
#include <QSet>
|
||||
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
static QSet< FileSystem::Type > s_unmountableFS(
|
||||
{
|
||||
FileSystem::Unformatted,
|
||||
|
@ -113,7 +117,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||
if ( fs->supportCreate() != FileSystem::cmdSupportNone &&
|
||||
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 )
|
||||
defaultFsIndex = fsCounter;
|
||||
fsCounter++;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "partition/FileSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
// KPMcore
|
||||
|
@ -48,6 +49,9 @@
|
|||
#include <QDir>
|
||||
#include <QPushButton>
|
||||
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
|
||||
: QDialog( parentWidget )
|
||||
, m_ui( new Ui_EditExistingPartitionDialog )
|
||||
|
@ -77,7 +81,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
|||
m_ui->fileSystemComboBox->setEnabled( doFormat );
|
||||
|
||||
if ( !doFormat )
|
||||
m_ui->fileSystemComboBox->setCurrentText( KPMHelpers::userVisibleFS( m_partition->fileSystem() ) );
|
||||
m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) );
|
||||
|
||||
updateMountPointPicker();
|
||||
} );
|
||||
|
@ -93,7 +97,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
|||
for ( auto fs : FileSystemFactory::map() )
|
||||
{
|
||||
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 );
|
||||
|
||||
|
@ -107,7 +111,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
|||
defaultFSType = FileSystem::Type::Ext4;
|
||||
}
|
||||
|
||||
QString thisFSNameForUser = KPMHelpers::userVisibleFS( m_partition->fileSystem() );
|
||||
QString thisFSNameForUser = userVisibleFS( m_partition->fileSystem() );
|
||||
if ( fsNames.contains( thisFSNameForUser ) )
|
||||
m_ui->fileSystemComboBox->setCurrentText( thisFSNameForUser );
|
||||
else
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "Branding.h"
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "partition/FileSystem.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
|
@ -38,6 +39,9 @@
|
|||
|
||||
#include <QComboBox>
|
||||
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
ReplaceWidget::ReplaceWidget( PartitionCoreModule* core,
|
||||
QComboBox* devicesComboBox,
|
||||
QWidget* parent )
|
||||
|
@ -193,7 +197,7 @@ ReplaceWidget::onPartitionSelected()
|
|||
return;
|
||||
}
|
||||
|
||||
QString fsNameForUser = KPMHelpers::userVisibleFS( partition->fileSystem() );
|
||||
QString fsNameForUser = userVisibleFS( partition->fileSystem() );
|
||||
QString prettyName = tr( "Data partition (%1)" ).arg( fsNameForUser );
|
||||
for ( const QString& line : osproberLines )
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "core/KPMHelpers.h"
|
||||
|
||||
#include "partition/FileSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Units.h"
|
||||
|
||||
|
@ -34,8 +35,8 @@
|
|||
#include <kpmcore/ops/newoperation.h>
|
||||
#include <kpmcore/util/report.h>
|
||||
|
||||
using KPMHelpers::untranslatedFS;
|
||||
using KPMHelpers::userVisibleFS;
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition )
|
||||
: PartitionJob( partition )
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
#include "partition/FileSystem.h"
|
||||
#include "partition/PartitionIterator.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
|
@ -44,8 +45,8 @@
|
|||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
|
||||
using KPMHelpers::untranslatedFS;
|
||||
using KPMHelpers::userVisibleFS;
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
using CalamaresUtils::Partition::PartitionIterator;
|
||||
|
||||
typedef QHash< QString, QString > UuidForPartitionHash;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "core/KPMHelpers.h"
|
||||
|
||||
#include "partition/FileSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
// KPMcore
|
||||
|
@ -31,8 +32,8 @@
|
|||
#include <kpmcore/ops/createfilesystemoperation.h>
|
||||
#include <kpmcore/util/report.h>
|
||||
|
||||
using KPMHelpers::untranslatedFS;
|
||||
using KPMHelpers::userVisibleFS;
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
|
||||
: PartitionJob( partition )
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "core/KPMHelpers.h"
|
||||
|
||||
#include "partition/FileSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Units.h"
|
||||
|
||||
|
@ -34,8 +35,8 @@
|
|||
#include <kpmcore/util/report.h>
|
||||
|
||||
using CalamaresUtils::BytesToMiB;
|
||||
using KPMHelpers::untranslatedFS;
|
||||
using KPMHelpers::userVisibleFS;
|
||||
using CalamaresUtils::Partition::untranslatedFS;
|
||||
using CalamaresUtils::Partition::userVisibleFS;
|
||||
|
||||
SetPartFlagsJob::SetPartFlagsJob( Device* device,
|
||||
Partition* partition,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue