allow changing the msdos partition alignment from the device properties
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1095438
This commit is contained in:
parent
6dba1bbbd1
commit
bd1f7b8c5d
|
@ -43,6 +43,7 @@ DevicePropsDialog::DevicePropsDialog(QWidget* parent, Device& d) :
|
||||||
setCaption(i18nc("@title:window", "Device properties: <filename>%1</filename>", device().deviceNode()));
|
setCaption(i18nc("@title:window", "Device properties: <filename>%1</filename>", device().deviceNode()));
|
||||||
|
|
||||||
setupDialog();
|
setupDialog();
|
||||||
|
setupConnections();
|
||||||
|
|
||||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "devicePropsDialog"));
|
restoreDialogSize(KConfigGroup(KGlobal::config(), "devicePropsDialog"));
|
||||||
}
|
}
|
||||||
|
@ -81,6 +82,35 @@ void DevicePropsDialog::setupDialog()
|
||||||
|
|
||||||
dialogWidget().type().setText(type);
|
dialogWidget().type().setText(type);
|
||||||
|
|
||||||
|
if (device().partitionTable()->type() == PartitionTable::msdos)
|
||||||
|
dialogWidget().radioLegacy().setChecked(true);
|
||||||
|
else if (device().partitionTable()->type() == PartitionTable::msdos_vista)
|
||||||
|
dialogWidget().radioVista().setChecked(true);
|
||||||
|
else
|
||||||
|
dialogWidget().hideTypeRadioButtons();
|
||||||
|
|
||||||
setMinimumSize(dialogWidget().size());
|
setMinimumSize(dialogWidget().size());
|
||||||
resize(dialogWidget().size());
|
resize(dialogWidget().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DevicePropsDialog::setupConnections()
|
||||||
|
{
|
||||||
|
connect(&dialogWidget().radioVista(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
|
||||||
|
connect(&dialogWidget().radioLegacy(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DevicePropsDialog::setDirty(bool)
|
||||||
|
{
|
||||||
|
setDefaultButton(KDialog::Ok);
|
||||||
|
enableButtonOk(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DevicePropsDialog::legacyAlignment() const
|
||||||
|
{
|
||||||
|
return dialogWidget().radioLegacy().isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DevicePropsDialog::vistaAlignment() const
|
||||||
|
{
|
||||||
|
return dialogWidget().radioVista().isChecked();
|
||||||
|
}
|
||||||
|
|
|
@ -44,8 +44,13 @@ class DevicePropsDialog : public KDialog
|
||||||
DevicePropsDialog(QWidget* parent, Device& d);
|
DevicePropsDialog(QWidget* parent, Device& d);
|
||||||
~DevicePropsDialog();
|
~DevicePropsDialog();
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool legacyAlignment() const;
|
||||||
|
bool vistaAlignment() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setupDialog();
|
void setupDialog();
|
||||||
|
void setupConnections();
|
||||||
|
|
||||||
Device& device() { return m_Device; }
|
Device& device() { return m_Device; }
|
||||||
const Device& device() const { return m_Device; }
|
const Device& device() const { return m_Device; }
|
||||||
|
@ -53,6 +58,9 @@ class DevicePropsDialog : public KDialog
|
||||||
DevicePropsWidget& dialogWidget() { Q_ASSERT(m_DialogWidget); return *m_DialogWidget; }
|
DevicePropsWidget& dialogWidget() { Q_ASSERT(m_DialogWidget); return *m_DialogWidget; }
|
||||||
const DevicePropsWidget& dialogWidget() const { Q_ASSERT(m_DialogWidget); return *m_DialogWidget; }
|
const DevicePropsWidget& dialogWidget() const { Q_ASSERT(m_DialogWidget); return *m_DialogWidget; }
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void setDirty(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Device& m_Device;
|
Device& m_Device;
|
||||||
DevicePropsWidget* m_DialogWidget;
|
DevicePropsWidget* m_DialogWidget;
|
||||||
|
|
|
@ -43,6 +43,20 @@ class DevicePropsWidget : public QWidget, public Ui::DevicePropsWidgetBase
|
||||||
QLabel& sectorSize() { Q_ASSERT(m_LabelSectorSize); return *m_LabelSectorSize; }
|
QLabel& sectorSize() { Q_ASSERT(m_LabelSectorSize); return *m_LabelSectorSize; }
|
||||||
QLabel& totalSectors() { Q_ASSERT(m_LabelTotalSectors); return *m_LabelTotalSectors; }
|
QLabel& totalSectors() { Q_ASSERT(m_LabelTotalSectors); return *m_LabelTotalSectors; }
|
||||||
QLabel& type() { Q_ASSERT(m_LabelType); return *m_LabelType; }
|
QLabel& type() { Q_ASSERT(m_LabelType); return *m_LabelType; }
|
||||||
|
|
||||||
|
QRadioButton& radioLegacy() { Q_ASSERT(m_RadioLegacy); return *m_RadioLegacy; }
|
||||||
|
const QRadioButton& radioLegacy() const { Q_ASSERT(m_RadioLegacy); return *m_RadioLegacy; }
|
||||||
|
|
||||||
|
QRadioButton& radioVista() { Q_ASSERT(m_RadioVista); return *m_RadioVista; }
|
||||||
|
const QRadioButton& radioVista() const { Q_ASSERT(m_RadioVista); return *m_RadioVista; }
|
||||||
|
|
||||||
|
QSpacerItem& spacerType() { Q_ASSERT(m_SpacerType); return *m_SpacerType; }
|
||||||
|
|
||||||
|
void hideTypeRadioButtons()
|
||||||
|
{
|
||||||
|
radioVista().setVisible(false);
|
||||||
|
radioLegacy().setVisible(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,15 +6,56 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>406</width>
|
<width>609</width>
|
||||||
<height>283</height>
|
<height>397</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="3" column="0">
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="PartTableWidget" name="m_PartTableWidget" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>80</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>80</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="m_LabelTextType">
|
<widget class="QLabel" name="m_LabelTextType">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Type:</string>
|
<string>Type:</string>
|
||||||
|
@ -24,7 +65,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="m_LabelType">
|
<widget class="QLabel" name="m_LabelType">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
@ -37,6 +78,54 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="m_TypeLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_RadioLegacy">
|
||||||
|
<property name="text">
|
||||||
|
<string>Legacy Alignment</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_RadioVista">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vista Compatible Alignment</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="m_SpacerType">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="m_LabelTextCapacity">
|
||||||
|
<property name="text">
|
||||||
|
<string>Capacity:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QLabel" name="m_LabelCapacity">
|
<widget class="QLabel" name="m_LabelCapacity">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -73,6 +162,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0" colspan="2">
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="m_LabelTextCHS">
|
<widget class="QLabel" name="m_LabelTextCHS">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -142,6 +238,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="11" column="0" colspan="2">
|
||||||
|
<widget class="Line" name="line_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="12" column="0">
|
<item row="12" column="0">
|
||||||
<widget class="QLabel" name="m_LabelTextPrimariesMax">
|
<widget class="QLabel" name="m_LabelTextPrimariesMax">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -165,16 +268,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="m_LabelTextCapacity">
|
|
||||||
<property name="text">
|
|
||||||
<string>Capacity:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="13" column="0" colspan="2">
|
<item row="13" column="0" colspan="2">
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -191,68 +284,6 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="PartTableWidget" name="m_PartTableWidget" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>80</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>80</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0" colspan="2">
|
|
||||||
<widget class="Line" name="line_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0" colspan="2">
|
|
||||||
<widget class="Line" name="line_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -683,8 +683,19 @@ void MainWindow::onPropertiesDevice(const QString&)
|
||||||
|
|
||||||
if (pmWidget().selectedDevice())
|
if (pmWidget().selectedDevice())
|
||||||
{
|
{
|
||||||
QPointer<DevicePropsDialog> dlg = new DevicePropsDialog(this, *pmWidget().selectedDevice());
|
Device& d = *pmWidget().selectedDevice();
|
||||||
dlg->exec();
|
|
||||||
|
QPointer<DevicePropsDialog> dlg = new DevicePropsDialog(this, d);
|
||||||
|
if (dlg->exec() == KDialog::Accepted)
|
||||||
|
{
|
||||||
|
if (d.partitionTable()->type() == PartitionTable::msdos && dlg->vistaAlignment())
|
||||||
|
d.partitionTable()->setType(d, PartitionTable::msdos_vista);
|
||||||
|
else if (d.partitionTable()->type() == PartitionTable::msdos_vista && dlg->legacyAlignment())
|
||||||
|
d.partitionTable()->setType(d, PartitionTable::msdos);
|
||||||
|
|
||||||
|
on_m_OperationStack_devicesChanged();
|
||||||
|
}
|
||||||
|
|
||||||
delete dlg;
|
delete dlg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue