Select Git revision
PartitionModel.cpp
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
PartitionModel.cpp 9.26 KiB
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
*
* Calamares 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.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/PartitionModel.h"
#include "core/ColorUtils.h"
#include "core/PartitionInfo.h"
#include "core/KPMHelpers.h"
#include "utils/Logger.h"
// CalaPM
#include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h>
#include <kpmcore/core/partitiontable.h>
#include <kpmcore/fs/filesystem.h>
// KF5
#include <KFormat>
// Qt
#include <QColor>
//- ResetHelper --------------------------------------------
PartitionModel::ResetHelper::ResetHelper( PartitionModel* model )
: m_model( model )
{
m_model->beginResetModel();
}
PartitionModel::ResetHelper::~ResetHelper()
{
m_model->endResetModel();
}
//- PartitionModel -----------------------------------------
PartitionModel::PartitionModel( QObject* parent )
: QAbstractItemModel( parent )
, m_device( nullptr )
{
}
void
PartitionModel::init( Device* device , const OsproberEntryList& osproberEntries )
{
beginResetModel();
m_device = device;
m_osproberEntries = osproberEntries;
endResetModel();
}
int
PartitionModel::columnCount( const QModelIndex& parent ) const
{
return ColumnCount;
}