Continue converting LVM away from QStrings to Partition objects.
This commit is contained in:
parent
280ba106e8
commit
007c2faf11
|
@ -48,11 +48,9 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, FS::lvm2_pv::P
|
|||
|
||||
void CreateVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
for (const auto &p : m_PhysicalVolumes) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p.second->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p.second->deviceNode(), false);
|
||||
}
|
||||
}
|
||||
for (const auto &p : m_PhysicalVolumes)
|
||||
if (p.first == QString() && !LvmDevice::s_DirtyPVs.contains(p.second->deviceNode()))
|
||||
dialogWidget().listPV().addPartition(*p.second, false);
|
||||
}
|
||||
|
||||
void CreateVolumeGroupDialog::setupConnections()
|
||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
|||
|
||||
private:
|
||||
QStringList m_SystemVGList;
|
||||
FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
const FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
class ListPhysicalVolumeWidgetItem : public QListWidgetItem
|
||||
{
|
||||
public:
|
||||
ListPhysicalVolumeWidgetItem(const QString& pvnode, bool checked) :
|
||||
QListWidgetItem(pvnode + QStringLiteral(" | ") + Capacity::formatByteSize(FS::lvm2_pv::getPVSize(pvnode)))
|
||||
ListPhysicalVolumeWidgetItem(const Partition& p, bool checked) :
|
||||
QListWidgetItem(p.deviceNode() + QStringLiteral(" | ") + Capacity::formatByteSize(p.capacity()))
|
||||
{
|
||||
setToolTip(pvnode);
|
||||
setToolTip(p.deviceNode());
|
||||
setSizeHint(QSize(0, 32));
|
||||
setCheckState( checked ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
@ -40,16 +40,9 @@ ListPhysicalVolumes::ListPhysicalVolumes(QWidget* parent) :
|
|||
setupUi(this);
|
||||
}
|
||||
|
||||
void ListPhysicalVolumes::addPartitionList(const QStringList& partlist, bool checked)
|
||||
void ListPhysicalVolumes::addPartition(const Partition& p, bool checked)
|
||||
{
|
||||
for (auto const &part : partlist) {
|
||||
addPartition(part, checked);
|
||||
}
|
||||
}
|
||||
|
||||
void ListPhysicalVolumes::addPartition(const QString& part, bool checked)
|
||||
{
|
||||
ListPhysicalVolumeWidgetItem *item = new ListPhysicalVolumeWidgetItem(part, checked);
|
||||
ListPhysicalVolumeWidgetItem *item = new ListPhysicalVolumeWidgetItem(p, checked);
|
||||
listPhysicalVolumes().addItem(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "ui_listphysicalvolumesbase.h"
|
||||
|
||||
#include <core/partition.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class Device;
|
||||
|
@ -34,8 +36,7 @@ class ListPhysicalVolumes : public QWidget, public Ui::ListPhysicalVolumesBase
|
|||
public:
|
||||
ListPhysicalVolumes(QWidget* parent = nullptr);
|
||||
|
||||
void addPartitionList(const QStringList& partlist, bool checked);
|
||||
void addPartition(const QString& part, bool checked);
|
||||
void addPartition(const Partition& p, bool checked);
|
||||
|
||||
QStringList checkedItems();
|
||||
|
||||
|
|
|
@ -51,11 +51,11 @@ ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, FS::lvm2_pv::P
|
|||
void ResizeVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
dialogWidget().listPV().addPartitionList(device().deviceNodes(), true);
|
||||
for (const auto &p : m_PhysicalVolumes) {
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p.second->deviceNode())) {
|
||||
dialogWidget().listPV().addPartition(p.second->deviceNode(), false);
|
||||
}
|
||||
if (p.first == device().name())
|
||||
dialogWidget().listPV().addPartition(*p.second, true);
|
||||
else if (p.first == QString() && !LvmDevice::s_DirtyPVs.contains(p.second->deviceNode())) // TODO: Remove LVM PVs in current VG
|
||||
dialogWidget().listPV().addPartition(*p.second, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
|
||||
private:
|
||||
VolumeManagerDevice& m_Device;
|
||||
FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
const FS::lvm2_pv::PhysicalVolumes m_PhysicalVolumes; // List of all devices found on the system
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue