- 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.
- get username, password etc. from the config object, not the page
- jobs now depend entirely on config
- handle logic of "what's the root password" in Config
- The configuration for writing the hostname (to /etc/hostname,
to /etc/hosts and possibly to systemd-hostname) is read-only,
because it comes from the config file and won't change after.
- add the "reuse user password for root" setting to Config,
make the UI page follow that setting.
- add the require-strong-password default and toggle settings to
Config; this is not well-checked yet.
On the widget / UI side, connect checkboxes only if they are
visible; refactor reuse-user-password-for-root settings.
- The language code "ie" is not recognized,
- "ia" is, and it seems to be the post-war variant of
Interlingue, so we may want to rename / relabel.
The testEsperanto test -- now split into scripts and
esperanto -- would have picked "ie" out of the list
because it does map to C locale.
The TODO said it was unused: it **is** used, but only in
a very limited scope. Drop it from jobs where it wasn't
useful (e.g. those that just return prettyName(), outside
of the partition module).
This builds some machinery so that we can create
a detector for member-functions (methods) named <whatever>.
Use the macro to build the machinery:
DECLARE_HAS_METHOD(myFunction)
then after that,
has_myFunction<T>
is either std::true_type or std::false_type
depending on whether T has a method myFunction.
- no need for the definition to be in public header, move to implementation
- while here, sort the members and private methods
- add a makeJob() to add jobs to the queue
- having a struct with an obtuse API for adding jobs-that-need-to-happen-
to-this-device is just not good for maintainability.
- break the build by making things private.
- The enum for install choice was copied into PartitionActions and
used in the Config object; its definition does not belong in the UI.
- Chase the renamings required.
- add an option to select what button should be selected when the
partitioning module is started; TODO: the actual functionality is
**not** implemented.
- drop the previously suggested name, which didn't get beyond the
comments-in-the-config-file stage (but which intended to do the
same things as this one)
- add option to schema already, even if it's not implemented.
See #1297
FIXUP conf
The encryption widget (passphrase for disk encryption) should show
ok / warning / error whenever the state changes; this avoids
it showing up first with **no** icon (it should show a warning
when both passphrases are empty).
Both the KPMCore and the ChoicePage -- asynchronously -- were connected
to the nextStatusChanged() signal. So if the core said next was true,
that could end up communicated to the ViewManager, enabling the *next*
button in the UI.
Changing to the *erase* page generally triggers a KPMCore reload,
which later emits a `hasRootMountPointChanged()` signal, once the
layout is applied and the disk gets a root mount point. So we'd
get a `true` from KPMCore, which -- because it was connected directly
to the signal to the VM -- would override any other considerations.
Hook up both signals to an intermediate slot that just recalculates
whether the next button should be enabled, based on the state
both of the Choice page and whatever else.
- drop groups from the viewstep
- note that the Config object should also be in charge of creating
Jobs (but then the de-tangling needs to be completed)
- add tests of default groups loading
Doesn't compile because QRegExpValidator is a gui thing.
Previously, we check for RCC support every single time CMake runs.
This is slightly wasteful, and it wasn't being done right anyway.
But it's moot because:
- Calamares supports back to Qt 5.9
- Qt 5.9's version of rcc (at least, 5.9.7) **does** support the
command-line argument `--format-version 1`
- Everything newer does too.
Simplify translations a little, too: just use autorcc rather than
building things by hand.
- The sources were in src/calamares but processed and generated
in libcalamares, which is weird at best.
- Generate an "extended" version header.
- Use the extended version in the logger and nowhere else.
- While here, minor coding style cleanups
The overall change here means that after running CMake, only
Logger.cpp needs to be rebuilt (if the extended version has
changed) and not a handful of other files that don't need the
full version number, but do happen to include CalamaresVersion.h
- Very rarely do we need the full-git-version of Calamares,
so split that into a separate header with a little trickery.
- In the "normal" version header, drop the full-git-version values.
- This is a half-step: the ViewStep shouldn't do job creation either,
eventually it needs to be the Config object, but this is better
than asking the widget (UI) to create some jobs.
- When updating login- or host-name, or the autologin setting,
set it in GS as well. This is a minor improvement over doing
it only when leaving the page.
- Since the Config object isn't complete, there are leftovers in
the widget, which has a fillGlobalStorage() for the not-jobs-related
bits previously in createJobs().
- since the configuration is in the UI parts, we need the widget still
to load the whole configuration (until the config object is complete).
Create the widget before doing configuration; this is wrong. But now
we don't hit nullptr derefs all over.
- make the HostName textbox just a view on the Config's HostName
- make the username and login textboxes view onto Config
- query the Config rather than the UI for job data
- delay construction of the Page (widget) until it's needed
- hand the Config object to the Page on construction
This is prep-work for putting the configuration information into the
Config object, rather than in the UI elements.
- most of the things in utils/ are in the CalamaresUtils namespace,
let Permissions follow suit. Chase the name change in the
*preservefiles* module.
- add an `apply()` function for doing the most basic of chmod.
Note that we don't use `QFile::setPermissions()` because the
**values** used are different (0755 for chmod is 0x755 in the
enum value passed to `setPermissions()`).
On the "Users" tab, the user can choose a username. It was possible to
use 'root' as username, which led to an installation error, because
'root' exists already.
Added a new check to the username validation.
Fixes#1462.
With PR calamares/calamares#1357 the label of the "Manual partitioning" option
was changed, which introduced several downsides:
* The label is shown for UEFI and for BIOS installations.
* The mountpoint of the ESP is and should be distro specific.
* The label always mentioned GPT, which is irrelevant.
* The label should explain, what the option does, and not, what
problems can occur under certain circumstances.
set index in i18n.qml to -1, old settings were just for reading from the bogus model
current model uses strings, so index fails to read from it. This fixes cala crashing on loading i18n.qml
- Expand the documentation, emphasize octal-vs-decimal
- east-const consistently in this file (most of Calamares is west-const)
- shuffle the is-valid bool to the end of the data members,
so sorting by size.
- already had methods for various kinds of broken-up data, but
not one for plain "region/zone" strings; having this makes
it easier for QML to report a zone.
- use the region/zone method from QML, so that clicking on the
world map updates the actual TZ in Config.
- get network status from the global Network object; document that
- get the strings describing the language and LC settings from
the config-object instead of roll-our-own
- use the model of supported locales from Config to populate listboxes
- connect selection of language or LC to the Config object
- remove stray and useless TODOs
- remove unnecessary empty overrides
- clean up includes
- drop all the code that is now in Config
Since the business logic (setting locations, maintaining GS, ...)
is all in the Config object, the ViewStep is remarkably simple:
hook up a UI to the Config, which in the case of QML is done
automatically.
- since the Page hooked up a model and changed the region-selection
**after** connecting to signals, it would reset the location
to Africa/Abijan (alphabetically the first timezone) during
construction. Don't do that.
- this doesn't do the lookup **yet**
- while here, refactor setConfigurationMap so it reads like a story,
with chunks bitten out into a handful of static inline void methods.
- 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
- 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.
- allow finer-grained control over whether-or-not to adjust the
timezone in the live system.
- handle some special cases at the point of loading-configuration.
- document the setting in locale.conf
- correct some documentation bugs
- adjust the YAML schema for locale.conf so it's legal YAML syntax
**and** validates the current file.
- since all locale changes need to be entered into GS anyway, this
is something the Config object can do because it is the source
of truth for locale settings.
- drop all the GS settings from the Page.
- remove the weirdly-structured prettyStatus and similar:
the Config object has human-readable status strings (three,
for location, language, and LC-formats) which can be
normal properties with signals.
- Implement prettyStatus in the view step by querying the Config.
- the language and LC settings migrate from page to config
- add API for explicitly setting language (which is then preserved
when clicking new locations)
- since Config knows what settings there are, it should create the
jobs to run later -- not the Page.
- this doesn't work yet, because the Config does **not** know what
the selected timezone is yet.
The Config object wasn't being used at all in the locale module;
reset it to empty and start using it in locale, so that
configuration functionality can be added to it as-needed,
and with the necessary refactoring built-in.
In 022045ae05 a regression was introduced: if no *slideshowAPI*
is specified in the branding file, Calamares refuses to start, with
a YAML failure.
Before the refactoring, we had `YAML::Node doc` and looked up
the *slideshowAPI* in it with `doc["slideshowAPI"]`. After the
refactoring, we had `const YAML::Node& doc`. The `const` makes
all the difference:
- subscripting a non-existent key in a mutable Node silently
returns a Null node (and possibly inserts the key);
- subscripting a non-existent key in a const Node returns an
invalid or undefined node.
Calling IsNull() or IsScalar() on a Null node works: the functions
return a bool. Calling them on an invalid node throws an exception.
So in the **const** case, this code can throws an exception that it
doesn't in the non-const case:
`doc[ "slideshowAPI" ].IsScalar()`
- Massage the code to check for validity before checking for scalar
- Add a `get()` that produces more useful exception types when
looking up an invalid key
- Use `get()` to lookup the slideshow node just once.
- previously, the first column (name) was sized to show the
names **that were visible at startup**, which fails when
there are long names hidden in groups that are not expanded
immediately.
- change the columns to resize according to the contents; this makes
the descriptions jump to the right as the name column gets wider.
FIXES#1448
- there are no consumers for checking-the-capacity-of-the-drive
This parameter was introduced in 3cd18fd285 as "preparatory work"
but never completed. The architecture of the PartitionCoreModule
makes it very difficult to get the necessary parameters to
the right place, and it would probably be better to put
a SortFilterProxyModel in front of a partitioning model anyway.
Since the display code can already filter on size, just drop this one.
- make the rectangles slightly larger
- align text to center of the rectangle
- make the rectangle fill out the column; without this, the
width would collapse back to 0 after a change in the model,
which would draw 0-width rectangles.
FIXES#1453
- continuations, for the console, no longer print the date + level,
which makes things easier to visually group and read.
- the file log is mostly unchanged, except it contains more spaces now.
- fix the schema so the schema is valid json-schema
- the schema doesn't actually validate the *operations* yet
- sort the named backends (needs a double-check that the
list covers all the ones we currently support)
SEE #1441
- Don't do in code what is already done in the designer (.ui) file
- setFrameStyle() is difficult because it mixes different enums
into an int, which causes the warning from clang.
- Add access to the panel-sides membe of the view manager, and
calculate which sides are populated by panels (if any).
- Pass the calculated panel-sides to the view manager before it
starts adding viewpages, so they get consistent margins.
- Give classes a virtual destructor that need them
- Remove spurious ;
- Refactor addJobs() because that doesn't need to be in a class
- Remove redundant intermediate base-classes
- Some variant helpers take a default parameter if the map does not
contains the given key or if the type mismatches. Make all helpers
behave the same.
- Initialize the attribute partAttributes to 0; it is a primitive type
and it is not initialized in some constructors.
Fixes commit c1b5426c6 ([partition] Add support for partition attributes).
- Move implementation of default constructor to cpp.
added missing components listed as ResponsiveBase, ListItemDelegate & ListViewTemplate
parts of which were on nitrux
keyboard.qml no longer uses buttons within ListView, can't work as buttons and have them visible
see https://doc.qt.io/qt-5/qml-qtquick-listview.html#footerPositioning-prop
set ListView as actually visible within a normal calamares window size
- If the 'no tracking' box is checked, then the way to uncheck
it is to tick some **other** box.
- It doesn't make sense to unselect 'none' and then have .. none
selected.
KDE neon does not do this kind of tracking -- although it was originally
requested by KDE neon, no server roll-out was done once the
privacy policy was thought out.
- give the on-some-checkbox-state-changed slots better names
- while here, refactor is-any-actual-tracking-option-checked
- improve other debug messages, to be a whole sentence
- QString to-integer members detect if an integer string begins with
"0x" (base 16) or "0", base 8; but QVariant members do not.
- QString: the C language convention is used is base is set to 0.
- Convert to QString and use its member toLongLong() and set base to 0
to detect integer strings begin with a prefix.
- These have **not** been fixed for validation, so the schema's themselves
will fail to load. This is a consequence of variations in JSON-Schema
representations through various drafts. Fixing the schemata is
fairly straightforward.
This gives us 19 new tests, all of which fail.
- Note that this is missing *languageIcon* so if that gets uncommented,
it will fail validation.
- While here decide that should be
right up front in object (mappings) declaration.
- The size of a 2GiB partition (in bytes) is larger than the largest
32-bit signed integer; we hit signed overflow while calculating
2^11 * 2^10 * 2^10 and the test fails.
- Switch the whole table of sizes to qint64 instead.
- For testing purposes only, introduce a _qi suffix for qint64.
FIXES#1430
- All the headers go to relevant subdirs, but we don't keep
libcalamares and libcalamaresui apart.
- While here, remove unused variable from libcalamares CMake
- link the library privately -- the public API uses QVariantMap
- install FindYAMLCPP just in case
- add yamlcpp explicitly in the few places that really need it
(e.g. netinstall testing the parsing of netinstall.yaml)
- Add the Calamares CMake-modules to the search path automatically
- Export to CalamaresTargets.cmake and use namespace Calamares::
- Document imported targets
- Find Qt, because the translations machinery will need macros from that
- The installed lib links to IMPORTED libraries from KF5, so we need
to find them (again) as well.
- Do all the status indication in one component, but vary
the top-level message based on whether the mandatory
requirements are satisfied.
- Vary color and icon based on each requirement's *mandatory* setting.
- Value is configurable (through the "selector" which is passed
to GeoIP lookups). This is convenient for tests so you can "fix"
the value that the lookup will return.
- The Radio's are replaced by CheckBoxes and some logic, so
that different tracking styles can be enabled independently.
None of the settings end up in the Config yet, though.
- Uses global storage to steer the jobs that are created, in case
the slideshow needs to be tweaked by percentages or whatever.
- While here, add some code docs and apply coding style.
- When loading QML V2, both loadQmlV2Complete() and changeSlideShowState()
lock the same mutex, introduced in e7f4479df1.
- Explicitly unlock when loading is done and we need to change the state
immediately.
- For testing purposes, it's useful to load a module externally
and then register it to the ModuleManager (this hands off ownership).
- Refactor overall module loading to use the exposed single-module method.
- QML files need to be searched in specific places; this was initialized
by Calamares, but not for the text application. Move initialization
into the library.
- fixes:
12:44:25 [6]: Python Error:
<class 'TypeError'>
'builtin_function_or_method' object is not subscriptable
File "/usr/lib/calamares/modules/rawfs/main.py", line 188, in run
item.copy(filesystems.index(item), len(filesystems))
File "/usr/lib/calamares/modules/rawfs/main.py", line 99, in copy
if libcalamares.job.configuration["bogus"]:
- The -s will run the slideshow with a bogus job-queue, allowing easier
testing of the slideshow. This is more convenient than having a Calamares
with an empty show and a bogus exec section.
- The -s option for running the slideshow / execution phase of
Calamares needs to create a bogus Module for the ExecutionViewStep.
- Previously, unless setDefaultFontSize() was called explicitly,
the default size would be 0, leading to unexpected and weird
displays (and a warning on stderr).
- If setDefaultFontSize() is not called, get a sensible size instead
(like defaultFontHeight() was already trying to do).
- When loading *view* modules, we always need a QApplication for GUI
bits, because the widget for a module is created is very early.
- If it's a view module, replace the application object with one
that supports GUIs; without the --ui flag, though, it will just
run the jobs.
- All the configuration lives in the Config object (or the
tracking objects that it exposes).
- Get data from the config object for the jobs; TODO: give the
jobs a less-clunky interface.
The UI isn't hooked up to the Config object yet, though.
- a single tracking type can be enabled for configuration in the
config file; each must have a policy URL. Class TrackingStyleConfig
is a base class for that kind of configuration.
- root_mount_point was used initially for logging c1a139995 (adding new
bootloader job options are to use grub for BIOS, gummiboot for efi set
extra mountpoint when efi is found)
- the trace was removed since 533031b3c ([bootloader] print() does not
log)
- The Python configuration tests sometimes need extra setup, so
do that through a CMakeTests.txt file in the test directory.
- Patch up existing tests:
- grubcfg needs /tmp/calamares/etc/default to exist
- rawfs won't work on FreeBSD because of differences in /proc
- drop the *discard* from filesystems-on-SSD in the standard example
configuration.
- keep the table **with** *discard* around for referece and explanation.
Remember that the example configurations are intended as **examples**,
to document available settings, and do not reflect a sensible
production configuration.
FIXES#1395
clean up obsolete lines in welcomeq.qml
add requirement section from welcome.conf to welcomeq.conf
data shows correctly in Recommended.qml, fails to show any in Requirements.qml if run without admin rights
This makes it possible to remove QML from Calamares, possibly yielding
a smaller, lighter installer; it takes with it the nice slideshow,
modern configurable navigation and the QML UIs built for various modules.
By default, WITH_QML is on and the "normal" feature set is retained.
- look for Qml modules only when WITH_QML is on (the default)
- look for Network, since that's pulled in only implicitly
- disable the QML Calamares models (modules/*q) if no QML is
enabled; longer-term plan is to merge the **pages** back to
the "upstream" modules, and have things be run-time switchable,
but that's not here yet. Also disable the notesqml module when
QML is off.
- reminder to make all the ABI-relevant WITH_* settings available as #defines
- move the compilation of KDSAG to the calamares executable, not the library
- when DBus activation is on, drop all of kdsingleapplicationguard