[prev in list] [next in list] [prev in thread] [next in thread] 

List:       calligra-devel
Subject:    Re: Anatomy of the style manager
From:       Elvis Stansvik <elvstone () gmail ! com>
Date:       2013-05-31 15:00:56
Message-ID: CAHms=eZP_Z37v2V1PYatPA6Pt00TW1Liba+OS+5wuyfOjdY8iw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


2013/5/30 Pierre Stirnweiss <pstirnweiss@googlemail.com>

> Hello Elvis,
>
> I am unfortunately kept away from coding by non hobby stuff at the moment.
> I have been working for quite a while on a new style manager. The current
> style manager is a mix of several partial rewrites on top of each other. I
> have started from scratch completely, using a QAbstractModel approach (so
> we can later easily go to QML stuff). The style manager is actually nearly
> rewritten (for paragraph style stuff). I would however really welcome help
> in that. If you are interested in this part of calligra, you can find my
> stuff in the branch: textshape_stylesWidget_pierreSt.
>

That sounds great. Unfortunately I have just started my summer job, so I
only had time for some small fixes in the days leading up to this, and now
I'm busy with the job :/ I briefly looked at the branch though, and it
seems it's on the right track. My mail below was about the underlying style
manager though (KoStyleManager).

Let me know, if you want to help me with this. To start with I have only
> tried to replicate the current dialog. However, I don't think they are
> particularly good, so the second step should probably be to improve them.
> Also there are some really good wish items for the style manager which
> ought to be implemented.
>

Perhaps I'll have some time over this summer despite my job, but no
guarantees

PierreSt, who is actually still alive
>

Good news indeed! :)

Elvis


>
> On Tue, May 28, 2013 at 7:04 PM, Elvis Stansvik <elvstone@gmail.com>wrote:
>
>> Hi again,
>>
>> Some more questions about the style manager :)
>>
>> The style manager currently contains, among other things:
>>
>>     QHash<int, KoCharacterStyle*> charStyles;
>>     QHash<int, KoParagraphStyle*> paragStyles;
>>     QHash<int, KoParagraphStyle *> unusedParagraphStyles;
>>     QVector<int> m_usedCharacterStyles;
>>     QVector<int> m_usedParagraphStyles;
>>
>> The first two are the ones that holds all char/parag styles currently in
>> the manager, and they have been there since a long time.
>>
>> The unusedParagraphStyles, along with the associated
>> API addUnusedStyle(...) and moveToUsedStyles(...) was added later by
>> Gopalakrishna.
>>
>> The last two are the most recently added, by Pierre, for use in the
>> DockerStylesComboModel.
>>
>> Taking a paragraph style as example, when it is added to the manager
>> normally using add(...), it's added to paragStyles, and if it's used
>> (isApplied() returns true), its ID is also added to m_usedParagraphStyles.
>> The manager also starts listening on the styleApplied signal of the style,
>> and adds the ID to m_usedParagraphStyles when the signal fires. It also
>> seems that these IDs are never removed from m_usedParagraphStyles, but
>> since style IDs are monotonically increasing, I don't think this is a
>> practical problem (just a slight memory/performance bug).
>>
>> However, in KoStyleManager::moveToUsedStyles(...), which seems to be
>> used for transporting a style from unusedParagraphStyles into
>> paragStyles, the corresponding ID is never added to m_usedParagraphStyles,
>> and the manager does not connect to the styleApplied signal. Is this a bug
>> or intended?
>>
>> It would be great if someone who's more experienced with the SM could
>> shed some light on the motivation for these different containers, and also
>> point out if I have gotten something wrong.
>>
>> Cheers,
>> Elvis
>>
>> _______________________________________________
>> calligra-devel mailing list
>> calligra-devel@kde.org
>> https://mail.kde.org/mailman/listinfo/calligra-devel
>>
>>
>
> _______________________________________________
> calligra-devel mailing list
> calligra-devel@kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel
>
>

