Add a function to convert QStringList of flag names to flags.
CCBUG: 400331
This commit is contained in:
parent
8139d5c295
commit
92065f7a23
|
@ -269,6 +269,20 @@ QStringList PartitionTable::flagNames(Flags flags)
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param list QStringList of the flags' names
|
||||||
|
@returns flags corresponding to names
|
||||||
|
*/
|
||||||
|
PartitionTable::Flags PartitionTable::flagsFromList(const QStringList list)
|
||||||
|
{
|
||||||
|
Flags flags;
|
||||||
|
|
||||||
|
for (const auto &flag : flagList())
|
||||||
|
if (list.contains(flagName(flag)))
|
||||||
|
flags.setFlag(flag);
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent, qint64& start, qint64& end)
|
bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent, qint64& start, qint64& end)
|
||||||
{
|
{
|
||||||
if (d.type() == Device::Type::Disk_Device) {
|
if (d.type() == Device::Type::Disk_Device) {
|
||||||
|
|
|
@ -184,6 +184,7 @@ public:
|
||||||
static const QList<Flag> flagList();
|
static const QList<Flag> flagList();
|
||||||
static QString flagName(Flag f);
|
static QString flagName(Flag f);
|
||||||
static QStringList flagNames(Flags f);
|
static QStringList flagNames(Flags f);
|
||||||
|
static PartitionTable::Flags flagsFromList(const QStringList list);
|
||||||
|
|
||||||
static bool getUnallocatedRange(const Device& device, PartitionNode& parent, qint64& start, qint64& end);
|
static bool getUnallocatedRange(const Device& device, PartitionNode& parent, qint64& start, qint64& end);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue