[welcome] Apply coding style
This commit is contained in:
parent
e023adc9b2
commit
7d1800a0d7
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
CheckerContainer::CheckerContainer( const Calamares::RequirementsModel &model, QWidget* parent )
|
CheckerContainer::CheckerContainer( const Calamares::RequirementsModel& model, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
||||||
, m_checkerWidget( nullptr )
|
, m_checkerWidget( nullptr )
|
||||||
@ -60,7 +60,7 @@ CheckerContainer::requirementsComplete( bool ok )
|
|||||||
m_waitingWidget->deleteLater();
|
m_waitingWidget->deleteLater();
|
||||||
m_waitingWidget = nullptr; // Don't delete in destructor
|
m_waitingWidget = nullptr; // Don't delete in destructor
|
||||||
|
|
||||||
m_checkerWidget = new ResultsListWidget( m_model, this);
|
m_checkerWidget = new ResultsListWidget( m_model, this );
|
||||||
layout()->addWidget( m_checkerWidget );
|
layout()->addWidget( m_checkerWidget );
|
||||||
|
|
||||||
m_verdict = ok;
|
m_verdict = ok;
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#ifndef CHECKERCONTAINER_H
|
#ifndef CHECKERCONTAINER_H
|
||||||
#define CHECKERCONTAINER_H
|
#define CHECKERCONTAINER_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
class ResultsListWidget;
|
class ResultsListWidget;
|
||||||
class WaitingWidget;
|
class WaitingWidget;
|
||||||
@ -40,7 +40,7 @@ class CheckerContainer : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CheckerContainer(const Calamares::RequirementsModel &model, QWidget* parent = nullptr );
|
explicit CheckerContainer( const Calamares::RequirementsModel& model, QWidget* parent = nullptr );
|
||||||
virtual ~CheckerContainer();
|
virtual ~CheckerContainer();
|
||||||
|
|
||||||
bool verdict() const;
|
bool verdict() const;
|
||||||
@ -52,13 +52,13 @@ public slots:
|
|||||||
void requirementsProgress( const QString& message );
|
void requirementsProgress( const QString& message );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WaitingWidget *m_waitingWidget;
|
WaitingWidget* m_waitingWidget;
|
||||||
ResultsListWidget *m_checkerWidget;
|
ResultsListWidget* m_checkerWidget;
|
||||||
|
|
||||||
bool m_verdict;
|
bool m_verdict;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Calamares::RequirementsModel &m_model;
|
const Calamares::RequirementsModel& m_model;
|
||||||
} ;
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,12 +38,12 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
|
||||||
#include <unistd.h> //geteuid
|
#include <unistd.h> //geteuid
|
||||||
@ -123,8 +123,10 @@ GeneralRequirements::checkRequirements()
|
|||||||
{
|
{
|
||||||
checkEntries.append(
|
checkEntries.append(
|
||||||
{ entry,
|
{ entry,
|
||||||
[req = m_requiredStorageGiB] { return tr( "has at least %1 GiB available drive space" ).arg( req ); },
|
[ req = m_requiredStorageGiB ] {
|
||||||
[req = m_requiredStorageGiB] {
|
return tr( "has at least %1 GiB available drive space" ).arg( req );
|
||||||
|
},
|
||||||
|
[ req = m_requiredStorageGiB ] {
|
||||||
return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req );
|
return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req );
|
||||||
},
|
},
|
||||||
enoughStorage,
|
enoughStorage,
|
||||||
@ -134,8 +136,8 @@ GeneralRequirements::checkRequirements()
|
|||||||
{
|
{
|
||||||
checkEntries.append(
|
checkEntries.append(
|
||||||
{ entry,
|
{ entry,
|
||||||
[req = m_requiredRamGiB] { return tr( "has at least %1 GiB working memory" ).arg( req ); },
|
[ req = m_requiredRamGiB ] { return tr( "has at least %1 GiB working memory" ).arg( req ); },
|
||||||
[req = m_requiredRamGiB] {
|
[ req = m_requiredRamGiB ] {
|
||||||
return tr( "The system does not have enough working memory. At least %1 GiB is required." )
|
return tr( "The system does not have enough working memory. At least %1 GiB is required." )
|
||||||
.arg( req );
|
.arg( req );
|
||||||
},
|
},
|
||||||
|
@ -24,17 +24,14 @@
|
|||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
|
||||||
static inline void setCondition( QLabel* label, CalamaresUtils::ImageType t )
|
static inline void
|
||||||
|
setCondition( QLabel* label, CalamaresUtils::ImageType t )
|
||||||
{
|
{
|
||||||
label->setPixmap(
|
label->setPixmap(
|
||||||
CalamaresUtils::defaultPixmap( t,
|
CalamaresUtils::defaultPixmap( t, CalamaresUtils::Original, QSize( label->height(), label->height() ) ) );
|
||||||
CalamaresUtils::Original,
|
|
||||||
QSize( label->height(), label->height() ) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultWidget::ResultWidget( bool satisfied,
|
ResultWidget::ResultWidget( bool satisfied, bool required, QWidget* parent )
|
||||||
bool required,
|
|
||||||
QWidget* parent )
|
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
{
|
{
|
||||||
QBoxLayout* mainLayout = new QHBoxLayout;
|
QBoxLayout* mainLayout = new QHBoxLayout;
|
||||||
@ -48,11 +45,17 @@ ResultWidget::ResultWidget( bool satisfied,
|
|||||||
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
|
||||||
if ( satisfied )
|
if ( satisfied )
|
||||||
|
{
|
||||||
setCondition( m_iconLabel, CalamaresUtils::StatusOk );
|
setCondition( m_iconLabel, CalamaresUtils::StatusOk );
|
||||||
|
}
|
||||||
else if ( required )
|
else if ( required )
|
||||||
|
{
|
||||||
setCondition( m_iconLabel, CalamaresUtils::StatusError );
|
setCondition( m_iconLabel, CalamaresUtils::StatusError );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
setCondition( m_iconLabel, CalamaresUtils::StatusWarning );
|
setCondition( m_iconLabel, CalamaresUtils::StatusWarning );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ public:
|
|||||||
*
|
*
|
||||||
* Use setText() to set up the text of the widget.
|
* Use setText() to set up the text of the widget.
|
||||||
*/
|
*/
|
||||||
explicit ResultWidget( bool satisfied, bool required,
|
explicit ResultWidget( bool satisfied, bool required, QWidget* parent = nullptr );
|
||||||
QWidget* parent = nullptr );
|
|
||||||
|
|
||||||
/// @brief Set the displayed description of the check.
|
/// @brief Set the displayed description of the check.
|
||||||
void setText( const QString& text );
|
void setText( const QString& text );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel* m_textLabel;
|
QLabel* m_textLabel;
|
||||||
QLabel* m_iconLabel;
|
QLabel* m_iconLabel;
|
||||||
|
@ -47,16 +47,15 @@
|
|||||||
static void
|
static void
|
||||||
createResultWidgets( QLayout* layout,
|
createResultWidgets( QLayout* layout,
|
||||||
QList< ResultWidget* >& resultWidgets,
|
QList< ResultWidget* >& resultWidgets,
|
||||||
const Calamares::RequirementsModel &model,
|
const Calamares::RequirementsModel& model,
|
||||||
std::function< bool( const Calamares::RequirementEntry& ) > predicate
|
std::function< bool( const Calamares::RequirementEntry& ) > predicate )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
resultWidgets.clear();
|
resultWidgets.clear();
|
||||||
resultWidgets.reserve( model.count() );
|
resultWidgets.reserve( model.count() );
|
||||||
for ( auto i = 0; i < model.count(); i++ )
|
for ( auto i = 0; i < model.count(); i++ )
|
||||||
{
|
{
|
||||||
const auto &entry = model.getEntry(i);
|
const auto& entry = model.getEntry( i );
|
||||||
if ( !predicate(entry))
|
if ( !predicate( entry ) )
|
||||||
{
|
{
|
||||||
resultWidgets.append( nullptr );
|
resultWidgets.append( nullptr );
|
||||||
continue;
|
continue;
|
||||||
@ -105,7 +104,7 @@ private:
|
|||||||
void retranslate();
|
void retranslate();
|
||||||
};
|
};
|
||||||
|
|
||||||
ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, QWidget* parent)
|
ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, QWidget* parent )
|
||||||
: QDialog( parent )
|
: QDialog( parent )
|
||||||
, m_model( model )
|
, m_model( model )
|
||||||
{
|
{
|
||||||
@ -114,9 +113,8 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
|||||||
|
|
||||||
m_title = new QLabel( this );
|
m_title = new QLabel( this );
|
||||||
|
|
||||||
createResultWidgets( entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementEntry& e ) {
|
createResultWidgets(
|
||||||
return e.hasDetails();
|
entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementEntry& e ) { return e.hasDetails(); } );
|
||||||
} );
|
|
||||||
|
|
||||||
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
|
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
|
||||||
|
|
||||||
@ -132,7 +130,7 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
|||||||
retranslate(); // Do it now to fill in the texts
|
retranslate(); // Do it now to fill in the texts
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultsListDialog::~ResultsListDialog() {}
|
ResultsListDialog::~ResultsListDialog() { }
|
||||||
|
|
||||||
void
|
void
|
||||||
ResultsListDialog::retranslate()
|
ResultsListDialog::retranslate()
|
||||||
@ -142,7 +140,7 @@ ResultsListDialog::retranslate()
|
|||||||
|
|
||||||
for ( auto i = 0; i < m_model.count(); i++ )
|
for ( auto i = 0; i < m_model.count(); i++ )
|
||||||
{
|
{
|
||||||
const auto &entry = m_model.getEntry(i);
|
const auto& entry = m_model.getEntry( i );
|
||||||
if ( m_resultWidgets[ i ] )
|
if ( m_resultWidgets[ i ] )
|
||||||
{
|
{
|
||||||
m_resultWidgets[ i ]->setText( entry.enumerationText() );
|
m_resultWidgets[ i ]->setText( entry.enumerationText() );
|
||||||
@ -151,7 +149,7 @@ ResultsListDialog::retranslate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel &model, QWidget* parent )
|
ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel& model, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_model( model )
|
, m_model( model )
|
||||||
{
|
{
|
||||||
@ -242,7 +240,7 @@ ResultsListWidget::retranslate()
|
|||||||
{
|
{
|
||||||
for ( auto i = 0; i < m_model.count(); i++ )
|
for ( auto i = 0; i < m_model.count(); i++ )
|
||||||
{
|
{
|
||||||
const auto &entry = m_model.getEntry(i);
|
const auto& entry = m_model.getEntry( i );
|
||||||
if ( m_resultWidgets[ i ] )
|
if ( m_resultWidgets[ i ] )
|
||||||
{
|
{
|
||||||
m_resultWidgets[ i ]->setText( entry.negatedText() );
|
m_resultWidgets[ i ]->setText( entry.negatedText() );
|
||||||
|
@ -30,7 +30,7 @@ class ResultsListWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ResultsListWidget(const Calamares::RequirementsModel &model, QWidget* parent);
|
explicit ResultsListWidget( const Calamares::RequirementsModel& model, QWidget* parent );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @brief A link in the explanatory text has been clicked
|
/// @brief A link in the explanatory text has been clicked
|
||||||
@ -38,7 +38,7 @@ private:
|
|||||||
void retranslate();
|
void retranslate();
|
||||||
|
|
||||||
QLabel* m_explanation = nullptr; ///< Explanatory text above the list, with link
|
QLabel* m_explanation = nullptr; ///< Explanatory text above the list, with link
|
||||||
const Calamares::RequirementsModel &m_model;
|
const Calamares::RequirementsModel& m_model;
|
||||||
QList< ResultWidget* > m_resultWidgets; ///< One widget for each unsatisfied entry
|
QList< ResultWidget* > m_resultWidgets; ///< One widget for each unsatisfied entry
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user