File indexing completed on 2024-04-28 04:21:21
0001 // SPDX-FileCopyrightText: 2009-2010 Jesper K. Pedersen <blackie@kde.org> 0002 // SPDX-FileCopyrightText: 2020 Miika Turkia <miika.turkia@gmail.com> 0003 // 0004 // SPDX-License-Identifier: LicenseRef-KDE-Accepted-GPL 0005 0006 // krazy:skip 0007 /** 0008 \namespace ThumbnailView 0009 \brief The classes in this namespace makes up the thumbnail window 0010 0011 The Thumbnail Viewer was in the old days implemented entirely by ourself 0012 using QGridView (from Qt3). In the summer of 2010 it was rewritten to use 0013 Qt's model/view framework. 0014 0015 The widget used \ref ThumbnailWidget is a subclass of QListView. The 0016 class \ref ThumbnailModel is a subclass of QAbstractListModel, and the 0017 painting code is in the class Delegate, which is a subclass of 0018 QItemDelegate. 0019 0020 <h2>Base structure and API</h2> 0021 The only class that should be seen from the outside is the class \ref 0022 ThumbnailFacade. This class has delegates for the methods on the various 0023 object that the outside need to know. Please be careful not to expose 0024 anything, except though this class. 0025 0026 The thumbnail viewer was likely one of the very first pieces of code that 0027 was written in KPhotoAlbum, and consequently also one of the pieces of 0028 code that just grew larger and larger organically. During a large 0029 refactoring session in July 2009, this was cleaned up, but a number of 0030 objects are still very tightly connected. 0031 0032 To avoid that all these classes needed to be set up with pointers to each 0033 other, a factory (\ref ThumbnailFactory) was created, from which any of 0034 these object could get to the other. To avoid outside 0035 objects to misuse this factory to get to the objects, they were explicit 0036 constructed with the factory by the object who owned the pointers to all of 0037 the participants, namely \ref ThumbnailFacade, and as the \ref 0038 ThumbnailFactory only is an interface, it would not help the outside in. 0039 0040 To ease the jump between the involved objects, and to make it more 0041 explicit which objects participated, and what they accessed from each 0042 other, they all inherited from \ref ThumbnailComponent which offers 0043 methods like \ref ThumbnailComponent::model(), \ref 0044 ThumbnailComponent::widget() etc. 0045 0046 The core part of this module consist of these classes: 0047 \li \ref ThumbnailFacade - The API for the other modules in KPhotoAlbum. 0048 \li \ref ThumbnailWidget - This is the widget that are put into the main 0049 windows gui. 0050 \li \ref ThumbnailModel - This is the underlying model of the 0051 widget. Here you will find methods to access and alter the 0052 stack, the list of images etc. This is also the actual implementation of 0053 Qt's QAbstractListModel. 0054 \li \ref Delegate - Here are all the code for painting the 0055 items in the widget. It is a subclass of QAbstractItemDelegate. 0056 \li \ref CellGeometry - This is where you will find the logic for 0057 calculating the sizes of cells, the text height etc. 0058 0059 <h2>Thumbnail Handling</h2> 0060 \li \ref ThumbnailRequest - When the browser recognizes that it needs a 0061 thumbnail, it will ask the \ref ImageManager to create one. This could of 0062 course result in a huge amount of requests that are pending but never 0063 needed anyway, in the case where the user presses page down to scroll by 0064 lots of pages. To solve that problem, the \ref ImageManager can ask the 0065 request if it is still needed, at the time when it is about to load the 0066 thumbnail in question. To implement this, we need to subclass 0067 \ref ImageManager::ImageRequest - that's exactly what this class is about. 0068 0069 0070 \li \ref ImageManager::ThumbnailBuilder - It is possible from the menus to ask the 0071 application to rebuild all its thumnails on disk. This class will do that 0072 for us. 0073 0074 <h2>Mouse Interaction</h2> 0075 \li \ref MouseInteraction The logic behind mouse gestures are slightly 0076 complicated, and has been the root of a lot of trouble in the past of 0077 KPhotoAlbum. Therefore the mouse handling has been split into a number of 0078 classes on their own. Mouse events are delegated from the \ref 0079 ThumbnailWidget to these classes. The super class for these sub classes 0080 are \ref MouseInteraction. 0081 0082 \li \ref MouseTrackingInteraction - This is by far the simplest of all of the 0083 interaction classes, it is in action when no mouse button are down, and 0084 takes care of updating the status bar with information about which 0085 thumbnail the cursor is over. 0086 0087 \li \ref SelectionInteraction - This interaction used to take care of all 0088 mouse interaction when the widget was one we had implemented 0089 ourself. These days it only takes care of detecting a drag and drop operation. 0090 0091 \li \ref GridResizeInteraction - This interaction is active when the user is 0092 resizing the grid. It is active when the middle mouse button has been 0093 pressed down. 0094 0095 \li \ref ThumbnailDND - Reordering images is done using the drag and drop 0096 mechanism of Qt. The implementation of these event handlers are done in 0097 this class. 0098 0099 <h2>Keyboard Interaction</h2> 0100 \li Keyboard event handlers are implemented in \ref KeyboardEventHandler. 0101 0102 <h2>Tooltips</h2> 0103 \li \ref ThumbnailToolTip - In the thumbnail viewer, it is possible to show 0104 some tooltips which shows details about the thumbnail the cursor is on 0105 top of. This is implemented using this class. 0106 0107 **/ 0108 // vi:expandtab:tabstop=4 shiftwidth=4: