Commit Graph

652 Commits

Author SHA1 Message Date
Kai Uwe Broulik
3ebdd64e6b Optimize SortFilterModel role names
* Reserve m_roleIds
* Avoid double lookup contains+value but use default value argument
* Constify

Differential Revision: https://phabricator.kde.org/D8639
2017-11-06 15:17:42 +01:00
Kai Uwe Broulik
d51456bdfc Remove DataModel::roleNameToId
It is unused and returned -1 whereas SortFilterModel would return Qt::DisplayRole

Differential Revision: https://phabricator.kde.org/D8638
2017-11-06 15:17:15 +01:00
Kai Uwe Broulik
c1e432065f sceneGraphBackend() is new in Qt 5.9 2017-09-29 10:48:37 +02:00
Kai Uwe Broulik
bb6b170516 [FrameSvgItem] Iterate child nodes properly
Documentation says "Children are stored internally as a linked list, so iterating over the children via the index is suboptimal."

Differential Revision: https://phabricator.kde.org/D8046
2017-09-28 23:05:36 +02:00
Marco Martin
9e7d02cde2 pick up the proper positive/neutral/negative colors 2017-09-28 16:14:33 +02:00
David Edmundson
daef5c8b6b Fix FrameSVGItem with the software renderer
Summary:
Software rendering (at time of writing Qt5.10) doesn't seem to like our
tiling/stretching in the 9-tiles.
Also when using QPainter it's arguably faster to create and cache
pixmaps of the whole frame, which is what the slow path of FrameSVGItem
does.

Test Plan: Ran FrameSVG test then plasma shell with scene device set

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D8013
2017-09-27 15:50:49 +01:00
David Edmundson
94235482f9 Don't animate IconItem in software mode
Summary:
IconItem uses a gorgeous shader to fade between two states. This doesn't
work with software rendering.

Given software rendering is a second class citizen, just skip the
animation.

Test Plan:
Hovered over kickoff.
Went from one to the other, without temporarily disappearing

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D8014
2017-09-27 15:50:44 +01:00
Marco Martin
b62118c90c possibility to set an attached colorscope to not inherit
this makes an easy bridging between the plasma and kirigami theming
reviewed-by:Eike Hein
2017-09-19 16:42:08 +02:00
Marco Martin
48e27b5493 register revision 1 for QQuickItem
make the base properties of revision 1 available
2017-09-13 11:29:04 +02:00
Kai Uwe Broulik
a963302926 [Icon Item] Don't needlessly unset imagePath
We'll eventually delete the Plasma::Svg anyway if we failed to find an appropriate icon.
Just need to make sure we don't use isValid with the old source set but this is only done with
m_usesPlasmaTheme, hence the new check there, also optimizes the non-themed case.

Differential Revision: https://phabricator.kde.org/D7584
2017-08-30 16:39:53 +02:00
Kai Uwe Broulik
a8ce2e85ec [FrameSvgItem] Create margins/fixedMargins object on demand
On my machine I end up creating 490 margins and 490 fixed margin objects.
After this change I only create 171 margin objects and 20 fixed margin objects.

Differential Revision: https://phabricator.kde.org/D7582
2017-08-29 11:10:19 +02:00
Volker Krause
0a8d1f9cd4 Fix compilation on Yocto
Summary:
By default, Qt is built without accessibility there, which is what
would indirectly include the needed QColor with a "normal" Qt build
here.

Reviewers: #frameworks, broulik

Reviewed By: broulik

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D7117
2017-08-03 22:19:29 +02:00
Kai Uwe Broulik
c00069c43d Use new connect syntax in more places
Especially in frequently created items. Shoves off a couple of milliseconds of startup time.

Differential Revision: https://phabricator.kde.org/D6614
2017-07-10 22:24:50 +02:00
Friedrich W. H. Kossebau
0e1219d03b API dox: use @param for normal parameter listing, not @arg 2017-07-03 16:24:20 +02:00
Marco Martin
eab4aa9909 Make sure size is final after showEvent
Summary:
* make sure after a showevent the size is final and the
dialog can be safely repositioned.
* set mainItem visible in :setVisible() so that is executed before showEvent:
   resizing windows in their show event is definitely not enough, causes events to arrive to
   reset to the old geometry in race with the setgeometry done there, don't know yet
   if it's the qpa, qwindow, or the windowmanager
* make synctomaintem and updatelayoutparameters working even if
the dialog is not visible as we need to resize beforehand
* move the plasmasurface window also in the show event as if there was no moveevent
  after an hide/show, its position would be resetted to 0,0

Test Plan:
current dialog users behave the same (like pre-D6216 notifications applet), tests still pass
notifications applet reworked to use this works as expected

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: sebas, hein, davidedmundson, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D6215
2017-06-21 13:29:26 +02:00
David Edmundson
8fdbfa6980 Emit usedPrefixChanged when prefix is empty
As found by Fabian Vogt
2017-06-07 19:46:19 +01:00
Marco Martin
bf1d1cc6b2 don't switch colors on new themes
new themes as breeze aren't supposed to just use the button graphics
on top, that also mean, don't switch palette on top if the new prefix
is there
2017-06-07 18:24:33 +02:00
Aleix Pol
3b303d7363 Small improvements in IconItem
Summary:
Don't construct a QUrl for every source strings. Check it's a file url
first (which is the only kind of url we support at the moment)
When extracting the path, use toLocalFile, so it works on platforms where
path!=toLocalPath (e.g. windows)
Don't split a string and get a chunk, but just extract the chunk we need
with section. Reduces allocations that are automatically discarded.
Narrow iconPath scope

Test Plan: Tests still pass, plasmashell still works

Reviewers: #frameworks, #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D6014
2017-05-29 19:10:37 +02:00
Marco Martin
32e67a591e minimize dialog resizes/moves
Summary:
take into account size hints also when adjusting with synctomainitemsize
which sometimes has to be executed right before adjusting from the layout
hints, giving one wrong resize

introduce geometryUpdatesBlocked, which stops the dialog
from syncing which is useful when both visual parent and item
contents gets updated in one go (the tooltip) it is not
yet exported to qml and it shouldn't as is dangerous, but
kicker may make use of it between changing the submenu model and
the visualparent

alternative implementations may be:
* a method that takes both main item and visual parent
* delaying with a timer setGeometry (ouch)
this part can also be left behind for now and see if the rest is good enough

Test Plan:
no visual glitches visible anymore in wayland when moving the tooltip
in the taskbar, x11 ok too

Reviewers: #plasma, hein, davidedmundson

Reviewed By: #plasma, hein, davidedmundson

Subscribers: broulik, davidedmundson, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5912
2017-05-25 11:21:50 +02:00
Marco Martin
fd2e850156 recreate plasmashellsurf on exposed, destoy on hidden
Summary:
every time the window gets shown the wayland surfaces
get created, when hidden, they get destroyed

showevent is too early for it as they aren't there yet,
use :Exposed instead, but only the first time when the surface
isn't there yet

Test Plan:
popup applets always have correct blur in a wayland
session

Reviewers: #plasma, #plasma_on_wayland, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5745
2017-05-12 16:58:21 +02:00
Marco Martin
85699c8d2f reload icon when usesPlasmaTheme changes
Summary:
when usesPlasmaTheme gets changed, make sure to
invalidate the svg icon if there, to reload the
icon from the proper source, being either from
the plasma theme or the system icon theme.

Test Plan:
cuttlefish now reloads dynamically the proper icons
when the monochrome checkbox is ticked

Reviewers: #plasma, sebas

Reviewed By: #plasma, sebas

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5721
2017-05-05 22:40:27 +02:00
Eike Hein
4f48901b05 Introduce units.iconSizeHints.* to provide user-configurable icon size hints
Summary:
In effect this is meant to resurrect the "Panel" icon size setting from
the Icons -> Advanced KCM in System Settings, for use as a ceiling on
panel icons to avoid them taking up too much space, especially in wide
vertical panels.

Previously, the actually-unused "Desktop" size hint was added to the
iconSizes map. I believe this was in error, as the size hints are
semantically different from the size classes. This patch marks the
"desktop" iconSizes map entry as deprecated and makes it available
under iconSizeHints instead.

The soon-to-be-updated D5592 will demonstrate this API in use.

CCBUG:378443

Reviewers: #plasma, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5593
2017-04-26 20:41:06 +09:00
Aleix Pol
328cd681a7 Update qmltypes 2017-04-10 16:02:23 +02:00
Aleix Pol
2df613f938 Generate plugins.qmltypes files for the plugins we install
Reviewers: #plasma, #frameworks, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, hein, plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5088
2017-04-10 15:09:57 +02:00
Marco Martin
e1aa250e70 remove some debug
now with fallback is common to have prefixes that are not present and fail.
this generates a lot of debug that is not really useful, as is an OK
thing.
2017-04-05 13:40:46 +02:00
Marco Martin
fb8ed07651 if the user did set an implicit size, keep it
Summary:
if the user code did something like
IconItem {
   implicitWidth: 32
   implicitHeight: 32
}

