[Qt-creator] Extending Qt Creator with scripts
Nicolas Arnaud-Cormos
nicolas.arnaud-cormos at kdab.com
Sun Oct 30 19:51:46 CET 2011
Hi all,
Qt Creator is one of my favorite IDE, unfortunatelly there's something I'm
still missing compare to xemacs: scripting.
In my day to day work, I'm using xemacs most of the time because of existing
scripts for this particular project. Also, we all have some specific tasks we
do again and again in a project, and creating a new plugin each time would be
a pain.
I would like to work on this, but before starting anything let's discuss the
architecture a bit here (and maybe on IRC), so I would be able to push it
upstream.
Langage
=======
I'm thinking of javascript, for 2 reasons: it's supported by Qt Script, and
QML developpers know it.
I considered QML 5 seconds, but I don't see how a declarative langage (mainly
for creating graphical interface) can be used here, and what we would gain.
So my primary goal is javascript using Qt Script.
Script manager
============
There's already a ScriptManager class in core, not used, with already some
nice things. This ScriptManager is used to start the engine with all the Qt
Creator interfaces registered.
Seems like a good decision, and I'll revive this class.
Qt Creator interfaces
=================
There's not much code right now, but it seems that the direction taken by
ScriptManager is to do a 1:1 mapping with QtCreator.
For me, it doesn't make sense, scripting must be fast and easy.
I would propose to create an object (or maybe more than one) for each plugin,
with methods we want to export to javascript.
For exemple, for a cppplugin, I would like to write something like this (more
or less, but you get the idea):
if (isCppFile())
editor.switchDeclarationDefinition()
Script plugin
==========
The script plugin will manage the script files (directories, delete,
create...).
Like the macro plugin, a way to execute a script using the locator, and a way
to assign shortcuts to scripts.
So except the engine (in ScriptManager... maybe rename it to ScriptEngine) and
the plugins interfaces, everything script related should be in this plugin.
Macro plugin
==========
That's the last target of my project: replacing the current macro plugin by
something which create scripts.
So instead of storing key events (press 's' key, release 's' key...), I would
store editor->write("slots") in a script. It should also fix some issues of the
current macro plugin...
Any comments are very welcome, either here or on IRC (nikikko).
Cheers,
Nicolas
--
Nicolas Arnaud-Cormos | nicolas.arnaud-cormos at kdab.com | Senior Software
Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
More information about the Qt-creator
mailing list