Rename ids to make them easier to read. They are intentionally named
differently from their aliases to reduce potential confusion, e.g.
* icon -> image
* slider -> control
Pass remainingTime property explicitly instead of looking up the
top-most item via implicit scoping / context. It doesn't work well
especially in ListView delegates. Besides, there already was such
property in the PopupDialog, although it was unused until now.
Amends 7d0f1a014c, this time for real
ScrollView+ListView duo gained a small padding between its delegates and
a scrollbar, but only when the scrollbar is visible. It solves the
problem of content 'sticking' to the scrollbar, and keeps right side
aligned when there is no scroll.
It also behaves as intended under RTL layout mirroring, out of the box.
No visually observable changes, again. But it replaces most of the
anchors tweaking with a simple QtQuick.Layout interface.
You might've noticed how
topMargin: PlasmaCore.Units.gridUnit
got replaced with a different-looking
Layout.topMargin: PlasmaCore.Units.smallSpacing * 2
but that's all according to the plan, since this ScrollView is now
inside a ColumnLayout which has its own spacing that adds up.
Also, settingsColumn id is removed because it became unused.
Would you ever polish something before dividing it by zero?
Well, at least this is somehow justifiable. Anchors were too horrible to
deal with, even for a rewriting. Now they are all in one place, sorted
out, and no more manual width setting.
Replaces Math.round(PlasmaCore.Units.gridUnit / 2) with smallSpacing * 2
for better performance. This is not equal to largeSpacing, which is
deprecated for this very same reason anyway.
This change may result in slightly more dense layout on your system,
because the wrong formula was used before.
Apparently, `plasmoid` context property can turn into /dev/null before
its action does. Fixes the following error:
plasmoids/org.kde.plasma.battery/contents/ui/main.qml:166:
TypeError: Cannot read property 'configuration' of null
Fixes the following error:
plasmoids/org.kde.plasma.battery/contents/ui/PowerProfileItem.qml:137:
TypeError: Cannot read property 'label' of undefined
Profile data was moved to the root component where it makes most sense.
Other chunks of code were aggregated into read-only properties nearby.
It greatly simplified the rest of code in the file.
Took a while to figure out actual structure of the data that comes from
plasma data engine, so now it's somehow documented for future reference.
Moved aforementioned component's source code directly to the only place
of its instantiation left.
Boolean property `inListView` which was responsible exclusively for the
font size selection, got totally abolished and replaced with font
bindings themselves.
Other boolean properties of the grid were marked as `readonly` which
they should've been from the beginning; and {Left,Right}Labels' binding
to them had to be qualified with property access by id, which --
again -- was just an oversight, and worked only because it was a
top-level(even though an 'inline') component.
Renamed GridLayout's `id` to simply "details" for better readability.
It remained always hidden ever since
df2469e7d2, and there were no plans to
revive it anyway. I did some cleanup and layout refactoring before
dropping it though, just in case, so this removed code pretty much
worked and looked good.
It was necessary to drop the `required` qualifier from inListView
property due to a bug in Qt/QML compiler which somehow considers
`required` properties of inline components for named roles resolution,
but only when they are also directly instantiated somewhere in the file
as opposed to deferred instantiation via `Loader::sourceComponent`.
ToolTipArea::active is now bound to just false, which was the case ever
since df2469e7d2. It's going to be removed
completely soon.
The code is not consistent on how do we access properties (role names)
of rows/models of Plasma Data Engine's Data Source. This is obviously
due to the fact that some properties (role names) contain literal
spaces, and thus -- as explained in previous commit -- are currently
inexpressible in terms of QML properties.
However, even at the cost of inconsistency, `battery.State` reads better
than `battery["State"]`; while `battery["Is Power Supply"]` reads the
way it is, just because there's literally no other way around it.
(Actually, we could create a ECMAScript class, and deserialize data
source's row into sanely named fields. But that's a good proposal for
another patch.)
Top level item's `property var battery` is unambiguously set to the
`model` value itself in the ListView's delegate declaration in
PopupDialog.qml component. The fact that there were used two equivalent
methods is strange, but likely happened due to an incomplete
refactoring some time in past.
The intention is to make it as short as meaningfully possible, as it is
used a lot in expressions, and will be used even more after porting the
rest of accesses to the dynamically scoped `model` variable to the
equivalent `root.battery` property lookup.
They were supposed to be in the column on the right this whole time, as
was indicated by an artificial Layout.leftMargin (ex-anchors.leftMargin).
Cons: Now the ToolTip pops up anywhere over a possibly lengthy details
and inhibition hint's text.
Pros: The ToolTip is never active.
This is a direct translation of anchors to QtQuick.Layouts, except
gridUnit in leftMargin is replaced with something it was really meant
to be: the value of a margin on the right side of the batteryIcon,
which happens to be the RowLayout's spacing.
But once we yeet the ToolTipArea (or even before that), those
BatteryDetails and InhibitionHint components should be placed inside
the infoRow's ColumnLayout.
Replaces Row/Column with RowLayout/ColumnLayout, and x/y/width/height
with appropriate Layout.margins and preferrewWidth bindings.
Layout.* properties of the mainItem itself are now greatly simplified,
because top-level RowLayout manages its implicit width just fine.
Maximum width for BatteryDetails component is back, after it was lost
in 44ed25e521 refactoring.
This commit re-implements the critical notification to be inside the
notification popup, not the notification item. This yields several
benefits:
- It's the semantically correct place to implement it since critical
notifications don't appear in the history, so there's no reason to
implement it in a component that's re-used for the history view
- The line extends down to the bottom for critical notifications that
have buttons, job progress, text input fields, files, or screenshots
- Simpler code overall
This reverts commit be7efa5ec2.
This reverts commit 93355636de.
This was not the best way to implement the feature, as it failed to take
into account the fact that critical notifications can have more content
than just text. A better place to implement it would be in the popup
itself.
We still get user complaints that this UI is confusing because of the
terminology used and the visual proximity between the checkbox and the
inhibitions list. This commit attempts to improve that by:
- Make the checkbox text shorter, have less jargon, and say the word
"manual" in it instead of "automatic", which was confusing
- Adding the word "currently" to app-initiated inhibitions, to textually
distinguish transient app-initiated inhibitions from user-initiated
manual inhibition
- Separating the checkbox from the inhibitions list with a subtle line
separator
We can leverage the `priority` property of QActions, which is Normal (128)
by default, and hide it from systray header if the priority is set to
LowPriority (0).
BUG: 446396