mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-02 20:05:37 -04:00
[locale] Move more business logic to Config
- writing *localeConf* settings to GS can be done always when the formats are set, rather than special-cased. The code that handles the "special case" of no widget existing for the ViewStep overlooks the other crashes that happen then. - Since Config knows what jobs to create, just ask it rather than keeping a copy.
This commit is contained in:
parent
f6419d5de1
commit
0c9480aa3f
3 changed files with 12 additions and 22 deletions
|
@ -170,18 +170,28 @@ Config::Config( QObject* parent )
|
||||||
|
|
||||||
connect( this, &Config::currentLocationChanged, [&]() {
|
connect( this, &Config::currentLocationChanged, [&]() {
|
||||||
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
|
|
||||||
|
// Update the GS region and zone (and possibly the live timezone)
|
||||||
const auto* location = currentLocation();
|
const auto* location = currentLocation();
|
||||||
bool locationChanged = ( location->region() != gs->value( "locationRegion" ) )
|
bool locationChanged = ( location->region() != gs->value( "locationRegion" ) )
|
||||||
|| ( location->zone() != gs->value( "locationZone" ) );
|
|| ( location->zone() != gs->value( "locationZone" ) );
|
||||||
|
|
||||||
gs->insert( "locationRegion", location->region() );
|
gs->insert( "locationRegion", location->region() );
|
||||||
gs->insert( "locationZone", location->zone() );
|
gs->insert( "locationZone", location->zone() );
|
||||||
|
|
||||||
if ( locationChanged && m_adjustLiveTimezone )
|
if ( locationChanged && m_adjustLiveTimezone )
|
||||||
{
|
{
|
||||||
QProcess::execute( "timedatectl", // depends on systemd
|
QProcess::execute( "timedatectl", // depends on systemd
|
||||||
{ "set-timezone", location->region() + '/' + location->zone() } );
|
{ "set-timezone", location->region() + '/' + location->zone() } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update GS localeConf (the LC_ variables)
|
||||||
|
auto map = localeConfiguration().toMap();
|
||||||
|
QVariantMap vm;
|
||||||
|
for ( auto it = map.constBegin(); it != map.constEnd(); ++it )
|
||||||
|
{
|
||||||
|
vm.insert( it.key(), it.value() );
|
||||||
|
}
|
||||||
|
gs->insert( "localeConf", vm );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ LocaleViewStep::isAtEnd() const
|
||||||
Calamares::JobList
|
Calamares::JobList
|
||||||
LocaleViewStep::jobs() const
|
LocaleViewStep::jobs() const
|
||||||
{
|
{
|
||||||
return m_jobs;
|
return m_config->createJobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,24 +165,6 @@ LocaleViewStep::onActivate()
|
||||||
void
|
void
|
||||||
LocaleViewStep::onLeave()
|
LocaleViewStep::onLeave()
|
||||||
{
|
{
|
||||||
if ( m_actualWidget )
|
|
||||||
{
|
|
||||||
m_jobs = m_config->createJobs();
|
|
||||||
|
|
||||||
auto map = m_config->localeConfiguration().toMap();
|
|
||||||
QVariantMap vm;
|
|
||||||
for ( auto it = map.constBegin(); it != map.constEnd(); ++it )
|
|
||||||
{
|
|
||||||
vm.insert( it.key(), it.value() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "localeConf", vm );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_jobs.clear();
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->remove( "localeConf" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,6 @@ private:
|
||||||
LocalePage* m_actualWidget;
|
LocalePage* m_actualWidget;
|
||||||
bool m_nextEnabled;
|
bool m_nextEnabled;
|
||||||
|
|
||||||
Calamares::JobList m_jobs;
|
|
||||||
|
|
||||||
CalamaresUtils::GeoIP::RegionZonePair m_startingTimezone;
|
CalamaresUtils::GeoIP::RegionZonePair m_startingTimezone;
|
||||||
std::unique_ptr< CalamaresUtils::GeoIP::Handler > m_geoip;
|
std::unique_ptr< CalamaresUtils::GeoIP::Handler > m_geoip;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue