Saturday, June 9, 2012

The power of built-in debugging and introspection

I've recently started reading the excellent "Code Complete" by Steve McConnell and - as is often the case when you encounter a good book - got inspired by some of its ideas. I was particularly enlightened by the idea of implementing advanced built-in debugging/introspection capabilities, only available if application was compiled with DEBUG flag.
I found this idea very interesting for QComicBook - it would be very cool to be able to check internal state of some more sophisticated widgets when debugging issues. QComicBook has fairly detailed tracing (if you compile it with -DCMAKE_BUILD_TYPE=Debug flag), but it's not very useful in debugging subtle issues (such as with drawing) as it simply produces too much text output to analyse.
So, I started hacking it today. For starters I picked the most troublesome widget in QComicBook - ContinuousPageView, responsible for continuous view mode. This widget still has some minor issues that show up under specific circumstances, and they are very hard to debug. I implemented a simple Debug window, available via Debug > Continuous View menu option; it displays frames for all pages, showing their sizes, position on the QGraphicsScene and internal state. And it didn't take long as I spotted first potential problem: when rotation is applied, some sizes manifested by QGraphicsItem interface (blue boxes) don't match numbers used internally to handle continuous view logic; this seems to affect pages that use estimated sizes only (i.e. not loaded yet).
I'm not sure yet if this can cause real problems, but certainly it looks suspicious. It also definitely shows the potential of built-in debugging tools and I'm going to add some more to QComicBook in the future. Frame View mode, job subsystem, memory usage are just a few top candidates for live introspection. Having them at hand, it will hopefully be much easier to prepare a rock solid QComicBook 1.0.0 :)

Tuesday, June 5, 2012

QComicBook UI cleanup, quest for icons

As a part of the preparations for QComicBook 1.0.0 (yeah, it should eventually come - it's been 7 years already!) I've started working on UI cleanup. The goal is to make it simple and ditch some useless actions (is anyone using Page top/Page bottom or '5 pages forward'??); target #1 is to clean up the toolbar. Another goal is to make QComicBook UI look like the rest of the desktop, i.e. use system theme icons.
Much to my delight I discovered that Qt supports standard desktop icons (be it GNOME, KDE, XFCE...) from version 4.6! This works well and I was able to quickly test it by replacing some icons with themed icons using Qt Designer. Unsurprisingly there are some icons that just don't exist in standard themes. For most menu actions it's OK to just get rid of them, but toolbar actions must have icons... That means 'Two pages mode', 'Manga mode' and 'Fit to width', 'Fit to height' and alike as a minimum (see first screenshot). Unfortunately existing QComicBook icons stand out too much from pretty much any desktop theme and I need to find or create replacements for them. Suggestions, ideas or contributions anyone?

Saturday, June 2, 2012

QComicBook 0.9.0 is available

This release have seen a lot of delays, but it's finally available. It brings two notable internal changes:
  • switch to Qt GraphicsView framework, leading to more lightweight and flexible page handling implementation. This opens up more possibilities for future tweaks and enhancements.
  • more robust image transformation code resulting in dramatic improvement in responsiveness and performance whenever you scale main window, rotate a page etc; this kind of operations are now performed in a separate thread. If you ever considered QComicBook to be a bit sluggish, give it another chance again and try version 0.9.0!
As usual, latest QComicBook releases can be found on it's home site.