Sunday, December 9, 2012

GUI Preparation – Version String

One of the items needed in the About box is the version string.  Two minor changes were made to the CommandLine class so that it can provide the version string.  The previous version() function was renamed to isVersionOption() to mirror the name of the isHelpOption() function.

A new version() function was added to access the version string.  The version string is accessed from the ibcp_RELEASE_STRING definition contained in the CMake generated ibcp_config.h header file (from ibcp_config.h.in).  CMake gets the release string from either git (if the repository is present) or from variables set in the CMakeLists.txt file.  The actual version string starts at the seventh character of release string, which skips over the "release" part of the string.

An include statement could be added to whichever source file needs the release string, but keeping the include in a single source file and providing access functions to its values allows this to be updated in the future without having to change a bunch of other source files.  This also applies to the copyright year value.  The CommandLine class also provides access to the program name.

[commit 5431b8f9b4]

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)