[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: [Panel-devel] Svg::elementRect and theme configs
From: "Leo Franchi" <lfranchi () gmail ! com>
Date: 2007-08-01 22:44:57
Message-ID: c5793d500708011544t15d50ebcqf67a71bd26a5828d () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On 7/31/07, Leo Franchi <lfranchi@gmail.com> wrote:
>
>
>
> On 7/31/07, Aaron J. Seigo < aseigo@kde.org> wrote:
> >
> > On Tuesday 31 July 2007, Leo Franchi wrote:
> > > API). So basically in order to get the correct element rect, i had to
> > > add the two lines included in the patch.
> >
> > it *looks* ok (i'm in the middle of recompilling trunk/ on my lappie (at
> > the
> > airport), so can't easily check right now).. have you tested with the
> > analog
> > clock and url applets in plasma to make sure they don't break anything
> > there?
>
>
>
> the only applet which uses elementRect currently is the
> Script applet, and it does indeed break that :-/
> I'm going to try to figure out exactly why that is so...
>
Ok, i attach a new patch, plasma.svg.patch, that instead of "fixing"
elementRect, exposes QSvgRenderer::matrixForElement to the client.
This way the default
behaviour remains the same and nothing breaks, but applets
that need to deal with the transformation matrix can do so.
> Also, regarding the current Theme->setApplicationName(), currently if you
> > > set the application to, say, "amarok", plasma will look for the
> > > [Theme-amarok] group in plasmarc. Now, as Amarok doesn't depend on
> > kdebase,
> > > there might not be a plasmarc at all.
> >
> > that doesn't matter, as it will be created as needed.
> >
> > > So it makes little sense for us to
> > > edit/create plasmarc if none exists. I think it would be a better idea
> > to
> > > look into the application-default config, so amarokrc would hold the
> > > relevant theme data. What do you guys think?
> >
> > as long as it can be done without breaking, for instance, krunner which
> > relies
> > on plasmarc being used. that's why it is as it is. i don't see the
> > probably
> > really? if it's a performance issue that you are concerned about i'd
> > recommend benchmarking it first =)
>
>
> the only concern is that it was a little strange for a
> user, installing amarok on a kdebase-less system, would
> have a plasmarc with his amarok-specific theme selection.
>
I attach a test patch to illustrate what I mean. Basically, instead of
looking in plasmarc for [Theme-appname], it looks for
appname.rc, [Theme]. Is this reasonable? Does this break anything? I don't
really know what krunner or anything else
needs...
Also, i attach a patch to fix the buggy patch applied in r695097. It is
mostly ok, but the change in call from d->source(source) to
d->source(source, false) stops the engine from actually creating the source
when it needs to be created. this fixes things for me.
all 3 patches have been tested against trunk and i can't notice any adverse
effects.
leo
>
> --
> > Aaron J. Seigo
> > humru othro a kohnu se
> > GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
> >
> > KDE core developer sponsored by Trolltech
> >
> > _______________________________________________
> > Panel-devel mailing list
> > Panel-devel@kde.org
> > https://mail.kde.org/mailman/listinfo/panel-devel
> >
> >
> >
>
>
> --
> ______________________________________________________
> Leo Franchi angel666@myrealbox.com
> 4305 Charlemagne Ct lfranchi@gmail.com
> Austin cell: (650) 704 3680
> TX, USA home: (650) 329 0125
>
--
______________________________________________________
Leo Franchi angel666@myrealbox.com
4305 Charlemagne Ct lfranchi@gmail.com
Austin cell: (650) 704 3680
TX, USA home: (650) 329 0125
[Attachment #5 (text/html)]
<span class="gmail_quote">On 7/31/07, <b class="gmail_sendername">Leo Franchi</b> \
<<a href="mailto:lfranchi@gmail.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">lfranchi@gmail.com</a>> wrote: \
</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; \
margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; \
border-left-width: 1px; border-left-style: solid; padding-left: 1ex"> \
<br><br><div><span><span class="gmail_quote">On 7/31/07, <b \
class="gmail_sendername">Aaron J. Seigo</b> <<a href="mailto:aseigo@kde.org" \
target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> \
aseigo@kde.org </a>> wrote:</span><blockquote class="gmail_quote" \
style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: \
0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; \
padding-left: 1ex"> On Tuesday 31 July 2007, Leo Franchi wrote:<br>> API). So \
basically in order to get the correct element rect, i had to<br>> add the two \
lines included in the patch.<br><br>it *looks* ok (i'm in the middle of \
recompilling trunk/ on my lappie (at the <br>airport), so can't easily check \
right now).. have you tested with the analog<br>clock and url applets in plasma to \
make sure they don't break anything \
there?</blockquote></span><div><br><br>the only applet which uses \
elementRect currently is the Script applet, and it does indeed break that :-/ \
</div>I'm going to try to figure out exactly why that is \
so...</div></blockquote><div><br><br>Ok, i attach a new patch, plasma.svg.patch
, that instead of "fixing" elementRect, expos \
es QSvgRenderer::matrixForElement to the client. This way the default \
<br>behaviour remains the same and nothing breaks, \
but applets that need to deal with the transformation matrix can do
so. </div><br><blockquote class="gmail_quote" style="margin-top: 0; \
margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; \
border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; \
padding-left: 1ex"> <div><span><blockquote class="gmail_quote" style="margin-top: 0; \
margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; \
border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; \
padding-left: 1ex"> > Also, regarding the current Theme->setApplicationName(), \
currently if you<br>> set the application to, say, "amarok", plasma will \
look for the<br>> [Theme-amarok] group in plasmarc. Now, as Amarok doesn't \
depend on kdebase, <br>> there might not be a plasmarc at all.<br><br>that \
doesn't matter, as it will be created as needed.<br><br>> So it makes little \
sense for us to<br>> edit/create plasmarc if none exists. I think it would be a \
better idea to <br>> look into the application-default config, so amarokrc would \
hold the<br>> relevant theme data. What do you guys think?<br><br>as long as it \
can be done without breaking, for instance, krunner which relies<br>on plasmarc being \
used. that's why it is as it is. i don't see the probably <br>really? if \
it's a performance issue that you are concerned about i'd<br>recommend \
benchmarking it first \
=)</blockquote></span><div><br>the only concern is that it&nb \
sp;was a little strange for a user, installing amarok on a
kdebase-less system, would have a plasmarc with his amarok-specific theme selection. \
</div></div></blockquote><div><br><br>I attach a test patch t \
o illustrate what I mean. Basically, instead of&nbs \
p;looking in plasmarc for [Theme-appname], it looks for
appname.rc, [Theme]. Is this reasonable? Does this break anything? \
I don't really know what krunner or anything else <br>needs...<br><br>Also, i \
attach a patch to fix the buggy patch applied in r695097. It is mostly ok, but \
the change in call from d->source(source) to d->source(source, false) stops the \
engine from actually creating the source when it needs to be created. this fixes \
things for me. <br><br>all 3 patches have been tested against trunk and i can't \
notice any adverse effects. <br></div><br><blockquote class="gmail_quote" \
style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: \
0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; \
padding-left: 1ex"> <div><div>leo </div><br><blockquote class="gmail_quote" \
style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: \
0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; \
padding-left: 1ex">
--<span><br>Aaron J. Seigo<br>humru othro a kohnu se<br>GPG Fingerprint: 8B8B 2209 \
0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43<br><br>KDE core developer \
sponsored by Trolltech<br><br></span>_______________________________________________ \
<br>Panel-devel mailing list<br><a href="mailto:Panel-devel@kde.org" target="_blank" \
onclick="return top.js.OpenExtLink(window,event,this)">Panel-devel@kde.org</a><br><a \
href="https://mail.kde.org/mailman/listinfo/panel-devel" target="_blank" \
onclick="return top.js.OpenExtLink(window,event,this)"> \
https://mail.kde.org/mailman/listinfo/panel-devel</a><br><br><br></blockquote></div><div><span><br><br \
clear="all"><br>-- <br>______________________________________________________<br>Leo \
Franchi \
<a href="mailto:angel666@myrealbox.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)"> angel666@myrealbox.com</a><br>4305 \
Charlemagne Ct <a \
href="mailto:lfranchi@gmail.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)"> lfranchi@gmail.com</a> \
<br>Austin
cell: (650) 704 3680<br>TX, \
USA   \
; home: \
(650) 329 0125 </span></div></blockquote><br><br clear="all"><br>-- \
<br>______________________________________________________ <br>Leo \
Franchi
<a href="mailto:angel666@myrealbox.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">angel666@myrealbox.com</a><br>4305 Charlemagne \
Ct <a \
href="mailto:lfranchi@gmail.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)"> lfranchi@gmail.com</a> \
<br>Austin &nbs \
p; \
cell: (650) 704 3680 <br>TX, \
USA   \
; home: \
(650) 329 0125
["plasma.svg.patch" (application/octet-stream)]
Index: svg.cpp
===================================================================
--- svg.cpp (revision 695342)
+++ svg.cpp (working copy)
@@ -177,10 +177,16 @@
QSizeF naturalSize = renderer->defaultSize();
qreal dx = size.width() / naturalSize.width();
qreal dy = size.height() / naturalSize.height();
-
+
return QRect(elementRect.x() * dx, elementRect.y() * dy,
elementRect.width() * dx, elementRect.height() * dy);
}
+
+ QMatrix matrixForElement(const QString& elementId)
+ {
+ createRenderer();
+ return renderer->matrixForElement(elementId);
+ }
static QHash<QString, SharedSvgRenderer::Ptr> renderers;
SharedSvgRenderer::Ptr renderer;
@@ -261,6 +267,12 @@
return d->renderer->elementExists(elementId);
}
+QMatrix Svg::matrixForElement(const QString& elementId) const
+{
+ d->createRenderer();
+ return d->renderer->matrixForElement(elementId);
+}
+
bool Svg::isValid() const
{
d->createRenderer();
Index: svg.h
===================================================================
--- svg.h (revision 695342)
+++ svg.h (working copy)
@@ -30,6 +30,7 @@
class QRectF;
class QSize;
class QSizeF;
+class QMatrix;
namespace Plasma
{
@@ -157,6 +158,14 @@
Q_INVOKABLE bool elementExists( const QString& elementId ) const;
/**
+ * The transformation matrix of the element. That includes the
+ * transformation on the element itself.
+ * @arg elementId the id of the element
+ * @return the matrix for the element
+ **/
+ Q_INVOKABLE QMatrix matrixForElement(const QString& elementId) const;
+
+ /**
* @return true if the SVG file exists and the document is valid,
* otherwise false. This method can be expensive as it
* causes disk access.
["plasma.theme.patch" (application/octet-stream)]
Index: theme.cpp
===================================================================
--- theme.cpp (revision 695342)
+++ theme.cpp (working copy)
@@ -72,13 +72,13 @@
void Theme::settingsChanged()
{
- QString groupName = "Theme";
+ QString configName = "plasmarc";
if (!d->app.isEmpty() && d->app != "plasma") {
- groupName.append("-").append(d->app);
+ configName = QString(d->app + "rc");
}
- KSharedConfig::Ptr config = KSharedConfig::openConfig("plasmarc");
- KConfigGroup group(config, groupName);
+ KSharedConfig::Ptr config = KSharedConfig::openConfig(configName);
+ KConfigGroup group(config, "Theme");
QString themeName = group.readEntry("name", d->themeName);
if (themeName != d->themeName) {
d->themeName = themeName;
["plasma.dataengine.patch" (application/octet-stream)]
Index: dataengine.cpp
===================================================================
--- dataengine.cpp (revision 695342)
+++ dataengine.cpp (working copy)
@@ -140,7 +140,7 @@
if (!s) {
// we didn't find a data source, so give the engine an opportunity to make one
if (d->sourceRequested(source)) {
- s = d->source(source, false);
+ s = d->source(source);
if (s) {
// now we have a source; since it was created on demand, assume
// it should be removed when not used
_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic