From a606306e794a6dc0e879e588b7cd1e7ae06203f9 Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Wed, 11 Jul 2018 12:23:10 -0300 Subject: [PATCH] Showing SoftwareRAID device properties and allowing to create RAID device partition table. --- src/gui/devicepropsdialog.cpp | 2 ++ src/gui/infopane.cpp | 9 +++++++++ src/gui/mainwindow.cpp | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gui/devicepropsdialog.cpp b/src/gui/devicepropsdialog.cpp index 342bd77..883d11b 100644 --- a/src/gui/devicepropsdialog.cpp +++ b/src/gui/devicepropsdialog.cpp @@ -129,6 +129,8 @@ void DevicePropsDialog::setupDialog() } else { if (device().type() == Device::Type::LVM_Device) dialogWidget().type().setText(xi18nc("@label device", "LVM Volume Group")); + else if (device().type() == Device::Type::SoftwareRAID_Device) + dialogWidget().type().setText(xi18nc("@label device", "Software RAID Device")); else dialogWidget().type().setText(xi18nc("@label device", "Volume Manager Device")); //TODO: add Volume Manger Device info diff --git a/src/gui/infopane.cpp b/src/gui/infopane.cpp index b749719..dde9e53 100644 --- a/src/gui/infopane.cpp +++ b/src/gui/infopane.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -193,6 +194,14 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d) createLabels(i18nc("@label device", "Total PE:"),QString::number(lvm.totalPE()), cols(area), x, y); createLabels(i18nc("@label device", "Allocated PE:"), QString::number(lvm.allocatedPE()), cols(area), x, y); createLabels(i18nc("@label device", "Free PE:"), QString::number(lvm.freePE()), cols(area), x, y); + } else if (d.type() == Device::Type::SoftwareRAID_Device) { + const SoftwareRAID& raid = dynamic_cast(d); + createLabels(i18nc("@label device", "Volume Type:"), QStringLiteral("RAID"), cols(area), x, y); + createLabels(i18nc("@label device", "Capacity:"), Capacity::formatByteSize(raid.capacity()), cols(area), x, y); + createLabels(i18nc("@label device", "RAID Level:"), QString::number(raid.raidLevel()), cols(area), x, y); + createLabels(i18nc("@label device", "Chunk Size:"),Capacity::formatByteSize(raid.chunkSize()), cols(area), x, y); + createLabels(i18nc("@label device", "Total Chunk:"), Capacity::formatByteSize(raid.totalChunk()), cols(area), x, y); + createLabels(i18nc("@label device", "Array Size:"), Capacity::formatByteSize(raid.arraySize()), cols(area), x, y); } } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index a1a7ac0..1304058 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -484,7 +484,8 @@ void MainWindow::enableActions() actionCollection()->action(QStringLiteral("createNewPartitionTable")) ->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice())); actionCollection()->action(QStringLiteral("createNewPartitionTable")) - ->setVisible(pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::Type::Disk_Device); + ->setVisible(pmWidget().selectedDevice() && (pmWidget().selectedDevice()->type() == Device::Type::Disk_Device || + pmWidget().selectedDevice()->type() == Device::Type::SoftwareRAID_Device)); actionCollection()->action(QStringLiteral("exportPartitionTable")) ->setEnabled(pmWidget().selectedDevice() && pmWidget().selectedDevice()->partitionTable() &&