[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> \
&lt;<a href="mailto:lfranchi@gmail.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">lfranchi@gmail.com</a>&gt; 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> &lt;<a href="mailto:aseigo@kde.org" \
target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> \
aseigo@kde.org </a>&gt; 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>&gt; API). So \
basically in order to get the correct element rect, i had to<br>&gt; add the two \
lines included in the patch.<br><br>it *looks* ok (i&#39;m in the middle of \
recompilling trunk/ on my lappie (at the   <br>airport), so can&#39;t easily check \
right now).. have you tested with the analog<br>clock and url applets in plasma to \
make sure they don&#39;t break anything \
there?</blockquote></span><div><br><br>the&nbsp;only&nbsp;applet&nbsp;which&nbsp;uses \
&nbsp;elementRect&nbsp;currently&nbsp;is&nbsp;the&nbsp;Script&nbsp;applet,&nbsp;and&nbsp;it&nbsp;does&nbsp;indeed&nbsp;break&nbsp;that&nbsp;:-/&nbsp; \
</div>I&#39;m going to try to figure out exactly why that is \
so...</div></blockquote><div><br><br>Ok,&nbsp;i&nbsp;attach&nbsp;a&nbsp;new&nbsp;patch,&nbsp;plasma.svg.patch
 ,&nbsp;that&nbsp;instead&nbsp;of&nbsp;&quot;fixing&quot;&nbsp;elementRect,&nbsp;expos \
es&nbsp;QSvgRenderer::matrixForElement&nbsp;to&nbsp;the&nbsp;client.&nbsp;This&nbsp;way&nbsp;the&nbsp;default \
<br>behaviour&nbsp;remains&nbsp;the&nbsp;same&nbsp;and&nbsp;nothing&nbsp;breaks,&nbsp; \
but&nbsp;applets&nbsp;that&nbsp;need&nbsp;to&nbsp;deal&nbsp;with&nbsp;the&nbsp;transformation&nbsp;matrix&nbsp;can&nbsp;do
 &nbsp;so.&nbsp;&nbsp;</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">  &gt; Also, regarding the current Theme-&gt;setApplicationName(), \
currently if you<br>&gt; set the application to, say, &quot;amarok&quot;, plasma will \
look for the<br>&gt; [Theme-amarok] group in plasmarc. Now, as Amarok doesn&#39;t \
depend on kdebase,   <br>&gt; there might not be a plasmarc at all.<br><br>that \
doesn&#39;t matter, as it will be created as needed.<br><br>&gt; So it makes little \
sense for us to<br>&gt; edit/create plasmarc if none exists. I think it would be a \
better idea to   <br>&gt; look into the application-default config, so amarokrc would \
hold the<br>&gt; 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&#39;s why it is as it is. i don&#39;t see the probably   <br>really? if \
it&#39;s a performance issue that you are concerned about i&#39;d<br>recommend \
benchmarking it first \
=)</blockquote></span><div><br>the&nbsp;only&nbsp;concern&nbsp;is&nbsp;that&nbsp;it&nb \
sp;was&nbsp;a&nbsp;little&nbsp;strange&nbsp;for&nbsp;a&nbsp;user,&nbsp;installing&nbsp;amarok&nbsp;on&nbsp;a
 &nbsp;kdebase-less&nbsp;system,&nbsp;would&nbsp;have&nbsp;a&nbsp;plasmarc&nbsp;with&nbsp;his&nbsp;amarok-specific&nbsp;theme&nbsp;selection. \
</div></div></blockquote><div><br><br>I&nbsp;attach&nbsp;a&nbsp;test&nbsp;patch&nbsp;t \
o&nbsp;illustrate&nbsp;what&nbsp;I&nbsp;mean.&nbsp;Basically,&nbsp;instead&nbsp;of&nbs \
p;looking&nbsp;in&nbsp;plasmarc&nbsp;for&nbsp;[Theme-appname],&nbsp;it&nbsp;looks&nbsp;for&nbsp;
 appname.rc,&nbsp;[Theme].&nbsp;Is&nbsp;this&nbsp;reasonable?&nbsp;Does&nbsp;this&nbsp;break&nbsp;anything? \
I don&#39;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, &nbsp;but \
the change in call from d-&gt;source(source) to d-&gt;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&#39;t \
&nbsp;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&nbsp;</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&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
<a href="mailto:angel666@myrealbox.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)"> angel666@myrealbox.com</a><br>4305 \
Charlemagne Ct&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <a \
href="mailto:lfranchi@gmail.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)"> lfranchi@gmail.com</a> \
<br>Austin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cell: (650) 704 3680<br>TX, \
USA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;home: \
(650) 329 0125  </span></div></blockquote><br><br clear="all"><br>-- \
<br>______________________________________________________ <br>Leo \
Franchi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <a href="mailto:angel666@myrealbox.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">angel666@myrealbox.com</a><br>4305 Charlemagne \
Ct&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a \
href="mailto:lfranchi@gmail.com" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)"> lfranchi@gmail.com</a> \
<br>Austin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
cell: (650) 704 3680 <br>TX, \
USA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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