mirror of https://github.com/cutefishos/calamares
Added ProgressTreeModel/View, including different kinds of items.
Redone CalamaresWindow without UI file. Const correctness in ViewStep and plugins.main
parent
3a3bf71054
commit
80789b6143
@ -0,0 +1,33 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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 "CategoryItem.h"
|
||||||
|
|
||||||
|
|
||||||
|
CategoryItem::CategoryItem( const QString& text, ProgressTreeItem* parent )
|
||||||
|
: ProgressTreeItem( parent )
|
||||||
|
, m_text( text )
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
CategoryItem::data( int column ) const
|
||||||
|
{
|
||||||
|
Q_UNUSED( column );
|
||||||
|
return m_text;
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CATEGORYITEM_H
|
||||||
|
#define CATEGORYITEM_H
|
||||||
|
|
||||||
|
#include "ProgressTreeItem.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CategoryItem : public ProgressTreeItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit CategoryItem( const QString& text, ProgressTreeItem* parent = nullptr );
|
||||||
|
|
||||||
|
virtual QVariant data( int column ) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_text;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CATEGORYITEM_H
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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 "ProgressTreeItem.h"
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeItem::ProgressTreeItem( ProgressTreeItem* parent )
|
||||||
|
{
|
||||||
|
m_parentItem = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeItem::~ProgressTreeItem()
|
||||||
|
{
|
||||||
|
qDeleteAll( m_childItems );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ProgressTreeItem::appendChild( ProgressTreeItem* item )
|
||||||
|
{
|
||||||
|
m_childItems.append( item );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeItem*
|
||||||
|
ProgressTreeItem::child( int row )
|
||||||
|
{
|
||||||
|
return m_childItems.value( row );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ProgressTreeItem::childCount() const
|
||||||
|
{
|
||||||
|
return m_childItems.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ProgressTreeItem::columnCount() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ProgressTreeItem::row() const
|
||||||
|
{
|
||||||
|
if ( m_parentItem )
|
||||||
|
return m_parentItem->m_childItems.indexOf(
|
||||||
|
const_cast< ProgressTreeItem* >( this ) );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeItem*
|
||||||
|
ProgressTreeItem::parent()
|
||||||
|
{
|
||||||
|
return m_parentItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeRoot::ProgressTreeRoot()
|
||||||
|
: ProgressTreeItem()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
ProgressTreeRoot::data( int column ) const
|
||||||
|
{
|
||||||
|
Q_UNUSED( column );
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PROGRESSTREEITEM_H
|
||||||
|
#define PROGRESSTREEITEM_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
class ProgressTreeItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ProgressTreeItem( ProgressTreeItem* parent = nullptr );
|
||||||
|
|
||||||
|
virtual ~ProgressTreeItem();
|
||||||
|
|
||||||
|
virtual void appendChild( ProgressTreeItem* item );
|
||||||
|
|
||||||
|
virtual ProgressTreeItem* child( int row );
|
||||||
|
virtual int childCount() const;
|
||||||
|
virtual int columnCount() const;
|
||||||
|
virtual QVariant data( int column ) const = 0;
|
||||||
|
virtual int row() const;
|
||||||
|
virtual ProgressTreeItem* parent();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList< ProgressTreeItem* > m_childItems;
|
||||||
|
ProgressTreeItem* m_parentItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProgressTreeRoot : public ProgressTreeItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ProgressTreeRoot();
|
||||||
|
|
||||||
|
virtual QVariant data( int column ) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROGRESSTREEITEM_H
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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 "ProgressTreeModel.h"
|
||||||
|
|
||||||
|
#include "progresstree/CategoryItem.h"
|
||||||
|
#include "progresstree/ViewStepItem.h"
|
||||||
|
#include "ViewManager.h"
|
||||||
|
|
||||||
|
ProgressTreeModel::ProgressTreeModel( QObject* parent )
|
||||||
|
: QAbstractItemModel( parent )
|
||||||
|
{
|
||||||
|
setupModelData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeModel::~ProgressTreeModel()
|
||||||
|
{
|
||||||
|
delete m_rootItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Qt::ItemFlags
|
||||||
|
ProgressTreeModel::flags( const QModelIndex& index ) const
|
||||||
|
{
|
||||||
|
if ( !index.isValid() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return Qt::ItemIsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QModelIndex
|
||||||
|
ProgressTreeModel::index( int row, int column, const QModelIndex& parent ) const
|
||||||
|
{
|
||||||
|
if ( !hasIndex( row, column, parent ) )
|
||||||
|
return QModelIndex();
|
||||||
|
|
||||||
|
ProgressTreeItem* parentItem;
|
||||||
|
|
||||||
|
if ( !parent.isValid() )
|
||||||
|
parentItem = m_rootItem;
|
||||||
|
else
|
||||||
|
parentItem = static_cast< ProgressTreeItem* >( parent.internalPointer() );
|
||||||
|
|
||||||
|
ProgressTreeItem* childItem = parentItem->child( row );
|
||||||
|
if ( childItem )
|
||||||
|
return createIndex( row, column, childItem );
|
||||||
|
else
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QModelIndex
|
||||||
|
ProgressTreeModel::parent( const QModelIndex& index ) const
|
||||||
|
{
|
||||||
|
if ( !index.isValid() )
|
||||||
|
return QModelIndex();
|
||||||
|
|
||||||
|
ProgressTreeItem* childItem = static_cast< ProgressTreeItem* >( index.internalPointer() );
|
||||||
|
ProgressTreeItem* parentItem = childItem->parent();
|
||||||
|
|
||||||
|
if ( parentItem == m_rootItem )
|
||||||
|
return QModelIndex();
|
||||||
|
|
||||||
|
return createIndex( parentItem->row(), 0, parentItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
ProgressTreeModel::data( const QModelIndex& index, int role ) const
|
||||||
|
{
|
||||||
|
if ( !index.isValid() )
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if ( role != Qt::DisplayRole )
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
ProgressTreeItem *item = static_cast< ProgressTreeItem* >( index.internalPointer() );
|
||||||
|
|
||||||
|
return item->data( index.column() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
ProgressTreeModel::headerData( int section, Qt::Orientation orientation, int role ) const
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ProgressTreeModel::rowCount( const QModelIndex& parent ) const
|
||||||
|
{
|
||||||
|
ProgressTreeItem* parentItem;
|
||||||
|
if ( parent.column() > 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( !parent.isValid() )
|
||||||
|
parentItem = m_rootItem;
|
||||||
|
else
|
||||||
|
parentItem = static_cast< ProgressTreeItem* >( parent.internalPointer() );
|
||||||
|
|
||||||
|
return parentItem->childCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ProgressTreeModel::columnCount( const QModelIndex& parent ) const
|
||||||
|
{
|
||||||
|
if ( parent.isValid() )
|
||||||
|
return static_cast< ProgressTreeItem* >( parent.internalPointer() )->columnCount();
|
||||||
|
else
|
||||||
|
return m_rootItem->columnCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ProgressTreeModel::setupModelData()
|
||||||
|
{
|
||||||
|
m_rootItem = new ProgressTreeRoot();
|
||||||
|
const Calamares::ViewManager* vm = Calamares::ViewManager::instance();
|
||||||
|
|
||||||
|
CategoryItem* prepare = new CategoryItem( tr( "Prepare" ), m_rootItem );
|
||||||
|
m_rootItem->appendChild( prepare );
|
||||||
|
|
||||||
|
foreach ( const Calamares::ViewStep* step, vm->steps() )
|
||||||
|
{
|
||||||
|
prepare->appendChild( new ViewStepItem( step, prepare ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rootItem->appendChild( new CategoryItem( tr( "Install" ), m_rootItem ) );
|
||||||
|
m_rootItem->appendChild( new CategoryItem( tr( "Finish" ), m_rootItem ) );
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PROGRESSTREEMODEL_H
|
||||||
|
#define PROGRESSTREEMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
|
class ProgressTreeRoot;
|
||||||
|
|
||||||
|
class ProgressTreeModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ProgressTreeModel( QObject* parent = nullptr );
|
||||||
|
virtual ~ProgressTreeModel();
|
||||||
|
|
||||||
|
Qt::ItemFlags flags( const QModelIndex& index ) const override;
|
||||||
|
QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override;
|
||||||
|
QModelIndex parent( const QModelIndex& index ) const override;
|
||||||
|
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
|
||||||
|
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
|
||||||
|
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
|
||||||
|
int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupModelData();
|
||||||
|
|
||||||
|
ProgressTreeRoot* m_rootItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROGRESSTREEMODEL_H
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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 "ProgressTreeView.h"
|
||||||
|
|
||||||
|
ProgressTreeView* ProgressTreeView::s_instance = nullptr;
|
||||||
|
|
||||||
|
ProgressTreeView*
|
||||||
|
ProgressTreeView::instance()
|
||||||
|
{
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressTreeView::ProgressTreeView( QWidget* parent )
|
||||||
|
: QTreeView( parent )
|
||||||
|
{
|
||||||
|
s_instance = this; //FIXME: should assert when s_instance gets written and it wasn't nullptr
|
||||||
|
|
||||||
|
setFrameShape( QFrame::NoFrame );
|
||||||
|
setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
|
setHeaderHidden( true );
|
||||||
|
setRootIsDecorated( true );
|
||||||
|
setExpandsOnDoubleClick( true );
|
||||||
|
|
||||||
|
setSelectionMode( QAbstractItemView::NoSelection );
|
||||||
|
setDragDropMode( QAbstractItemView::NoDragDrop );
|
||||||
|
setAcceptDrops( false );
|
||||||
|
setUniformRowHeights( false );
|
||||||
|
|
||||||
|
setSortingEnabled( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressTreeView::~ProgressTreeView()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PROGRESSTREEVIEW_H
|
||||||
|
#define PROGRESSTREEVIEW_H
|
||||||
|
|
||||||
|
#include <QTreeView>
|
||||||
|
|
||||||
|
class ProgressTreeView : public QTreeView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static ProgressTreeView* instance();
|
||||||
|
|
||||||
|
explicit ProgressTreeView( QWidget* parent = 0 );
|
||||||
|
virtual ~ProgressTreeView();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static ProgressTreeView* s_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROGRESSTREEVIEW_H
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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 "ViewStepItem.h"
|
||||||
|
|
||||||
|
#include "viewpages/ViewStep.h"
|
||||||
|
|
||||||
|
|
||||||
|
ViewStepItem::ViewStepItem( const Calamares::ViewStep* step, ProgressTreeItem* parent )
|
||||||
|
: ProgressTreeItem( parent )
|
||||||
|
{
|
||||||
|
m_step = step;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ViewStepItem::appendChild( ProgressTreeItem* item )
|
||||||
|
{
|
||||||
|
Q_ASSERT( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
ViewStepItem::data( int column ) const
|
||||||
|
{
|
||||||
|
Q_UNUSED( column );
|
||||||
|
return m_step->prettyName();
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014, Teo Mrnjavac <teo@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef VIEWSTEPITEM_H
|
||||||
|
#define VIEWSTEPITEM_H
|
||||||
|
|
||||||
|
#include "ProgressTreeItem.h"
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
class ViewStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ViewStepItem : public ProgressTreeItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ViewStepItem( const Calamares::ViewStep* step, ProgressTreeItem* parent = nullptr );
|
||||||
|
|
||||||
|
void appendChild( ProgressTreeItem* item ) override;
|
||||||
|
|
||||||
|
QVariant data( int column ) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Calamares::ViewStep* m_step;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // VIEWSTEPITEM_H
|
||||||
Loading…
Reference in New Issue