[libcalamares] Accessors for key and complete region data

This commit is contained in:
Adriaan de Groot 2019-12-09 17:20:46 -04:00
parent b29b89579e
commit 1d17cf5c77
2 changed files with 13 additions and 0 deletions

View File

@ -180,6 +180,15 @@ TZRegionModel::data( const QModelIndex& index, int role ) const
return region.tr();
}
const TZRegion&
TZRegionModel::region( int index ) const
{
if ( ( index < 0 ) || ( index >= m_regions.count() ) )
{
index = 0;
}
return m_regions[ index ];
}
} // namespace Locale
} // namespace CalamaresUtils

View File

@ -54,6 +54,8 @@ public:
/// @brief Give the localized human-readable form
virtual QString tr() const = 0;
const char* key() const { return m_key; }
protected:
char* m_human = nullptr;
char* m_key = nullptr;
@ -91,6 +93,8 @@ public:
QVariant data( const QModelIndex& index, int role ) const override;
const TZRegion& region( int index ) const;
private:
QVector< TZRegion > m_regions;
};