Skip to content
Snippets Groups Projects
Select Git revision
  • df1ee680c8cb32a89acbd22386a63bafaa0f27fb
  • master default protected
  • md-export
  • th/mail
  • 179-einladungen-zum-aushaengen-drucken
5 results

database.py

Blame
  • 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;
    }