in the hopes of increasing code clarity.
previously we had three distinct models. the model of languages, the
subset model of available languages (!selected), and the inverse model
of selected languages (!available).
this does make a lot of sense conceptually but also complicated the code
a whole lot because data needs to be shuffled and shared between the
three models. this lead to partial duplication in the data() function,
as well as the need for excess book keeping of the lists.
the new design takes a different approach: there is a single model of
all translations now. in the UI it gets filtered into the visual
incarnations: available and selected - these simply sort and filter as
necessary.
the actual languages are now objects to encapsulate their newly found
statefulness with the new languagecompleter tech. this also allows us to
move the actual mutation logic into the language itself. to on-demand
complete a language by installing missing packages one now calls
complete() on the language which in turn internally defers to the
various abstraction systems.
one unfortunate aspect is that the requirements for selected languages
is kind of divergent from available languages. for selected languages
their *configured* order matters. to enable this there is a secondary
list of languages purely for establishing the selection and selection
preference (i.e. order of use). this is a bit awkward but considering
this very minor divergent in requirements I didn't see justification to
make selected languages a completely separate model.
the refactor also, rather by accident, repairs the handling of missing
languages which probably broke at some point because of the excessive
book keeping work (the missing languages never showed up in the model)
the visualization of missing languages is also streamlined now by not
treating them as part of the model but rather a secondary list of codes
that are configured but not actually available on the system. this
reduces the visual presentation a bit (not that it was particularly
useful since you can't do anything with a missing language anyway) but
has the advantage that it means we can consider the base model of
languages const (Language instance are loaded at startup only) and also
removes some cruft from the qml code that purely existed to visualize
missing languages.
to be clear: the languages are still listed in a warning, but no longer
displayed in the listview.
We do this sometimes, but not consistenly.
The benefit is twofold.
First it improves the diff when adding new values since no existing line needs to be touched.
Second it prevents clang-format from collapsing the definition into a single line, which is undesired for large enums.
Summary:
This makes the list items draggable.
To do this, the backend model was split up into three models so
the move() method could actually move a row as the new drag handle
expects. This also makes move and remove actions a little bit
faster since there's no proxy abstractions involved. The use of
Plasma.SortFilterModel with JS callbacks for filtering has been
dropped from the QML code.
The lists now use DelegateRecycler to be speedier.
The list of available languages is now guaranteed to be sorted in
a locale-aware manner and case-insensitively, using QCollator.
This likely works better than whatever PSFM was doing with the
Qt::DisplayRole sort role before.
Also drops a stray unused KConfigGroup member from
TranslationsModel.
Reviewers: mart, davidedmundson
Reviewed By: mart
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D13194
Summary:
* Changed the overall design from two lists to one list with a modal
sheet to add more languages.
* Replaced a modal "You need to relogin for changes" dialog with a
MessageType.Positive InlineMessage.
* Reworked the way missing languages are handled: The old KCM silently
rewrote config and showed a warning. The new design shows an
informative warning and removes the missing languages on the next
save. Until then they're flagged as missing in the list.
* Manages Apply button state correctly (or rather at all ...).
This depends on D12097.
This implements T7247.
This is currently not final code. It's a WIP upload to give Marco
something to work with to fix various Kirigami and SimpleKCM problems.
Currently known issues:
* Does not save (code is from old KCM, might have been broken there)
* Disabled SwipeListItem actions do not show disabled
* Placement of actions button in SwipeListItem is wonky if the
contentItem is a RowLayout
* SwipeListItem spews errors about positionAnimation after using an
action
* SwipeListItem is awkward to use, we need a drag-reorderable list
delegate
* OverlaySheet spews numerous warnings about not being able to find
applicationWindow and activeFocusItem
* The sheet is parented to the SimpleKCM's parent since there's no
app window to be modal too
* The footer inside an OverlaySheet sometimes moves up above the
content instead of staying down
* Even though SimpleKCM is just a Kirigami.ScrollablePage like
Kirigami Gallery pages, an InlineMessage that fills the page width
gets cut off on the left and right, so wonky code to insert margins
next to them
* List has window bg color as background instead of view background
color
Reviewers: #kirigami, mart
Subscribers: rkflx, aspotashev, davidedmundson, safaalfulaij, abetts, ngraham, plasma-devel
Tags: #plasma, #kirigami
Differential Revision: https://phabricator.kde.org/D12102
Summary:
* Changed the overall design from two lists to one list with a modal
sheet to add more languages.
* Replaced a modal "You need to relogin for changes" dialog with a
MessageType.Positive InlineMessage.
* Reworked the way missing languages are handled: The old KCM silently
rewrote config and showed a warning. The new design shows an
informative warning and removes the missing languages on the next
save. Until then they're flagged as missing in the list.
* Manages Apply button state correctly (or rather at all ...).
This depends on D12097.
This implements T7247.
This is currently not final code. It's a WIP upload to give Marco
something to work with to fix various Kirigami and SimpleKCM problems.
Currently known issues:
* Does not save (code is from old KCM, might have been broken there)
* Disabled SwipeListItem actions do not show disabled
* Placement of actions button in SwipeListItem is wonky if the
contentItem is a RowLayout
* SwipeListItem spews errors about positionAnimation after using an
action
* SwipeListItem is awkward to use, we need a drag-reorderable list
delegate
* OverlaySheet spews numerous warnings about not being able to find
applicationWindow and activeFocusItem
* The sheet is parented to the SimpleKCM's parent since there's no
app window to be modal too
* The footer inside an OverlaySheet sometimes moves up above the
content instead of staying down
* Even though SimpleKCM is just a Kirigami.ScrollablePage like
Kirigami Gallery pages, an InlineMessage that fills the page width
gets cut off on the left and right, so wonky code to insert margins
next to them
* List has window bg color as background instead of view background
color
Reviewers: #kirigami, mart
Subscribers: plasma-devel
Tags: #plasma, #kirigami
Differential Revision: https://phabricator.kde.org/D12102