On Tue, Sep 17, 2013 at 8:08 PM, Guillaume Chéreau <
guillaume.cher...@gmail.com> wrote:

> (Sorry, I send the email again because I forgot to put a subject.  Please
> don't reply to my previous message.)
>
> Hello all!
>
> I started to work on an experimental branch to try to get ride of all
> QAction dependencies in the core of stellarium.  This is something that
> we could eventually merge in the simplegles-qml branch (the Qt5 branch).
>
> The rational to remove QAction is that in Qt5 they are not part of
> QtCore, but QtWidget, and they don't interact well with qml.
>
> List of changes (sorry for the long mail):
>
> - There is a new class StelAction, that behaves like a qt QAction, with
>   the ability to handle secondary shortcuts.  This class replaces the
>   current use of QAction and StelShortcut.
>

QAction had separate slots and signals for "state changed, by the program
or by the user" and "state changed specifically by the user". (See
http://qt-project.org/doc/qt-4.8/qaction.html ) Does your code do the same
thing?


> - All the StelAction are registered and connected by modules during
>   initialization.  This is different from the current code where the
>   actions are first created from the default_shortcut.json file, and then
>   connected to the proper QObject slot during the gui and plugins
>   initialization.
>

I agree with the "registered by the modules part". For a number of reasons,
I dislike the current  implementation, but I haven't had the time to do
anything about it. See below.

- To simplify the code, I added a method of StelModule that creates a new
>   StelAction and automatically connects it to an object slot or property.
>   The interesting thing is that using Qt class introspection, we can
>   directly decide if the action is checkable or not.  Plus, when an
>   action is linked to a Qt property that defines a signal handler, the
>   change in the property will automatically change the state of the
>   StelAction.  I think this has the potential to fix a few tricky issues
>   with the synchronisation of GUI buttons and module states.
>

I agree that such tricky situations are a problem, but I'm not sure if any
"automatic" approach won't cause similar problems. I need to look at your
code, but I won't be able to run it because of the OpenGL part. :)


> - StelAction are identified by the action id only, and not by the group
>   id as it is currently the case.  The group id is now only used to sort
>   the actions in the shortcut editor.  This makes the code much simpler,
>   the drawback is that we have to ensure that all actions have unique
>   names, but that can be enforced at runtime.
>
> - This is not implemented yet, but I am thinking of replacing the json
>   file to store the redefined shortcut, by a much simpler ini file (or
>   even just as a '[shortcuts'] usection in config.ini).  It could simply
>   be a list of <action-name> =
>   <new-key-sequence><new-secondary-key-sequence>.
>

I like JSON, but I'll leave the dispute about formats to you and Timothy
Reaves. :)

What I would like is to have only the key sequences that are different from
the defaults to be saved to a file. (So there's no default keyboard
shortcuts file.) The current system depends too much in keeping strings in
sync across multiple files, which is inconvenient and prone to errors.

In all cases, I think that the action descriptions shouldn't be kept in the
file. By the way, does your code handle dynamic translation of the action
descriptions? (I.e. what happens to the descriptions when the language is
changed at runtime?)

- I am also thinking of giving each script a default action name (for
>   example "actionScript/landscapes.ssc"), that way we can also redefine
>   their shortcut shortcuts in the .ini file with the same syntax.
>

There are a lot of scripts included in the default package. I'm not sure if
this won't clutter the key sequence definition window, but this is a
relatively minor problem. :) How are you going to handle scripts in
subdirectories?

Regards,
Bogdan Marinov
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Stellarium-pubdevel mailing list
Stellarium-pubdevel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel

Reply via email to