koffice

Dmitry Kazakov dimula73 at gmail.com
Tue Sep 29 13:15:54 CEST 2009


On Tue, Sep 29, 2009 at 11:51 AM, Thomas Zander <zander at kde.org> wrote:

> SVN commit 1029197 by zander:
>
> Inline the KoDocument::undoLastCommand, no need for a virtual method.
>
>  M  +1 -1      krita/image/kis_undo_adapter.cc
>  M  +0 -5      libs/main/KoDocument.cpp
>  M  +0 -5      libs/main/KoDocument.h
>
>
> --- trunk/koffice/krita/image/kis_undo_adapter.cc #1029196:1029197
> @@ -78,7 +78,7 @@
>      * command->undo() and remove the cache without committing it
>      * to the undoStack
>      */
> -    m_doc->undoLastCommand();
> +    m_doc->undoStack()->undo();
>  }
>

Argh! =(
You are beaking encapsulation! Isn't this a basic principle of
object-oriented programming?
There is an object (doc), and there is it's interface (undoLastCommand). And
no calls to private members! (undo stack is private, right?) Why do you use
private members?

These calls to privates are curse of our code... They make it simply
unmaintainable... Just remember zooming subsys and PixelAspect button
case...

I'm insisting on reverting this. I admit that this function may be
'non-virtual', i simply didn't manage to compile this as non-virtual. =(





>  void KisUndoAdapter::setUndo(bool undo)
> --- trunk/koffice/libs/main/KoDocument.cpp #1029196:1029197
> @@ -2381,11 +2381,6 @@
>         d->undoStack->push(command);
>  }
>
> -void KoDocument::undoLastCommand()
> -{
> -    d->undoStack->undo();
> -}
> -
>  void KoDocument::beginMacro(const QString & text)
>  {
>     d->undoStack->beginMacro(text);
> --- trunk/koffice/libs/main/KoDocument.h #1029196:1029197
> @@ -790,11 +790,6 @@
>     virtual void addCommand(QUndoCommand* command);
>
>     /**
> -     * Undo the command that is stored at the top of the stack
> -     */
> -    virtual void undoLastCommand();
> -
> -    /**
>      * Begins recording of a macro command. At the end endMacro needs to be
> called.
>      * @param text command description
>      */
>



-- 
Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20090929/4c5cf6fd/attachment.htm 


More information about the kimageshop mailing list