mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 09:25:36 -04:00
Add status info to Summary page. Still needs work to make it nice.
Also added onActivate/onLeave to ViewStep and ViewManager.
This commit is contained in:
parent
49b91608e3
commit
c339ac8cfc
7 changed files with 84 additions and 1 deletions
|
@ -148,6 +148,8 @@ ViewManager::next()
|
||||||
{
|
{
|
||||||
m_currentStep++;
|
m_currentStep++;
|
||||||
m_stack->setCurrentIndex( m_currentStep );
|
m_stack->setCurrentIndex( m_currentStep );
|
||||||
|
step->onLeave();
|
||||||
|
m_steps.at( m_currentStep )->onActivate();
|
||||||
installing = m_steps.at( m_currentStep ) == m_installationViewStep;
|
installing = m_steps.at( m_currentStep ) == m_installationViewStep;
|
||||||
emit currentStepChanged();
|
emit currentStepChanged();
|
||||||
}
|
}
|
||||||
|
@ -169,6 +171,8 @@ ViewManager::back()
|
||||||
{
|
{
|
||||||
m_currentStep--;
|
m_currentStep--;
|
||||||
m_stack->setCurrentIndex( m_currentStep );
|
m_stack->setCurrentIndex( m_currentStep );
|
||||||
|
step->onLeave();
|
||||||
|
m_steps.at( m_currentStep )->onActivate();
|
||||||
emit currentStepChanged();
|
emit currentStepChanged();
|
||||||
}
|
}
|
||||||
else if ( !step->isAtBeginning() )
|
else if ( !step->isAtBeginning() )
|
||||||
|
|
|
@ -25,7 +25,25 @@ ViewStep::ViewStep( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
ViewStep::~ViewStep()
|
ViewStep::~ViewStep()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
ViewStep::prettyStatus() const
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ViewStep::onActivate()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ViewStep::onLeave()
|
||||||
|
{}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
virtual ~ViewStep();
|
virtual ~ViewStep();
|
||||||
|
|
||||||
virtual QString prettyName() const = 0;
|
virtual QString prettyName() const = 0;
|
||||||
|
virtual QString prettyStatus() const;
|
||||||
|
|
||||||
//TODO: we might want to make this a QSharedPointer
|
//TODO: we might want to make this a QSharedPointer
|
||||||
virtual QWidget* widget() = 0;
|
virtual QWidget* widget() = 0;
|
||||||
|
@ -47,6 +48,20 @@ public:
|
||||||
virtual bool isAtBeginning() const = 0;
|
virtual bool isAtBeginning() const = 0;
|
||||||
virtual bool isAtEnd() const = 0;
|
virtual bool isAtEnd() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onActivate called every time a ViewStep is shown, either by going forward
|
||||||
|
* or backward.
|
||||||
|
* The default implementation does nothing.
|
||||||
|
*/
|
||||||
|
virtual void onActivate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onLeave called every time a ViewStep is hidden and control passes to
|
||||||
|
* another ViewStep, either by going forward or backward.
|
||||||
|
* The default implementation does nothing.
|
||||||
|
*/
|
||||||
|
virtual void onLeave();
|
||||||
|
|
||||||
virtual QList< Calamares::job_ptr > jobs() const = 0;
|
virtual QList< Calamares::job_ptr > jobs() const = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
#include "SummaryPage.h"
|
#include "SummaryPage.h"
|
||||||
|
|
||||||
|
#include "ViewManager.h"
|
||||||
|
#include "viewpages/ViewStep.h"
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
|
@ -25,8 +28,36 @@
|
||||||
SummaryPage::SummaryPage( QWidget* parent )
|
SummaryPage::SummaryPage( QWidget* parent )
|
||||||
: QWidget()
|
: QWidget()
|
||||||
{
|
{
|
||||||
QBoxLayout *mainLayout = new QHBoxLayout;
|
QBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
setLayout( mainLayout );
|
setLayout( mainLayout );
|
||||||
|
|
||||||
|
mainLayout->addStretch();
|
||||||
|
|
||||||
|
m_label = new QLabel( this );
|
||||||
|
mainLayout->addWidget( m_label );
|
||||||
|
m_label->setWordWrap( true );
|
||||||
|
|
||||||
|
mainLayout->addStretch();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SummaryPage::onActivate()
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
foreach ( Calamares::ViewStep* step,
|
||||||
|
Calamares::ViewManager::instance()->prepareSteps() )
|
||||||
|
{
|
||||||
|
//TODO: make it nice!
|
||||||
|
if ( !step->prettyStatus().isEmpty() )
|
||||||
|
{
|
||||||
|
if ( !text.isEmpty() )
|
||||||
|
text += "<br/><br/>";
|
||||||
|
|
||||||
|
text += "<h3>" + step->prettyName() +
|
||||||
|
"</h3><br/>" + step->prettyStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_label->setText( text );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,18 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class SummaryPage : public QWidget
|
class SummaryPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SummaryPage( QWidget* parent = nullptr );
|
explicit SummaryPage( QWidget* parent = nullptr );
|
||||||
|
|
||||||
|
void onActivate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLabel* m_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SUMMARYPAGE_H
|
#endif // SUMMARYPAGE_H
|
||||||
|
|
|
@ -88,3 +88,10 @@ SummaryViewStep::jobs() const
|
||||||
return QList< Calamares::job_ptr >();
|
return QList< Calamares::job_ptr >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SummaryViewStep::onActivate()
|
||||||
|
{
|
||||||
|
m_widget->onActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ public:
|
||||||
|
|
||||||
QList< Calamares::job_ptr > jobs() const override;
|
QList< Calamares::job_ptr > jobs() const override;
|
||||||
|
|
||||||
|
void onActivate() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SummaryPage* m_widget;
|
SummaryPage* m_widget;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue