Wednesday, 30 January 2013

Improved Calligra for Windows after Sprint Weekend

Calligra Suite has seen improvements on Windows after a few important bugs were fixed over last weekend's sprint in Magdeburg:
  • Calligra Words now has improved support for Microsoft .doc files, aligning with that available to Linux users.
  • Calligra Stage may now be used to give presentations, with support for multiple-monitors and the Presenter View, a custom display which assists the speaker by showing timer, slide notes and views of the current and next slide.
 This updated version has been packaged and is available on KO GmbH's downloads page.

Demonstrating Stage on multiple displays in Windows
The last few days Camilla and myself have been working to get Calligra running much more reliably on Windows - her experience in KDE, Calligra and general Linux development were invaluable, and being able to bring my own experience with the Windows platform and the build environments maintained by our employer were seen to be a perfect opportunity to host a sprint at KO GmbH's headquarters in Germany.

We started Friday with two big issues:
  • Microsoft .DOC import filter would load documents, but without text
  • CalligraStage would crash when the user tried to give a presentation
We started out reviewing sample documents which reflected the first issue - documents were being loaded with their structure intact (which we could see thanks to the TextDocument Inspector tool - thanks Friedrich!) but with the text missing.

Comparing stack traces helped us discover that LibreOffice and MS Word authored files were encoded slightly differently, and that the MS Word files used a format which required text to be passed through a text-converter object built on top of iconv, a text conversion library. On Windows, the iconv library used did not list the requested encoding "UNICODELITTLE" in its codepage lookup table. References to UNICODELITTLE and UNICODEBIG were replaced by UCS-2LE and UCS-2BE, which were recognised on Linux, Windows and Mac platforms. Rebuilding and opening a doc, and text!

Whilst testing the sample documents, an issue with the positioning of tables was also seen with the Windows build of the msword-odf filter only. Comparing Windows and Linux stack traces to see where the tables were being inserted into the ODT documents showed that, quite to our surprise, the Linux code didn't follow the same execution path as Windows - all tables with the Windows-built filter were being treated as floating, even those in the test document which were not. The culprit was an uninitialised "isFloating" member variable in a data structure. A default constructor and a rebuild, and they suddenly appeared where they belonged, rather than stacked all on top of each other at the start of the document!

Calligra Stage was a little more problematic owing to issues with the build environment which affected Stage, but not Calligra Words. Thankfully we managed to find a workaround that would let us focus on debugging the presentation error. Previously we'd tried to fix this problem, and it looked like an object was getting lost, yet the event for the object was being triggered correctly with a valid object. It turned out there were subtle differences to how one could work with QWidgets in the two platforms - setting our slide-view widget's parent to the QDesktopWidget worked fine in Linux, but led to an access violation error in Windows. Removing these calls in Windows, relying just on setting Fullscreen suddenly had presentations working, albeit hidden by the taskbar, and with an odd border. It was determined that the calls to resize and move the Widget after making it fullscreen were the problem. These were wrapped in a single setGeometry call and the fullscreen call moved til after this operation - now presentations worked, fullscreen and to secondary monitors. The Presenter View was fixed in a similar fashion, bringing the Calligra feature-set in Windows closer in line with that enjoyed by its Linux users.


The sprint was very rewarding, fixing the original document import issue, finding another and having time to fix a serious bug with Stage presentations, all making real progress towards making Calligra more usable on Windows.