Kraxy/EBN: missing Q_OBJECT
[kphotoalbum.git] / ThumbnailView / ThumbnailPainter.h
blobb8e995b417e00a1e37d327560e483020d7e17e71
1 /* Copyright (C) 2003-2009 Jesper K. Pedersen <blackie@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public
5 License as published by the Free Software Foundation; either
6 version 2 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
18 #ifndef THUMBNAILPAINTER_H
19 #define THUMBNAILPAINTER_H
21 #include "ThumbnailComponent.h"
22 #include "DB/ResultId.h"
23 #include <QMutex>
24 #include <QSet>
25 #include <QObject>
26 #include "ImageManager/ImageClient.h"
27 #include "enums.h"
29 class QTimer;
30 class QString;
31 class QRect;
32 class QPainter;
34 namespace ThumbnailView {
36 class ThumbnailWidget;
37 class CellGeometry;
38 class ThumbnailModel;
39 class ThumbnailFactory;
41 class ThumbnailPainter :public QObject, public ImageManager::ImageClient, private ThumbnailComponent
43 Q_OBJECT
45 public:
46 ThumbnailPainter( ThumbnailFactory* factory );
47 void paintCell ( QPainter * p, int row, int col );
48 OVERRIDE void pixmapLoaded( const QString&, const QSize& size, const QSize& fullSize, int, const QImage&, const bool loadedOK);
49 bool thumbnailStillNeeded( const QString& fileName ) const;
50 void repaint( const DB::ResultId& id );
52 private slots:
53 void slotRepaint();
55 private:
56 void paintCellPixmap( QPainter*, int row, int col );
57 void paintCellText( QPainter*, int row, int col );
58 void paintCellBackground( QPainter*, int row, int col );
59 QRect cellTextGeometry( int row, int col ) const;
60 QString thumbnailText( const DB::ResultId& mediaId ) const;
61 void paintStackedIndicator( QPainter* painter, const QRect &rect, const DB::ResultId& mediaId);
62 void paintBoundingRect( QPainter* painter, int row, int col );
63 void paintDropIndicator( QPainter* painter, int row, int col );
64 void requestThumbnail( const DB::ResultId& id );
66 private:
67 QTimer* _repaintTimer;
68 QMutex _pendingRepaintLock;
69 IdSet _pendingRepaint;
74 #endif /* THUMBNAILPAINTER_H */