then never automatically update implicitWidth or height.
this favors compatibility and fixes the desktop
toolbox appearance

Test Plan:
textbox works, other icon items in plasmashell seems properly sized.
applet alternatives fix is still needed

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: hein, davidedmundson, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5243
2017-04-03 16:07:18 +02:00
Kai Uwe Broulik
611a4b5920 [Icon Item] Make "smooth" property actually do something
We had m_smooth but never actually used it in the texture node.
With Plasma SVG icons this shouldn't be used but when passing custom pixmaps
or raster graphics (e.g. custom icon in Kicker, thumbnails in Folder View)

Differential Revision: https://phabricator.kde.org/D5214
2017-03-28 13:44:53 +02:00
Marco Martin
8a42b06042 sensible implicit size for svgs
if the icon is an svg, try to get the implicit size
baked into the file, in

reviewed-by:Eike Hein
2017-03-28 12:51:12 +02:00
Kai Uwe Broulik
7487e208b6 [Default Tooltip] Fix icon size
We overwrite implicit size based on the icon loaded nowadays which breaks this.
Also, while at it, added an explicit "valid" check for the icon.

Differential Revision: https://phabricator.kde.org/D5202
2017-03-28 11:05:06 +02:00
Eike Hein
bc33f0470d Set implicit size from source size for image/SVG URL sources.
Summary:
This allows users of IconItem to know the aspect ratio of the
source document, which can be used to size the item or set
applet size hints to accomodate non-square images better.

This will be used in a patch to Kicker/Dashboard that ports
a use of Image in its CompactRepresentation to IconItem to
get the hover highlight effect even for a custom button image.

Reviewers: #plasma, mart, davidedmundson

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5160
2017-03-24 06:34:24 +09:00
David Edmundson
547a34d346 Handle applyPrefixes with an empty string
Summary:
When setting an empty QStringList as prefix, it can lead to unexpected results, such as the prefix not changing.

BUG: 377441

Reviewers: #plasma

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5000
2017-03-10 09:50:24 +00:00
David Edmundson
f8bedf84b7 Use initialiser list
Test Plan: Ran

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4857
2017-03-06 00:13:22 +00:00
David Edmundson
23b70f4d45 Implement FadingMaterial frag/vert shaders on core profile
Summary:
Like all the inbuilt shaders this now has a separate GLS source file which
works with a newer version without requiring compatibility.

Was https://git.reviewboard.kde.org/r/128426/

Test Plan:
Ran plasmashell with ForceGlCoreProfile set in the config
Hovered an icon in the task manager and it animated to the correct one
correctly.
Ran glslangValidator on both files. No warnings.

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: mart, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4851
2017-03-05 23:44:56 +00:00
David Edmundson
3b05f569ac Split frag and vert code of FadingNode into separate files
Summary:
This matches what Qt does internally, it's easier to read and gives us
syntax highlighting on the shader files, but more importantly in future
we will get Qt's automatic loading of core profile shaders.

Test Plan:
Opened QML with IconItem, made the icon switch.
Still looks the same

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: mart, broulik, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4848
2017-03-05 23:44:50 +00:00
David Rosca
af2b27d1b8 IconItem: Add roundToIconSize property
Disabling this property makes it possible to show icon of arbitrary size.

Differential Revision: https://phabricator.kde.org/D4689
2017-02-28 11:18:17 +01:00
Marco Martin
916bcbf6c0 possibility to use a fallback chain as prefix
Summary:
if a framesvgitem has an array as prefix, like

FrameSvg {
 prefix: ["toolbutton-hover", "hover"]
}

it will use the first available prefix, so on themes that
have toolbutton-hover, that one will be used, old themes will
continue to use "hover" as prefix

Test Plan:
tested the calendar with breeze theme has breeze-widget style
toolbuttons, with olt themes as air, the old behavior is still
there, switching on the fly works

Reviewers: davidedmundson, #plasma

Subscribers: davidedmundson, broulik, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4827
2017-02-27 18:55:02 +01:00
Kai Uwe Broulik
408b311662 [FrameSvgItemMargins] Don't update on repaintNeeded
FrameSvgItem already updates the margins in response to that.

