[welcome] Apply coding style

This commit is contained in:
Adriaan de Groot 2020-05-04 13:00:00 +02:00
parent e023adc9b2
commit 7d1800a0d7
8 changed files with 42 additions and 39 deletions

View File

@ -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;

View File

@ -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,7 +123,9 @@ 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 ] {
return tr( "has at least %1 GiB available drive space" ).arg( req );
},
[ req = m_requiredStorageGiB ] { [ 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 );
}, },

View File

@ -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,12 +45,18 @@ 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 );
} }
}
void void

View File

@ -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;

View File

@ -48,8 +48,7 @@ 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() );
@ -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 );