Switch Device::Type enum to enum class.

This commit is contained in:
Andrius Štikonas 2018-04-09 02:58:03 +01:00
parent 2137fa58b8
commit 96693a8455
8 changed files with 20 additions and 20 deletions

View File

@ -106,7 +106,7 @@ void DevicePropsDialog::setupDialog()
dialogWidget().capacity().setText(Capacity::formatByteSize(device().capacity()));
dialogWidget().totalSectors().setText(QLocale().toString(device().totalLogical()));
if (device().type() == Device::Disk_Device) {
if (device().type() == Device::Type::Disk_Device) {
const DiskDevice& disk = dynamic_cast<const DiskDevice&>(device());
@ -127,7 +127,7 @@ void DevicePropsDialog::setupDialog()
dialogWidget().buttonSmartMore().setVisible(false);
}
} else {
if (device().type() == Device::LVM_Device)
if (device().type() == Device::Type::LVM_Device)
dialogWidget().type().setText(xi18nc("@label device", "LVM Volume Group"));
else
dialogWidget().type().setText(xi18nc("@label device", "Volume Manager Device"));

View File

@ -176,7 +176,7 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d)
maxPrimaries = QStringLiteral("%1/%2").arg(d.partitionTable()->numPrimaries()).arg(d.partitionTable()->maxPrimaries());
}
if (d.type() == Device::Disk_Device) {
if (d.type() == Device::Type::Disk_Device) {
const DiskDevice& disk = dynamic_cast<const DiskDevice&>(d);
createLabels(i18nc("@label device", "Type:"), type, cols(area), x, y);
@ -185,7 +185,7 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d)
createLabels(i18nc("@label device", "Logical sector size:"), Capacity::formatByteSize(disk.logicalSectorSize()), cols(area), x, y);
createLabels(i18nc("@label device", "Physical sector size:"), Capacity::formatByteSize(disk.physicalSectorSize()), cols(area), x, y);
createLabels(i18nc("@label device", "Primaries/Max:"), maxPrimaries, cols(area), x, y);
} else if (d.type() == Device::LVM_Device) {
} else if (d.type() == Device::Type::LVM_Device) {
const LvmDevice& lvm = dynamic_cast<const LvmDevice&>(d);
createLabels(i18nc("@label device", "Volume Type:"), QStringLiteral("LVM"), cols(area), x, y);
createLabels(i18nc("@label device", "Capacity:"), Capacity::formatByteSize(lvm.capacity()), cols(area), x, y);

View File

@ -481,7 +481,7 @@ void MainWindow::enableActions()
actionCollection()->action(QStringLiteral("createNewPartitionTable"))
->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
actionCollection()->action(QStringLiteral("createNewPartitionTable"))
->setVisible(pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::Disk_Device);
->setVisible(pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::Type::Disk_Device);
actionCollection()->action(QStringLiteral("exportPartitionTable"))
->setEnabled(pmWidget().selectedDevice() &&
pmWidget().selectedDevice()->partitionTable() &&
@ -489,10 +489,10 @@ void MainWindow::enableActions()
actionCollection()->action(QStringLiteral("importPartitionTable"))
->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
actionCollection()->action(QStringLiteral("smartStatusDevice"))
->setEnabled(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Disk_Device &&
->setEnabled(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Type::Disk_Device &&
pmWidget().selectedDevice()->smartStatus().isValid());
actionCollection()->action(QStringLiteral("smartStatusDevice"))
->setVisible(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Disk_Device);
->setVisible(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Type::Disk_Device);
actionCollection()->action(QStringLiteral("propertiesDevice"))
->setEnabled(pmWidget().selectedDevice() != nullptr);
@ -510,7 +510,7 @@ void MainWindow::enableActions()
actionCollection()->action(QStringLiteral("createVolumeGroup"))
->setEnabled(CreateVolumeGroupOperation::canCreate());
bool lvmDevice = pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::LVM_Device;
bool lvmDevice = pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::Type::LVM_Device;
bool removable = false;
if (lvmDevice)
@ -1111,7 +1111,7 @@ void MainWindow::onCreateNewVolumeGroup()
void MainWindow::onResizeVolumeGroup()
{
if (pmWidget().selectedDevice()->type() == Device::LVM_Device) {
if (pmWidget().selectedDevice()->type() == Device::Type::LVM_Device) {
LvmDevice* d = dynamic_cast<LvmDevice*>(pmWidget().selectedDevice());
QVector<const Partition*> pvList;
@ -1128,7 +1128,7 @@ void MainWindow::onResizeVolumeGroup()
void MainWindow::onRemoveVolumeGroup()
{
Device* tmpDev = pmWidget().selectedDevice();
if (tmpDev->type() == Device::LVM_Device) {
if (tmpDev->type() == Device::Type::LVM_Device) {
operationStack().push(new RemoveVolumeGroupOperation(*(dynamic_cast<LvmDevice*>(tmpDev))));
}
}
@ -1136,7 +1136,7 @@ void MainWindow::onRemoveVolumeGroup()
void MainWindow::onDeactivateVolumeGroup()
{
Device* tmpDev = pmWidget().selectedDevice();
if (tmpDev->type() == Device::LVM_Device) {
if (tmpDev->type() == Device::Type::LVM_Device) {
DeactivateVolumeGroupOperation* deactivate = new DeactivateVolumeGroupOperation( *(dynamic_cast<LvmDevice*>(tmpDev)) );
Report* tmpReport = new Report(nullptr);
if (deactivate->execute(*tmpReport)) {

View File

@ -102,7 +102,7 @@ void NewDialog::setupDialog()
dialogWidget().checkBoxEncrypt().hide();
dialogWidget().editPassphrase().hide();
if (device().type() == Device::LVM_Device) {
if (device().type() == Device::Type::LVM_Device) {
dialogWidget().comboFileSystem().removeItem(dialogWidget().comboFileSystem().findText(QStringLiteral("lvm2 pv")));
}
@ -137,7 +137,7 @@ void NewDialog::setupConnections()
bool NewDialog::canMove() const
{
return (device().type() == Device::LVM_Device) ? false : true;
return (device().type() == Device::Type::LVM_Device) ? false : true;
}
void NewDialog::accept()

View File

@ -605,7 +605,7 @@ void PartitionManagerWidget::onResizePartition()
qint64 freeBefore = selectedDevice()->partitionTable()->freeSectorsBefore(p);
qint64 freeAfter = selectedDevice()->partitionTable()->freeSectorsAfter(p);
if (selectedDevice()->type() == Device::LVM_Device) {
if (selectedDevice()->type() == Device::Type::LVM_Device) {
freeBefore = 0;
freeAfter = selectedDevice()->partitionTable()->freeSectors();
}

View File

@ -130,7 +130,7 @@ void ResizeDialog::reject()
void ResizeDialog::setupDialog()
{
SizeDialogBase::setupDialog();
if (device().type() == Device::LVM_Device) {
if (device().type() == Device::Type::LVM_Device) {
dialogWidget().hideBeforeAndAfter();
detailsWidget().checkAlign().setChecked(false);
detailsWidget().checkAlign().setEnabled(false);
@ -162,5 +162,5 @@ bool ResizeDialog::canShrink() const
bool ResizeDialog::canMove() const
{
return (device().type() == Device::LVM_Device) ? false : ResizeOperation::canMove(&partition());
return (device().type() == Device::Type::LVM_Device) ? false : ResizeOperation::canMove(&partition());
}

View File

@ -105,11 +105,11 @@ void SizeDialogBase::setupDialog()
dialogWidget().partResizerWidget().init(device(), partition(), minimumFirstSector(), maximumLastSector(), true, canMove());
dialogWidget().partResizerWidget().setAlign(Config::alignDefault());
if (device().type() == Device::Disk_Device) {
if (device().type() == Device::Type::Disk_Device) {
dialogWidget().lvName().hide();
dialogWidget().textLVName().hide();
}
if (device().type() == Device::LVM_Device) {
if (device().type() == Device::Type::LVM_Device) {
dialogWidget().hideBeforeAndAfter();
detailsWidget().checkAlign().setChecked(false);
detailsWidget().checkAlign().setEnabled(false);
@ -380,7 +380,7 @@ void SizeDialogBase::onLVNameChanged(const QString& newName)
partition().setPartitionPath(device().deviceNode() + QStringLiteral("/") + newName.trimmed());
if ((dialogWidget().lvName().isVisible() &&
dialogWidget().lvName().text().isEmpty()) ||
(device().type() == Device::LVM_Device &&
(device().type() == Device::Type::LVM_Device &&
dynamic_cast<LvmDevice&>(device()).partitionNodes().contains(partition().partitionPath())) ) {
m_IsValidLVName = false;
} else {

View File

@ -130,7 +130,7 @@
<label context="@label">Backend plugin</label>
</entry>
<entry key="defaultFileSystem" type="Int">
<default>static_cast&lt;int&gt;(FileSystem::Type::Ext4)</default>
<default>static_cast&lt;int&gt;(FileSystem::Type::Ext4)</default>
</entry>
<entry key="preferredUnit" type="Int">
<label context="@label">Preferred unit:</label>