Partitions: use an enum with clear semantics instead of bool
This commit is contained in:
parent
42d5e6d1c4
commit
a62143f62b
@ -16,7 +16,7 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PartUtils.h"
|
||||
#include "DeviceList.h"
|
||||
|
||||
#include "PartitionCoreModule.h"
|
||||
|
||||
@ -98,8 +98,10 @@ isIso9660( const Device* device )
|
||||
}
|
||||
|
||||
|
||||
QList< Device* > getDevices( bool writableOnly )
|
||||
QList< Device* > getDevices( DeviceType which )
|
||||
{
|
||||
bool writableOnly = (which == DeviceType::WritableOnly);
|
||||
|
||||
using DeviceList = QList< Device* >;
|
||||
|
||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||
|
@ -28,13 +28,17 @@ class Device;
|
||||
namespace PartUtils
|
||||
{
|
||||
|
||||
enum class DeviceType { All, WritableOnly };
|
||||
|
||||
/**
|
||||
* @brief Gets a list of storage devices.
|
||||
* @param writableOnly if set to true, only devices which can be overwritten
|
||||
* @param which Can be used to select from all the devices in
|
||||
* the system, filtering out those that do not meet a criterium.
|
||||
* If set to WritableOnly, only devices which can be overwritten
|
||||
* safely are returned (e.g. RO-media are ignored, as are mounted partitions).
|
||||
* @return a list of Devices meeting this criterium.
|
||||
*/
|
||||
QList< Device* > getDevices( bool writableOnly = false );
|
||||
QList< Device* > getDevices( DeviceType which = DeviceType::All );
|
||||
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ PartitionCoreModule::doInit()
|
||||
FileSystemFactory::init();
|
||||
|
||||
using DeviceList = QList< Device* >;
|
||||
DeviceList devices = PartUtils::getDevices( true );
|
||||
DeviceList devices = PartUtils::getDevices( PartUtils::DeviceType::WritableOnly );
|
||||
|
||||
cDebug() << "LIST OF DETECTED DEVICES:";
|
||||
cDebug() << "node\tcapacity\tname\tprettyName";
|
||||
|
Loading…
Reference in New Issue
Block a user