Updating VolumeGroupDialog constraints.

This commit is contained in:
Caio Carvalho 2018-08-13 17:59:42 -03:00
parent f81f6fbff2
commit eec9801582
4 changed files with 103 additions and 74 deletions

View File

@ -76,11 +76,15 @@ VolumeGroupDialog::~VolumeGroupDialog()
void VolumeGroupDialog::setupDialog()
{
dialogWidget().volumeType().addItem(QStringLiteral("LVM"));
dialogWidget().volumeType().addItem(QStringLiteral("RAID"));
dialogWidget().volumeType().addItems({ QStringLiteral("LVM"), QStringLiteral("RAID") });
dialogWidget().volumeType().setCurrentIndex(0);
dialogWidget().raidLevel().addItems({ QStringLiteral("0"), QStringLiteral("1"),
QStringLiteral("4"), QStringLiteral("5"),
QStringLiteral("6"), QStringLiteral("10") });
updateNameValidator();
updateComponents();
setMinimumSize(dialogWidget().size());
resize(dialogWidget().size());
@ -173,4 +177,15 @@ void VolumeGroupDialog::onVolumeTypeChanged(int index)
Q_UNUSED(index)
updateNameValidator();
updatePartitionList();
updateComponents();
}
void VolumeGroupDialog::updateComponents()
{
dialogWidget().spinPESize().setVisible(dialogWidget().volumeType().currentText() == QStringLiteral("LVM"));
dialogWidget().textTotalPESize().setVisible(dialogWidget().volumeType().currentText() == QStringLiteral("LVM"));
dialogWidget().raidLevel().setVisible(dialogWidget().volumeType().currentText() == QStringLiteral("RAID"));
dialogWidget().textRaidLevel().setVisible(dialogWidget().volumeType().currentText() == QStringLiteral("RAID"));
dialogWidget().chunkSize().setVisible(dialogWidget().volumeType().currentText() == QStringLiteral("RAID"));
dialogWidget().textChunkSize().setVisible(dialogWidget().volumeType().currentText() == QStringLiteral("RAID"));
}

View File

@ -47,7 +47,9 @@ protected:
virtual void updateSizeInfos();
virtual void updateSectorInfos();
virtual void updatePartitionList();
virtual void updateNameValidator();
virtual void onPartitionListChanged();
virtual void onVolumeTypeChanged(int index);
VolumeGroupWidget& dialogWidget() {
@ -83,11 +85,8 @@ protected:
return m_IsValidName;
}
protected:
virtual void onPartitionListChanged();
private:
virtual void updateNameValidator();
void updateComponents();
protected:
VolumeGroupWidget* m_DialogWidget;

View File

