C++14 GUI with Interactivity (A basic RSS Reader, 4K monitor capable) 12/15/2016

The basics of an interactive RSS reader built completely from scratch using a cross-platform C language graphics library, C language embedded database library, and a C language XML library all shrouded in C++14 based application that ties it all together. The interactivity is was the final piece to pull it all together. I would have finished this yesterday, but the code I had defined that worked out-of-the-box in GCC versions 5 and earlier did not compile so well in GCC 6.2. I took it as an opportunity to make the code better. After the screenshots is the latest code that provides a rudimentary example of a software application that can run across all desktop/laptop operating system upon a foundation that can also be adapted to mobile operating systems. The best thing about this code, it is works well on a 4K monitor and I am confident that the foundation can be expanded with little effort to support 8K monitors and beyond.

Rss Reader in 4K Resolution

My basic goal is achieved. I wanted to get to the point of an interactive Rss Reader application that works across platforms and, now, renders successfully on different screens. This approach works and provides near maximum control over the solution. The approach I have pursued using the Allegro 5 Graphics Library provides a solid balance of productive and highly capable GUI definition. It is awesome!

gautierrss20161215

Writing Code in gedit

A year or so ago, gedit was a good editor for this type of task. This year, it is not so hot, but I’ve adapted to it and it does the basic functions of handling text entries. The left side shows the folder hierarchy into which I’ve placed source code, makefile, and runtime assets like fonts.

gautierrss20161215codelayout

Building the Application on the Command-line

I use the standard make build system and Alt-Tab between gedit and the terminal. The following is the latest binary listing of the executable compiled in debug mode. The other files are the fonts (courtesy of Google) and the sqlite database that is created when the program starts up. The database contains the rss feeds data (headlines, articles, and feed names). It is essentially the same application I built in 2015 but better adapted to C++14 and, in this case, GCC 6.2.

gautierrss20161215build

The C++ Code

The majority of the code is C++ conforming to the C++14 spec. I also limited dynamic memory management at the application level with solid performance. The RSS Engine in which Rss feeds are pulled from the Web, sliced and diced using libxml2 and interred into an embedded sqlite database is still largely C language based with a C++14 covering I’ve put in place. The application accesses this wrapper to present the data to the reader which then arranges to render it and respond to mouse clicks and scrolls. The latest code is shown below. Compared to the previous article, I’ve added the RSS Engine represented by gautier_rss_model.cxx/hxx as well as updates to the interactivity sequences in InteractiveRegion.cxx/hxx. RssReader.cxx/hxx was updated with code to combine the implementation in both of those solutions into an overall application.

gautier_rss_model.hxx

Defines the interface the application uses to get rss feed data.

gautier_rss_model.cxx

Rss feed data engine implementation. This code is the actual Rss logic in terms of pulling data from the Web and containing it within the software application or the attached sqlite database. Unlike the 2015 version, this was changed from a series of namespace scoped functions to functions contained in a class. This was more practical that resolving internal vs. external linkage issues. After a few hours of “tuning”, it handles the loading of data quite well. The main bug was when this area of the program did not receive the right value for the name of the database file. Once that was resolved through aligning the storage classification of the variable involved to the overall definition of the rss_model type in the main namespace, all was good.

InteractiveRegion.hxx

Defines the interface the application uses to present lines of text that can be scrolled and clicked.

InteractiveRegion.cxx

The actual interactive solution for lines of text that can be scrolled and clicked.

RssReader.hxx

Defines the interface that the operating system’s representation of the program, in main(), uses to initiate the software application.

RssReader.cxx

The actual Rss Reader solution that links together various elements to provide an overall visual and logical representation of the Rss Reader concept.

Makefile

Updated makefile to build the application sourcing in all the relevant includes and libraries

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s