[kde-edu]: Changes in kvtml
Frederik Gladhorn
frederik.gladhorn at gmx.de
Sun Apr 22 18:34:00 CEST 2007
Hi all!
Ok, it took me a while, but I started playing around with the kvtml stuff in
the lib. I was getting frustrated every time I looked at the KVocTrain code,
so I decided I have to act.
There are six weeks left until feature freeze, and I'd like to make a rather
big chage, that will trouble all that are using our beloved KVTML file
format.
For lawyers: I'll be using language for things that can be in KVTML docs.
These can of course be totally different things, which is the cause to call
them identifiers in the lib. Feel free to fill in whatever you like instead.
The concept of original language + x translations is not really great for apps
that actually can have more than two languages. So far it is never possible
to practice language 2 with language 3.
This is intersting for people learing eg. Chinese or Japanese, to have some
sort of signs and maybe traditional and simplified and be able to practice
them in respect to each other.
See bug #93446 (https://bugs.kde.org/show_bug.cgi?id=93446).
Another thing is that this concept blows up the code unnecessarily and in a
ugly way. Because everywhere there is special treatment for original, than an
iteration over all translations.
KVocTrain and also the lib we have about thousand places like (rather small
example of duplicate code directly next to each other):
(from keduvocdocument.cpp)
if (sort_column == 0)
return e1.original().toLower() < e2.original().toLower();
else
return e1.translation(sort_column).toLower() <
e2.translation(sort_column).toLower();
This will become:
return e1.translation(sort_column).toLower() <
e2.translation(sort_column).toLower();
I modified KEduVocExpression as a start, to see how bad changing that is. I
started with 950 lines of code and I ended up with 530 lines of code (ok,
it's not tested and will grow a couple of lines again).
For most of the programs using it there will be little to no problems. The
original() calls will have to be replaced by translation(0) and
translation(0) becomes translation(1).
Only the grading has to be saved a little different, because now it will be
possible to practice language 2 with 3, which is the point of the whole
exercise.
Each word in every language can now save grades from the other language. So if
I am shown a word in language 2 and enter it correctly in language 3, the
lang 3 entry saves that it was correct one time from lang 2.
(Before there was a bool which decided if it was from or to original. See
attachment.)
The bigger problem is that this change will not be downward compatible. I'd
adapt the original readers to provide the new structure. To keep
KEduVocKvtmlReader clean I'd like to have two versions of it. One simply
reading old files to the new structure and another one to read the new files.
The other big change is the use of lessons. To make KEduVocDocument a little
cleaner I removed all references to lessons and vocabulary entries, exept two
functions: rootLesson() and setRootLesson().
Lessons now actually contain their vocabulary and can contain sublessons.
This makes organization much nicer and removes many special case treatment as
well.
For most apps (unless they begin to like lessons) this is no big change.
Instead of myDoc->entry(index) it changes to
myDoc->rootLesson()->entry(index).
Types will actually be a real class to fix bug #138488, that it was impossible
to query
for nouns and have noun:male/femal/nutral included.
The multiple choice class was a really weird container for five QString. I'd
replace it with a QStringList which is more flexible and smaller. This also
get's rid of the fixed maximum of multiple choice answers. Do you want to
rather keep it?
Please send your suggestions and concerns!
Did something always annoy you with KEduVocDocument? Do you want a new
comfortable function there? Will you burn me on a pile of wood for doing
this?
I'd like to get this in soon, so all KDE4 kvtml apps make use from the change
right from the beginning.
I think I will need one more week to get the lib done. If there are no
protests I might actually apply this. I'll happily send out a patch to those
interested. It's probably still a bit buggy, but if kvoctrain works with it,
most of the other apps should as well.
Also tell me, if you want to port your app yourself or if I should do it.
Any help is of course very appreciated.
Attached: xml proposal (I think there are still some things mixed up, is the
old one defined cleanly anywhere?)
At the moment, I have new lesson, expression and so on classes and almost
finished writer/reader classes.
For kvoctrain I hope this makes it possible/necessary to fix:
#93446, #108568 (a bit), #125555, #138488 and #140039
Greetings,
Frederik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-edu/attachments/20070422/0d7dc3e0/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-edu/attachments/20070422/0d7dc3e0/attachment.pgp
More information about the kde-edu
mailing list