@ -34,82 +34,101 @@ public:
public:
QLineEdit& vgName() {
QLineEdit& vgName() const {
Q_ASSERT(m_EditVGName);
return *m_EditVGName;
}
QComboBox& volumeType() {
QComboBox& volumeType() const {
Q_ASSERT(m_ComboVolumeType);
return *m_ComboVolumeType;
}
QSpinBox& spinPESize() {
QSpinBox& spinPESize() const {
Q_ASSERT(m_SpinPESize);
return *m_SpinPESize;
}
ListPhysicalVolumes& listPV() {
ListPhysicalVolumes& listPV() const {
Q_ASSERT(m_ListPV);
return *m_ListPV;
}
QLabel& totalSize() {
QLabel& totalSize() const {
Q_ASSERT(m_LabelTotalSize);
return *m_LabelTotalSize;
}
QLabel& totalSectors() {
QLabel& totalSectors() const {
Q_ASSERT(m_LabelTotalSectors);
return *m_LabelTotalSectors;
}
QLabel& totalUsedSize() {
QLabel& totalUsedSize() const {
Q_ASSERT(m_LabelTotalUsedSize);
return *m_LabelTotalUsedSize;
}
QLabel& totalLV() {
QLabel& totalLV() const {
Q_ASSERT(m_LabelTotalLV);
return *m_LabelTotalLV;
}
QLabel& textVGName() {
QLabel& textVGName() const {
Q_ASSERT(m_LabelTextVGName);
return *m_LabelTextVGName;
}
QLabel& textVolumeType() {
QLabel& textVolumeType() const {
Q_ASSERT(m_LabelTextVolumeType);
return *m_LabelTextVolumeType;
}
QLabel& textTotalSize() {
QLabel& textTotalSize() const {
Q_ASSERT(m_LabelTextTotalSize);
return *m_LabelTextTotalSize;
}
QLabel& textTotalSectors() {
QLabel& textTotalSectors() const {
Q_ASSERT(m_LabelTextTotalSectors);
return *m_LabelTextTotalSectors;
}
QLabel& textTotalUsedSize() {
QLabel& textTotalUsedSize() const {
Q_ASSERT(m_LabelTextTotalUsedSize);
return *m_LabelTextTotalUsedSize;
}
QLabel& textTotalLV() {
QLabel& textTotalLV() const {
Q_ASSERT(m_LabelTextTotalLV);
return *m_LabelTextTotalLV;
}
QLabel& textTotalPESize() {
QLabel& textTotalPESize() const {
Q_ASSERT(m_LabelTextPESize);
return *m_LabelTextPESize;
}
QSpinBox& chunkSize() const {
Q_ASSERT(m_ChunkSize);
return *m_ChunkSize;
}
QComboBox& raidLevel() const {
Q_ASSERT(m_RaidLevel);
return *m_RaidLevel;
}
QLabel& textChunkSize() const {
Q_ASSERT(m_LabelChunkSize);
return *m_LabelChunkSize;
}
QLabel& textRaidLevel() const {
Q_ASSERT(m_LabelRaidLevel);
return *m_LabelRaidLevel;
}
};
#endif

View File

@ -17,7 +17,7 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="9">
<item row="0" column="0" rowspan="7">
<widget class="ListPhysicalVolumes" name="m_ListPV" native="true">
<property name="minimumSize">
<size>
@ -65,37 +65,44 @@
</layout>
</item>
<item row="2" column="1">
<widget class="QLabel" name="m_LabelRaidLevel">
<property name="text">
<string>RAID level:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="m_RaidLevel"/>
<widget class="QLabel" name="m_LabelTextPESize">
<property name="text">
<string>Physical Extent Size: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_LabelRaidLevel">
<property name="text">
<string>RAID level:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_LabelChunkSize">
<property name="text">
<string>Chunk Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
<widget class="QLabel" name="m_LabelTextPESize">
<property name="text">
<string>Physical Extent Size: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item row="2" column="2">
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<widget class="QSpinBox" name="m_SpinPESize">
<property name="suffix">
@ -112,22 +119,11 @@
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QLabel" name="m_LabelChunkSize">
<property name="text">
<string>Chunk Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QSpinBox" name="spinBox">
<widget class="QComboBox" name="m_RaidLevel"/>
</item>
<item>
<widget class="QSpinBox" name="m_ChunkSize">
<property name="suffix">
<string> KiB</string>
</property>
@ -144,7 +140,7 @@
</item>
</layout>
</item>
<item row="5" column="1">
<item row="3" column="1">
<widget class="QLabel" name="m_LabelTextTotalSize">
<property name="text">
<string>Total Size: </string>
@ -157,7 +153,7 @@
</property>
</widget>
</item>
<item row="5" column="2">
<item row="3" column="2">
<widget class="QLabel" name="m_LabelTotalSize">
<property name="text">
<string>---</string>
@ -170,7 +166,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="4" column="1">
<widget class="QLabel" name="m_LabelTextTotalUsedSize">
<property name="text">
<string>Used Size: </string>
@ -183,7 +179,7 @@
</property>
</widget>
</item>
<item row="6" column="2">
<item row="4" column="2">
<widget class="QLabel" name="m_LabelTotalUsedSize">
<property name="text">
<string>---</string>
@ -196,7 +192,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="5" column="1">
<widget class="QLabel" name="m_LabelTextTotalSectors">
<property name="text">
<string>Total Sectors: </string>
@ -209,7 +205,7 @@
</property>
</widget>
</item>
<item row="7" column="2">
<item row="5" column="2">
<widget class="QLabel" name="m_LabelTotalSectors">
<property name="text">
<string>---</string>
@ -222,7 +218,7 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="6" column="1">
<widget class="QLabel" name="m_LabelTextTotalLV">
<property name="text">
<string>Total LV: </string>
@ -235,7 +231,7 @@
</property>
</widget>
</item>
<item row="8" column="2">
<item row="6" column="2">
<widget class="QLabel" name="m_LabelTotalLV">
<property name="text">
<string>---</string>