refactor the part resizer and the size dialog base so they're less ugly, less

confusing and don't use free sectors before and after the partition but just
plain start and end.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1103958
This commit is contained in:
Volker Lanz 2010-03-16 11:40:54 +00:00
parent f3c74efa53
commit c384fdaf21
15 changed files with 417 additions and 405 deletions

8
TODO
View File

@ -26,8 +26,11 @@ Plans and ideas for 1.1:
* once the above redesign is done, allow the user to adjust first and last
sector directly. maybe offer a details dialog widget. maybe also offer to
skip alignign the parition when creating it in that details widget?
skip aligning the partition when creating it in that details widget?
* write a KFormattedSpinBox widget to allow qint64 instead of int and to show
sector numbers nicely
===============================================================================
Bugs to fix for 1.1:
@ -35,6 +38,9 @@ Bugs to fix for 1.1:
* copy&paste seems broken wrt alignment when copying from cylinder aligned to
sector aligned drives (maybe even more than that)
* resizing a newly created extended that has children (leading to a merge of
operations) crashes in NewOperation::description()
===============================================================================
For releases after 1.1:

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -36,7 +36,7 @@
@param destpartition the Partition the new one is to be inserted to
*/
InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedPartition, const Partition& destpartition) :
SizeDialogBase(parent, Capacity::MiB, device, insertedPartition, -1, -1),
SizeDialogBase(parent, device, insertedPartition, destpartition.firstSector(), destpartition.lastSector()),
m_DestPartition(destpartition)
{
setMainWidget(&dialogWidget());
@ -49,8 +49,8 @@ InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedP
dialogWidget().hideFileSystem();
dialogWidget().hideLabel();
setupDialog();
setupConstraints();
setupDialog();
setupConnections();
restoreDialogSize(KConfigGroup(KGlobal::config(), "insertDialog"));
@ -63,16 +63,6 @@ InsertDialog::~InsertDialog()
saveDialogSize(kcg);
}
qint64 InsertDialog::freeSectorsBefore() const
{
return 0;
}
qint64 InsertDialog::freeSectorsAfter() const
{
return destPartition().length() - partition().length();
}
bool InsertDialog::canGrow() const
{
return ResizeOperation::canGrow(&partition());

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -46,8 +46,6 @@ class InsertDialog : public SizeDialogBase
const Partition& destPartition() const { return m_DestPartition; }
virtual bool canGrow() const;
virtual bool canShrink() const { return false; }
virtual qint64 freeSectorsBefore() const;
virtual qint64 freeSectorsAfter() const;
private:
const Partition& m_DestPartition;

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -40,14 +40,14 @@
@param r the permitted Roles for the new Partition
*/
NewDialog::NewDialog(QWidget* parent, Device& device, Partition& unallocatedPartition, PartitionRole::Roles r) :
SizeDialogBase(parent, Capacity::MiB, device, unallocatedPartition, 0, 0),
SizeDialogBase(parent, device, unallocatedPartition, unallocatedPartition.firstSector(), unallocatedPartition.lastSector()),
m_PartitionRoles(r)
{
setMainWidget(&dialogWidget());
setCaption(i18nc("@title:window", "Create a new partition"));
setupDialog();
setupConstraints();
setupDialog();
setupConnections();
restoreDialogSize(KConfigGroup(KGlobal::config(), "newDialog"));
@ -134,6 +134,9 @@ void NewDialog::onRoleChanged(bool)
dialogWidget().comboFileSystem().setEnabled(r != PartitionRole::Extended);
partition().setRoles(PartitionRole(r));
setupConstraints();
dialogWidget().partResizerWidget().update();
updateHideAndShow();
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *

View File

@ -561,7 +561,7 @@ void PartitionManagerWidget::onResizePartition()
const qint64 freeAfter = selectedDevice()->partitionTable()->freeSectorsAfter(*selectedPartition());
Partition resizedPartition(*selectedPartition());
QPointer<ResizeDialog> dlg = new ResizeDialog(this, *selectedDevice(), resizedPartition, freeBefore, freeAfter);
QPointer<ResizeDialog> dlg = new ResizeDialog(this, *selectedDevice(), resizedPartition, selectedPartition()->firstSector() - freeBefore, freeAfter + selectedPartition()->lastSector());
if (dlg->exec() == KDialog::Accepted && dlg->isModified())
{

View File

@ -97,7 +97,7 @@ void PartPropsDialog::setupDialog()
button(KDialog::Cancel)->setFocus();
dialogWidget().partResizerWidget().setReadOnly(true);
dialogWidget().partResizerWidget().init(device(), partition(), 0, 0);
dialogWidget().partResizerWidget().init(device(), partition(), partition().firstSector(), partition().lastSector());
const QString mp = partition().mountPoints().size() == 0 ? i18nc("@item mountpoint", "(none found)") : partition().mountPoints().join(", ");
dialogWidget().mountPoint().setText(mp);

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -22,6 +22,7 @@
#include "core/partition.h"
#include "core/device.h"
#include "core/partitiontable.h"
#include "fs/filesystem.h"
@ -47,13 +48,12 @@ PartResizerWidget::PartResizerWidget(QWidget* parent) :
m_Device(NULL),
m_Partition(NULL),
m_PartWidget(NULL),
m_SectorsBefore(0),
m_SectorsAfter(0),
m_TotalSectors(-1),
m_MinimumSectors(-1),
m_MaximumSectors(-1),
m_MaxFirstSector(-1),
m_MinLastSector(-1),
m_MinimumFirstSector(0),
m_MaximumFirstSector(-1),
m_MinimumLastSector(-1),
m_MaximumLastSector(0),
m_MinimumLength(-1),
m_MaximumLength(-1),
m_LeftHandle(this),
m_RightHandle(this),
m_DraggedWidget(NULL),
@ -66,21 +66,19 @@ PartResizerWidget::PartResizerWidget(QWidget* parent) :
/** Intializes the PartResizerWidget
@param d the Device the Partition is on
@param p the Partition to show and/or resize
@param freeBefore number of sectors free before the Partition
@param freeAfter number of sectors free after the Partition
@param minFirst the minimum value for the first sector
@param maxLast the maximum value for the last sector
*/
void PartResizerWidget::init(Device& d, Partition& p, qint64 freeBefore, qint64 freeAfter)
void PartResizerWidget::init(Device& d, Partition& p, qint64 minFirst, qint64 maxLast)
{
setDevice(d);
setPartition(p);
setSectorsBefore(freeBefore);
setSectorsAfter(freeAfter);
setMinimumFirstSector(minFirst);
setMaximumLastSector(maxLast);
setTotalSectors(sectorsBefore() + partition().length() + sectorsAfter());
setMinimumSectors(qMax(partition().sectorsUsed(), partition().minimumSectors()));
setMaximumSectors(qMin(totalSectors(), partition().maximumSectors()));
setMinimumLength(qMax(partition().sectorsUsed(), partition().minimumSectors()));
setMaximumLength(qMin(totalSectors(), partition().maximumSectors()));
/** @todo get real pixmaps for the handles */
QPixmap pixmap(handleWidth(), handleHeight());
@ -115,7 +113,7 @@ qint64 PartResizerWidget::sectorsPerPixel() const
int PartResizerWidget::partWidgetStart() const
{
return handleWidth() + sectorsBefore() / sectorsPerPixel();
return handleWidth() + (partition().firstSector() - minimumFirstSector()) / sectorsPerPixel();
}
int PartResizerWidget::partWidgetWidth() const
@ -166,160 +164,114 @@ void PartResizerWidget::mousePressEvent(QMouseEvent* event)
}
}
bool PartResizerWidget::movePartition(qint64 newFirstSector)
{
if (maximumFirstSector() > -1 && newFirstSector > maximumFirstSector())
newFirstSector = maximumFirstSector();
if (minimumFirstSector() > -1 && newFirstSector < minimumFirstSector())
newFirstSector = minimumFirstSector();
qint64 delta = newFirstSector - partition().firstSector();
qint64 newLastSector = partition().lastSector() + delta;
if (minimumLastSector() > -1 && newLastSector < minimumLastSector())
{
const qint64 deltaLast = minimumLastSector() - newLastSector;
newFirstSector += deltaLast;
newLastSector += deltaLast;
}
if (maximumLastSector() > -1 && newLastSector > maximumLastSector())
{
const qint64 deltaLast = newLastSector - maximumLastSector();
newFirstSector -= deltaLast;
newLastSector -= deltaLast;
}
if (newLastSector - newFirstSector + 1 != partition().length() ||
(maximumFirstSector() > -1 && newFirstSector > maximumFirstSector()) ||
(minimumFirstSector() > -1 && newFirstSector < minimumFirstSector()) ||
(minimumLastSector() > -1 && newLastSector < minimumLastSector()) ||
(maximumLastSector() > -1 && newLastSector > maximumLastSector()))
{
kWarning() << "constraints not satisfied while trying to move partition " << partition().deviceNode();
return false;
}
if (partition().children().size() > 0 &&
(!checkAlignment(*partition().children().first(), partition().firstSector() - newFirstSector) ||
!checkAlignment(*partition().children().last(), partition().lastSector() - newLastSector)))
{
kDebug() << "cannot align children while trying to move partition " << partition().deviceNode();
return false;
}
partition().setFirstSector(newFirstSector);
partition().fileSystem().setFirstSector(newFirstSector);
emit firstSectorChanged(newFirstSector);
partition().setLastSector(newLastSector);
partition().fileSystem().setLastSector(newLastSector);
emit lastSectorChanged(newLastSector);
resizeLogicals();
updatePositions();
return true;
}
void PartResizerWidget::mouseMoveEvent(QMouseEvent* event)
{
int x = event->pos().x() - m_Hotspot;
if (draggedWidget() == &leftHandle())
{
const qint64 newSectorsBefore = qMax(x * sectorsPerPixel(), 0LL);
updateSectorsBefore(newSectorsBefore);
const qint64 newFirstSector = qMax(minimumFirstSector() + x * sectorsPerPixel(), 0LL);
updateFirstSector(newFirstSector);
}
else if (draggedWidget() == &rightHandle())
{
const qint64 newSectorsAfter = qMax((width() - rightHandle().width() - x) * sectorsPerPixel(), 0LL);
updateSectorsAfter(newSectorsAfter);
const qint64 newLastSector = qMin(minimumFirstSector() + (x - rightHandle().width()) * sectorsPerPixel(), maximumLastSector());
updateLastSector(newLastSector);
}
else if (draggedWidget() == &partWidget())
else if (draggedWidget() == &partWidget() && moveAllowed())
{
x -= handleWidth();
qint64 newSectorsBefore = qMax(x * sectorsPerPixel(), 0LL);
qint64 newSectorsAfter = sectorsAfter() + sectorsBefore() - newSectorsBefore;
if (newSectorsAfter < 0)
{
newSectorsAfter = 0;
newSectorsBefore = sectorsBefore() + sectorsAfter();
}
if (newSectorsBefore != sectorsBefore() && newSectorsAfter != sectorsAfter())
updateSectors(newSectorsBefore, newSectorsAfter);
const qint64 newFirstSector = qMax(minimumFirstSector() + (x - handleWidth()) * sectorsPerPixel(), 0LL);
movePartition(newFirstSector);
}
}
/** Updates the start and end sector of the Partition.
@param newSectorsBefore new value for free sectors before the Partition
@param newSectorsAfter new value for free sectors after the Partition
@return true on success
*/
bool PartResizerWidget::updateSectors(qint64 newSectorsBefore, qint64 newSectorsAfter)
{
Q_ASSERT(newSectorsBefore >= 0);
Q_ASSERT(newSectorsAfter >= 0);
Q_ASSERT(newSectorsBefore + newSectorsAfter + partition().length() == totalSectors());
if (newSectorsBefore < 0 || newSectorsAfter < 0)
{
kWarning() << "new sectors before partition: " << newSectorsBefore;
kWarning() << "new sectors after partition: " << newSectorsBefore;
return false;
}
if (newSectorsBefore + newSectorsAfter + partition().length() != totalSectors())
{
kWarning() << "total sectors: " << totalSectors();
kWarning() << "new sectors before partition: " << newSectorsBefore;
kWarning() << "new sectors after partition: " << newSectorsBefore;
kWarning() << "partition length: " << partition().length();
return false;
}
if (!moveAllowed())
return false;
const qint64 oldBefore = sectorsBefore();
const qint64 oldAfter = sectorsAfter();
// Two hacky things about updating free sectors before and after a partition in one go:
// 1) We have to call updateSectorsBefore and updateSectorsAfter with length-checking disabled,
// because the partition might in between those calls get smaller or bigger than
// allowed. The second call will, of course, restore the original length.
// 2) If the user moves the mouse fast enough, it's possible to move the beginning past the
// end or the end in front of the beginning of the partition in between the calls. Both
// methods won't allow that and return false in that case. We try moving the beginning first and
// just move the end first if that fails.
if (!updateSectorsBefore(newSectorsBefore, false))
{
updateSectorsAfter(newSectorsAfter, false);
updateSectorsBefore(newSectorsBefore, false);
}
else
updateSectorsAfter(newSectorsAfter, false);
bool rval = false;
if (oldBefore != sectorsBefore())
{
rval = true;
emit sectorsBeforeChanged(sectorsBefore());
}
if (oldAfter != sectorsAfter())
{
rval = true;
emit sectorsAfterChanged(sectorsAfter());
}
if (rval)
updatePositions();
return rval;
}
void PartResizerWidget::mouseReleaseEvent(QMouseEvent* event)
{
if (event->button() == Qt::LeftButton)
m_DraggedWidget = NULL;
}
/** Updates the free sectors before the Partition
@param newSectorsBefore new value for number of sectors free before Partition
@param enableLengthCheck true if the method is supposed to do some sanity checking on the Partition length
@return true on success
*/
bool PartResizerWidget::updateSectorsBefore(qint64 newSectorsBefore, bool enableLengthCheck)
bool PartResizerWidget::updateFirstSector(qint64 newFirstSector)
{
Q_ASSERT(newSectorsBefore >= 0);
if (maximumFirstSector() > -1 && newFirstSector > maximumFirstSector())
newFirstSector = maximumFirstSector();
if (newSectorsBefore < 0)
if (minimumFirstSector() > -1 && newFirstSector < minimumFirstSector())
newFirstSector = minimumFirstSector();
const qint64 newLength = partition().lastSector() - newFirstSector + 1;
if (newLength < minimumLength())
newFirstSector += minimumLength() - newLength;
if (newLength > maximumLength())
newFirstSector -= newLength - maximumLength();
if (newFirstSector != partition().firstSector() && (partition().children().size() == 0 || checkAlignment(*partition().children().first(), partition().firstSector() - newFirstSector)))
{
kWarning() << "new sectors before partition: " << newSectorsBefore;
return false;
}
const qint64 oldSectorsBefore = sectorsBefore();
const qint64 newLength = partition().length() + oldSectorsBefore - newSectorsBefore;
if (enableLengthCheck)
{
if (newLength < minimumSectors())
newSectorsBefore -= minimumSectors() - newLength;
if (newLength > maximumSectors())
newSectorsBefore += newLength - maximumSectors();
}
else if (newLength < 0)
return false;
qint64 newFirstSector = partition().firstSector() + newSectorsBefore - oldSectorsBefore;
if (maxFirstSector() > -1 && newFirstSector > maxFirstSector())
{
newSectorsBefore -= newFirstSector - maxFirstSector();
newFirstSector = maxFirstSector();
}
if (newSectorsBefore >= 0 && newSectorsBefore != oldSectorsBefore && (partition().children().size() == 0 || checkSnap(*partition().children().first(), oldSectorsBefore - newSectorsBefore)))
{
setSectorsBefore(newSectorsBefore);
partition().setFirstSector(newFirstSector);
partition().fileSystem().setFirstSector(newFirstSector);
resizeLogicals();
emit sectorsBeforeChanged(sectorsBefore());
emit lengthChanged(partition().length());
emit firstSectorChanged(newFirstSector);
updatePositions();
@ -329,7 +281,7 @@ bool PartResizerWidget::updateSectorsBefore(qint64 newSectorsBefore, bool enable
return false;
}
bool PartResizerWidget::checkSnap(const Partition& child, qint64 delta) const
bool PartResizerWidget::checkAlignment(const Partition& child, qint64 delta) const
{
if (!partition().roles().has(PartitionRole::Extended))
return true;
@ -337,7 +289,7 @@ bool PartResizerWidget::checkSnap(const Partition& child, qint64 delta) const
if (child.roles().has(PartitionRole::Unallocated))
return true;
return qAbs(delta) >= device().cylinderSize();
return qAbs(delta) >= PartitionTable::sectorAlignment(device());
}
void PartResizerWidget::resizeLogicals()
@ -353,54 +305,30 @@ void PartResizerWidget::resizeLogicals()
partWidget().updateChildren();
}
/** Updates the number of free sectors after the Partition.
@param newSectorsAfter new value for number of sectors free after Partition
@param enableLengthCheck true if the method is supposed to do some sanity checking on the Partition length
@return true on success
*/
bool PartResizerWidget::updateSectorsAfter(qint64 newSectorsAfter, bool enableLengthCheck)
bool PartResizerWidget::updateLastSector(qint64 newLastSector)
{
Q_ASSERT(newSectorsAfter >= 0);
if (minimumLastSector() > -1 && newLastSector < minimumLastSector())
newLastSector = minimumLastSector();
if (newSectorsAfter < 0)
if (maximumLastSector() > -1 && newLastSector > maximumLastSector())
newLastSector = maximumLastSector();
const qint64 newLength = newLastSector - partition().firstSector() + 1;
if (newLength < minimumLength())
newLastSector += minimumLength() - newLength;
if (newLength > maximumLength())
newLastSector -= newLength - maximumLength();
if (newLastSector != partition().lastSector() && (partition().children().size() == 0 || checkAlignment(*partition().children().last(), partition().lastSector() - newLastSector)))
{
kWarning() << "new sectors after partition: " << newSectorsAfter;
return false;
}
const qint64 oldSectorsAfter = sectorsAfter();
const qint64 newLength = partition().length() + oldSectorsAfter - newSectorsAfter;
if (enableLengthCheck)
{
if (newLength < minimumSectors())
newSectorsAfter -= minimumSectors() - newLength;
if (newLength > maximumSectors())
newSectorsAfter += newLength - maximumSectors();
}
else if (newLength < 0)
return false;
qint64 newLastSector = partition().lastSector() + oldSectorsAfter - newSectorsAfter;
if (minLastSector() > -1 && newLastSector < minLastSector())
{
newSectorsAfter += newLastSector - minLastSector();
newLastSector = minLastSector();
}
if (newSectorsAfter >= 0 && newSectorsAfter != oldSectorsAfter && (partition().children().size() == 0 || checkSnap(*partition().children().last(), oldSectorsAfter - newSectorsAfter)))
{
setSectorsAfter(newSectorsAfter);
partition().setLastSector(newLastSector);
partition().fileSystem().setLastSector(newLastSector);
resizeLogicals();
emit sectorsAfterChanged(sectorsAfter());
emit lengthChanged(partition().length());
emit lastSectorChanged(newLastSector);
updatePositions();
@ -416,7 +344,7 @@ bool PartResizerWidget::updateSectorsAfter(qint64 newSectorsAfter, bool enableLe
*/
bool PartResizerWidget::updateLength(qint64 newLength)
{
newLength = qBound(minimumSectors(), newLength, qMin(totalSectors(), maximumSectors()));
newLength = qBound(minimumLength(), newLength, qMin(totalSectors(), maximumLength()));
if (newLength == partition().length())
return false;
@ -424,26 +352,26 @@ bool PartResizerWidget::updateLength(qint64 newLength)
const qint64 oldLength = partition().length();
qint64 delta = newLength - oldLength;
qint64 tmp = qMin(delta, sectorsAfter());
qint64 tmp = qMin(delta, maximumLastSector() - partition().lastSector());
delta -= tmp;
if (tmp != 0)
{
setSectorsAfter(sectorsAfter() - tmp);
partition().setLastSector(partition().lastSector() + tmp);
partition().fileSystem().setLastSector(partition().lastSector() + tmp);
emit sectorsAfterChanged(sectorsAfter());
emit lastSectorChanged(partition().lastSector());
}
tmp = qMin(delta, sectorsBefore());;
tmp = qMin(delta, partition().firstSector() - minimumFirstSector());
delta -= tmp;
if (tmp != 0)
{
setSectorsBefore(sectorsBefore() - tmp);
partition().setFirstSector(partition().firstSector() - tmp);
partition().fileSystem().setFirstSector(partition().firstSector() - tmp);
emit sectorsBeforeChanged(sectorsBefore());
emit firstSectorChanged(partition().firstSector());
}
if (partition().length() != oldLength)
@ -461,18 +389,18 @@ bool PartResizerWidget::updateLength(qint64 newLength)
@note This value can never be less than 0 and never be higher than totalSectors()
@param s the new minimum length
*/
void PartResizerWidget::setMinimumSectors(qint64 s)
void PartResizerWidget::setMinimumLength(qint64 s)
{
m_MinimumSectors = qBound(0LL, s, totalSectors());
m_MinimumLength = qBound(0LL, s, totalSectors());
}
/** Sets the maximum sectors the Partition can be long.
@note This value can never be less than 0 and never by higher than totalSectors()
@param s the new maximum length
*/
void PartResizerWidget::setMaximumSectors(qint64 s)
void PartResizerWidget::setMaximumLength(qint64 s)
{
m_MaximumSectors = qBound(0LL, s, totalSectors());
m_MaximumLength = qBound(0LL, s, totalSectors());
}
/** Sets if moving the Partition is allowed.

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -44,27 +44,31 @@ class PartResizerWidget : public QWidget
PartResizerWidget(QWidget* parent);
public:
void init(Device& d, Partition& p, qint64 sbefore, qint64 safter);
void init(Device& d, Partition& p, qint64 minFirst, qint64 maxLast);
qint64 sectorsBefore() const { return m_SectorsBefore; } /**< @return sectors free before Partition */
qint64 sectorsAfter() const { return m_SectorsAfter; } /**< @return sectors free after Partition */
qint64 totalSectors() const { return m_TotalSectors; } /**< @return total sectors (free + Partition's length) */
qint64 totalSectors() const { return maximumLastSector() - minimumFirstSector() + 1; } /**< @return total sectors (free + Partition's length) */
void setMinimumSectors(qint64 s);
qint64 minimumSectors() const { return m_MinimumSectors; } /**< @return minimum length for Partition */
qint64 minimumFirstSector() const { return m_MinimumFirstSector; } /**< @return the lowest allowed first sector */
void setMinimumFirstSector(qint64 s) { m_MinimumFirstSector = s; } /**< @param s the new lowest allowed first sector */
void setMaximumSectors(qint64 s);
qint64 maximumSectors() const { return m_MaximumSectors; } /**< @return maximum length for the Partition */
qint64 maximumFirstSector() const { return m_MaximumFirstSector; } /**< @return the highest allowed first sector */
void setMaximumFirstSector(qint64 s) { m_MaximumFirstSector = s; } /**< @param s the new highest allowed first sector */
qint64 minimumLastSector() const { return m_MinimumLastSector; } /**< @return the lowest allowed last sector */
void setMinimumLastSector(qint64 s) { m_MinimumLastSector = s; } /**< @param s the new lowest allowed last sector */
qint64 maximumLastSector() const { return m_MaximumLastSector; } /**< @return the highest allowed last sector */
void setMaximumLastSector(qint64 s) { m_MaximumLastSector = s; } /**< @param s the new highest allowed last sector */
void setMinimumLength(qint64 s);
qint64 minimumLength() const { return m_MinimumLength; } /**< @return minimum length for Partition */
void setMaximumLength(qint64 s);
qint64 maximumLength() const { return m_MaximumLength; } /**< @return maximum length for the Partition */
void setMoveAllowed(bool b);
bool moveAllowed() const { return m_MoveAllowed; } /**< @return true if moving the Partition is allowed */
qint64 maxFirstSector() const { return m_MaxFirstSector; } /**< @return the highest allowed first sector */
void setMaxFirstSector(qint64 s) { m_MaxFirstSector = s; } /**< @param s the new highest allowed first sector */
qint64 minLastSector() const { return m_MinLastSector; } /**< @return the lowest allowed last sector */
void setMinLastSector(qint64 s) { m_MinLastSector = s; } /**< @param s the new lowest allowed last sector */
bool readOnly() const { return m_ReadOnly; } /**< @return true if the widget is read only */
void setReadOnly(bool b) { m_ReadOnly = b; } /**< @param b the new value for read only */
@ -72,15 +76,15 @@ class PartResizerWidget : public QWidget
static qint32 handleHeight() { return m_HandleHeight; } /**< @return the handle height in pixels */
signals:
void sectorsBeforeChanged(qint64);
void sectorsAfterChanged(qint64);
void firstSectorChanged(qint64);
void lastSectorChanged(qint64);
void lengthChanged(qint64);
public slots:
bool updateSectors(qint64 newSectorsBefore, qint64 newSectorsAfter);
bool updateSectorsBefore(qint64 newSectorsBefore, bool enableLengthCheck = true);
bool updateSectorsAfter(qint64 newSectorsAfter, bool enableLengthCheck = true);
bool updateLength(qint64 newLength);
bool updateFirstSector(qint64 newFirstSector);
bool updateLastSector(qint64 newLastSector);
bool movePartition(qint64 newFirstSector);
protected:
Partition& partition() { Q_ASSERT(m_Partition); return *m_Partition; }
@ -91,9 +95,6 @@ class PartResizerWidget : public QWidget
const Device& device() const { Q_ASSERT(m_Device); return *m_Device; }
void setDevice(Device& d) { m_Device = &d; }
void setSectorsBefore(qint64 s) { m_SectorsBefore = s; }
void setSectorsAfter(qint64 s) { m_SectorsAfter = s; }
void paintEvent(QPaintEvent* event);
void resizeEvent(QResizeEvent* event);
void mousePressEvent(QMouseEvent* event);
@ -115,11 +116,9 @@ class PartResizerWidget : public QWidget
void set(qint64 newCap, qint64 newFreeBefore, qint64 newFreeAfter);
void setTotalSectors(qint64 s) { m_TotalSectors = s; }
void resizeLogicals();
bool checkSnap(const Partition& child, qint64 delta) const;
bool checkAlignment(const Partition& child, qint64 delta) const;
QWidget* draggedWidget() { return m_DraggedWidget; }
const QWidget* draggedWidget() const { return m_DraggedWidget; }
@ -129,13 +128,12 @@ class PartResizerWidget : public QWidget
Partition* m_Partition;
PartWidget* m_PartWidget;
qint64 m_SectorsBefore;
qint64 m_SectorsAfter;
qint64 m_TotalSectors;
qint64 m_MinimumSectors;
qint64 m_MaximumSectors;
qint64 m_MaxFirstSector;
qint64 m_MinLastSector;
qint64 m_MinimumFirstSector;
qint64 m_MaximumFirstSector;
qint64 m_MinimumLastSector;
qint64 m_MaximumLastSector;
qint64 m_MinimumLength;
qint64 m_MaximumLength;
QLabel m_LeftHandle;
QLabel m_RightHandle;

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -33,8 +33,8 @@
@param freebefore number of sectors free before the Partition to resize
@param freeafter number of sectors free after the Partition to resize
*/
ResizeDialog::ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64 freebefore, qint64 freeafter) :
SizeDialogBase(parent, Capacity::MiB, device, p, freebefore, freeafter),
ResizeDialog::ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64 minFirst, qint64 maxLast) :
SizeDialogBase(parent, device, p, minFirst, maxLast),
m_OriginalFirstSector(p.firstSector()),
m_OriginalLastSector(p.lastSector())
{
@ -45,8 +45,8 @@ ResizeDialog::ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64
dialogWidget().hideFileSystem();
dialogWidget().hideLabel();
setupDialog();
setupConstraints();
setupDialog();
setupConnections();
restoreDialogSize(KConfigGroup(KGlobal::config(), "resizeDialog"));

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -41,7 +41,7 @@ class ResizeDialog : public SizeDialogBase
Q_OBJECT
public:
ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64 freebefore, qint64 freeafter);
ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64 minFirst, qint64 maxLast);
~ResizeDialog();
public:

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -25,21 +25,21 @@
#include "core/device.h"
#include "core/partition.h"
#include "util/capacity.h"
#include <kdebug.h>
SizeDialogBase::SizeDialogBase(QWidget* parent, Capacity::Unit preferred, Device& device, Partition& part, qint64 freebefore, qint64 freeafter) :
SizeDialogBase::SizeDialogBase(QWidget* parent, Device& d, Partition& part, qint64 minFirst, qint64 maxLast) :
KDialog(parent),
m_SizeDialogWidget(new SizeDialogWidget(this)),
m_PreferredUnit(preferred),
m_Device(device),
m_Device(d),
m_Partition(part),
m_FreeSectorsBefore(freebefore),
m_FreeSectorsAfter(freeafter)
m_MinimumFirstSector(minFirst),
m_MaximumLastSector(maxLast)
{
}
qint64 SizeDialogBase::minSectors() const
qint64 SizeDialogBase::minimumLength() const
{
if (!canShrink())
return partition().length();
@ -47,44 +47,56 @@ qint64 SizeDialogBase::minSectors() const
return qMax(partition().sectorsUsed(), partition().minimumSectors());
}
qint64 SizeDialogBase::maxSectors() const
qint64 SizeDialogBase::maximumLength() const
{
if (!canGrow())
return partition().length();
return qMin(partition().length() + freeSectorsBefore() + freeSectorsAfter(), partition().maximumSectors());
return qMin(maximumLastSector() - minimumFirstSector() + 1, partition().maximumSectors());
}
int SizeDialogBase::sectorsToDialogUnit(const Partition& p, Capacity::Unit u, qint64 v)
static int sectorsToDialogUnit(const Partition& p, qint64 v)
{
return Capacity(v * p.sectorSize()).toInt(u);
return Capacity(v * p.sectorSize()).toInt(Capacity::preferredUnit());
}
qint64 SizeDialogBase::dialogUnitToSectors(const Partition& p, Capacity::Unit u, int v)
static qint64 dialogUnitToSectors(const Partition& p, int v)
{
return Capacity::unitFactor(Capacity::Byte, u) * v / p.sectorSize();
return Capacity::unitFactor(Capacity::Byte, Capacity::preferredUnit()) * v / p.sectorSize();
}
void SizeDialogBase::setupDialog()
{
dialogWidget().spinFreeBefore().setValue(Capacity(freeSectorsBefore() * partition().sectorSize()).toInt(preferredUnit()));
dialogWidget().spinFreeAfter().setValue(Capacity(freeSectorsAfter() * partition().sectorSize()).toInt(preferredUnit()));
dialogWidget().spinCapacity().setValue(Capacity(partition().capacity()).toInt(preferredUnit()));
dialogWidget().partResizerWidget().init(device(), partition(), minimumFirstSector(), maximumLastSector());
dialogWidget().spinFreeBefore().setSuffix(QString(" ") + Capacity::unitName(preferredUnit()));
dialogWidget().spinFreeAfter().setSuffix(QString(" ") + Capacity::unitName(preferredUnit()));
dialogWidget().spinCapacity().setSuffix(QString(" ") + Capacity::unitName(preferredUnit()));
// TODO: these don't belong here; the distinction between setupDialog and setupConstraints
// doesn't work that well, there's too much interdependency.
if (!canShrink())
dialogWidget().partResizerWidget().setMinimumLength(partition().length());
dialogWidget().partResizerWidget().init(device(), partition(), freeSectorsBefore(), freeSectorsAfter());
if (!canGrow())
dialogWidget().partResizerWidget().setMaximumLength(partition().length());
dialogWidget().spinFreeBefore().setValue(sectorsToDialogUnit(partition(), partition().firstSector() - minimumFirstSector()));
dialogWidget().spinFreeAfter().setValue(sectorsToDialogUnit(partition(), maximumLastSector() - partition().lastSector()));
dialogWidget().spinCapacity().setValue(Capacity(partition().capacity()).toInt(Capacity::preferredUnit()));
dialogWidget().spinFreeBefore().setSuffix(QString(" ") + Capacity::unitName(Capacity::preferredUnit()));
dialogWidget().spinFreeAfter().setSuffix(QString(" ") + Capacity::unitName(Capacity::preferredUnit()));
dialogWidget().spinCapacity().setSuffix(QString(" ") + Capacity::unitName(Capacity::preferredUnit()));
dialogWidget().spinFirstSector().setValue(partition().firstSector());
dialogWidget().spinLastSector().setValue(partition().lastSector());
}
void SizeDialogBase::setupConstraints()
{
dialogWidget().partResizerWidget().setMinimumSectors(minSectors());
dialogWidget().partResizerWidget().setMaximumSectors(maxSectors());
dialogWidget().partResizerWidget().setMinimumLength(minimumLength());
dialogWidget().partResizerWidget().setMaximumLength(maximumLength());
dialogWidget().labelMinSize().setText(Capacity(minSectors() * partition().sectorSize()).toString());
dialogWidget().labelMaxSize().setText(Capacity(maxSectors() * partition().sectorSize()).toString());
dialogWidget().labelMinSize().setText(Capacity(minimumLength() * partition().sectorSize()).toString());
dialogWidget().labelMaxSize().setText(Capacity(maximumLength() * partition().sectorSize()).toString());
if (!canShrink() && !canGrow())
dialogWidget().spinCapacity().setEnabled(false);
@ -92,92 +104,111 @@ void SizeDialogBase::setupConstraints()
if (!canMove())
dialogWidget().partResizerWidget().setMoveAllowed(false);
dialogWidget().partResizerWidget().setMaxFirstSector(partition().maxFirstSector());
dialogWidget().partResizerWidget().setMinLastSector(partition().minLastSector());
dialogWidget().partResizerWidget().setMaximumFirstSector(partition().maxFirstSector());
dialogWidget().partResizerWidget().setMinimumLastSector(partition().minLastSector());
const qint64 totalCapacity = sectorsToDialogUnit(partition(), preferredUnit(), dialogWidget().partResizerWidget().totalSectors());
const qint64 totalCapacity = sectorsToDialogUnit(partition(), maximumLastSector() - minimumFirstSector() + 1);
const qint64 minCapacity = sectorsToDialogUnit(partition(), preferredUnit(), minSectors());
const qint64 maxCapacity = sectorsToDialogUnit(partition(), preferredUnit(), maxSectors());
const qint64 minCapacity = sectorsToDialogUnit(partition(), minimumLength());
const qint64 maxCapacity = sectorsToDialogUnit(partition(), maximumLength());
dialogWidget().spinCapacity().setRange(minCapacity, maxCapacity);
const qint64 maxFree = totalCapacity - minCapacity;
dialogWidget().spinFreeBefore().setRange(0, maxFree);
dialogWidget().spinFreeAfter().setRange(0, maxFree);
dialogWidget().spinFirstSector().setRange(minimumFirstSector(), maximumLastSector());
dialogWidget().spinLastSector().setRange(minimumFirstSector(), maximumLastSector());
}
void SizeDialogBase::setupConnections()
{
connect(&dialogWidget().partResizerWidget(), SIGNAL(sectorsBeforeChanged(qint64)), SLOT(onSectorsBeforeChanged(qint64)));
connect(&dialogWidget().partResizerWidget(), SIGNAL(sectorsAfterChanged(qint64)), SLOT(onSectorsAfterChanged(qint64)));
connect(&dialogWidget().partResizerWidget(), SIGNAL(lengthChanged(qint64)), SLOT(onLengthChanged(qint64)));
connect(&dialogWidget().partResizerWidget(), SIGNAL(firstSectorChanged(qint64)), SLOT(onFirstSectorChanged(qint64)));
connect(&dialogWidget().partResizerWidget(), SIGNAL(lastSectorChanged(qint64)), SLOT(onLastSectorChanged(qint64)));
connect(&dialogWidget().spinFreeBefore(), SIGNAL(valueChanged(int)), SLOT(onFreeSpaceBeforeChanged(int)));
connect(&dialogWidget().spinFreeAfter(), SIGNAL(valueChanged(int)), SLOT(onFreeSpaceAfterChanged(int)));
connect(&dialogWidget().spinCapacity(), SIGNAL(valueChanged(int)), SLOT(onCapacityChanged(int)));
connect(&dialogWidget().spinFirstSector(), SIGNAL(valueChanged(int)), SLOT(onSpinFirstSectorChanged(int)));
connect(&dialogWidget().spinLastSector(), SIGNAL(valueChanged(int)), SLOT(onSpinLastSectorChanged(int)));
}
void SizeDialogBase::onSectorsBeforeChanged(qint64 newBefore)
void SizeDialogBase::onSpinFirstSectorChanged(int newFirst)
{
dialogWidget().spinFreeBefore().disconnect(this);
dialogWidget().spinFreeBefore().setValue(sectorsToDialogUnit(partition(), preferredUnit(), newBefore));
connect(&dialogWidget().spinFreeBefore(), SIGNAL(valueChanged(int)), SLOT(onFreeSpaceBeforeChanged(int)));
setFreeSectorsBefore(newBefore);
if (newFirst >= minimumFirstSector())
{
dialogWidget().partResizerWidget().updateFirstSector(newFirst);
setDirty();
}
}
void SizeDialogBase::onSpinLastSectorChanged(int newLast)
{
if (newLast <= maximumLastSector())
{
dialogWidget().partResizerWidget().updateLastSector(newLast);
setDirty();
}
}
void SizeDialogBase::onFirstSectorChanged(qint64 newFirst)
{
bool state = dialogWidget().spinFreeBefore().blockSignals(true);
dialogWidget().spinFreeBefore().setValue(sectorsToDialogUnit(partition(), newFirst - minimumFirstSector()));
dialogWidget().spinFreeBefore().blockSignals(state);
state = dialogWidget().spinFirstSector().blockSignals(true);
dialogWidget().spinFirstSector().setValue(newFirst);
dialogWidget().spinFirstSector().blockSignals(state);
updateLength(partition().length());
setDirty();
}
void SizeDialogBase::onSectorsAfterChanged(qint64 newAfter)
void SizeDialogBase::onLastSectorChanged(qint64 newLast)
{
dialogWidget().spinFreeAfter().disconnect(this);
dialogWidget().spinFreeAfter().setValue(sectorsToDialogUnit(partition(), preferredUnit(), newAfter));
connect(&dialogWidget().spinFreeAfter(), SIGNAL(valueChanged(int)), SLOT(onFreeSpaceAfterChanged(int)));
setFreeSectorsAfter(newAfter);
bool state = dialogWidget().spinFreeAfter().blockSignals(true);
dialogWidget().spinFreeAfter().setValue(sectorsToDialogUnit(partition(), maximumLastSector() - newLast));
dialogWidget().spinFreeAfter().blockSignals(state);
state = dialogWidget().spinLastSector().blockSignals(true);
dialogWidget().spinLastSector().setValue(newLast);
dialogWidget().spinLastSector().blockSignals(state);
updateLength(partition().length());
setDirty();
}
void SizeDialogBase::onLengthChanged(qint64 newLength)
void SizeDialogBase::updateLength(qint64 newLength)
{
dialogWidget().spinCapacity().disconnect(this);
dialogWidget().spinCapacity().setValue(sectorsToDialogUnit(partition(), preferredUnit(), newLength));
connect(&dialogWidget().spinCapacity(), SIGNAL(valueChanged(int)), SLOT(onCapacityChanged(int)));
bool state = dialogWidget().spinCapacity().blockSignals(true);
dialogWidget().spinCapacity().setValue(sectorsToDialogUnit(partition(), newLength));
dialogWidget().spinCapacity().blockSignals(state);
}
void SizeDialogBase::onCapacityChanged(int newCapacity)
{
qint64 newLength = dialogUnitToSectors(partition(), preferredUnit(), newCapacity);
const qint64 newLength = dialogUnitToSectors(partition(), newCapacity);
dialogWidget().partResizerWidget().updateLength(newLength);
}
void SizeDialogBase::onFreeSpaceBeforeChanged(int newBefore)
{
qint64 newSectorsBefore = dialogUnitToSectors(partition(), preferredUnit(), newBefore);
qint64 delta = dialogWidget().partResizerWidget().sectorsBefore() - newSectorsBefore;
qint64 newSectorsAfter = dialogWidget().partResizerWidget().sectorsAfter() + delta;
if (newSectorsAfter < 0)
{
dialogWidget().partResizerWidget().updateLength(partition().length() + newSectorsAfter);
newSectorsAfter = 0;
}
dialogWidget().partResizerWidget().updateSectors(newSectorsBefore, newSectorsAfter);
const qint64 newFirstSector = minimumFirstSector() + dialogUnitToSectors(partition(), newBefore);
if (!dialogWidget().partResizerWidget().movePartition(newFirstSector))
dialogWidget().partResizerWidget().updateFirstSector(newFirstSector);
setDirty();
}
void SizeDialogBase::onFreeSpaceAfterChanged(int newAfter)
{
qint64 newSectorsAfter = dialogUnitToSectors(partition(), preferredUnit(), newAfter);
qint64 delta = newSectorsAfter - dialogWidget().partResizerWidget().sectorsAfter();
qint64 newSectorsBefore = dialogWidget().partResizerWidget().sectorsBefore() - delta;
if (newSectorsBefore < 0)
{
dialogWidget().partResizerWidget().updateLength(partition().length() + newSectorsBefore);
newSectorsBefore = 0;
}
dialogWidget().partResizerWidget().updateSectors(newSectorsBefore, newSectorsAfter);
const qint64 newLastSector = maximumLastSector() - dialogUnitToSectors(partition(), newAfter);
const qint64 newFirstSector = newLastSector - partition().length() + 1;
if (!dialogWidget().partResizerWidget().movePartition(newFirstSector))
dialogWidget().partResizerWidget().updateLastSector(newLastSector);
setDirty();
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -42,7 +42,7 @@ class SizeDialogBase : public KDialog
Q_DISABLE_COPY(SizeDialogBase)
protected:
SizeDialogBase(QWidget* parent, Capacity::Unit preferred, Device& device, Partition& part, qint64 freebefore, qint64 freeafter);
SizeDialogBase(QWidget* parent, Device& device, Partition& part, qint64 minFirst, qint64 maxLast);
virtual ~SizeDialogBase() {}
SizeDialogWidget& dialogWidget() { Q_ASSERT(m_SizeDialogWidget); return *m_SizeDialogWidget; }
@ -59,37 +59,30 @@ class SizeDialogBase : public KDialog
virtual const Partition& partition() const { return m_Partition; }
virtual Device& device() { return m_Device; }
virtual const Device& device() const { return m_Device; }
virtual qint64 minSectors() const;
virtual qint64 maxSectors() const;
virtual qint64 freeSectorsBefore() const { return m_FreeSectorsBefore; }
virtual qint64 freeSectorsAfter() const { return m_FreeSectorsAfter; }
virtual qint64 minimumLength() const;
virtual qint64 maximumLength() const;
virtual qint64 minimumFirstSector() const { return m_MinimumFirstSector; }
virtual qint64 maximumLastSector() const { return m_MaximumLastSector; }
virtual void setDirty() {}
static int sectorsToDialogUnit(const Partition& p, Capacity::Unit u, qint64 v);
static qint64 dialogUnitToSectors(const Partition& p, Capacity::Unit u, int v);
virtual void updateLength(qint64 newLength);
protected slots:
void onSectorsBeforeChanged(qint64 newBefore);
void onSectorsAfterChanged(qint64 newAfter);
void onLengthChanged(qint64 newLength);
void onFirstSectorChanged(qint64 newFirst);
void onLastSectorChanged(qint64 newLast);
void onCapacityChanged(int newCapacity);
void onFreeSpaceBeforeChanged(int newBefore);
void onFreeSpaceAfterChanged(int newAfter);
public:
Capacity::Unit preferredUnit() const { return m_PreferredUnit; } /**< @return the preferred unit for a dialog */
private:
void setFreeSectorsBefore(qint64 newBefore) { m_FreeSectorsBefore = newBefore; }
void setFreeSectorsAfter(qint64 newAfter) { m_FreeSectorsAfter = newAfter; }
void onSpinFirstSectorChanged(int newFirst);
void onSpinLastSectorChanged(int newLast);
protected:
SizeDialogWidget* m_SizeDialogWidget;
Capacity::Unit m_PreferredUnit;
Device& m_Device;
Partition& m_Partition;
qint64 m_FreeSectorsBefore;
qint64 m_FreeSectorsAfter;
qint64 m_MinimumFirstSector;
qint64 m_MaximumLastSector;
};
#endif

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -43,6 +43,9 @@ class SizeDialogWidget : public QWidget, public Ui::SizeDialogWidgetBase
QSpinBox& spinFreeAfter() { Q_ASSERT(m_SpinFreeAfter); return *m_SpinFreeAfter; }
QSpinBox& spinCapacity() { Q_ASSERT(m_SpinCapacity); return *m_SpinCapacity; }
QSpinBox& spinFirstSector() { Q_ASSERT(m_SpinFirstSector); return *m_SpinFirstSector; }
QSpinBox& spinLastSector() { Q_ASSERT(m_SpinLastSector); return *m_SpinLastSector; }
QLabel& labelMinSize() { Q_ASSERT(m_LabelMinSize); return *m_LabelMinSize; }
QLabel& labelMaxSize() { Q_ASSERT(m_LabelMaxSize); return *m_LabelMaxSize; }

View File

@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>419</width>
<height>377</height>
<height>402</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1" colspan="3">
<item row="0" column="0" colspan="3">
<widget class="PartResizerWidget" name="m_PartResizerWidget" native="true">
<property name="minimumSize">
<size>
@ -27,7 +27,23 @@
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="2">
<item row="1" column="0" colspan="3">
<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_LabelRole">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -46,7 +62,7 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="m_RadioPrimary">
@ -71,7 +87,7 @@
</item>
</layout>
</item>
<item row="3" column="1" rowspan="2">
<item row="3" column="0">
<widget class="QLabel" name="m_LabelFileSystem">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -90,7 +106,7 @@
</property>
</widget>
</item>
<item row="4" column="3">
<item row="3" column="1" colspan="2">
<widget class="KComboBox" name="m_ComboFileSystem">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -100,7 +116,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="4" column="0">
<widget class="QLabel" name="m_LabelTextLabel">
<property name="text">
<string comment="@label">Label:</string>
@ -113,7 +129,7 @@
</property>
</widget>
</item>
<item row="5" column="3">
<item row="4" column="1" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KLineEdit" name="m_EditLabel">
@ -134,7 +150,7 @@
</item>
</layout>
</item>
<item row="6" column="1">
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -150,14 +166,14 @@
</property>
</widget>
</item>
<item row="6" column="3">
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="m_LabelMinSize">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -173,14 +189,14 @@
</property>
</widget>
</item>
<item row="7" column="3">
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="m_LabelMaxSize">
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -199,7 +215,7 @@
</property>
</widget>
</item>
<item row="8" column="3">
<item row="7" column="1" colspan="2">
<widget class="QSpinBox" name="m_SpinFreeBefore">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -207,9 +223,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string comment="@label:spinbox"> MiB</string>
</property>
<property name="minimum">
<number>0</number>
</property>
@ -218,7 +231,7 @@
</property>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -237,7 +250,7 @@
</property>
</widget>
</item>
<item row="9" column="3">
<item row="8" column="1" colspan="2">
<widget class="QSpinBox" name="m_SpinCapacity">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -245,9 +258,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string comment="@label:spinbox"> MiB</string>
</property>
<property name="minimum">
<number>0</number>
</property>
@ -256,26 +266,7 @@
</property>
</widget>
</item>
<item row="10" column="3">
<widget class="QSpinBox" name="m_SpinFreeAfter">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string comment="@label:spinbox"> MiB</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="9" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -294,23 +285,94 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="9" column="1" colspan="2">
<widget class="QSpinBox" name="m_SpinFreeAfter">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<property name="minimum">
<number>0</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
<property name="maximum">
<number>999999999</number>
</property>
</spacer>
</widget>
</item>
<item row="11" column="1" colspan="3">
<item row="10" column="0" colspan="3">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string comment="@label:listbox">First sector:</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="11" column="1" colspan="2">
<widget class="QSpinBox" name="m_SpinFirstSector">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string comment="@label:listbox">Last sector:</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="12" column="1" colspan="2">
<widget class="QSpinBox" name="m_SpinLastSector">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="13" column="0" colspan="3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>