mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 02:45:37 -04:00
[locale] Get starting TZ in Config
- read the *region* and *zone* settings; this duplicates what the ViewStep does and is currently unused, but .. - add new support for using the system's TZ (rather than the fixed values from *region* and *zone*). This complements GeoIP lookup. This is the actual feature that started the long rewrite of the Config object (so that all the business logic would be in one place, usable for both widgets and QML). FIXES #1381
This commit is contained in:
parent
781d76c9e5
commit
b607cf3f98
4 changed files with 42 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QTimeZone>
|
||||
|
||||
/** @brief Load supported locale keys
|
||||
*
|
||||
|
@ -342,17 +343,38 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||
#ifdef DEBUG_TIMEZONES
|
||||
if ( m_adjustLiveTimezone )
|
||||
{
|
||||
cDebug() << "Turning off live-timezone adjustments because debugging is on.";
|
||||
cWarning() << "Turning off live-timezone adjustments because debugging is on.";
|
||||
m_adjustLiveTimezone = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
if ( m_adjustLiveTimezone )
|
||||
{
|
||||
cDebug() << "Turning off live-timezone adjustments on FreeBSD.";
|
||||
cWarning() << "Turning off live-timezone adjustments on FreeBSD.";
|
||||
m_adjustLiveTimezone = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString region = CalamaresUtils::getString( configurationMap, "region" );
|
||||
QString zone = CalamaresUtils::getString( configurationMap, "zone" );
|
||||
if ( !region.isEmpty() && !zone.isEmpty() )
|
||||
{
|
||||
m_startingTimezone = CalamaresUtils::GeoIP::RegionZonePair( region, zone );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_startingTimezone
|
||||
= CalamaresUtils::GeoIP::RegionZonePair( QStringLiteral( "America" ), QStringLiteral( "New_York" ) );
|
||||
}
|
||||
|
||||
if ( CalamaresUtils::getBool( configurationMap, "useSystemTimezone", false ) )
|
||||
{
|
||||
auto systemtz = CalamaresUtils::GeoIP::splitTZString( QTimeZone::systemTimeZoneId() );
|
||||
if ( systemtz.isValid() )
|
||||
{
|
||||
m_startingTimezone = systemtz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Calamares::JobList
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue