Project and file templates
Miha Čančula
miha at noughmad.eu
Tue May 15 15:04:31 UTC 2012
Hello!
My name is Miha Čančula and I'll be working this summer on a template
system for KDevelop. My work is divided into two major parts:
*1. New Project templates*
KDevPlatform now includes a plugin called kdevappwizards that reuses
templates from KAppTemplate. Additional templates are also included by
various plugins. However, this is no simple way of importing your own
templates, or sharing them. That's why I plan to implement loading
templates locally and getting new ones from OCS [1]. Apart from the sharing
capability, there will be no major changes here, so you'll be able to
continue creating new projects as you did so far. *
*I will not change existing templates or currently accepted variables, so
everything will continue to work.
*2. File templates*
I would also like to extend the "Create Class" dialog using templates. This
will be a major change, and it's also use much more frequently. Therefore I
would like some input from both users and possible writers of such
templates.
Templates are good not only because of support for different languages, but
there are also different styles of classes in the same language. The most
notable examples are probably QObjects with their macros, C++ classes with
private D-pointer, and also new-style vs. old-style classes in Python.
Using a template it would also be possible to generate a pure C struct with
method-like functions. *
2. a) Writers*
There is a great Qt template library called Grantlee[2] by Stephen Kelly.
It features the same syntax as the better known Django, so it is note some
obscure language. In comparison with KMacroExpander used for app templates,
it supports for loops, if statements and calling some functions on the
variables.
I have already used it, so I'm familiar with its syntax and built-in
functions (called filters). It is also possible to expose additional
filters.
However, if people express a wish I can also implement a simpler system
like the one for project templates. It is less powerful, but may be better
suited for simple templates. The lack of loops is the major drawback here.
If any of the prospective template writers has other ideas and/or wishes,
please voice them to me.
*2. b) Users*
>From the user point of view, the new functionality would consist of
selecting a template, and an extended "Create class" dialog. There you
could define class members and methods. I think that especially for C++,
declaring a list of properties and having the template engine autogenerate
accessor methods is a great time-saver. Again, if you could think of
anything else that would simplify life for users, please share.
[1]: I'm still not sure what the correct terminology is. KNewStuff, OCS, or
something else. In any case this is where you download themes and plasmoids
from.
[2]: http://www.gitorious.org/grantlee/pages/Home
Regards,
Miha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120515/3383fd9d/attachment.html>
More information about the KDevelop-devel
mailing list