However, this is not how the tr() function works. The tr() function takes a constant char pointer and translates the string. It does not accept a QString, so the scheme described above will not work. Therefore, the GPL statement was changed from a QStringList to a const char * array, and also changed from a regular member to a static member. The initialization of which was moved outside of the CommandLine constructor. The variable was also appropriately prefixed with a 's_' to represent a static member.
The first line of the GPL statement requires special handling:
"%1 Copyright (c) 2010-%2 Thunder422"Where the %1 and %2 are place holders for the program name and the current copyright year. These were previously filled in by the CommandLine constructor when the QStringList was created. This can only be done after the string is in a QString, in other words, after it has been translated (if it is going to be translated).
The Tester run function previously received the GPL statement (as a QStringList argument), which it simply output. However, since the statement is now raw character strings, it will need to fill in the first line with the program name and copyright, neither of which it had access to. These could have been added as additional arguments, but instead, the argument was changed to a CommandLine instance pointer, which has new access functions for these values. After converting the GPL line to a QString, if at the first line, the program name and copyright year are filled in.
One other minor problem in the Tester run function was discovered and corrected with the interactive testing mode. The "Testing Xxx..." string was being output before the GPL statement and it should have been after the statement and the "Table initialization successful" message.
[commit c25848a1829] [commit e27358a938]
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.)