2008-09-24 20:32:01 +01:00
|
|
|
/***************************************************************************
|
2010-03-16 11:40:54 +00:00
|
|
|
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
|
2008-09-24 20:32:01 +01:00
|
|
|
* *
|
|
|
|
* 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 *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#if !defined(SIZEDIALOGBASE__H)
|
|
|
|
|
|
|
|
#define SIZEDIALOGBASE__H
|
|
|
|
|
|
|
|
#include "util/capacity.h"
|
|
|
|
|
|
|
|
#include <qglobal.h>
|
2014-05-13 23:50:54 +01:00
|
|
|
#include <QDebug>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
#include <kdialog.h>
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
class Partition;
|
|
|
|
class PartitionTable;
|
|
|
|
class SizeDialogWidget;
|
2010-03-18 11:04:13 +00:00
|
|
|
class SizeDetailsWidget;
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** Base class for all dialogs moving or resizing Partitions.
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
|
|
|
class SizeDialogBase : public KDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-11-09 13:51:08 +00:00
|
|
|
Q_DISABLE_COPY(SizeDialogBase)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
protected:
|
2010-03-16 11:40:54 +00:00
|
|
|
SizeDialogBase(QWidget* parent, Device& device, Partition& part, qint64 minFirst, qint64 maxLast);
|
2008-09-24 20:32:01 +01:00
|
|
|
virtual ~SizeDialogBase() {}
|
|
|
|
|
|
|
|
SizeDialogWidget& dialogWidget() { Q_ASSERT(m_SizeDialogWidget); return *m_SizeDialogWidget; }
|
|
|
|
const SizeDialogWidget& dialogWidget() const { Q_ASSERT(m_SizeDialogWidget); return *m_SizeDialogWidget; }
|
|
|
|
|
2010-03-18 11:04:13 +00:00
|
|
|
SizeDetailsWidget& detailsWidget() { Q_ASSERT(m_SizeDetailsWidget); return *m_SizeDetailsWidget; }
|
|
|
|
const SizeDetailsWidget& detailsWidget() const { Q_ASSERT(m_SizeDetailsWidget); return *m_SizeDetailsWidget; }
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
virtual const PartitionTable& partitionTable() const;
|
|
|
|
virtual bool canGrow() const { return true; }
|
|
|
|
virtual bool canShrink() const { return true; }
|
|
|
|
virtual bool canMove() const { return true; }
|
|
|
|
virtual void setupDialog();
|
|
|
|
virtual void setupConstraints();
|
|
|
|
virtual void setupConnections();
|
|
|
|
virtual Partition& partition() { return m_Partition; }
|
|
|
|
virtual const Partition& partition() const { return m_Partition; }
|
|
|
|
virtual Device& device() { return m_Device; }
|
|
|
|
virtual const Device& device() const { return m_Device; }
|
2010-03-16 11:40:54 +00:00
|
|
|
virtual qint64 minimumLength() const;
|
|
|
|
virtual qint64 maximumLength() const;
|
|
|
|
virtual qint64 minimumFirstSector() const { return m_MinimumFirstSector; }
|
|
|
|
virtual qint64 maximumLastSector() const { return m_MaximumLastSector; }
|
2008-10-06 09:01:28 +01:00
|
|
|
virtual void setDirty() {}
|
2010-04-27 12:04:59 +01:00
|
|
|
virtual void updateSpinCapacity(qint64 newLengthInSectors);
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-04-26 16:37:02 +01:00
|
|
|
virtual bool align() const;
|
|
|
|
virtual qint64 minimumLastSector() const;
|
|
|
|
virtual qint64 maximumFirstSector() const;
|
|
|
|
|
2010-04-27 12:04:59 +01:00
|
|
|
virtual void updateSpinFirstSector(qint64 newFirst);
|
|
|
|
virtual void updateSpinFreeBefore(qint64 sectorsFreeBefore);
|
|
|
|
|
|
|
|
virtual void updateSpinLastSector(qint64 newLast);
|
|
|
|
virtual void updateSpinFreeAfter(qint64 sectorsFreeAfter);
|
|
|
|
|
|
|
|
virtual void setMinimumLength(qint64 s) { m_MinimumLength = s; }
|
|
|
|
virtual void setMaximumLength(qint64 s) { m_MaximumLength = s; }
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
protected slots:
|
2010-04-27 12:04:59 +01:00
|
|
|
void onResizerWidgetFirstSectorChanged(qint64 newFirst);
|
|
|
|
void onResizerWidgetLastSectorChanged(qint64 newLast);
|
2010-03-16 11:40:54 +00:00
|
|
|
|
2010-04-27 12:04:59 +01:00
|
|
|
void onSpinCapacityChanged(double newCapacity);
|
|
|
|
void onSpinFreeBeforeChanged(double newBefore);
|
|
|
|
void onSpinFreeAfterChanged(double newAfter);
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-03-17 10:48:24 +00:00
|
|
|
void onSpinFirstSectorChanged(double newFirst);
|
|
|
|
void onSpinLastSectorChanged(double newLast);
|
2010-04-15 11:32:12 +01:00
|
|
|
void onAlignToggled(bool);
|
2009-05-05 21:01:40 +01:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
protected:
|
|
|
|
SizeDialogWidget* m_SizeDialogWidget;
|
2010-03-18 11:04:13 +00:00
|
|
|
SizeDetailsWidget* m_SizeDetailsWidget;
|
2008-09-24 20:32:01 +01:00
|
|
|
Device& m_Device;
|
|
|
|
Partition& m_Partition;
|
2010-03-16 11:40:54 +00:00
|
|
|
qint64 m_MinimumFirstSector;
|
|
|
|
qint64 m_MaximumLastSector;
|
2010-04-27 12:04:59 +01:00
|
|
|
qint64 m_MinimumLength;
|
|
|
|
qint64 m_MaximumLength;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|