Saturday, December 8, 2012

GUI Preparation

The 0.2 development series is going to conclude with the program displaying its about box and then exiting.  The GUI elements will be added in the 0.3 development series.  Before adding the about box, some modifications to existing classes are needed, which will occur over the next set of commits.  But first, this is probably a good time to create the v0.2-6 tag as there have been 11 commits since the last development tag.

The base GUI is already present in the program, which was added by default when the main window class was created by new class wizard in QtCreator.  This GUI only contains a blank menu bar, tool bar and status bar.  If it was activated, the only thing present beside the window title (with the normal minimize, maximum, close, etc. icons) would a blank window with an empty tool bar that can be docked (more on this later) on any of the four sides of the window.

However, the program is not currently activating this window because it exits with a usage message if no options were present on the command line.  The command line and tester classes need some minor modifications before the about box can be implemented, which will contain information that will be obtained from the command line class (version, GPL statement, etc.).

[commit 6f55c2ffae]

Table Initialization – Revisited

The Table class was modified to be singleton class (see November 14).  This implementation was modified.  To be consistent with the Token class, which is initialized with a static initialize() function, the Table class create() function was renamed to initialize() and changed to return nothing instead of a list of errors.

The old initialize() function, a normal private member function, was renamed to setupAndCheck() and still returns a list of errors.  Two new static functions were added to access the error list: hasErrors() to report if there were any errors detected and errorList() to return the list of errors.  Both fatally abort the program if the initialize function was not called.  The initialize function stores the error list returned by setupAndCheck() into a new static error list member variable.

The two static members, one for the pointer to the single instance and the other for the error list are now prefixed with 's_' instead of 'm_' to denote a static member as opposed to a regular member variable.  The static member variables to the Token class were also renamed with the 's_' prefix.

The new initialize function also checks if either the instance pointer is not null or if the error list is not empty to determine if the table instance was previously created or at least attempted.  When an error is found, the instance is deleted, so the instance pointer alone can't be used to determine if the instance creation was attempted.  Similarly, the new error list access functions also check if both the instance pointer is null and error list is empty to determine if there was a creation attempt.  The check for a non-empty error list was also added to the instance() access function.

The Token and Table initialize function calls were moved from the Tester run function to the main function.  This keeps the initialization in a single location.  The Tester run function still contains the check for table errors.  The error check was not moved to main because when the GUI is started, any table errors need to be reported in an error dialog box, not to the console output.  When the program is started from say an OS start menu or file browser, there is no console for these errors and the program will inexplicably fail to start.  Now work on the GUI can begin...

[commit 5c5da1f069]  [commit e0474f5144]

Standard Error Output - Oops

My job took me away from this project the past week.  In making the next set of changes, I discovered that the last commit did not compile.  During the development of the standard error output changes, the coutClose() function (which closes the current channel if open) was originally named cclose().  At the last moment, this was renamed to the more appropriate coutClose(), but in the haste to get the code committed, the code was not compiled and retested.

It has been recent policy recently make sure every commit pushed to the repository compile and test successfully, at least on the development platform (Linux).  Any problems with testing would be noted in the commit message.  The last commit failed this policy and I apologize (and worst, it went for a week in this state).

When a development tag is added, it is validated to compile and test successfully on both the Linux and Windows platform (specifically XP, though it should work on 7 also).  Again any problems are noted in the commit message.  For an actual release however, it will also be tested on the Windows 7 platform (and there should be no test issues).

[commit 4ffed94ea2]