[Attachment #5 (text/html)]

<div dir="ltr">2013/5/30 Pierre Stirnweiss <span dir="ltr">&lt;<a \
href="mailto:pstirnweiss@googlemail.com" \
target="_blank">pstirnweiss@googlemail.com</a>&gt;</span><br><div \
class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div \
dir="ltr"><div><div><div><div>Hello Elvis,<br><br></div>I am unfortunately kept away \
from coding by non hobby stuff at the moment. I have been working for quite a while \
on a new style manager. The current style manager is a mix of several partial \
rewrites on top of each other. I have started from scratch completely, using a \
QAbstractModel approach (so we can later easily go to QML stuff). The style manager \
is actually nearly rewritten (for paragraph style stuff). I would however really \
welcome help in that. If you are interested in this part of calligra, you can find my \
stuff in the branch: textshape_stylesWidget_pierreSt.<br> \
</div></div></div></div></blockquote><div><br></div><div style>That sounds great. \
Unfortunately I have just started my summer job, so I only had time for some small \
fixes in the days leading up to this, and now I&#39;m busy with the job :/ I briefly \
looked at the branch though, and it seems it&#39;s on the right track. My mail below \
was about the underlying style manager though (KoStyleManager).</div> <div \
style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>

</div>Let me know, if you want to help me with this. To start with I have only tried \
to replicate the current dialog. However, I don&#39;t think they are particularly \
good, so the second step should probably be to improve them. Also there are some \
really good wish items for the style manager which ought to be implemented.<br> \
</div></div></div></blockquote><div><br></div><div style>Perhaps I&#39;ll have some \
time over this summer despite my job, but no guarantees</div><div \
style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <div dir="ltr">PierreSt, who is \
actually still alive</div></blockquote><div><br></div><div style>Good news indeed! \
:)</div><div style><br></div><div style>Elvis</div><div style> </div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div class="gmail_extra"><br><div \
class="gmail_quote"><div><div class="h5">On Tue, May 28, 2013 at 7:04 PM, Elvis \
Stansvik <span dir="ltr">&lt;<a href="mailto:elvstone@gmail.com" \
target="_blank">elvstone@gmail.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi \
again,<div><br></div><div>Some more questions about the style manager :)</div> \
<div><br></div><div>The style manager currently contains, among other things:</div>

<div><br></div><div>
<div>    QHash&lt;int, KoCharacterStyle*&gt; charStyles;</div><div>    QHash&lt;int, \
KoParagraphStyle*&gt; paragStyles;</div><div><div>    QHash&lt;int, KoParagraphStyle \
*&gt; unusedParagraphStyles;</div></div><div><div>


    QVector&lt;int&gt; m_usedCharacterStyles;</div>
<div>    QVector&lt;int&gt; m_usedParagraphStyles;</div></div><div><br></div><div>The \
first two are the ones that holds all char/parag styles currently in the manager, and \
they have been there since a long time.</div> <div><br></div><div>The \
unusedParagraphStyles, along with the associated API addUnusedStyle(...) and \
moveToUsedStyles(...) was added later by Gopalakrishna.</div><div><br></div><div>The \
last two are the most recently added, by Pierre, for use in the \
DockerStylesComboModel.</div>



<div><br></div><div>Taking a paragraph style as example, when it is added to the \
manager normally using add(...), it&#39;s added to paragStyles, and if it&#39;s used \
(isApplied() returns true), its ID is also added to m_usedParagraphStyles. The \
manager also starts listening on the styleApplied signal of the style, and adds the \
ID to m_usedParagraphStyles when the signal fires. It also seems that these IDs are \
never removed from m_usedParagraphStyles, but since style IDs are monotonically \
increasing, I don&#39;t think this is a practical problem (just a slight \
memory/performance bug).</div>



<div><br></div><div>However, in \
<span>KoStyleManager</span><span>::</span><span>moveToUsedStyles(...), which seems to \
be used for transporting a style from </span><font \
color="#000000">unusedParagraphStyles into paragStyles, the corresponding ID is never \
added to </font>m_usedParagraphStyles, and the manager does not connect to the \
styleApplied signal. Is this a bug or intended?</div>



<div><br></div><div>It would be great if someone who&#39;s more experienced with the \
SM could shed some light on the motivation for these different containers, and also \
point out if I have gotten something wrong.</div> \
<div><br></div><div>Cheers,</div><div>Elvis</div> </div></div>
<br></div></div>_______________________________________________<br>
calligra-devel mailing list<br>
<a href="mailto:calligra-devel@kde.org" \
target="_blank">calligra-devel@kde.org</a><br> <a \
href="https://mail.kde.org/mailman/listinfo/calligra-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/calligra-devel</a><br> \
<br></blockquote></div><br></div> \
<br>_______________________________________________<br> calligra-devel mailing \
list<br> <a href="mailto:calligra-devel@kde.org">calligra-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/calligra-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/calligra-devel</a><br> \
<br></blockquote></div><br></div></div>



_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic