- Cape Town is in South Africa, so one might expect it to get South
Africa's timezone -- which is Africa/Johannesburg -- but Windhoek
is closer, so it gets that.
- Port Elisabeth is similar: Maseru lies between it an Johannesburg,
so it gets the wrong timezone, too.
These both illustrate how the limited resolution of the map, together
with the "closest location" lookup, can give poor results. For most
of South Africa, the "wrong" timezone is closer than the right one.
- The TZ widget uses a different coordinate system (mapping lat and lon
to pixel locations, and then calculating Manhattan distance from
that), so needs a different distance function.
- Simplify code: there's just one "closest TZ" function.
- introduce a distance function and use that, rather than coding it
inside the find() function. This is prep-work for unifying the
find() calls, based on various coordinate systems.
Support /etc/default/grub.d/ -- keep in mind that the **rest** of the
logic in writing a grub configuration file is unchanged, so 00calamares
may roughly override "global" or top-level grub variables like
GRUB_TIMEOUT.
FIXES#1457
- create directories for new tests ahead of the tests themselves;
this **can** still cause problems if a test is run standalone.
- if creating the grub-dir at runtime is necessary, be informative
if it fails.
- the default_dir was only stored in modify_grub_default() to
create the directory if needed; move that functionality to
the get_grub_config_paths() function (and drop the "s",
since it now returns just one).
Go over the locale module again:
- new models that avoid weird casts and inconvenient iteration
- shared timezone data
- simple sorting and filtering
- simplify the map / QML version
FIXES#1476FIXES#1426
- test insert, remove, emitted signals
- test loading and saving of YAML and JSON
This shows up a big bug in the YAML saving code (which was never
used, it seems, anyway)
- the loadJson behavior did too many notifications, and was likely to
deadlock; write directly to the map instead and emit only once.
- the loadYaml method did something very different from its
documentation or intent.
- refactor into some free functions (out of the lambda's for connecting)
- introduce new method to call from onLeave(), matching previous
widget behavior
- we can do GeoIP and GeoNames lookups, **or**
- use Calamares's internal GeoIP lookup and country / city hints.
The online version is much more accurate, but costs more lookups;
in these examples, set it all to "offline" and document what needs
to change (code edit) to use the online version.
It's probably a good beginner job to introduce a bool in localeq.qml
to switch the behaviors.
- Config has suitable strings for displaying TZ information.
Use them and automatic bindings. Don't update the strings manually.
- Suggest online or offline TZ lookups based on what the distro wants.
Edit the QML to pick online lookups (needs access to the geonames
service, though).
- Drop the variables that point at config and geoip: the Config
object has a currentLocation, which is filled in by both the
configuration and any GeoIP lookup -- it doesn't have city
or country information though.
- status is a longer phrase
- name is a short human-readable name
- code is the internal code
Code that writes its own "Timezone set to" messages can use
the name, rather than the status.
- when no location has been set at all, there's no sensible TZ
to report; just leave it blank. In *practice* you won't hit this
code from the Calamares UI before a location has been set, because
the Config object is instantiated and then immediately configured,
but from tests or unusual UIs it could be.
- needs some massaging because Config otherwise depends on
ModuleManager which is a UI class (for the Reasons),
but we already have a BUILD_AS_TEST define for that purpose.
- demonstrate a nullptr deref.
- The Config object now uses the re-done models and timezone data
- most of the properties of the locale Config are unchanged
- much less complication in extracting data from the zones model
It's convenient when e.g. QComboBox::currentData() gets the key
"automatically", and the default role for that method is UserRole,
so let the value of KeyRole overlap.