[libcalamares] Access list of locale Ids
- Make it easier to obtain locale-ids (from CALAMARES_TRANSLATION_LANGUAGES) so avoid splitting that string multiple times.
This commit is contained in:
parent
d8af11adee
commit
7b699bfc76
@ -29,6 +29,7 @@ namespace Locale
|
||||
|
||||
LabelModel::LabelModel( const QStringList& locales, QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
, m_localeIds( locales )
|
||||
{
|
||||
Q_ASSERT( locales.count() > 0 );
|
||||
m_locales.reserve( locales.count() );
|
||||
@ -132,7 +133,7 @@ LabelModel::find( const QString& countryCode ) const
|
||||
LabelModel*
|
||||
availableTranslations()
|
||||
{
|
||||
static LabelModel* model = new LabelModel( QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';' ) );
|
||||
static LabelModel* model = new LabelModel( QStringLiteral( CALAMARES_TRANSLATION_LANGUAGES ).split( ';' ) );
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,9 @@ public:
|
||||
*/
|
||||
const Label& locale( int row ) const;
|
||||
|
||||
/// @brief Returns all of the locale Ids (e.g. en_US) put into this model.
|
||||
const QStringList& localeIds() const { return m_localeIds; }
|
||||
|
||||
/** @brief Searches for an item that matches @p predicate
|
||||
*
|
||||
* Returns the row number of the first match, or -1 if there isn't one.
|
||||
@ -67,6 +70,7 @@ public:
|
||||
|
||||
private:
|
||||
QVector< Label > m_locales;
|
||||
QStringList m_localeIds;
|
||||
};
|
||||
|
||||
/** @brief Returns a model with all available translations.
|
||||
|
Loading…
Reference in New Issue
Block a user