[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request: allow SVGs to use systemcolors
From: "Manuel Mommertz" <2kmm () gmx ! de>
Date: 2010-09-30 13:40:38
Message-ID: 20100930134038.16579.25750 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On 2010-09-30 13:10:03, Marco Martin wrote:
> > still not completely happy having to keep a separate xml dom, however, there are \
> > probably not going to be other ways for a while and the implementation seems \
> > pretty good, so modulo those little things it could go in
If QXmlStreamReader::parse() would be virtual, we could create a stream reader, that \
replaces this on the fly. But for now I see no other way of doing this. The only idea \
that could work is: Create a QIODevice that reads from another QIODevice with help of \
QXmlStreamReader and writes the data again with QXmlStreamWriter... But this would be \
much more code and I don't think that this would be faster at all.
> On 2010-09-30 13:10:03, Marco Martin wrote:
> > /trunk/KDE/kdelibs/plasma/svg.cpp, line 107
> > <http://svn.reviewboard.kde.org/r/5495/diff/1/?file=38739#file38739line107>
> >
> > a check elements with the same id aren't existing should be done
You are right. But this would add more clutter. Maybe it is better to just leave the \
id as is. So no hint-uses-color-scheme but only current-color-scheme.
> On 2010-09-30 13:10:03, Marco Martin wrote:
> > /trunk/KDE/kdelibs/plasma/svg.cpp, line 441
> > <http://svn.reviewboard.kde.org/r/5495/diff/1/?file=38739#file38739line441>
> >
> > so the coloring of the pixmap is still kept as retrocompatibility?
I don't want to break existing themes ;)
> On 2010-09-30 13:10:03, Marco Martin wrote:
> > /trunk/KDE/kdelibs/plasma/theme.cpp, line 320
> > <http://svn.reviewboard.kde.org/r/5495/diff/1/?file=38741#file38741line320>
> >
> > i wonder how much is the benefit vs cost of caching this?
Both is quite low. ;) But as this stylesheet has to be generated for every \
Plasma::Svg object, which is 259 times for a start of plasma with the default setup + \
analog clock + calculator, it feels wrong to regenerate it that often.
> On 2010-09-30 13:10:03, Marco Martin wrote:
> > /trunk/KDE/kdelibs/plasma/theme.cpp, line 790
> > <http://svn.reviewboard.kde.org/r/5495/diff/1/?file=38741#file38741line790>
> >
> > the button widget should be modified if this will start to be used
For what reason?
- Manuel
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/5495/#review7905
-----------------------------------------------------------
On 2010-09-30 11:41:09, Manuel Mommertz wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/5495/
> -----------------------------------------------------------
>
> (Updated 2010-09-30 11:41:09)
>
>
> Review request for Plasma.
>
>
> Summary
> -------
>
> With this patch applied SVGs can put a style-element with id \
> 'current-system-colors' in it, which gets replaced by a style with the current \
> systemcolors. This allows SVGs to use colors like background color and text color \
> from the system palette. Giving themes much more possibilitys then just coloring \
> the resulting pixmap.
>
> Diffs
> -----
>
> /trunk/KDE/kdelibs/plasma/theme.h 1180314
> /trunk/KDE/kdelibs/plasma/theme.cpp 1180314
> /trunk/KDE/kdelibs/plasma/svg.cpp 1180314
>
> Diff: http://svn.reviewboard.kde.org/r/5495/diff
>
>
> Testing
> -------
>
> Changing theme, changing colorscheme
>
>
> Thanks,
>
> Manuel
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://svn.reviewboard.kde.org/r/5495/">http://svn.reviewboard.kde.org/r/5495/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On September 30th, 2010, 1:10 p.m., <b>Marco \
Martin</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;"> <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">still not completely happy having to keep a separate xml dom, however, \
there are probably not going to be other ways for a while and the implementation \
seems pretty good, so modulo those little things it could go in</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If \
QXmlStreamReader::parse() would be virtual, we could create a stream reader, that \
replaces this on the fly. But for now I see no other way of doing this. The only idea \
that could work is: Create a QIODevice that reads from another QIODevice with help of \
QXmlStreamReader and writes the data again with QXmlStreamWriter... But this would be \
much more code and I don't think that this would be faster at all.</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On September 30th, 2010, 1:10 p.m., <b>Marco \
Martin</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="/r/5495/diff/1/?file=38739#file38739line107" style="color: black; font-weight: \
bold; text-decoration: underline;">/trunk/KDE/kdelibs/plasma/svg.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool SharedSvgRenderer::load(const QByteArray &contents, const QString \
&styleSheet)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">103</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QDomElement</span> <span class="n">colorScheme</span> <span \
class="o">=</span> <span class="n">svg</span><span class="p">.</span><span \
class="n">createElement</span><span class="p">(</span><span \
class="s">"style"</span><span class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">a check elements with \
the same id aren't existing should be done</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">You are \
right. But this would add more clutter. Maybe it is better to just leave the id as \
is. So no hint-uses-color-scheme but only current-color-scheme.</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On September 30th, 2010, 1:10 p.m., <b>Marco \
Martin</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="/r/5495/diff/1/?file=38739#file38739line441" style="color: black; font-weight: \
bold; text-decoration: underline;">/trunk/KDE/kdelibs/plasma/svg.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">class \
SvgPrivate</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">385</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n"><span class="hl">applyColors</span></span><span class="hl"> </span><span \
class="o"><span class="hl">=</span></span><span class="hl"> </span><span \
class="n">elementRect</span><span class="p">(</span><span \
class="s">"hint-apply-color-scheme"</span><span class="p">).</span><span \
class="n">isValid</span><span class="p">()<span class="hl">;</span></span></pre></td> \
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">437</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k"><span class="hl">if</span></span><span class="hl"> </span><span \
class="p"><span class="hl">(</span></span><span class="n">elementRect</span><span \
class="p">(</span><span class="s">"hint-apply-color-scheme"</span><span \
class="p">).</span><span class="n">isValid</span><span class="p">()<span \
class="hl">)</span></span><span class="hl"> </span><span class="p"><span \
class="hl">{</span></span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">so the coloring of the \
pixmap is still kept as retrocompatibility?</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don't \
want to break existing themes ;)</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On September 30th, 2010, 1:10 p.m., <b>Marco \
Martin</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="/r/5495/diff/1/?file=38741#file38741line320" style="color: black; font-weight: \
bold; text-decoration: underline;">/trunk/KDE/kdelibs/plasma/theme.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ThemePrivate::colorsChanged()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">320</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span><span class="p">(</span><span class="n">stylesheet</span><span \
class="p">.</span><span class="n">isEmpty</span><span class="p">())</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">i wonder how much is the \
benefit vs cost of caching this?</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Both is \
quite low. ;) But as this stylesheet has to be generated for every Plasma::Svg \
object, which is 259 times for a start of plasma with the default setup + analog \
clock + calculator, it feels wrong to regenerate it that often.</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On September 30th, 2010, 1:10 p.m., <b>Marco \
Martin</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="/r/5495/diff/1/?file=38741#file38741line790" style="color: black; font-weight: \
bold; text-decoration: underline;">/trunk/KDE/kdelibs/plasma/theme.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">KSharedConfigPtr Theme::colorScheme() const</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">785</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">case</span> <span class="nl">ButtonHoverColor:</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">the button widget should \
be modified if this will start to be used</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">For what \
reason?</pre> <br />
<p>- Manuel</p>
<br />
<p>On September 30th, 2010, 11:41 a.m., Manuel Mommertz wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Plasma.</div>
<div>By Manuel Mommertz.</div>
<p style="color: grey;"><i>Updated 2010-09-30 11:41:09</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">With this patch applied SVGs can put a style-element with id \
'current-system-colors' in it, which gets replaced by a style with the \
current systemcolors. This allows SVGs to use colors like background color and text \
color from the system palette. Giving themes much more possibilitys then just \
coloring the resulting pixmap.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Changing theme, changing colorscheme</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/KDE/kdelibs/plasma/theme.h <span style="color: \
grey">(1180314)</span></li>
<li>/trunk/KDE/kdelibs/plasma/theme.cpp <span style="color: \
grey">(1180314)</span></li>
<li>/trunk/KDE/kdelibs/plasma/svg.cpp <span style="color: \
grey">(1180314)</span></li>
</ul>
<p><a href="http://svn.reviewboard.kde.org/r/5495/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic