The issue of synchronizing the two views of the document structure (list of xml:ids and tree view) is holding me up to a degree which is not commensurate with its importance. It's extremely complicated, because in fact the two views do not ultimately inherit from the same data source (the id list is constructed by parsing the document into a QStringList), so formally correct approaches to synchronizing selection using identification of equivalent QModelIndexes by tracing back to the source data won't fly, so some ad-hoc solution is going to be required. And in any case, it's by no means crucial that the two views stay in sync, at least initially. So I'm going to move on to the next stage, which will enable me to get some more code-writing experience in QT, and return to this issue at a much later stage.
The next stage is to plan the class structure that underlies the data model, by reviewing our previous plans, and starting from MJ's zone-defining code.
I'm currently re-reading all the material about model/view architecture in QT to figure out how best to approach the synchronization of two views which have two underlying models (one tree, one string list), and where the synchronization code should live (in the code for the dialog box holding the view controls, or in the HcmcImtDoc class). An added complication is that the QSortFilterProxyModel which is currently filtering the list view by regexp currently lives in the dialog box code, but I think it should almost certainly move to the HcmcImtDoc class.
Fixed the duplicate item bug in the string list filter, and fixed an unused parameter issue in the constructor of HcmcImtDoc. Also spent a bit of time narrowing down an error message when running the application: CRITICAL **: atk_object_set_name: assertion `name != NULL' failed. This turns out to be a bug in GTK/Gnome, which is Ubuntu's problem, not QT's. If you run the app with "-style windows" you don't see it. It doesn't affect anything.
The next task is to figure out how to hook together selections between the two views of the document (the tree view and the xml:id list), so that if you select something in one view, it gets selected in the other. I suspect this will be something like:
Went back to square one and created a new QSortFilterProxyModel to filter the list of xml:ids coming from the HcmcImtDoc object. This has solved the problem; I now have a working regular expression filter in the GUI, which can be used to select items in the list.
A new problem has emerged, though: each xml:id in the list is duplicated. This is not caused by the new filter; if I change back to the original unfiltered behaviour, I still get two of each item in the list. So this is due to what looks like duplicated code in HcmcImtDoc, which I think ended up in there when I was making changes to allow switching on and off of namespace-awareness. Shouldn't be hard to fix.
Did a QT update, but the issue still remains: "source_parent was not valid", in either filterAcceptsRow or filterAcceptsColumn of HcmcIdFilter. I'll probably need to re-read all the documentation on QSortFilterProxyModel...
Still working unsuccessfully on the QSortFilterProxyModel problem, but I've now discovered that a bug in that class was fixed in QT 4.6.2, so it may be solved by an update which I'll do tomorrow.
Added bool properties for namespace awareness in the HcmcImtDoc and DlgXmlIndex classes, so we don't have to decide right now which approach is best for our purposes. These are set in the constructor, but there's also a setter to change them later.
Tested two approaches to handling XML documents, one of which is namespace-aware and the other which is not. Both have advantages and disadvantages, so it's not yet clear which approach we should take for IMT. I need to make this switchable at the level of DlgXmlIndex and HcmcImtDoc, via public properties.
SA and I have decided that an effective way for Half-Baked to prepare for writing Hot Potatoes 7 would be to sponsor the development of the Image Markup Tool version 2, allowing us to develop a set of core libraries and functions, as well as gaining familiarity with the issues involved in compiling and releasing for different platforms. We also intend to use IMT 2 for creating end-user documentation in HotPot 7.
For this reason, Half-Baked will pay SA and myself to work on the development of IMT, and this work will be tracked in the "Half-Baked Contributions" post category, as well as in the "Activity Log" category.
I've started the process this morning by checking out the project and confirming I can build the DocModel subproject.
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.
|<< <||> >>|