Began fleshing out the ImtLinkSet class, after some trouble deciding whether to base it off QAbstractTableModel or QStandardItemModel, and whether to keep the links in a QMap or QHash (chose the former in both cases). It compiles, but doesn't have enough functionality for testing yet.
I'm still unsure about QMap; it may be that a simple QList with some lookup functions would be way better in the end.
After some experimentation, I realized my link setup was far too complicated, so I've thrown it away and started again, based on what I've learned from my home project. I've now rewritten ImtLink, and all links will be handled by a single ImtLinkSet class which will descend from QAbstractTableModel (not yet started). The end result should be much simpler, and easier to plug into the GUI.
One thing I've learned from my home project GVT is that your core data model really should descend from an QT abstract model, and not anything else, so I've started converting the top-level link-handling class, ImtLinkGrpSet, to a descendant of QAbstractTableModel. This involves re-implementing inherited functions from ImtElement, and implementing the core virtual functions from the table model. It's about half done, with one outstanding difficulty.
Interview with MT to complete a questionnaire from which she'll build a wireframe model. This was useful, and helped me to clarify a couple of ideas I haven't been sure about. I'm going to detail them here while they're fresh in my mind:
A couple of bugfixes and enhancements have been made to the Image Markup Tool, resulting in the release of version 1.8.1.9. These are the changes:
The new version is available from the IMT website.
Did some work on the old IMT to create a new release, adding a feature for MB:
<graphic> tag pointing to it, either just by file name or by relative path.The latter two fix some annoyances that have been bugging me for a while. Also updated the documentation date, and sent the package out to MB for testing.
Started adding some doxygen documentation to the code for the XML editor. This is a way of getting back into the project after a few weeks break.
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.
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."
The version information data is crucial for completing the <teiHeader> in a useful way, and I've been puzzling over how best to do it in an automated way. Following hints from this post: http://qtcreator.blogspot.com/2009/10/generating-automatic-version-numbers.html, I've written a bash script that creates a version.h header file, which provides all the key versioning info I'll want to include. Below is the script at the moment (it will probably get a bit more complicated later). I'll also want to figure out how to include the same info into a resource file in order to embed the correct versioning info into Windows builds, based on this post: http://stackoverflow.com/questions/2784697/setting-application-info-in-qt. I run the script automatically when doing a build, to get an up-to-date version.h file. This is done using a Custom Build Step in the Build Settings panel of QT (in "Projects").
#!/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)
#This is the file we're dealing with.
outfile="version.h"
#Remove the old file.
rm $outfile
#Do an SVN commit to update the revision number.
svn commit --message "Committing before an application build."
#Get the SVN revision number into a variable.
svnrev=`svnversion`
#echo the info into the output file.
#echo $svnrev>>$outfile
#echo $major"."$minor"."$build"."$svnrev>>$outfile
echo "#ifndef VERSION_H">>$outfile
echo "#define VERSION_H">>$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 "}">>$outfile
echo "inline const char* versionString(){return "$'\042'$major"."$minor"."$date"."$svnrev$'\042'"};">>$outfile
echo "">>$outfile
echo "">>$outfile
echo "">>$outfile
echo "#endif // VERSION_H">>$outfile
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.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| << < | > >> | |||||
| 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 | |