diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index e66d538be..93cf10a38 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -10,14 +10,22 @@ set( calamaresSources main.cpp CalamaresApplication.cpp CalamaresWindow.cpp - ViewManager.cpp Settings.cpp + ViewManager.cpp YamlUtils.cpp modulesystem/Module.cpp modulesystem/ModuleManager.cpp modulesystem/ViewModule.cpp + progresstree/CategoryItem.cpp + progresstree/ProgressTreeItem.cpp + progresstree/ProgressTreeModel.cpp + progresstree/ProgressTreeView.cpp + progresstree/ViewStepItem.cpp + + utils/CalamaresUtilsGui.cpp + viewpages/ViewStep.cpp viewpages/AbstractPage.cpp ) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 383d26c99..6a8c2171a 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -21,6 +21,8 @@ #include "CalamaresWindow.h" #include "CalamaresVersion.h" #include "modulesystem/ModuleManager.h" +#include "progresstree/ProgressTreeView.h" +#include "progresstree/ProgressTreeModel.h" #include "Settings.h" #include "utils/CalamaresUtils.h" #include "utils/Logger.h" @@ -132,6 +134,11 @@ CalamaresApplication::onPluginsReady() connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this] { m_mainwindow->show(); + + //TODO: move somewhere + ProgressTreeModel* m = new ProgressTreeModel( this ); + ProgressTreeView::instance()->setModel( m ); + ProgressTreeView::instance()->expandAll(); }); } diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index c13fc08d0..0452e5139 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -18,20 +18,47 @@ #include "CalamaresWindow.h" +#include "progresstree/ProgressTreeView.h" +#include "utils/CalamaresUtilsGui.h" #include "ViewManager.h" #include +#include +#include CalamaresWindow::CalamaresWindow( QWidget* parent ) : QWidget( parent ) { - setupUi( this ); // Hide close button setWindowFlags( Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint ); + QBoxLayout* mainLayout = new QHBoxLayout; + setLayout( mainLayout ); + + QWidget* sideBox = new QWidget( this ); + mainLayout->addWidget( sideBox ); + + QBoxLayout* sideLayout = new QVBoxLayout; + sideBox->setLayout( sideLayout ); + sideBox->setFixedWidth( 190 ); //FIXME + sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); + + QHBoxLayout* logoLayout = new QHBoxLayout; + sideLayout->addLayout( logoLayout ); + logoLayout->addStretch(); + QLabel* logoLabel = new QLabel( "branding\ngoes\nhere", sideBox ); + logoLabel->setFixedSize( 80, 80 ); + logoLayout->addWidget( logoLabel ); + logoLayout->addStretch(); + + ProgressTreeView* tv = new ProgressTreeView( sideBox ); + sideLayout->addWidget( tv ); + CalamaresUtils::unmarginLayout( sideLayout ); + CalamaresUtils::unmarginLayout( mainLayout ); + //This should create a PageManager or ViewManager or whatever, which //should control the sidebar, next/back buttons and QSW. Calamares::ViewManager* vm = new Calamares::ViewManager( this ); - layout()->addWidget( vm->centralWidget() ); + mainLayout->addWidget( vm->centralWidget() ); } diff --git a/src/calamares/CalamaresWindow.h b/src/calamares/CalamaresWindow.h index f7b792277..8fbc106aa 100644 --- a/src/calamares/CalamaresWindow.h +++ b/src/calamares/CalamaresWindow.h @@ -19,11 +19,9 @@ #ifndef CALAMARESWINDOW_H #define CALAMARESWINDOW_H -#include "ui_CalamaresWindow.h" - #include -class CalamaresWindow : public QWidget, private Ui::Base +class CalamaresWindow : public QWidget { Q_OBJECT public: diff --git a/src/calamares/ViewManager.cpp b/src/calamares/ViewManager.cpp index 26cd9d871..58cadd78e 100644 --- a/src/calamares/ViewManager.cpp +++ b/src/calamares/ViewManager.cpp @@ -18,6 +18,8 @@ #include "ViewManager.h" +#include "viewpages/ViewStep.h" + #include #include #include @@ -40,10 +42,6 @@ ViewManager::ViewManager( QObject* parent ) { s_instance = this; QBoxLayout* mainLayout = new QVBoxLayout; - mainLayout->setContentsMargins( 0, 0, 0, 0 ); - m_widget->setContentsMargins( 0, 0, 0, 0 ); - mainLayout->setMargin( 0 ); - mainLayout->setSpacing( 0 ); m_widget->setLayout( mainLayout ); m_stack = new QStackedWidget( m_widget ); diff --git a/src/calamares/ViewManager.h b/src/calamares/ViewManager.h index 23e162a84..eac31fdbc 100644 --- a/src/calamares/ViewManager.h +++ b/src/calamares/ViewManager.h @@ -20,16 +20,17 @@ #define VIEWMANAGER_H #include "UiDllMacro.h" -#include "viewpages/ViewStep.h" +#include #include -#include #include namespace Calamares { +class ViewStep; + class UIDLLEXPORT ViewManager : public QObject { Q_OBJECT @@ -43,6 +44,7 @@ public: void addViewStep( ViewStep* step ); + QList< ViewStep* > steps() const { return m_steps; } public slots: void next(); @@ -51,7 +53,7 @@ public slots: private: static ViewManager* s_instance; - QQueue< ViewStep* > m_steps; + QList< ViewStep* > m_steps; int m_currentStep; QWidget* m_widget; diff --git a/src/calamares/progresstree/CategoryItem.cpp b/src/calamares/progresstree/CategoryItem.cpp new file mode 100644 index 000000000..db0a6e473 --- /dev/null +++ b/src/calamares/progresstree/CategoryItem.cpp @@ -0,0 +1,33 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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; +} diff --git a/src/calamares/progresstree/CategoryItem.h b/src/calamares/progresstree/CategoryItem.h new file mode 100644 index 000000000..4de539e36 --- /dev/null +++ b/src/calamares/progresstree/CategoryItem.h @@ -0,0 +1,36 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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 diff --git a/src/calamares/progresstree/ProgressTreeItem.cpp b/src/calamares/progresstree/ProgressTreeItem.cpp new file mode 100644 index 000000000..7316fc2f8 --- /dev/null +++ b/src/calamares/progresstree/ProgressTreeItem.cpp @@ -0,0 +1,89 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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(); +} diff --git a/src/calamares/progresstree/ProgressTreeItem.h b/src/calamares/progresstree/ProgressTreeItem.h new file mode 100644 index 000000000..332d3e7ae --- /dev/null +++ b/src/calamares/progresstree/ProgressTreeItem.h @@ -0,0 +1,54 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#ifndef PROGRESSTREEITEM_H +#define PROGRESSTREEITEM_H + +#include +#include + +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 diff --git a/src/calamares/progresstree/ProgressTreeModel.cpp b/src/calamares/progresstree/ProgressTreeModel.cpp new file mode 100644 index 000000000..01bd7c4a0 --- /dev/null +++ b/src/calamares/progresstree/ProgressTreeModel.cpp @@ -0,0 +1,149 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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 ) ); +} diff --git a/src/calamares/progresstree/ProgressTreeModel.h b/src/calamares/progresstree/ProgressTreeModel.h new file mode 100644 index 000000000..1cef8548e --- /dev/null +++ b/src/calamares/progresstree/ProgressTreeModel.h @@ -0,0 +1,47 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#ifndef PROGRESSTREEMODEL_H +#define PROGRESSTREEMODEL_H + +#include + +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 diff --git a/src/calamares/progresstree/ProgressTreeView.cpp b/src/calamares/progresstree/ProgressTreeView.cpp new file mode 100644 index 000000000..e820b48ee --- /dev/null +++ b/src/calamares/progresstree/ProgressTreeView.cpp @@ -0,0 +1,53 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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() +{ + +} diff --git a/src/calamares/progresstree/ProgressTreeView.h b/src/calamares/progresstree/ProgressTreeView.h new file mode 100644 index 000000000..70fde63f5 --- /dev/null +++ b/src/calamares/progresstree/ProgressTreeView.h @@ -0,0 +1,37 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#ifndef PROGRESSTREEVIEW_H +#define PROGRESSTREEVIEW_H + +#include + +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 diff --git a/src/calamares/progresstree/ViewStepItem.cpp b/src/calamares/progresstree/ViewStepItem.cpp new file mode 100644 index 000000000..d5be94241 --- /dev/null +++ b/src/calamares/progresstree/ViewStepItem.cpp @@ -0,0 +1,43 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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(); +} diff --git a/src/calamares/progresstree/ViewStepItem.h b/src/calamares/progresstree/ViewStepItem.h new file mode 100644 index 000000000..a3c58a33f --- /dev/null +++ b/src/calamares/progresstree/ViewStepItem.h @@ -0,0 +1,43 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Teo Mrnjavac + * + * 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 . + */ + +#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 diff --git a/src/calamares/viewpages/ViewStep.h b/src/calamares/viewpages/ViewStep.h index 3498a7826..76b9a8637 100644 --- a/src/calamares/viewpages/ViewStep.h +++ b/src/calamares/viewpages/ViewStep.h @@ -33,7 +33,7 @@ public: explicit ViewStep( QObject *parent = nullptr ); virtual ~ViewStep(); - virtual QString prettyName() = 0; + virtual QString prettyName() const = 0; //TODO: we might want to make this a QSharedPointer virtual QWidget* widget() = 0; @@ -41,10 +41,10 @@ public: virtual void next() = 0; virtual void back() = 0; - virtual bool isNextEnabled() = 0; + virtual bool isNextEnabled() const = 0; - virtual bool isAtBeginning() = 0; - virtual bool isAtEnd() = 0; + virtual bool isAtBeginning() const = 0; + virtual bool isAtEnd() const = 0; signals: void nextStatusChanged( bool status ); diff --git a/src/modules/greeting/GreetingViewStep.cpp b/src/modules/greeting/GreetingViewStep.cpp index bcd9d77c0..bc1f5a16d 100644 --- a/src/modules/greeting/GreetingViewStep.cpp +++ b/src/modules/greeting/GreetingViewStep.cpp @@ -36,7 +36,7 @@ GreetingViewStep::~GreetingViewStep() QString -GreetingViewStep::prettyName() +GreetingViewStep::prettyName() const { return tr( "Welcome" ); } @@ -62,21 +62,21 @@ GreetingViewStep::back() bool -GreetingViewStep::isNextEnabled() +GreetingViewStep::isNextEnabled() const { return true; } bool -GreetingViewStep::isAtBeginning() +GreetingViewStep::isAtBeginning() const { return true; } bool -GreetingViewStep::isAtEnd() +GreetingViewStep::isAtEnd() const { return true; } diff --git a/src/modules/greeting/GreetingViewStep.h b/src/modules/greeting/GreetingViewStep.h index 45d8caa28..ef2c5adad 100644 --- a/src/modules/greeting/GreetingViewStep.h +++ b/src/modules/greeting/GreetingViewStep.h @@ -37,17 +37,17 @@ public: explicit GreetingViewStep( QObject* parent = nullptr ); virtual ~GreetingViewStep(); - QString prettyName() override; + QString prettyName() const override; QWidget* widget() override; void next() override; void back() override; - bool isNextEnabled() override; + bool isNextEnabled() const override; - bool isAtBeginning() override; - bool isAtEnd() override; + bool isAtBeginning() const override; + bool isAtEnd() const override; private: GreetingPage* m_widget; diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index 9a4e60b71..e7dce1668 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -29,7 +29,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent ) QString -PartitionViewStep::prettyName() +PartitionViewStep::prettyName() const { return tr( "Partitions" ); } @@ -55,21 +55,21 @@ PartitionViewStep::back() bool -PartitionViewStep::isNextEnabled() +PartitionViewStep::isNextEnabled() const { return false; } bool -PartitionViewStep::isAtBeginning() +PartitionViewStep::isAtBeginning() const { return true; } bool -PartitionViewStep::isAtEnd() +PartitionViewStep::isAtEnd() const { return true; } diff --git a/src/modules/partition/PartitionViewStep.h b/src/modules/partition/PartitionViewStep.h index 44044650d..506a9d0cc 100644 --- a/src/modules/partition/PartitionViewStep.h +++ b/src/modules/partition/PartitionViewStep.h @@ -35,17 +35,17 @@ class PLUGINDLLEXPORT PartitionViewStep : public Calamares::ViewStep public: explicit PartitionViewStep( QObject* parent = 0 ); - QString prettyName() override; + QString prettyName() const override; QWidget* widget() override; void next() override; void back() override; - bool isNextEnabled() override; + bool isNextEnabled() const override; - bool isAtBeginning() override; - bool isAtEnd() override; + bool isAtBeginning() const override; + bool isAtEnd() const override; private: PartitionPage* m_widget;