[Psi-devel] a patch for auto-replace
Drakosha
drakosha at mail15.com
Tue Feb 8 14:43:29 PST 2005
I started doing the stuff, but i got really confused. Please see some
questions below:
Michail Pishchagin wrote:
>Drakosha wrote:
>
>
>>I'd really like to hear comments and improvements
>>suggestions.
>>
>>
>
>Ok, here comes the comments list :)
>
>1. Why not to store the replace list in the config.xml? It would be alot
>simplier that way. Store QMap<QString, QString> in Options structure, have
>one AutoCorrect class inside PsiCon. Update the correction list on options
>change. As only one user profile is active at a time, you could store
>AutoCorrect in the PsiCon::Private class.
>
>
What PsiCon stands for? Why hold a qmap and autocorrect - i.e. hold the
data twice? Can i somehow get from PsiCon to options?
About separate config file - r u sure you want to put it inside config.xml?
Besides i'll probably have to read much more about signals and slots :).
>class PsiCon {
>// ...
>public slots:
> void autoCorrect( QTextEdit & );
>// ...
>};
>
>void PsiCon::autoCorrect( QTextEdit &te ) {
> d->autoCorrect->correctEdit( te );
>}
>
>// ------------------
>
>ChatEdit {
>// ...
>signals:
> void autoCorrect( QTextEdit & );
>private slots:
> void textChanged();
>// ...
>};
>
>ChatEdit::ChatEdit( ... ) {
>// ...
> connect(this, SIGNAL(textChanged()), SLOT(textChanged()));
>// ...
>}
>
>void ChatEdit::textChanged() {
> emit autoCorrect( *this );
>}
>
>// ------------------
>
>ChatDlg::ChatDlg( ... ) {
>// ...
> connect( d->mle, SIGNAL(autoCorrect( QTextEdit & )), d->psi,
>SLOT(autoCorrect( QTextEdit & )));
>// ...
>}
>
>2. I'd like the formatting to be according to the Common Psi Standard (too bad
>there's no version of it online). Basically, it's very to the major Psi code
>base.
>
> * Use tabs for indentation
> * Following constructions are preferred:
>
> if ( foo )
> doBar();
>
> while ( foo ) {
> doBar();
> }
>
> * Spaces between braces are optional, but I really like when they're here
>
>
That's easy, some googling and emacs is configured ;)
>3. I think you should move your AutoCorrect class to separate file, and add
>additional API for loading/saving: toXml/fromXml, just like the XMPP::VCard
>class does (look in iris/xmpp-im/xmpp_vcard.* for example). Probably you also
>should use private implementation model (just like VCard does).
>
>4. Small API changes. Instead of enable()/disable() functions, create one
>setEnabled(bool) function. This would be in Qt style :). And rename
>workOnTextChange() to "public slot: correctTextEdit()", or something like
>that.
>
>2Hal: we need to create Psi Hacker's Guide and put it to Developer section
>online.
>
>-mblsha
>_______________________________________________
>Psi-devel-affinix.com mailing list
>Psi-devel-affinix.com at lists.affinix.com
>http://lists.affinix.com/listinfo.cgi/psi-devel-affinix.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.dreamhost.com/pipermail/psi-devel-affinix.com/attachments/20050209/d72cdbb0/attachment.htm
More information about the Psi-devel-affinix.com
mailing list