From 3b55b65a349e81f493965b41929893775729e79b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 2 Jun 2022 18:29:35 +0200 Subject: [PATCH] [partition] Implement config-side of a replace-filesystem choice --- src/modules/partition/Config.cpp | 13 ++++++++++++- src/modules/partition/Config.h | 7 ++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/Config.cpp b/src/modules/partition/Config.cpp index 367c4ee38..278503312 100644 --- a/src/modules/partition/Config.cpp +++ b/src/modules/partition/Config.cpp @@ -213,7 +213,7 @@ Config::setSwapChoice( Config::SwapChoice c ) void Config::setEraseFsTypeChoice( const QString& choice ) { - QString canonicalChoice = PartUtils::canonicalFilesystemName( choice, nullptr ); + const QString canonicalChoice = PartUtils::canonicalFilesystemName( choice, nullptr ); if ( canonicalChoice != m_eraseFsTypeChoice ) { m_eraseFsTypeChoice = canonicalChoice; @@ -221,6 +221,17 @@ Config::setEraseFsTypeChoice( const QString& choice ) } } +void +Config::setReplaceFilesystemChoice( const QString& filesystemName ) +{ + const QString canonicalChoice = PartUtils::canonicalFilesystemName( filesystemName, nullptr ); + if ( canonicalChoice != m_replaceFileSystemChoice ) + { + m_replaceFileSystemChoice = canonicalChoice; + Q_EMIT replaceModeFilesystemChanged( canonicalChoice ); + } +} + bool Config::acceptPartitionTableType( PartitionTable::TableType tableType ) const { diff --git a/src/modules/partition/Config.h b/src/modules/partition/Config.h index 1de3174b9..b82716fc2 100644 --- a/src/modules/partition/Config.h +++ b/src/modules/partition/Config.h @@ -31,7 +31,8 @@ class Config : public QObject Q_PROPERTY( QString eraseModeFilesystem READ eraseFsType WRITE setEraseFsTypeChoice NOTIFY eraseModeFilesystemChanged ) - Q_PROPERTY( QString replaceModeFilesystem READ replaceModeFilesystem WRITE setReplaceFilesystem NOTIFY replaceModeFilesystemChanged ) + Q_PROPERTY( QString replaceModeFilesystem READ replaceModeFilesystem WRITE setReplaceFilesystemChoice NOTIFY + replaceModeFilesystemChanged ) Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL ) @@ -124,6 +125,9 @@ public: */ QString eraseFsType() const { return m_eraseFsTypeChoice; } + /// @brief Currently-selected FS type for *replace* mode + QString replaceModeFilesystem() const { return m_replaceFileSystemChoice; } + /** @brief Configured default FS type (for other modes than erase) * * This is not "Unknown" or "Unformatted" @@ -161,6 +165,7 @@ private: void fillConfigurationFSTypes( const QVariantMap& configurationMap ); EraseFsTypesSet m_eraseFsTypes; QString m_eraseFsTypeChoice; + QString m_replaceFileSystemChoice; FileSystem::Type m_defaultFsType; SwapChoiceSet m_swapChoices;