Archives for: December 2010

03/12/10

Permalink 11:24:52 am, by mholmes, 33 words, 246 views   English (CA)
Categories: Activity log; Mins. worked: 60

Created splash logo image and about box

Created a logo image (which may change, of course), and an About box class based on QDialog which retrieves application title and version information from the auto-generated version.h file, and displays it.

01/12/10

Permalink 02:28:09 pm, by mholmes, 888 words, 193 views   English (CA)
Categories: Activity log; Mins. worked: 150

Finished and tested appVersion.sh

This is now working well, and seems to be pretty solid; I've tested it in the context of the application itself, and it returns the right values. It can also compare another version number to determine whether it's older, newer or identical. I'm still not exactly clear on how I'll integrate this with compilation on other platforms. I've added version.sh to SVN, and the other platforms could just check out and use it (turning off the pre-compilation step that generates it); however, if version.sh is in SVN, we have the slight paradox that every compile will result in a new commit, because version.sh will be renewed each time and will therefore end up being committed. Maybe that's not a bad thing, actually; that has the effect of incrementing the SVN revision number for every build that's done, making the SVN revision work similarly to a build number. I've modified the script a bit so that it does a commit first, to update any other changed files; then it builds version.h; then it commits the rebuilt version.h right at the end. That means the committed version.h will always be one version behind the actual SVN version, but that's no bad thing unless we end up editing code on the other platforms, which I'm hoping will not happen.

#!/bin/bash

#Major version number (unlikely to change).
major=2

#Minor version number is changeable, but done manually.
minor=0

#Build number is yyyymmdd from today.
date=$(date +%Y%m%d)
dateDashed=$(date +%Y-%m-%d)
dateSeconds=$(date +%s)

#This is the file we're dealing with.
outfile="version.h"

#Do an SVN update, then commit to update the revision number.
svn update
svn commit --message "Committing any changed files before generating version.h for an application build."

#Empty the file.
echo "">$outfile

#Get the SVN revision number into a variable, and parse out the last version number.
svnrev=`svnversion | sed -e 's/.*://' -e 's/[A-Z]*$//'`

#echo the info into the output file.
#echo $svnrev>>$outfile
#echo $major"."$minor"."$build"."$svnrev>>$outfile

echo "//This is an auto-generated file, created at build time as part of a Custom Build Step.">>$outfile
echo "//Do not edit this file directly. It is generated from the bash script appversion.sh.">>$outfile
echo "#ifndef VERSION_H">>$outfile
echo "#define VERSION_H">>$outfile
echo "">>$outfile
echo "">>$outfile
echo "#include <QString>">>$outfile
echo "#include <QStringList>">>$outfile

echo "">>$outfile
echo "namespace Version">>$outfile
echo "{">>$outfile
echo "const int MAJOR = "$major";">>$outfile
echo "const int MINOR = "$minor";">>$outfile
echo "const int DATE = "$date";">>$outfile
echo "const int REVISION = "$svnrev";">>$outfile

echo "inline const char* strVersion(){return "$'\042'$major"."$minor"."$date"."$svnrev$'\042'";}">>$outfile
echo "inline const char* strVersionMajor(){return "$'\042'$major$'\042'";}">>$outfile
echo "inline const char* strVersionMinor(){return "$'\042'$minor$'\042'";}">>$outfile
echo "inline const char* strVersionDate(){return "$'\042'$dateDashed$'\042'";}">>$outfile
echo "inline const char* strVersionRevision(){return "$'\042'$svnrev$'\042'";}">>$outfile
echo "inline int intVersionMajor(){return $major;}">>$outfile
echo "inline int intVersionMinor(){return $minor;}">>$outfile
echo "inline int intVersionDate(){return $dateSeconds;}">>$outfile
echo "inline int intVersionRevision(){return $svnrev;}">>$outfile
echo "inline int versionComparedWithThis(QString &candidateVersion){">>$outfile
echo "//This returns -1 if the candidate version is older, 0 if it's the same, and 1 if it's newer.">>$outfile
echo -e "\t bool ok;">>$outfile
echo -e "\t QStringList verList = candidateVersion.split("$'\042'"."$'\042'");">>$outfile
echo -e "\t if (verList.count() < 1) return -1;">>$outfile
echo -e "\t int candMajor = verList.at(0).toInt(&ok, 10);">>$outfile
echo -e "\t if (candMajor < "$major") return -1;">>$outfile
echo -e "\t if (candMajor > "$major") return 1;">>$outfile
echo -e "\t if (verList.count() < 2) return -1;">>$outfile
echo -e "\t int candMinor = verList.at(1).toInt(&ok, 10);">>$outfile
echo -e "\t if (candMinor < "$minor") return -1;">>$outfile
echo -e "\t if (candMinor > "$minor") return 1;">>$outfile
echo -e "\t if (verList.count() < 3) return -1;">>$outfile
echo -e "\t int candDate = verList.at(2).toInt(&ok, 10);">>$outfile
echo -e "\t if (candDate < "$date") return -1;">>$outfile
echo -e "\t if (candDate > "$date") return 1;">>$outfile
echo -e "\t if (verList.count() < 4) return -1;">>$outfile
echo -e "\t int candRevision = verList.at(3).toInt(&ok, 10);">>$outfile
echo -e "\t if (candRevision < "$svnrev") return -1;">>$outfile
echo -e "\t if (candRevision > "$svnrev") return 1;">>$outfile
echo -e "\t return 0;">>$outfile
echo -e "\t">>$outfile
echo -e "\t">>$outfile
echo -e "\t">>$outfile
echo "}">>$outfile

echo "">>$outfile
echo "}">>$outfile

echo "">>$outfile
echo "">>$outfile
echo "#endif // VERSION_H">>$outfile

svn commit --message "Committing modified version.h before an application build."


Image Markup Tool blog

The Image Markup Tool is a Windows application for annotating images, using TEI XML as its data format. Our aim is to produce a tool which creates conformant TEI P5 XML files, but which has a simple enough interface that it can be used by people with little or no experience in editing XML code.

Reports

December 2010
Sun Mon Tue Wed Thu Fri Sat
 << < Current> >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

XML Feeds