Replace complicated QPair type with custom LvmPV class.

This commit is contained in:
Andrius Štikonas 2016-11-02 23:07:01 +00:00
parent b2520a8dc6
commit 97aedd1806
4 changed files with 12 additions and 12 deletions

View File

@ -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()

View File

@ -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
};

View File

@ -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);
}
}

View File

@ -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