[partition] Implement config-side of a replace-filesystem choice

This commit is contained in:
Adriaan de Groot 2022-06-02 18:29:35 +02:00
parent b763087e11
commit 3b55b65a34
2 changed files with 18 additions and 2 deletions

View File

@ -213,7 +213,7 @@ Config::setSwapChoice( Config::SwapChoice c )
void void
Config::setEraseFsTypeChoice( const QString& choice ) Config::setEraseFsTypeChoice( const QString& choice )
{ {
QString canonicalChoice = PartUtils::canonicalFilesystemName( choice, nullptr ); const QString canonicalChoice = PartUtils::canonicalFilesystemName( choice, nullptr );
if ( canonicalChoice != m_eraseFsTypeChoice ) if ( canonicalChoice != m_eraseFsTypeChoice )
{ {
m_eraseFsTypeChoice = canonicalChoice; 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 bool
Config::acceptPartitionTableType( PartitionTable::TableType tableType ) const Config::acceptPartitionTableType( PartitionTable::TableType tableType ) const
{ {

View File

@ -31,7 +31,8 @@ class Config : public QObject
Q_PROPERTY( Q_PROPERTY(
QString eraseModeFilesystem READ eraseFsType WRITE setEraseFsTypeChoice NOTIFY eraseModeFilesystemChanged ) 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 ) Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL )
@ -124,6 +125,9 @@ public:
*/ */
QString eraseFsType() const { return m_eraseFsTypeChoice; } 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) /** @brief Configured default FS type (for other modes than erase)
* *
* This is not "Unknown" or "Unformatted" * This is not "Unknown" or "Unformatted"
@ -161,6 +165,7 @@ private:
void fillConfigurationFSTypes( const QVariantMap& configurationMap ); void fillConfigurationFSTypes( const QVariantMap& configurationMap );
EraseFsTypesSet m_eraseFsTypes; EraseFsTypesSet m_eraseFsTypes;
QString m_eraseFsTypeChoice; QString m_eraseFsTypeChoice;
QString m_replaceFileSystemChoice;
FileSystem::Type m_defaultFsType; FileSystem::Type m_defaultFsType;
SwapChoiceSet m_swapChoices; SwapChoiceSet m_swapChoices;