Replace complicated QPair type with custom LvmPV class.
This commit is contained in:
parent
b2520a8dc6
commit
97aedd1806
|
@ -27,7 +27,7 @@
|
|||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, FS::lvm2_pv::PhysicalVolumes physicalVolumes, QList<Device*> devices)
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, QList<LvmPV> physicalVolumes, QList<Device*> devices)
|
||||
: VolumeGroupDialog(parent, vgName, pvList)
|
||||
, m_PESize(peSize)
|
||||
, m_PhysicalVolumes(physicalVolumes)
|
||||
|
@ -49,8 +49,8 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgNam
|
|||
void CreateVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
for (const auto &p : m_PhysicalVolumes)
|
||||
if (p.first == QString() && !LvmDevice::s_DirtyPVs.contains(p.second))
|
||||
dialogWidget().listPV().addPartition(*p.second, false);
|
||||
if (p.vgName() == QString() && !LvmDevice::s_DirtyPVs.contains(p.partition()))
|
||||
dialogWidget().listPV().addPartition(*p.partition(), false);
|
||||
}
|
||||
|
||||
void CreateVolumeGroupDialog::setupConnections()
|
||||
|
|
|
@ -31,7 +31,7 @@ class CreateVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(CreateVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, FS::lvm2_pv::PhysicalVolumes physicalVolumes, QList<Device*> devices);
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QList<const Partition*>& pvList, qint32& peSize, QList<LvmPV> physicalVolumes, QList<Device*> devices);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -49,7 +49,7 @@ protected:
|
|||
qint32& m_PESize;
|
||||
|
||||
private:
|
||||
const FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all LVM Physical Volumes found on the system
|
||||
const QList<LvmPV> m_PhysicalVolumes; // List of all LVM Physical Volumes found on the system
|
||||
const QList<Device*> m_Devices; // List of all devices found on the system
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
@param parent pointer to the parent widget
|
||||
@param d the Device to show properties for
|
||||
*/
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QList<const Partition*>& partList, FS::lvm2_pv::PhysicalVolumes physicalVolumes)
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QList<const Partition*>& partList, QList<LvmPV> physicalVolumes)
|
||||
: VolumeGroupDialog(parent, d->name(), partList)
|
||||
, m_Device(d)
|
||||
, m_PhysicalVolumes(physicalVolumes)
|
||||
|
@ -52,10 +52,10 @@ void ResizeVolumeGroupDialog::setupDialog()
|
|||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
for (const auto &p : m_PhysicalVolumes) {
|
||||
if (p.first == device()->name())
|
||||
dialogWidget().listPV().addPartition(*p.second, true);
|
||||
else if (p.first == QString() && !LvmDevice::s_DirtyPVs.contains(p.second)) // TODO: Remove LVM PVs in current VG
|
||||
dialogWidget().listPV().addPartition(*p.second, false);
|
||||
if (p.vgName() == device()->name())
|
||||
dialogWidget().listPV().addPartition(*p.partition(), true);
|
||||
else if (p.vgName() == QString() && !LvmDevice::s_DirtyPVs.contains(p.partition())) // TODO: Remove LVM PVs in current VG
|
||||
dialogWidget().listPV().addPartition(*p.partition(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QList<const Partition*>& partList, FS::lvm2_pv::PhysicalVolumes physicalVolumes);
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QList<const Partition*>& partList, QList<LvmPV> physicalVolumes);
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -44,7 +44,7 @@ protected:
|
|||
|
||||
private:
|
||||
VolumeManagerDevice* m_Device;
|
||||
const FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
const QList<LvmPV> m_PhysicalVolumes; // List of all devices found on the system
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue