[libcalamares] Accessors for key and complete region data
This commit is contained in:
parent
b29b89579e
commit
1d17cf5c77
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user