Qucs/qucs — pull request #11 by yodalee (2014-05-23 19:45:29+00:00)
Title: Feature54 shortcut

I try to write a version of customize shortcut.
The shortcut tab is added in Application Setting action in File menu.
This is a quite hacking version, that makes the applications more complicated, so more refactor might be needed.
******
First I implement a object keysequenceedit which is provided in qt5 but not qt4 (not to mension qt3).
It is inherited from QLineEdit that detect user input key sequence.
so user can hit Ctrl+Alt+T and the LineEdit like object will show Ctrl+Alt+T directly.
******
Second I modify the data in QucsSettings record.
Add a Group call Shortcut, which will be loaded and save into a Qmap from key to string of the shortcut.
******
Then in qucs_init.cpp, qucs.h
Add a function to set default shortcut mapping.
and a function to set shortcut from map to QAction
******
Last is the qucssettingsdialog.h qucssettingsdialog.cpp
Simply add a QTable to show the mapping relation
user can input their new setting and press "setShortcut" to set, or "removeShortcut" to clear the previous setting. Or press "reset to default" to reset all shortcut setting to default.
After user input the shortcut, it will check whether the input conflict with other shortcut setting before, and shows a warning of which is conflicted.
******
To be determined:
* The shortcut setting interface is not very easy to use, because the table layout is too small. Maybe I can write another ShortcutSettingDialog to do this work?
* The current implement is difficult to find the shortcut user want to set. Maybe I should implement a tree structure to store the shortcut, and use treeview to let user find the shortcut more easily.
For example: left subwindow shows: File, Edit, Positioning...
Click on File item, the right subwindow shows: New, NewText, Open ....
* Current implement is difficult to maintain.
If developer wanna add a new QAction, it has to first find qucs_init.cpp, add QAction at proper position, and add related setting in default setting and setShortcut function, not very convenient for developer.