- 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.
The (renamed) class TranslatableString keeps a key value
(e.g. New_York) and a human-readable version around; the
human-readable one is passed through QObject::tr() for translation
on-the-fly.
- The models are overly complicated: **overall** there is just one
list of timezones, and we need various views on that list.
Start over with an empty model of regions.
- there **is** another source of information about the CPU,
so in the test use that to cross-check what hostCPU() says.
NB: it's probably a good idea to fall back on the same file
in hostCPU() for better accuracy.