2015-02-07 00:32:25 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* Copyright (C) 2008, 2010 by Volker Lanz <vl@fidra.de> *
|
2016-03-02 18:33:40 +00:00
|
|
|
* Copyright (C) 2016 by Andrius Štikonas <andrius@stikonas.eu> *
|
2015-02-07 00:32:25 +00: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 3 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, see <http://www.gnu.org/licenses/>.*
|
|
|
|
*************************************************************************/
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(SIZEDIALOGBASE_H)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define SIZEDIALOGBASE_H
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <util/capacity.h>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-04-18 17:17:19 +01:00
|
|
|
#include <QtGlobal>
|
2014-05-13 23:50:54 +01:00
|
|
|
#include <QDebug>
|
2014-05-17 03:06:58 +01:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QPushButton>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
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.
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
2014-05-17 03:06:58 +01:00
|
|
|
class SizeDialogBase : public QDialog
|
2008-09-24 20:32:01 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
Q_DISABLE_COPY(SizeDialogBase)
|
|
|
|
|
|
|
|
protected:
|
|
|
|
SizeDialogBase(QWidget* parent, Device& device, Partition& part, qint64 minFirst, qint64 maxLast);
|
|
|
|
virtual ~SizeDialogBase() {}
|
|
|
|
|
|
|
|
SizeDialogWidget& dialogWidget() {
|
|
|
|
Q_ASSERT(m_SizeDialogWidget);
|
|
|
|
return *m_SizeDialogWidget;
|
|
|
|
}
|
|
|
|
const SizeDialogWidget& dialogWidget() const {
|
|
|
|
Q_ASSERT(m_SizeDialogWidget);
|
|
|
|
return *m_SizeDialogWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
SizeDetailsWidget& detailsWidget() {
|
|
|
|
Q_ASSERT(m_SizeDetailsWidget);
|
|
|
|
return *m_SizeDetailsWidget;
|
|
|
|
}
|
|
|
|
const SizeDetailsWidget& detailsWidget() const {
|
|
|
|
Q_ASSERT(m_SizeDetailsWidget);
|
|
|
|
return *m_SizeDetailsWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
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() {}
|
|
|
|
virtual void updateSpinCapacity(qint64 newLengthInSectors);
|
|
|
|
|
|
|
|
virtual bool align() const;
|
|
|
|
virtual qint64 minimumLastSector() const;
|
|
|
|
virtual qint64 maximumFirstSector() const;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-05-22 20:03:49 +01:00
|
|
|
protected:
|
2015-07-13 15:17:41 +01:00
|
|
|
void onResizerWidgetFirstSectorChanged(qint64 newFirst);
|
|
|
|
void onResizerWidgetLastSectorChanged(qint64 newLast);
|
|
|
|
|
|
|
|
void onSpinCapacityChanged(double newCapacity);
|
|
|
|
void onSpinFreeBeforeChanged(double newBefore);
|
|
|
|
void onSpinFreeAfterChanged(double newAfter);
|
|
|
|
|
2017-09-11 18:46:48 +01:00
|
|
|
void onSpinFirstSectorChanged(qint64 newFirst);
|
|
|
|
void onSpinLastSectorChanged(qint64 newLast);
|
2015-07-13 15:17:41 +01:00
|
|
|
void onAlignToggled(bool);
|
|
|
|
|
|
|
|
void toggleDetails();
|
|
|
|
|
|
|
|
SizeDialogWidget* m_SizeDialogWidget;
|
|
|
|
SizeDetailsWidget* m_SizeDetailsWidget;
|
|
|
|
Device& m_Device;
|
|
|
|
Partition& m_Partition;
|
|
|
|
qint64 m_MinimumFirstSector;
|
|
|
|
qint64 m_MaximumLastSector;
|
|
|
|
qint64 m_MinimumLength;
|
|
|
|
qint64 m_MaximumLength;
|
|
|
|
|
|
|
|
public:
|
|
|
|
QPushButton* okButton;
|
|
|
|
QPushButton* cancelButton;
|
|
|
|
QPushButton* detailsButton;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|