From calligra-devel Thu May 30 12:19:24 2013 From: Pierre Stirnweiss Date: Thu, 30 May 2013 12:19:24 +0000 To: calligra-devel Subject: Re: Anatomy of the style manager Message-Id: X-MARC-Message: https://marc.info/?l=calligra-devel&m=136991640530916 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============3615592581684070624==" --===============3615592581684070624== Content-Type: multipart/alternative; boundary=047d7bdc1b247a3e5504ddee839e --047d7bdc1b247a3e5504ddee839e Content-Type: text/plain; charset=ISO-8859-1 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. 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. PierreSt, who is actually still alive On Tue, May 28, 2013 at 7:04 PM, Elvis Stansvik wrote: > Hi again, > > Some more questions about the style manager :) > > The style manager currently contains, among other things: > > QHash charStyles; > QHash paragStyles; > QHash unusedParagraphStyles; > QVector m_usedCharacterStyles; > QVector 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 > > --047d7bdc1b247a3e5504ddee839e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello Elvis,

I am unfortu= nately 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 e= asily go to QML stuff). The style manager is actually nearly rewritten (for= paragraph style stuff). I would however really welcome help in that. If yo= u are interested in this part of calligra, you can find my stuff in the bra= nch: textshape_stylesWidget_pierreSt.
Let me know, if you want to help me with this. To start with I have o= nly tried to replicate the current dialog. However, I don't think they = are particularly good, so the second step should probably be to improve the= m. Also there are some really good wish items for the style manager which o= ught to be implemented.

PierreSt, who is actually still alive


On Tue, May 28, 2013 at= 7:04 PM, Elvis Stansvik <elvstone@gmail.com> wrote:
Hi again,

Some more questions about the style manager :)

T= he style manager currently contains, among other things:

=A0 =A0 QHash<int, KoCharacterStyle*> charStyles;
=A0 = =A0 QHash<int, KoParagraphStyle*> paragStyles;
=A0 =A0= QHash<int, KoParagraphStyle *> unusedParagraphStyles;
=A0 =A0 QVector<int> m_usedCharacterStyles;
=A0 =A0 QVector<int> m_usedParagraphStyles;

=
The first two are the ones that holds all char/parag styles curr= ently in the manager, and they have been there since a long time.

The unusedParagraphStyles, along with the associated AP= I=A0addUnusedStyle(...) and=A0moveToUsedStyles(...) was added later by Gopa= lakrishna.

The last two are the most recently adde= d, by Pierre, for use in the DockerStylesComboModel.

Taking a paragraph style as example, when it is added t= o the manager normally using add(...), it's added to paragStyles, and i= f it's used (isApplied() returns true), its ID is also added to m_usedP= aragraphStyles. The manager also starts listening on the styleApplied signa= l of the style, and adds the ID to m_usedParagraphStyles when the signal fi= res. It also seems that these IDs are never removed from m_usedParagraphSty= les, but since style IDs are monotonically increasing, I don't think th= is is a practical problem (just a slight memory/performance bug).

However, in=A0KoStyleManager::moveToUsedStyles(...), which seems to be used for = transporting a style from=A0unusedParagraphS= tyles into paragStyles, the corresponding ID is never added to=A0m_u= sedParagraphStyles, and the manager does not connect to the styleApplied si= gnal. 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 co= ntainers, 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


--047d7bdc1b247a3e5504ddee839e-- --===============3615592581684070624== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ calligra-devel mailing list calligra-devel@kde.org https://mail.kde.org/mailman/listinfo/calligra-devel --===============3615592581684070624==--