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"
26 #include "ImageManager/ImageClient.h"
34 namespace ThumbnailView
{
36 class ThumbnailWidget
;
39 class ThumbnailFactory
;
41 class ThumbnailPainter
:public QObject
, public ImageManager::ImageClient
, private ThumbnailComponent
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
);
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
);
67 QTimer
* _repaintTimer
;
68 QMutex _pendingRepaintLock
;
69 IdSet _pendingRepaint
;
74 #endif /* THUMBNAILPAINTER_H */