Phase 1 of the GSoC is now over and I’m happy to say that a lot of work has been managed to be done by now. Given the uncertainity surrounding my exams due to the pandemic we are facing, I began my work early in the month of may. All the milestones for the first period( and more so) has been completed.
My mentors Florian and Armin have been of great help and have helped me overcome every issue I’ve faced, as well as provided interesting and useful information as GSoC is at it’s core a great learning experience for us students. The community has also been helpful and interactive and helped me implement the features in the desired way and provided insight on what the users of LibreCAD would require.
Shifting of GUI from Lua to C++
MainWindow class has been added which has responsibilty of managing and initialization of the GUI. Toolbar, CliCommand and Layers classes have been updated to reflect the new changes.
All the lua scripts from lcUILua/ui which were responsible for the GUI initialization have been removed and all their functionality has been shifted to the C++ classes.
Thanks to Florian’s idea of operation loading, the lua tools are now loaded automatically by the C++ code. The lua scripts define properties according to which the appropriate menu item, toolbar button and command is created for that particular tool.
This has made it easy to add lua tools without requiring to change the code in any of the other files.
Lua GUI API
The Lua GUI API has been added. Menu, MenuItem, ToolbarTab, ToolbarGroup, ToolbarButton have been added, and the MainWindow, CliCommand and Layers classes have been updated to add all the required lua gui api functions.
Mutiple callbacks, positioning of menu items, easy addition of commands to the commandline and other functionality have been added thanks to the addition of this api.
Removal of QtBridge
With the addition of the lua gui api, the qt bridge is no longer necessary and has been replaced with the lua bridge. Knowledge of qt is no longer required for using gui related functions and operations in the lua plugins.
Dialog Widget Lua GUI API
Lua GUI API has been extended to include many dialog widget classes that make it easy to create and use GUI widgets in lua plugins. The following classes have been added :-
DialogWidget , AngleGUI, ColorGUI, EntityGUI, ButtonGUI, ComboBox GUI, InputGUI, HorizontalGroupGUI, SliderGUI, TextGUI, NumberGUI, RadioButtonGUI, RadioGroupGUI, CoordinateGUI, CheckBoxGUI.
Unit Tests :-
Unit tests have been added for all the work done above.
Customizable Toolbar :-
Customizable toolbar has been added which allows the user to easily customize the toolbar buttons and groups into their desired order. The order is saved so the next time the user opens LibreCAD, the toolbar buttons are in the same order.
The order of buttons can be stored and imported in xml format, as well as a default order is available.
Benefits to the user :-
So what do you the user, benefit from the work done so far?
- Lua plugins are easier to write, GUI related code can be written without requiring any knowledge of the Qt Framework, GUI can be easily manipulated.
- Tool operations can be easily added without needing to change the code in any other part of the project.
- Parts of the user documentation like the lua tools can be automatically generated thanks to the addition of the properties.
- Dialog Widget API provides lots of easy to use GUI elements that can be used in the lua plugins to provide more interaction through the plugins without writing a lot of code.
- Toolbar buttons can be ordered in the user’s desired way so that users can access the most frequently used tools easily.
- The toolbar ordering is exported and imported in xml so can be easily transferred between different computers.
It’s been a lot of fun so far and I look forward to working on more things on the next two coding periods.
Thanks for reading!