2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2014-06-30 18:08:13 +02:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-06-30 18:08:13 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2014-06-30 18:08:13 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CREATEPARTITIONDIALOG_H
|
|
|
|
#define CREATEPARTITIONDIALOG_H
|
|
|
|
|
2015-07-02 13:49:21 +02:00
|
|
|
// KPMcore
|
|
|
|
#include <kpmcore/core/partitionrole.h>
|
2016-03-08 12:44:01 +01:00
|
|
|
#include <kpmcore/core/partitiontable.h>
|
2015-07-02 13:49:21 +02:00
|
|
|
|
2014-06-30 18:08:13 +02:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QScopedPointer>
|
|
|
|
|
2014-07-01 17:33:53 +02:00
|
|
|
|
2014-06-30 18:08:13 +02:00
|
|
|
class Device;
|
|
|
|
class Partition;
|
2014-07-15 17:37:04 +02:00
|
|
|
class PartitionNode;
|
2014-08-09 11:31:00 +02:00
|
|
|
class PartitionSizeController;
|
2014-06-30 18:08:13 +02:00
|
|
|
class Ui_CreatePartitionDialog;
|
|
|
|
|
2014-08-08 11:46:43 +02:00
|
|
|
/**
|
|
|
|
* The dialog which is shown to create a new partition or to edit a
|
|
|
|
* to-be-created partition.
|
|
|
|
*/
|
2014-06-30 18:08:13 +02:00
|
|
|
class CreatePartitionDialog : public QDialog
|
|
|
|
{
|
2014-07-04 18:32:35 +02:00
|
|
|
Q_OBJECT
|
2014-06-30 18:08:13 +02:00
|
|
|
public:
|
2018-05-16 15:14:50 +02:00
|
|
|
/**
|
|
|
|
* @brief Dialog for editing a new partition.
|
|
|
|
*
|
|
|
|
* For the (unlikely) case that a newly created partition is being re-edited,
|
|
|
|
* pass a pointer to that @p partition, otherwise pass nullptr.
|
|
|
|
*/
|
2020-08-22 01:19:58 +02:00
|
|
|
CreatePartitionDialog( Device* device,
|
|
|
|
PartitionNode* parentPartition,
|
|
|
|
Partition* partition,
|
|
|
|
const QStringList& usedMountPoints,
|
|
|
|
QWidget* parentWidget = nullptr );
|
2020-10-23 22:23:10 +02:00
|
|
|
~CreatePartitionDialog() override;
|
2014-06-30 18:08:13 +02:00
|
|
|
|
2014-08-08 11:46:43 +02:00
|
|
|
/**
|
|
|
|
* Must be called when user wants to create a partition in
|
|
|
|
* freeSpacePartition.
|
|
|
|
*/
|
|
|
|
void initFromFreeSpace( Partition* freeSpacePartition );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Must be called when user wants to edit a to-be-created partition.
|
|
|
|
*/
|
2014-07-16 16:20:58 +02:00
|
|
|
void initFromPartitionToCreate( Partition* partition );
|
2021-06-21 23:20:32 +02:00
|
|
|
Partition* getNewlyCreatedPartition();
|
2014-06-30 18:08:13 +02:00
|
|
|
|
2016-03-08 12:44:01 +01:00
|
|
|
PartitionTable::Flags newFlags() const;
|
|
|
|
|
2014-07-04 18:32:35 +02:00
|
|
|
private Q_SLOTS:
|
|
|
|
void updateMountPointUi();
|
2016-11-21 00:05:44 +01:00
|
|
|
void checkMountPointSelection();
|
2014-07-04 18:32:35 +02:00
|
|
|
|
2014-06-30 18:08:13 +02:00
|
|
|
private:
|
|
|
|
QScopedPointer< Ui_CreatePartitionDialog > m_ui;
|
2014-08-09 11:31:00 +02:00
|
|
|
PartitionSizeController* m_partitionSizeController;
|
2014-06-30 18:08:13 +02:00
|
|
|
Device* m_device;
|
2014-07-15 17:37:04 +02:00
|
|
|
PartitionNode* m_parent;
|
2014-07-01 17:33:53 +02:00
|
|
|
PartitionRole m_role = PartitionRole( PartitionRole::None );
|
2016-11-20 23:05:55 +01:00
|
|
|
QStringList m_usedMountPoints;
|
2014-07-16 10:15:57 +02:00
|
|
|
|
2014-07-28 11:45:13 +02:00
|
|
|
void initGptPartitionTypeUi();
|
|
|
|
void initMbrPartitionTypeUi();
|
2014-08-07 13:04:02 +02:00
|
|
|
void initPartResizerWidget( Partition* );
|
2014-06-30 18:08:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CREATEPARTITIONDIALOG_H */
|