[libcalamares] Coding style

This commit is contained in:
Adriaan de Groot 2020-02-11 15:25:28 +01:00
parent 1b3d32ca79
commit 241cb04f06
2 changed files with 11 additions and 9 deletions

View File

@ -44,7 +44,7 @@ Label::Label( const QString& locale, LabelFormat format, QObject* parent )
void void
Label::setLabels( const QString& locale, LabelFormat format ) Label::setLabels( const QString& locale, LabelFormat format )
{ {
emit localeIdChanged(m_localeId); emit localeIdChanged( m_localeId );
//: language[name] (country[name]) //: language[name] (country[name])
QString longFormat = QObject::tr( "%1 (%2)" ); QString longFormat = QObject::tr( "%1 (%2)" );
@ -65,10 +65,10 @@ Label::setLabels( const QString& locale, LabelFormat format )
countryName = m_locale.nativeCountryName(); countryName = m_locale.nativeCountryName();
} }
m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName; m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName;
emit labelChanged(m_label); emit labelChanged( m_label );
m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) ) m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) )
: englishName; : englishName;
emit englishLabelChanged(m_englishLabel); emit englishLabelChanged( m_englishLabel );
} }
QLocale QLocale

View File

@ -21,8 +21,8 @@
#define LOCALE_LABEL_H #define LOCALE_LABEL_H
#include <QLocale> #include <QLocale>
#include <QString>
#include <QObject> #include <QObject>
#include <QString>
namespace CalamaresUtils namespace CalamaresUtils
{ {
@ -40,9 +40,9 @@ class Label : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString label READ label NOTIFY labelChanged CONSTANT FINAL) Q_PROPERTY( QString label READ label NOTIFY labelChanged CONSTANT FINAL )
Q_PROPERTY(QString englishLabel READ englishLabel NOTIFY englishLabelChanged CONSTANT FINAL) Q_PROPERTY( QString englishLabel READ englishLabel NOTIFY englishLabelChanged CONSTANT FINAL )
Q_PROPERTY(QString localeId MEMBER m_localeId NOTIFY localeIdChanged CONSTANT FINAL) Q_PROPERTY( QString localeId MEMBER m_localeId NOTIFY localeIdChanged CONSTANT FINAL )
public: public:
/** @brief Formatting option for label -- add (country) to label. */ /** @brief Formatting option for label -- add (country) to label. */
@ -53,7 +53,7 @@ public:
}; };
/** @brief Empty locale. This uses the system-default locale. */ /** @brief Empty locale. This uses the system-default locale. */
Label(QObject* parent = nullptr); Label( QObject* parent = nullptr );
/** @brief Construct from a locale name. /** @brief Construct from a locale name.
* *
@ -61,7 +61,9 @@ public:
* The @p format determines whether the country name is always present * The @p format determines whether the country name is always present
* in the label (human-readable form) or only if needed for disambiguation. * in the label (human-readable form) or only if needed for disambiguation.
*/ */
Label( const QString& localeName, LabelFormat format = LabelFormat::IfNeededWithCountry, QObject* parent = nullptr ); Label( const QString& localeName,
LabelFormat format = LabelFormat::IfNeededWithCountry,
QObject* parent = nullptr );
/** @brief Define a sorting order. /** @brief Define a sorting order.
* *