Differential Revision: https://phabricator.kde.org/D4688
2017-02-21 17:48:22 +01:00
Marco Martin
d8a1a9eb08 don't regenerate frames when setting every property
Summary:
give frameSvg the concept of repaintBlocked(), that enables and
disables the regeneration of the frame data when a property is set.
the use case is when often, a lot of properties are set one after
the other (such as prefix, enabled borders, size)
collapse the formely similar, but a bit different logic of frame
regeneration is a single function for better maintanability.
QML FrameSvgItem sets repaintblocked when it starts and releases it just on oncomponentCompleted

Test Plan:
plasmashell still starts, autotests still work, all frames are rendered correctly
the destruction of old frames is cutted by 50%. in the qml profiler
the creation time of a framesvgitem slightly improved, on this machine from around 26 msecs to around 21, can still be improved, but at least the code is a bit simpler

Reviewers: #plasma

Subscribers: davidedmundson, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4414
2017-02-07 13:08:27 +01:00
David Edmundson
8d60a8f1f5 Use texture atlas for static icon item
Summary:
Icon's are generally small, they may as well go in the existing shared
texture atlas, save some memory and it means more items can be batched
whilst rendering.

The textures used during animation are unchanged for now as it also
requires changing FadingNode's shader.

Test Plan:
Ran plasma.
We use atlas's in frame/SVGItem already so it should be fine.

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: mart, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4342
2017-01-30 10:24:33 +00:00
Eike Hein
593f8183dd Set wrapMode to Text.WrapAnywhere.
Summary:
Means long main texts don't get truncated. One of the main uses
for tooltips is to show full text for things that are truncated
in the usual UI, so this is a bad default.

BUG:375141

Reviewers: #plasma, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4189
2017-01-19 00:55:48 +09:00
Kevin Funk
f8a7b418d5 Prefer nullptr over Q_NULLPTR 2017-01-16 18:17:34 +01:00
Albert Astals Cid
5c46e32993 Q_ENUMS -> Q_ENUM and Q_FLAGS -> Q_FLAG
REVIEW: 129826
2017-01-14 01:06:28 +01:00
David Edmundson
66ebf2c84f Part Revert "[Units] Make iconSizes property constant"
Summary:
Though we can make the property constant, some applications still use the
signal (for example FolderView.qml) to know that one of the icons has
changed sizes and do some processing.

Whilst it would be possible to fix folderview, we should avoid public
API changes.

Reviewers: #plasma, #frameworks

Subscribers: plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4092
2017-01-12 11:51:17 +00:00
Kai Uwe Broulik
0a7ae2ce97 [Icon Item] Round size we want to load a pixmap in
QML sizes can be fractional. In case we're asked to load a 31.5 px pixmap it would truncate
it to 31 and then round down to 22 causing a blurry result. Instead, round the size.

Differential Revision: https://phabricator.kde.org/D4040
2017-01-11 10:34:35 +01:00
Kai Uwe Broulik
a0119858e4 [ToolTipDialog] Use KWindowSystem::isPlatformX11() which is cached
I think it's wrong to set the flags for *every* event() but at least avoid the
string comparison Qt does internally in QX11Info::isPlatformX11()
Also, removes the need for an ifdef.

Differential Revision: https://phabricator.kde.org/D4019
2017-01-08 18:11:14 +01:00
Kai Uwe Broulik
8875a04a1b [Icon Item] Fix updating implicit size when icon sizes change
The old code was connecting the KIconLoader signal to implicitWidth/HeightChanged
but never actually set a new implicit size.
Also, while at it use "setImplicitSize" - it's also marked internal but public
like setSize and uses qreal instead of QSizeF.

Differential Revision: https://phabricator.kde.org/D4011
2017-01-08 16:16:59 +01:00
Kai Uwe Broulik
4479fdab7f [Units] Make iconSizes property constant
It's not the property that changes (we don't assign a new QQmlPropertyMap) but
the properties within and it's already smart enough to signal this.

Differential Revision: https://phabricator.kde.org/D4013
2017-01-08 16:02:56 +01:00
Kai Uwe Broulik
56773014e1 Introduce Units singleton
Every single (Frame)SvgItem would creates its own Units instance which in turn would
create a property map for icon sizes and lots of other stuff. Avoid this.

CHANGELOG: There is now a global "Units" instance reducing memory consumption and creation time of SVG items

Differential Revision: https://phabricator.kde.org/D4012
2017-01-08 16:00:20 +01:00
Kai Uwe Broulik
d46a91ea57 [Icon Item] Support non-square icons
BUG: 355592

Differential Revision: https://phabricator.kde.org/D3892
2017-01-05 15:15:14 +01:00
Montel Laurent
39adcec588 Add missing Q_dECL_OVERRIDE 2017-01-03 09:13:39 +01:00