- fsName was a QString (a copy) so it could be modified;
- the modification isn't really necessary.
- While here, pick up new PointerSetter convenience class.
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.
- Add function for mapping panel sides to an orientation (H/V)
- Pass that into the creation functions
This is prep-work for handling vertical navigation and horizontal
progress reporting cleanly.
- using the QML sidebar would not highlight the first step on startup,
only after next / prev would the highlight show up. Now, notify
when all the modules are loaded (and number 0 is active).
module builds & runs, config connections are not registering
no errors
finishedq.qml is offering a different option though, running commands directly in qml
plasma-framework executer is used for that
- move most of the business logic to Config
- make retranslate of the page more robust (e.g. changing language
after failure would restore the un-failed message)
There's still some bits left.
*If* the distro has GeoIP enabled and auto-selects the language for
Calamares, then Belarus now selects Russian, rather the Belarusian.
This is based on some personal input, mostly, and Wikipedia census data.
FIXES#1634
- the configuration is still duplicated in the widget, and
functionality still needs to move to the Config object
- the ViewStep is cut down to almost nothing
- the host system's /etc/group is being read, and that varies between
host OS versions; since I was doing today's release on KaOS, the
test was failing because of arbitrary differences between the
default groups on each Linux flavor.
FIXES#1604
(Admittedly, this fixes the problem only when there's Plasma Solid automount
present, and not any of the other kinds; but none of those have been reported
yet, and adding them into AutoMount.cpp is opaque to the rest of the
system)
- It shouldn't be necessary to explicitly .get() pointers for
logging, and it's convenient to know when a pointer is smart.
* no annotation means raw (e.g. @0x0)
* S means shared
* U means unique
- switch logging in job to VERBOSE because we don't want to be printing
pointers to the regular session log
- switch logging in test to VERBOSE to actually see the messages from the Job
- hook the test into the build
The popup now cuts down messages to a manageable length.
Hopefully the part that is preserved, will still show
something meaningful for the user (8 lines of text should
be sufficient for the kind of things we do).
FIXES#1613
- Although unique_ptr is only used when ICU is enabled, include it
always because it is likely that we'll use more unique_ptr
in the implementation at some point.
Ever since signed shim binaries for multiple architectures became
available, the shim binaries installed in Linux distributions have
been renamed to include the EFI architecture in the binary names.
This started in Fedora, but is now used in openSUSE and Ubuntu too.
Reference for shim binary names comes from shim spec in Fedora:
d8c3c8e392/f/shim.spec (_23-32)
- Some minor bits snuck in with the string-truncation code
- While here, make UPDATE_BUTTON_PROPERTY more statement-like
so it doesn't confuse code-formatters.
Writing `Logger::NoQuote{}`` has annoyed me for a while, so
switch it to a constant, like SubEntry, so it looks more
like a regular manipulator object.
The value inside a unique_ptr can't be opaque, it needs to be known
at any site where the pointer may be deleted. shared_ptr does not
have that (deletion is part of the shared_ptr object, which is larger
than the unique_ptr) and so can be used for opaque deletions.
The QLatin1String() might be replaced by char[], that trades one
initialization for two but with a simpler data section; this
probably is not worth profiling.
With Qt 5.15.2 (and clang), `k->first` works, but this breaks
with Qt 5.11 (and gcc), this is not available and the dereference
must be written differently, `(*k).first`.
- This kind of runs around the selection model on the view,
but we're drawing radio buttons ourselves **anyway**
and the list of themes knows which is selected / current
independent of the view.
- make ThemeInfo and ThemeInfoList internal, expose only
ThemesModel to the rest of the PlasmaLnF module
- don't build the widget anymore (needs to be replaced by
a delegate)
- also individual changes need to be signalled
- use QSignalBlocker to avoid spamming changes when calling
aggregate change methods
- refactor findById() so that also a row number can be
obtained, which is needed for the change signals.
- put a filter model in place, so only the themes with "show" set
are displayed
- rip out the messing about with widgets, soon to introduce a model-
based UI
This is the bugfix part (rather than the "clean up this widgets mess")
of issue-1573, ensuring that the LookAndFeelPackage setting is
saved to the target system config file.
- Need to update the variant that is in use, **and**
explicitly update it in the widget, in order to re-load
the keyboard image for the newly-selected layout+variant.
- Make explicit which one runs in the host, which one is selectable.
- Document *location* parameter in the selectable version.
- Tidy up alignment of apidox.