Commit 177d6fe8 authored by Adriaan de Groot's avatar Adriaan de Groot

[libcalamares] Apply coding style

parent 08b50129
......@@ -239,7 +239,8 @@ CStringListModel::CStringListModel( CStringPairList l )
{
}
void CStringListModel::setList(CalamaresUtils::Locale::CStringPairList l)
void
CStringListModel::setList( CalamaresUtils::Locale::CStringPairList l )
{
beginResetModel();
m_list = l;
......@@ -270,10 +271,12 @@ CStringListModel::data( const QModelIndex& index, int role ) const
}
void
CStringListModel::setCurrentIndex(const int &index)
CStringListModel::setCurrentIndex( const int& index )
{
if ( ( index < 0 ) || ( index >= m_list.count() ) )
{
return;
}
m_currentIndex = index;
emit currentIndexChanged();
......@@ -285,10 +288,10 @@ CStringListModel::currentIndex() const
return m_currentIndex;
}
QHash<int, QByteArray>
QHash< int, QByteArray >
CStringListModel::roleNames() const
{
return {{Qt::DisplayRole,"label"}, {Qt::UserRole, "key"}};
return { { Qt::DisplayRole, "label" }, { Qt::UserRole, "key" } };
}
const CStringPair*
......
......@@ -141,7 +141,7 @@ protected:
class CStringListModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY( int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged )
public:
/// @brief Create empty model
......@@ -154,24 +154,28 @@ public:
QVariant data( const QModelIndex& index, int role ) const override;
const CStringPair* item( int index ) const;
QHash<int, QByteArray> roleNames() const override;
QHash< int, QByteArray > roleNames() const override;
void setCurrentIndex(const int &index);
void setCurrentIndex( const int& index );
int currentIndex() const;
void setList(CStringPairList);
void setList( CStringPairList );
inline int indexOf(const QString &key)
inline int indexOf( const QString& key )
{
const auto it = std::find_if(m_list.constBegin(), m_list.constEnd(), [&](const CalamaresUtils::Locale::CStringPair *item) -> bool
{
return item->key() == key;
});
const auto it = std::find_if(
m_list.constBegin(), m_list.constEnd(), [&]( const CalamaresUtils::Locale::CStringPair* item ) -> bool {
return item->key() == key;
} );
if(it != m_list.constEnd())
return std::distance(m_list.constBegin(), it);
else return -1;
if ( it != m_list.constEnd() )
{
return std::distance( m_list.constBegin(), it );
}
else
{
return -1;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment