Command pattern implementation

Bo Thorsen bo at thorsen-consulting.dk
Wed Sep 27 08:40:02 BST 2006


Hi all,

I have an implementation of the command pattern, which I would like to donate 
to KDE. If you want it, of course.

Originally I wrote this with the intention of selling it, but that's probably 
not going to happen anyway, so I thought this might be something KDE would 
want to have.

I actually wanted to come to aKademy myself to talk about it and to meet old 
friends I haven't seen for too long, but that wasn't possible. So this mail 
will have to do.

It can obviously do undo and redo, and has a history class with signals for 
enabling and disabling undo/redo actions.

More interestingly: You can ask the history to record macros and later play 
these back. I also have some GUI classes for putting these macros in a menu 
so you can choose from a list of previously recorded macros.

And the big feature: You can stream these macros to Python code. And you can 
load the Python code on startup and get all your macros available again. It's 
also possible to write your own Python code here and get this executed in 
your application.

It's got a not entirely complete unittest suite (written using cppunit) and 
some documentation and apidocs.

I have written a text editor that uses the library. The editor itself sucks 
because I have been way too ambitious with the C++ support in it. But the 
macro stuff from this command library is really cool :) 

If you are interested in seeing this, you can download the command library and 
the editor from http://www.thorsen-consulting.dk/command-and-editor.tar.bz2. 
It compiles for me using Qt 4.1 on SuSE 10.1.

Other Linux distros might have difficulties compiling it because of a 
backtrace implementation I have done. If this is the case for you, change 
#ifdef Q_OS_LINUX to #if 0 in tc-freeclasses/src/backtrace.cpp.

I hope you will discuss this and figure out if it's a worthy addition to KDE 
4.

Bo Thorsen.

-- 

Thorsen Consulting ApS - Qt consulting services
http://www.thorsen-consulting.dk




More information about the kde-core-devel mailing list