HIG improvements: Use radio buttons instead of combo box for partition role;
also add buddies and shortcuts. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=902047
This commit is contained in:
parent
a7a090381f
commit
1eec719a7d
|
@ -68,24 +68,28 @@ void NewDialog::setupDialog()
|
|||
qSort(fsNames);
|
||||
dialogWidget().comboFileSystem().addItems(fsNames);
|
||||
|
||||
dialogWidget().radioPrimary().setVisible(partitionRoles() & PartitionRole::Primary);
|
||||
dialogWidget().radioExtended().setVisible(partitionRoles() & PartitionRole::Extended);
|
||||
dialogWidget().radioLogical().setVisible(partitionRoles() & PartitionRole::Logical);
|
||||
|
||||
if (partitionRoles() & PartitionRole::Primary)
|
||||
dialogWidget().comboRole().addItem(i18nc("@item:inlistbox partition role", "Primary"));
|
||||
if (partitionRoles() & PartitionRole::Extended)
|
||||
dialogWidget().comboRole().addItem(i18nc("@item:inlistbox partition role", "Extended"));
|
||||
if (partitionRoles() & PartitionRole::Logical)
|
||||
dialogWidget().comboRole().addItem(i18nc("@item:inlistbox partition role", "Logical"));
|
||||
dialogWidget().radioPrimary().setChecked(true);
|
||||
else
|
||||
dialogWidget().radioLogical().setChecked(true);
|
||||
|
||||
SizeDialogBase::setupDialog();
|
||||
|
||||
// don't move these above the call to parent's setupDialog, because only after that has
|
||||
// run there is a valid partition set in the part resizer widget and they will need that.
|
||||
onRoleChanged(0);
|
||||
onRoleChanged(false);
|
||||
onFilesystemChanged(0);
|
||||
}
|
||||
|
||||
void NewDialog::setupConnections()
|
||||
{
|
||||
connect(&dialogWidget().comboRole(), SIGNAL(currentIndexChanged(int)), SLOT(onRoleChanged(int)));
|
||||
connect(&dialogWidget().radioPrimary(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
||||
connect(&dialogWidget().radioExtended(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
||||
connect(&dialogWidget().radioLogical(), SIGNAL(toggled(bool)), SLOT(onRoleChanged(bool)));
|
||||
connect(&dialogWidget().comboFileSystem(), SIGNAL(currentIndexChanged(int)), SLOT(onFilesystemChanged(int)));
|
||||
|
||||
SizeDialogBase::setupConnections();
|
||||
|
@ -102,16 +106,15 @@ void NewDialog::accept()
|
|||
KDialog::accept();
|
||||
}
|
||||
|
||||
void NewDialog::onRoleChanged(int idx)
|
||||
void NewDialog::onRoleChanged(bool)
|
||||
{
|
||||
PartitionRole::Roles r = PartitionRole::None;
|
||||
|
||||
const QString itemText = dialogWidget().comboRole().itemText(idx);
|
||||
if (itemText == i18nc("@item:inlistbox partition role", "Primary"))
|
||||
if (dialogWidget().radioPrimary().isChecked())
|
||||
r = PartitionRole::Primary;
|
||||
if (itemText == i18nc("@item:inlistbox partition role", "Extended"))
|
||||
else if (dialogWidget().radioExtended().isChecked())
|
||||
r = PartitionRole::Extended;
|
||||
if (itemText == i18nc("@item:inlistbox partition role", "Logical"))
|
||||
else if (dialogWidget().radioLogical().isChecked())
|
||||
r = PartitionRole::Logical;
|
||||
|
||||
dialogWidget().comboFileSystem().setEnabled(r != PartitionRole::Extended);
|
||||
|
|
|
@ -43,7 +43,7 @@ class NewDialog : public SizeDialogBase
|
|||
|
||||
protected slots:
|
||||
void accept();
|
||||
void onRoleChanged(int);
|
||||
void onRoleChanged(bool);
|
||||
void onFilesystemChanged(int);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -46,10 +46,13 @@ class SizeDialogWidget : public QWidget, public Ui::SizeDialogWidgetBase
|
|||
QLabel& labelMinSize() { Q_ASSERT(m_LabelMinSize); return *m_LabelMinSize; }
|
||||
QLabel& labelMaxSize() { Q_ASSERT(m_LabelMaxSize); return *m_LabelMaxSize; }
|
||||
|
||||
QComboBox& comboRole() { Q_ASSERT(m_ComboRole); return *m_ComboRole; }
|
||||
QRadioButton& radioPrimary() { Q_ASSERT(m_RadioPrimary); return *m_RadioPrimary; }
|
||||
QRadioButton& radioExtended() { Q_ASSERT(m_RadioExtended); return *m_RadioExtended; }
|
||||
QRadioButton& radioLogical() { Q_ASSERT(m_RadioLogical); return *m_RadioLogical; }
|
||||
|
||||
QComboBox& comboFileSystem() { Q_ASSERT(m_ComboFileSystem); return *m_ComboFileSystem; }
|
||||
|
||||
void hideRole() { delete m_LabelRole; m_LabelRole = NULL; delete m_ComboRole; m_ComboRole = NULL; }
|
||||
void hideRole() { delete m_LabelRole; m_LabelRole = NULL; delete m_RadioPrimary; m_RadioPrimary = NULL; delete m_RadioExtended; m_RadioExtended = NULL; delete m_RadioLogical; m_RadioLogical = NULL; }
|
||||
void hideFileSystem() { delete m_LabelFileSystem; m_LabelFileSystem = NULL; delete m_ComboFileSystem; m_ComboFileSystem = NULL; }
|
||||
};
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>421</width>
|
||||
<height>372</height>
|
||||
<width>425</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
|
@ -53,16 +53,16 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string comment="@label:listbox" >Partition type:</string>
|
||||
<string comment="@label:listbox" >Partition &type:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>m_RadioPrimary</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="KComboBox" name="m_ComboRole" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="m_LabelFileSystem" >
|
||||
<property name="sizePolicy" >
|
||||
|
@ -72,11 +72,14 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string comment="@label:listbox" >File system:</string>
|
||||
<string comment="@label:listbox" >File &system:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>m_ComboFileSystem</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
|
@ -99,8 +102,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLabel" name="m_LabelMinSize" >
|
||||
</widget>
|
||||
<widget class="QLabel" name="m_LabelMinSize" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
|
@ -119,8 +121,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QLabel" name="m_LabelMaxSize" >
|
||||
</widget>
|
||||
<widget class="QLabel" name="m_LabelMaxSize" />
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
|
@ -131,17 +132,20 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string comment="@label:listbox" >Free space before:</string>
|
||||
<string comment="@label:listbox" >Free space &before:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>m_SpinFreeBefore</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QSpinBox" name="m_SpinFreeBefore" >
|
||||
<property name="suffix" >
|
||||
<string comment="@label:spinbox"> MiB</string>
|
||||
<string comment="@label:spinbox" > MiB</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>0</number>
|
||||
|
@ -160,17 +164,20 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string comment="@label:listbox" >Size:</string>
|
||||
<string comment="@label:listbox" >S&ize:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>m_SpinCapacity</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<widget class="QSpinBox" name="m_SpinCapacity" >
|
||||
<property name="suffix" >
|
||||
<string comment="@label:spinbox"> MiB</string>
|
||||
<string comment="@label:spinbox" > MiB</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>0</number>
|
||||
|
@ -189,17 +196,20 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string comment="@label:listbox" >Free space after:</string>
|
||||
<string comment="@label:listbox" >Free space &after:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>m_SpinFreeAfter</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" >
|
||||
<widget class="QSpinBox" name="m_SpinFreeAfter" >
|
||||
<property name="suffix" >
|
||||
<string comment="@label:spinbox"> MiB</string>
|
||||
<string comment="@label:spinbox" > MiB</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>0</number>
|
||||
|
@ -209,6 +219,31 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioPrimary" >
|
||||
<property name="text" >
|
||||
<string>&Primary</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioExtended" >
|
||||
<property name="text" >
|
||||
<string>&Extended</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioLogical" >
|
||||
<property name="text" >
|
||||
<string>&Logical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -242,6 +277,15 @@
|
|||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_RadioPrimary</tabstop>
|
||||
<tabstop>m_RadioExtended</tabstop>
|
||||
<tabstop>m_RadioLogical</tabstop>
|
||||
<tabstop>m_ComboFileSystem</tabstop>
|
||||
<tabstop>m_SpinFreeBefore</tabstop>
|
||||
<tabstop>m_SpinCapacity</tabstop>
|
||||
<tabstop>m_SpinFreeAfter</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in New Issue