This allows injecting arbitrary Python code before
the script of a module is even run. For testing
purposes, that gives us a chance to modify existing
(internal) modules before the script (e.g. to test
subprocess calls).
This is related to https://invent.kde.org/neon/neon/calamares-settings/-/merge_requests/1
which adds .. the default things from the example configuration to the
configuration file KDE neon ships. The default layout doesn't add
any subvolumes at all, which seems to be non-functional.
If nothing is configured, complain and use /@ as the lone subvolume.
PARTITION_UNSAFE is a debug mode. It is not used in
production, because it allows you to pick an install
device that would be dangerous (e.g. the current / device).
Existing code kept two copies of a list of pointers,
and deleted pointers from one of the lists and returned
the other -- which now contains dangling pointers.
Refactor by applying suitable lambdas to a single
copy of the list; this avoids copying the list so
there is no danger of dangling pointers.
- The log **file** got every QDebug object, while stdout only
got the ones of sufficient logging level. A CDebug object checks the
logging level before writing anything -- so those already were
consistent, but any qDebug() in the program (not cDebug()!) would
reach the writing-function anyway, and so log to the file.
Fix this weird inconsistency by checking log-level just once,
for both writes.
- Map QtMsgType -- used by qDebug() and qWarning() -- to levels used
by Calamares in a consistent fashion.
- Drop unused log levels (INFO, EXTRA unused in any Calamares code).
The bootloader model knows about both rows and
devices, so we can look up both at once. The
existing implementation as a non-member was rather
sketchy and wasn't used except as support for
restoreSelectedBootLoader().
If the pakcage manager fails in some way, convert to a readable
error message instead of leaking the exception to the caller
(which produces a traceback, which is harder to read and less
informative)
Widgets are easier to style if they have a name, and easier to spot
in the widget tree as well. Give the requirements-checker
parts meaningful names.
SEE #1685
- in legacy mode, *id* can have an effect and leads to
"packagechooser_<id>"; if unset, uses the the module
instance id instead, still as "packagechooser_<instanceid>".
- in packages mode, *id* is not used and only the whole
module Id (generally, "packagechooser@<instanceid>")
is used, but in packages mode there's no need for other
packages to mess with GS settings for this packagechooser.
When the module is loaded and the viewstep created, it doesn't have a
module Id **yet**. That is set after reading more of the configuration
file. It **is** set by the time setConfigurationMap() is called,
so pass it on to the Config object then. This means that packagechooser
modules can skip the *id* config key and use the module Id.
The model needs to be attached to the widget; because of changes
in the order that widget() and setConfigurationMap() are called,
the model is created earlier, but needs to be connected later.
- convenience method to install a (string) list of packages
(doesn't do the installation, but adds to GS the list, so
that the packages module can handle it).
- the %4 is left-over from the feature-summary string,
- replace it with ""; don't change the source string
because that will break translations right now.
- turn the translations-QRC phase into a function, just in
case other tests need translations as well.
- This CMake code might work as the base of translation-wrangling for
plugins (externally).
- don't pass the item IDs to packages module, use the
packages lists for each item
- document the item list in more detail (including the packages member
and new install-method item)
- convenience method to install a (string) list of packages
(doesn't do the installation, but adds to GS the list, so
that the packages module can handle it).
Rip out most of the ViewStep that deals with configuration,
move it to a Config object (not one that supports QML yet,
though), and massage the model a little.
The single-values *package* member in a PackageItem was not used,
so remove it -- to show that it really isn't used. This is prep-
work for putting the package name *back*, as multi-valued,
and using the *packages* module.
- if the queue is emptied, there was no usable data; set
failure to NoData rather than BadData.
- FetchNextUnless::done() is done only if the parameter is true (that
is, it's done!); otherwise should continue.
- drop the debugging line because that has already been
logged by the call to `runCommand()` that backs
`target_env_call()`.
- use the same (top-level) function rather than having a
function and elsewhere a very-similar method.
The code path for setting the locale / language automatically
emits currentLanguageStatusChanged(), but the code that updates
GS connects to currentLanguageCodeChaged(). This was altered in
the 3.2.28 release cycle. Since then, automcatic locale selection
wasn't setting *locale* in GS, so that a click-through kind of
locale selection would not set it; then the packages module
has no *locale* setting for localization packages.
The combination of status and code signals (machine- and human-
readable) is ok. Introduce a setter to the language that does
the necessary signalling, so that setting the language automatically
also DTRT.
FIXES#1671
The code path for setting the locale / language automatically
emits currentLanguageStatusChanged(), but the code that updates
GS connects to currentLanguageCodeChaged(). This was altered in
the 3.2.28 release cycle. Since then, automcatic locale selection
wasn't setting *locale* in GS, so that a click-through kind of
locale selection would not set it; then the packages module
has no *locale* setting for localization packages.
The combination of status and code signals (machine- and human-
readable) is ok. Introduce a setter to the language that does
the necessary signalling, so that setting the language automatically
also DTRT.
FIXES#1671
- Move variables closer to where they are needed
- Do the winnowing / selection always, but in unsafe mode return
the un-winnowed list of devices
- Massage build documentation a little
When loading the lists, no initial string-value was being
set for the model, layout and variant; the configuration
could pass right through and pick up empty strings instead.
If the user does not change the model, the UI would show
"pc105" but the internal setting would still be empty.
FIXES#1668
The machinery in `setConfigurationMap()` was just duplicating
checks already in place in the `getString()` and `getBool()`
methods, and there's no special need for efficiency here,
so prefer the more readable and short code.
("efficiency" here means "we're saving one method call in
case the configuration is not set")
In 4ffa79d4cf, the spelling
was changed to consistently be "autoLoginUser" in the *users*
module, but that changed the Global Storage key as well,
and the *displaymanager* module wasn't changed to follow.
You'll need a VM with 2 disks to demonstrate:
- Configure Calamares to pick "none" as initial action on
the partition page (this is a safe choice),
- Enter partition page,
- No action is selected, and the next> button is greyed out.
- Click erase; notice next> is now available.
- Change devices, notice no action is selected, but next>
is still available. Clicking on it, though, does nothing.
When changing to "no action", update the next-button's
availability.
Avoid the extra indirection through the otherwise-unused
prettyGptType(const QString&), construct table of names
only on first call to avoid static-initialization order
(though that's not important here).
- There's still 49 enumeration values not handled, leading to
an annoying Clang warning, but there's just no **point**
in listing them all: that's what 'default' is for.
In 4ffa79d4cf, the spelling
was changed to consistently be "autoLoginUser" in the *users*
module, but that changed the Global Storage key as well,
and the *displaymanager* module wasn't changed to follow.
In particular, we need a separate Job class to set the label; this
is invoked after we formatted a partition, and when no other changes
to the partition have been requested in the Edit dialog.
The partition- and filesystem-label setting code was already there,
but not in the call to createNewPartition(); now we set the
FS label twice (once in the call, once afterwards)
When creating or editing a new formatted partition, allow
to set a filesystem label (16 chars maximum). Modify
the KPMHelpers to accept it as a new parameter. Partitions
created by default may get a meaningful label too.
The partitioning header 'FileSystem.h' is for KPMCore support;
it is already included by Global.h and guarded by ifdefs for
KPMCore. Do not unconditionally include it from the implementation.
- make the functies that take a GS* first-class
- use the convenience functions from JobQueue for the others
- inline so only the explicit-GS* functions are in the library
The skip-checking is now in the functions for adding plugins and
subdirectories, so that third-party building should get it
as well, for free. Since AddModuleSubdirectory and AddPlugin
use the newly split-out module, handling SKIP_MODULES and USE_*
consistently across module repositories is now easier.
While here, make accumulating-the-skipped-modules explicit.
- offer a convenience method for showing a popup and
URL information and copying the URL to the clipboard
- use that from ViewManager (on failure) and DebugWindow (on demand)
- make the tools tab buttons along the bottom row
- show the global storage tab by default
This costs little screen real-estate, makes the tools much more
visible and useful.
- use load() to start loading
- the FetchNextUnless class is useful in more spots in
the loading process
- set status explicitly on success (otherwise, a failure in a
previous URL would leave a failure message lying around even
when the module shows something useful)
- m_queue was not initialized to nullptr, crashes
- split queue-is-done to a separate slot rather than a lambda
- prefer queueing calls to fetchNext(), for responsiveness
Require a ; after RETRANSLATE macros. They are statement-like;
this makes it easier for some of them to be recognized by
clang-format and resolves some existing weird formatting.
Now all the business logic is in Config, the door is open to
building a QML-ified netinstall module. I'm not sure that
would be worth it: packagechooser offers more space for a
nice UI and should be QML'ed first.
- do some additions and check they work
- drop the ";add" annotation on the source, this is not
needed in the current situation with only adds available.
For methods that log a bunch of things, and which want to
consistently use SubEntry, but don't know when the **first**
log entry is within the method, Logger::Once can be used
to log one regular message (with function info) and the
rest are subentries.
- If the module knows about a preset, then it should be registered
even if there is not a value set for it specifically; this avoids
complaints from isEditable() for fields that are known, but
do not have a preset. (Reported by Anke)
There was a mix of autologin and autoLogin, leading to confusion
in the code. QML is sensitive to this, so go to one consistent name.
(Although the names of the settings in the `.conf` file are
different again)
- this test would fail if the logfile already exists for
any reason (including "I just ran the test")
- remove the file before expecting an empty logfile
- improve messages; a missing logfile is not a "things cannot
work" situation, it's a warning
Although the example configurations shouldn't really be used
as a sample of how to configure **your** Calamares for your
distro, many distro's do just copy the examples. So leave
traces of the OEM-configuration settings in the example,
and give the standard configuration a 'nothing changed'
set of presets.
- you can still call set*(), eg. from the UI, when the field is
not editable. Although the code previously ignored the change,
this would lead to a mismatch between what the UI is showing
(the changed value) and what the Config has (old value).
Emit a changed-signal (notify) with the old value so that the
UI is changed *back* as soon as possible.
- warn about fields applied twice (program error)
- warn about fields not used (configuration error)
- add operator<< for "clean" looking preset application
Build up the list of known presets by what the Config-object
expects, not by what the Config file provides. This allows
early detection of mis-matched configurations.
Presets can only apply to Q_PROPERTY properties, and the
preset must match the property name.
This adds support for checking whether a field is editable;
Config objects should reject changes if the field is not
editable. There is an "unlock" setting to override the
check, although this is currently always locked.
This tests only the termbin ("fiche") paste by sending it
a derpy fixed string. Prints the resulting URL, doesn't
verify in particular.
It'd be rude to run this test too often.
- mark functions with STATICTEST so they can be compiled into a test
- move logfile-reading so we can call the pastebin-upload functions
with an arbitrary payload.
- The Paste API promises just a (string) URL back, not
a whole message, so return just the URL from the
abstract API and the concrete (fiche) implementation.
- Set clipboard contents from the UI
- Build (translated) message in the UI code
- have a namespace Paste with just one entry point, which will handle
untangling type &c.
This doesn't compile, but indicates the direction to take the API
- Use just type and url, since port can be specified in
a URL. Note that we only use host and port, not the
scheme (or the path, for that matter).
- Factor out understanding the *uploadServer* key to a function.
- get a QByteArray rather than going through a char[] buffer
- bytes-read is not important since the RE can only match if
there **are** that many characters.
- it might not be very current, and it's *probably* better to
use dbus-activation / kf5dbus, but let's not call it
deprecated until very sure that the dbus version does the
right thing.
- Add a toggle() to the debug-window manager, for convenience
- Make the manager available to QML
- Use the debug-window manager (code imported from KaOS)
Move the management of the (a?) DebugWindow to a separate
class, and hang on to that manager in CalamaresWindow.
This is prep-work towards making it available from QML as well.
The Quit button can have its own logic at a QML level for
show/hide. It **ought** to follow the *quitVisible* property,
but can do additional work. Here, document how a distro might
choose to hide the Quit button on the last page (generally,
that's the "finished" page).
It's possible to ignore the "user setting" for restart-now
and call doRestart(true) directly. This is intended for
use with specific UIs that make that choice clear for the user.
Hook up both [finished] and [finishedq] to the "traditional"
restart-if-the-box-is-ticked logic although the example
QML doesn't expose that box.