PDA

View Full Version : Starting assistant from command line



mderdem
21st March 2007, 10:32
Hello,

I find myself too often switching between my editor of choice and the assistant. Is it possible to do something like :

> assistant -index QScrollBar

which could open the assistant and find the given word (QWidget in this case) in the index.

Is this possible (or anything in this direction would also help) ?

Thanks.

MDE

wysota
21st March 2007, 10:41
see "assistant -help" :)

mderdem
21st March 2007, 10:43
Well, of course I did. Am I missing something here ? :(

Usage: assistant [option]
Options:
-file Filename assistant opens the specified file
-server reads commands from a socket after
assistant has started
-profile fileName starts assistant and displays the
profile specified in the file fileName.
-addContentFile file adds the content file 'file' to the set of
documentation available by default
-removeContentFile file removes the content file 'file' from the
documentation available by default
-docPath path sets the Qt documentation root path to
'path' and starts assistant
-hideSidebar assistant will hide the sidebar.
-resourceDir assistant will load translations from
this directory.
-help shows this help.

wysota
21st March 2007, 10:53
Two first options are important. The first one loads a specified file and the other turns assistant into a server which you can send commands to, including the thing you want to achieve. Unfortunately I haven't seen the command list anywhere in the docs, so you'd have to look into the sources.

Edit: Ok, looks like the command name is the page name you wish to open.

mderdem
21st March 2007, 12:53
Thanks wysota. Obviously the command doc and (in my case) a small executable which can talk to assistant is missing.

I looked into building a small app which uses the QAssistantClient. but it doesn't seem trivial . Unfortunately I have got real work to do :(

wysota
21st March 2007, 13:04
Why not trivial? I think it should be quite simple.

mderdem
21st March 2007, 17:35
The QAssistantClient::showPage method is asking for a html page filepath. All I need is to get assistant to show the page for say QWidget.

wysota
21st March 2007, 20:58
I don't see a problem...

mderdem
22nd March 2007, 10:35
Let me help you :) There are two problems right now:

1. Getting assistant to get to the right page, showPage needs an html file path, like:

ac.showPage( qtdir + "/doc/html/" + phrase.toLower() + ".html" );

This means getting assistant locating a phrase like "setClipping" is not possible. Index searching can not be done remotely

2. Everytime a new QAssistantClient is created, a new assistant process is forked. Not really cool. :mad:

wysota
22nd March 2007, 11:38
1. Getting assistant to get to the right page, showPage needs an html file path, like:

ac.showPage( qtdir + "/doc/html/" + phrase.toLower() + ".html" );

This means getting assistant locating a phrase like "setClipping" is not possible. Index searching can not be done remotely

If you want to search by method name, you can do one of two things:
a) locate assistant's index file and do the search yourself there
or
b) use CTags or a simmilar method to build your own index file and then you can quickly find the proper class for a method and ask assistant to fetch it.


2. Everytime a new QAssistantClient is created, a new assistant process is forked. Not really cool. :mad:
So don't start a new QAssistantClient but instead reuse the old one.

mderdem
22nd March 2007, 12:27
Thanks for the ideas. Obviously you are not bounded by the time limitations I suffer from.

What you offer is certainly doable. But the purpose is to reuse the assistant and it's features. It would be easier to write a macro in my editor which does a grep and prepares a list of html files and let's me pick one of them. :cool: