2015-02-07 00:32:25 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* Copyright (C) 2008, 2010, 2012 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 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/>.*
|
|
|
|
*************************************************************************/
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(RESIZEDIALOG_H)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define RESIZEDIALOG_H
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
#include "gui/sizedialogbase.h"
|
|
|
|
|
|
|
|
class Partition;
|
|
|
|
class Device;
|
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** Let the user resize or move a Partition.
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
|
|
|
class ResizeDialog : public SizeDialogBase
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
public:
|
|
|
|
ResizeDialog(QWidget* parent, Device& device, Partition& p, qint64 minFirst, qint64 maxLast);
|
|
|
|
~ResizeDialog();
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
public:
|
|
|
|
bool isModified() const;
|
|
|
|
qint64 resizedFirstSector() const {
|
|
|
|
return m_ResizedFirstSector;
|
|
|
|
}
|
|
|
|
qint64 resizedLastSector() const {
|
|
|
|
return m_ResizedLastSector;
|
|
|
|
}
|
2010-04-15 16:30:08 +01:00
|
|
|
|
2016-05-17 18:03:28 +01:00
|
|
|
void accept() override;
|
|
|
|
void reject() override;
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
protected:
|
2016-05-17 18:03:28 +01:00
|
|
|
bool canGrow() const override;
|
|
|
|
bool canShrink() const override;
|
|
|
|
bool canMove() const override;
|
|
|
|
void setupDialog() override;
|
|
|
|
void setDirty() override;
|
2015-07-13 15:17:41 +01:00
|
|
|
void rollback();
|
|
|
|
void setResizedFirstSector(qint64 s) {
|
|
|
|
m_ResizedFirstSector = s;
|
|
|
|
}
|
|
|
|
void setResizedLastSector(qint64 s) {
|
|
|
|
m_ResizedLastSector = s;
|
|
|
|
}
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
qint64 originalFirstSector() const {
|
|
|
|
return m_OriginalFirstSector;
|
|
|
|
}
|
|
|
|
qint64 originalLastSector() const {
|
|
|
|
return m_OriginalLastSector;
|
|
|
|
}
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
private:
|
|
|
|
qint64 m_OriginalFirstSector;
|
|
|
|
qint64 m_OriginalLastSector;
|
|
|
|
qint64 m_ResizedFirstSector;
|
|
|
|
qint64 m_ResizedLastSector;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|