[libcalamares] Refactor timezone loading
- load from a TextStream. This is prep-work for alternate TZ data sources.
This commit is contained in:
parent
0948963d86
commit
00626fd96c
@ -110,12 +110,8 @@ RegionData::tr() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
loadTZData( RegionVector& regions, ZoneVector& zones )
|
loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
|
||||||
{
|
{
|
||||||
QFile file( TZ_DATA_FILE );
|
|
||||||
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
|
||||||
{
|
|
||||||
QTextStream in( &file );
|
|
||||||
while ( !in.atEnd() )
|
while ( !in.atEnd() )
|
||||||
{
|
{
|
||||||
QString line = in.readLine().trimmed().split( '#', SplitKeepEmptyParts ).first().trimmed();
|
QString line = in.readLine().trimmed().split( '#', SplitKeepEmptyParts ).first().trimmed();
|
||||||
@ -186,6 +182,16 @@ loadTZData( RegionVector& regions, ZoneVector& zones )
|
|||||||
zones.append( new TimeZoneData( region, zone, countryCode, latitude, longitude ) );
|
zones.append( new TimeZoneData( region, zone, countryCode, latitude, longitude ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
loadTZData( RegionVector& regions, ZoneVector& zones )
|
||||||
|
{
|
||||||
|
QFile file( TZ_DATA_FILE );
|
||||||
|
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
|
{
|
||||||
|
QTextStream in( &file );
|
||||||
|
loadTZData( regions, zones, in );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user