[libcalamares] Move KPMcore-dependencies

- FileSystem.h depends on KPMcore and only compiles when
  KPMcore is present; it can use KPMcore identifiers.
- Global.h doesn't.
- Move the few functions introduced into Global.h that need
  KPMcore, to FileSystem.h instead.
This commit is contained in:
Adriaan de Groot 2022-07-19 11:46:57 +02:00
parent 04e93f513c
commit 97cbebc0f7
2 changed files with 24 additions and 27 deletions

View File

@ -19,6 +19,7 @@
#define PARTITION_FILESYSTEM_H #define PARTITION_FILESYSTEM_H
#include "DllMacro.h" #include "DllMacro.h"
#include "partition/Global.h"
#include <kpmcore/fs/filesystem.h> #include <kpmcore/fs/filesystem.h>
@ -70,6 +71,28 @@ userVisibleFS( FileSystem* fs )
return fs ? userVisibleFS( *fs ) : QString(); return fs ? userVisibleFS( *fs ) : QString();
} }
/** @brief Mark a particular filesystem type as used (or not)
*
* See useFilesystemGS(const QString&, bool); this method uses the filesystem type
* enumeration to pick the name. (The other implementation is in `Global.h`
* because it touches Global Storage, but this one needs KPMcore)
*/
inline void
useFilesystemGS( FileSystem::Type filesystem, bool used )
{
useFilesystemGS( untranslatedFS( filesystem ), used );
}
/* @brief Reads from global storage whether the typesystem type is used
*
* See isFilesystemUsedGS(const QString&). (The other implementation is in `Global.h`
* because it touches Global Storage, but this one needs KPMcore)
*/
inline bool
isFilesystemUsedGS( FileSystem::Type filesystem )
{
return isFilesystemUsedGS( untranslatedFS( filesystem ) );
}
} // namespace Partition } // namespace Partition
} // namespace CalamaresUtils } // namespace CalamaresUtils

View File

@ -10,20 +10,15 @@
/* /*
* This is the API for manipulating Global Storage keys related to * This is the API for manipulating Global Storage keys related to
* filesystems and partitions. * filesystems and partitions. This does **not** depend on KPMcore.
*/ */
#ifndef PARTITION_GLOBAL_H #ifndef PARTITION_GLOBAL_H
#define PARTITION_GLOBAL_H #define PARTITION_GLOBAL_H
#include "DllMacro.h" #include "DllMacro.h"
#include "FileSystem.h"
#include "JobQueue.h" #include "JobQueue.h"
// TODO: this assumes KPMcore is present, but the header and TU
// are used always.
#include <kpmcore/fs/filesystem.h>
namespace CalamaresUtils namespace CalamaresUtils
{ {
namespace Partition namespace Partition
@ -77,27 +72,6 @@ isFilesystemUsedGS( const QString& filesystemType )
return isFilesystemUsedGS( Calamares::JobQueue::instanceGlobalStorage(), filesystemType ); return isFilesystemUsedGS( Calamares::JobQueue::instanceGlobalStorage(), filesystemType );
} }
/** @brief Mark a particular filesystem type as used (or not)
*
* See useFilesystemGS(const QString&, bool); this method uses the filesystem type
* enumeration to pick the name.
*/
inline void
useFilesystemGS( FileSystem::Type filesystem, bool used )
{
useFilesystemGS( untranslatedFS( filesystem ), used );
}
/* @brief Reads from global storage whether the typesystem type is used
*
* See isFilesystemUsedGS(const QString&).
*/
inline bool
isFilesystemUsedGS( FileSystem::Type filesystem )
{
return isFilesystemUsedGS( untranslatedFS( filesystem ) );
}
} // namespace Partition } // namespace Partition
} // namespace CalamaresUtils } // namespace CalamaresUtils