Open letsfindaway opened 1 week ago
Another aspect of it, in a sense, is that the name of the pages on disk need to be changed each time a scene is moved. This implies heavy operations of renaming, especially slow on a network context. Maybe the displayed name and the order of the pages could be treated from a dedicated XML file in the OpenBoard Document's folder
Another aspect of it, in a sense, is that the name of the pages on disk need to be changed each time a scene is moved. This implies heavy operations of renaming, especially slow on a network context. Maybe the displayed name and the order of the pages could be treated from a dedicated XML file in the OpenBoard Document's folder
Definitely another aspect. But yes, having some kind of "table of content" file would be great. But what to choose for the actual file names? The best case would be that it is still somehow human readable. So a UUID would be ugly. But we could collect ideas! Probably we just number them by their creation sequence.
If we provide such a file which describes the pages of a document, then I would at least like to enable its use for also storing the references of each page to the media and object files. This would enable us to definitely decide whether a given file is still referenced in the document and would finally allow to cleanup documents, just as I already tried and as also some functions in the UBForeighnObjectsHandler
are trying. See also https://github.com/letsfindaway/OpenBoard/issues/198#issuecomment-2495479802.
Instead XML I propose to use the binary CBOR format for this file, as it might be rewritten quite some times and should be as compact as possible.
CBOR is a structured, binary serialization format. See https://doc.qt.io/qt-6/cbor.html. It is part of Qt Core. For many primitive types, but also for Urls and UUIDs it provides high-speed encoding and decoding and avoids the translation of values to and from text. It is an international standard described in RFC8949.
Currently pages are just numbered. There already was a request to add a feature name pages several years ago (see issue 366) and I think this could be quite useful. Also the
UBThumbnailTextItem
has already provisions to support an arbitrary label for a page.Here some thoughts about this idea:
From the user perspective the user should be able to edit the name either in Document mode or in the Board thumbnail sidebar. Editing should be started by a double-click on the name. The label then changes to an editable field. If the user clears this field, then the page number is again used. When the user clicks outside the field, then editing is finished.
Edit: Double-click is not a good idea, as it already jumps from Document mode to Board mode. Think about better ways! What if the caption is editable by default? Let's just provide a two-line text edit field below the pixmap and use the
QTextDocument
text options to set alignment to centered!From an implementation perspective: For editing, note that
QGraphicsTextItem
already has the capability to be editable. To ease handling of the names I propose to embed the name to the image using the QImageWriter::setText() and QImageReader::text() functions. I have verified that this works for thejpg
format we're using for the thumbnails. The name is inserted asComment
in the EXIF information for the image.