calamares/src/modules/partition/core/DeviceModel.h
Adriaan de Groot 1cd9b93a22 REUSE: Giant boilerplate cleanup
- point to main Calamares site in the 'part of' headers instead
  of to github (this is the "this file is part of Calamares"
  opening line for most files).
- remove boilerplate from all source files, CMake modules and completions,
  this is the 3-paragraph summary of the GPL-3.0-or-later, which has
  a meaning entirely covered by the SPDX tag.
2020-08-26 02:28:38 +02:00

54 lines
1.3 KiB
C++

/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
* SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef DEVICEMODEL_H
#define DEVICEMODEL_H
#include <QAbstractListModel>
#include <QList>
#include <QScopedPointer>
class Device;
class PartitionModel;
/**
* A Qt model which exposes a list of Devices.
*/
class DeviceModel : public QAbstractListModel
{
Q_OBJECT
public:
DeviceModel( QObject* parent = nullptr );
~DeviceModel() override;
using DeviceList = QList< Device* >;
/**
* Init the model with the list of devices. Does *not* take ownership of the
* devices.
*/
void init( const DeviceList& devices );
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
Device* deviceForIndex( const QModelIndex& index ) const;
void swapDevice( Device* oldDevice, Device* newDevice );
void addDevice( Device* device );
void removeDevice( Device* device );
private:
DeviceList m_devices;
};
#endif /* DEVICEMODEL_H */