[summaryq] Apply coding style
This commit is contained in:
parent
b43759c6a5
commit
d2e11dd5d1
@ -20,15 +20,19 @@
|
||||
#include "utils/Retranslator.h"
|
||||
#include "viewpages/ExecutionViewStep.h"
|
||||
|
||||
SummaryModel::SummaryModel(QObject* parent) : QAbstractListModel(parent)
|
||||
{}
|
||||
SummaryModel::SummaryModel( QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
{
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> SummaryModel::roleNames() const
|
||||
QHash< int, QByteArray >
|
||||
SummaryModel::roleNames() const
|
||||
{
|
||||
return { { Qt::DisplayRole, "title" }, { Qt::UserRole, "message" } };
|
||||
}
|
||||
|
||||
QVariant SummaryModel::data(const QModelIndex& index, int role) const
|
||||
QVariant
|
||||
SummaryModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() )
|
||||
{
|
||||
@ -38,12 +42,14 @@ QVariant SummaryModel::data(const QModelIndex& index, int role) const
|
||||
return role == Qt::DisplayRole ? item->title : item->message;
|
||||
}
|
||||
|
||||
int SummaryModel::rowCount(const QModelIndex&) const
|
||||
int
|
||||
SummaryModel::rowCount( const QModelIndex& ) const
|
||||
{
|
||||
return m_summary.count();
|
||||
}
|
||||
|
||||
void SummaryModel::setSummary(const Calamares::ViewStepList& steps)
|
||||
void
|
||||
SummaryModel::setSummary( const Calamares::ViewStepList& steps )
|
||||
{
|
||||
m_summary.clear();
|
||||
Q_EMIT beginResetModel();
|
||||
@ -54,44 +60,50 @@ void SummaryModel::setSummary(const Calamares::ViewStepList& steps)
|
||||
QWidget* widget = step->createSummaryWidget();
|
||||
|
||||
if ( text.isEmpty() && !widget )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_summary << new StepSummary {step->prettyName(), text};
|
||||
|
||||
m_summary << new StepSummary { step->prettyName(), text };
|
||||
}
|
||||
Q_EMIT endResetModel();
|
||||
}
|
||||
|
||||
Config::Config(QObject *parent) : QObject(parent)
|
||||
, m_thisViewStep(static_cast<SummaryQmlViewStep*>(parent))
|
||||
, m_summary( new SummaryModel(this) )
|
||||
Config::Config( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_thisViewStep( static_cast< SummaryQmlViewStep* >( parent ) )
|
||||
, m_summary( new SummaryModel( this ) )
|
||||
{
|
||||
m_title = m_thisViewStep->prettyName();
|
||||
|
||||
if ( Calamares::Settings::instance()->isSetupMode() )
|
||||
m_message =( tr( "This is an overview of what will happen once you start "
|
||||
m_message = ( tr( "This is an overview of what will happen once you start "
|
||||
"the setup procedure." ) );
|
||||
else
|
||||
m_message = ( tr( "This is an overview of what will happen once you start "
|
||||
"the install procedure." ) );
|
||||
}
|
||||
|
||||
void Config::componentComplete()
|
||||
void
|
||||
Config::componentComplete()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
void Config::refresh()
|
||||
void
|
||||
Config::refresh()
|
||||
{
|
||||
m_summary->setSummary( stepsForSummary( Calamares::ViewManager::instance()->viewSteps() ));
|
||||
m_summary->setSummary( stepsForSummary( Calamares::ViewManager::instance()->viewSteps() ) );
|
||||
}
|
||||
|
||||
void Config::init()
|
||||
void
|
||||
Config::init()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
Calamares::ViewStepList Config::stepsForSummary( const Calamares::ViewStepList& allSteps ) const
|
||||
Calamares::ViewStepList
|
||||
Config::stepsForSummary( const Calamares::ViewStepList& allSteps ) const
|
||||
{
|
||||
Calamares::ViewStepList steps;
|
||||
for ( Calamares::ViewStep* step : allSteps )
|
||||
@ -103,12 +115,12 @@ Calamares::ViewStepList Config::stepsForSummary( const Calamares::ViewStepList&
|
||||
}
|
||||
|
||||
if ( m_thisViewStep == step )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
steps.append( step );
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
#ifndef SUMMARY_CONFIG_H
|
||||
#define SUMMARY_CONFIG_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractListModel>
|
||||
#include <QQmlParserStatus>
|
||||
#include "viewpages/ViewStep.h"
|
||||
#include <QAbstractListModel>
|
||||
#include <QObject>
|
||||
#include <QQmlParserStatus>
|
||||
|
||||
class SummaryQmlViewStep;
|
||||
|
||||
@ -28,42 +28,40 @@ class SummaryModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SummaryModel(QObject *parent = nullptr);
|
||||
explicit SummaryModel( QObject* parent = nullptr );
|
||||
int rowCount( const QModelIndex& = QModelIndex() ) const override;
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
|
||||
void setSummary(const Calamares::ViewStepList &steps);
|
||||
void setSummary( const Calamares::ViewStepList& steps );
|
||||
|
||||
protected:
|
||||
QHash< int, QByteArray > roleNames() const override;
|
||||
|
||||
private:
|
||||
QVector<StepSummary*> m_summary;
|
||||
QVector< StepSummary* > m_summary;
|
||||
};
|
||||
|
||||
class Config : public QObject, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString message MEMBER m_message NOTIFY messageChanged CONSTANT)
|
||||
Q_PROPERTY(QString title MEMBER m_title NOTIFY titleChanged CONSTANT)
|
||||
Q_PROPERTY(SummaryModel * summaryModel READ summaryModel CONSTANT FINAL)
|
||||
Q_PROPERTY( QString message MEMBER m_message NOTIFY messageChanged CONSTANT )
|
||||
Q_PROPERTY( QString title MEMBER m_title NOTIFY titleChanged CONSTANT )
|
||||
Q_PROPERTY( SummaryModel* summaryModel READ summaryModel CONSTANT FINAL )
|
||||
|
||||
public:
|
||||
explicit Config(QObject *parent = nullptr);
|
||||
explicit Config( QObject* parent = nullptr );
|
||||
virtual void componentComplete() override;
|
||||
virtual void classBegin() override {}
|
||||
|
||||
void refresh();
|
||||
void init();
|
||||
|
||||
SummaryModel * summaryModel() const
|
||||
{
|
||||
return m_summary;
|
||||
}
|
||||
SummaryModel* summaryModel() const { return m_summary; }
|
||||
|
||||
private:
|
||||
Calamares::ViewStepList stepsForSummary( const Calamares::ViewStepList& allSteps ) const;
|
||||
const SummaryQmlViewStep* m_thisViewStep;
|
||||
SummaryModel *m_summary;
|
||||
SummaryModel* m_summary;
|
||||
|
||||
QString m_message;
|
||||
QString m_title;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "SummaryQmlViewStep.h"
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryQmlViewStepFactory, registerPlugin<SummaryQmlViewStep>(); )
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryQmlViewStepFactory, registerPlugin< SummaryQmlViewStep >(); )
|
||||
|
||||
SummaryQmlViewStep::SummaryQmlViewStep( QObject* parent )
|
||||
: Calamares::QmlViewStep( parent )
|
||||
@ -20,10 +20,7 @@ SummaryQmlViewStep::SummaryQmlViewStep( QObject* parent )
|
||||
}
|
||||
|
||||
|
||||
SummaryQmlViewStep::~SummaryQmlViewStep()
|
||||
{
|
||||
|
||||
}
|
||||
SummaryQmlViewStep::~SummaryQmlViewStep() {}
|
||||
|
||||
QString
|
||||
SummaryQmlViewStep::prettyName() const
|
||||
@ -72,4 +69,3 @@ SummaryQmlViewStep::onActivate()
|
||||
{
|
||||
m_config->init();
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
#define SUMMARYQMLVIEWSTEP_H
|
||||
|
||||
#include "Config.h"
|
||||
#include "DllMacro.h"
|
||||
#include "utils/PluginFactory.h"
|
||||
#include "viewpages/QmlViewStep.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -41,13 +41,10 @@ public:
|
||||
|
||||
void onActivate() override;
|
||||
|
||||
QObject * getConfig() override
|
||||
{
|
||||
return m_config;
|
||||
}
|
||||
QObject* getConfig() override { return m_config; }
|
||||
|
||||
private:
|
||||
Config *m_config;
|
||||
Config* m_config;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( SummaryQmlViewStepFactory )
|
||||
|
Loading…
Reference in New Issue
Block a user