ThumbnailView Namespace Reference
The classes in this namespace makes up the thumbnail window.
More...
Detailed Description
The classes in this namespace makes up the thumbnail window.
Design Decisions
Base structure and API
The only class that should be seen from the outside is the class ThumbnailFacade. This class has delegates for the methods on the various object that the outside need to know. Please be careful not to expose anything, except though this class.
The thumbnail viewer was likely one of the very first pieces of code that was written in KPhotoAlbum, and consequently also one of the pieces of code that just grew larger and larger organically. During a large refactoring session in July 2009, this was cleaned up, but a number of objects are still very tightly connected, namely the widget itself (ThumbnailWidget), its painting code (ThumbnailPainter), its data model (ThumbnailModel), and its event handlers.
To avoid that all these classes needed to be set up with pointers to each other, a factory (ThumbnailFactory) was created, from which any of these object could get to the other. To avoid outside objects to misuse this factory to get to the objects, they were explicit constructed with the factory by the object who owned the pointers to all of the participants, namely ThumbnailFacade, and as the ThumbnailFactory only is an interface, it would not help the outside in.
To ease the jump between the involved objects, and to make it more explicit which objects participated, and what they accessed from each other, they all inherited from ThumbnailComponent which offers methods like ThumbnailComponent::model(), ThumbnailComponent::widget() etc.
The core part of this module consist of these classes:
- ThumbnailFacade - The API for the other modules in KPhotoAlbum.
- ThumbnailWidget - This is the widget that are put into the main windows gui.
- ThumbnailModel - This is the underlying model of the widget. Here you will find methods to access and alter the selection, the stack, the list of images etc.
- ThumbnailPainter - Here are all the code for painting the widget.
- CellGeometry - This is where you will find the logic for calculating the sizes of cells, the text height etc.
- Cell - This is a simple class with a (row,column) content.
Thumbnail Handling
- ThumbnailRequest - When the browser recognizes that it needs a thumbnail, it will ask the ImageManager to create one. This could of course result in a huge amount of requests that are pending but never needed anyway, in the case where the user presses page down to scroll by lots of pages. To solve that problem, the ImageManager can ask the request if it is still needed, at the time when it is about to load the thumbnail in question. To implement this, we need to subclass ImageManager::ImageRequest - that's exactly what this class is about.
- ThumbnailCache - To make the scrolling as smooth as possible, this class will try to preheat a cache of thumbnails that we expect would be needed at the next scroll action.
- ThumbnailBuilder - It is possible from the menus to ask the application to rebuild all its thumnails on disk. This class will do that for us.
Mouse Interaction
- MouseInteraction The logic behind mouse gestures are slightly complicated, and has been the root of a lot of trouble in the past of KPhotoAlbum. Therefore the mouse handling has been split into a number of classes on their own. Mouse events are delegated from the ThumbnailWidget to these classes. The super class for these sub classes are MouseInteraction.
- MouseTrackingInteraction - This is by far the simplest of all of the interaction classes, it is in action when no mouse button are down, and takes care of updating the status bar with information about which thumbnail the cursor is over.
- SelectionInteraction - This interaction takes care of selecting items in the thumbnail view, it is active when the left mouse button has been pressed down, and is dragged over items.
- GridResizeInteraction - This interaction is active when the user is resizing the grid. It is active when the middle mouse button has been pressed down.
- ThumbnailDND - Reordering images is done using the drag and drop mechanism of Qt. The implementation of these event handlers are done in this class.
Keyboard Interaction
Tooltips
- ThumbnailToolTip - In the thumbanil viewer, it is possible to show some tooltips which shows details about the thumbnail the cursor is on top of. This is implemented using this class.
Typedef Documentation
Enumeration Type Documentation
- Enumerator:
-
| ViewportCoordinates |
|
| ContentsCoordinates |
|
- Enumerator:
-
| FullyVisible |
|
| PartlyVisible |
|