1
/***************************************************************************
2
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18
***************************************************************************/
20
#if !defined(OPERATIONSTACK__H)
22
#define OPERATIONSTACK__H
32
/** @brief The list of Operations the user wants to have performed.
34
OperationStack also handles the Devices that were found on this computer and the merging of
35
Operations, e.g., when the user first creates a Partition, then deletes it.
41
Q_DISABLE_COPY(OperationStack)
43
friend class LibParted;
46
typedef QList<Device*> Devices;
47
typedef QList<Operation*> Operations;
54
void push(Operation* o);
56
void clearOperations();
57
int size() const { return operations().size(); } /**< @return number of operations */
59
Devices& previewDevices() { return m_PreviewDevices; } /**< @return the list of Devices */
60
const Devices& previewDevices() const { return m_PreviewDevices; } /**< @return the list of Devices */
62
Operations& operations() { return m_Operations; } /**< @return the list of operations */
63
const Operations& operations() const { return m_Operations; } /**< @return the list of operations */
65
Device* findDeviceForPartition(const Partition* p);
69
void addDevice(Device* d);
71
bool mergeNewOperation(Operation*& currentOp, Operation*& pushedOp);
72
bool mergeCopyOperation(Operation*& currentOp, Operation*& pushedOp);
73
bool mergeRestoreOperation(Operation*& currentOp, Operation*& pushedOp);
74
bool mergePartFlagsOperation(Operation*& currentOp, Operation*& pushedOp);
75
bool mergePartLabelOperation(Operation*& currentOp, Operation*& pushedOp);
78
Operations m_Operations;
79
mutable Devices m_PreviewDevices;