2004-11-21 14:55:42 +00:00
|
|
|
/* This file is part of the KDE projects
|
|
|
|
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
|
2005-07-28 14:59:42 +00:00
|
|
|
Copyright (C) 2000, 2001, 2002 David Faure <faure@kde.org>
|
2004-11-21 14:55:42 +00:00
|
|
|
Copyright (C) 2004 Martin Koller <m.koller@surfeu.at>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
2005-10-05 08:44:32 +00:00
|
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2005-07-04 19:02:09 +00:00
|
|
|
Boston, MA 02110-1301, USA.
|
2004-11-21 14:55:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KONQ_FILETIP_H
|
|
|
|
#define KONQ_FILETIP_H
|
|
|
|
|
2007-07-14 22:40:00 +00:00
|
|
|
#include <QtGui/QPixmap>
|
|
|
|
#include <QtGui/QLabel>
|
|
|
|
#include <QtGui/QResizeEvent>
|
2004-11-21 14:55:42 +00:00
|
|
|
#include <kio/previewjob.h>
|
|
|
|
|
2004-11-21 21:17:30 +00:00
|
|
|
#include <libkonq_export.h>
|
|
|
|
|
2004-11-21 14:55:42 +00:00
|
|
|
class KFileItem;
|
|
|
|
class QLabel;
|
2007-10-02 09:55:31 +00:00
|
|
|
class QScrollArea;
|
2004-11-21 14:55:42 +00:00
|
|
|
class QTimer;
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
2007-10-02 09:55:31 +00:00
|
|
|
class LIBKONQ_EXPORT KonqFileTip : public QFrame
|
2004-11-21 14:55:42 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2007-10-02 09:55:31 +00:00
|
|
|
KonqFileTip( QScrollArea *parent );
|
2004-11-21 14:55:42 +00:00
|
|
|
~KonqFileTip();
|
|
|
|
|
|
|
|
void setPreview(bool on);
|
|
|
|
|
|
|
|
/**
|
|
|
|
@param on show tooltip at all
|
|
|
|
@param preview include file preview in tooltip
|
|
|
|
@param num the number of tooltip texts to get from KFileItem
|
|
|
|
*/
|
|
|
|
void setOptions( bool on, bool preview, int num );
|
|
|
|
|
|
|
|
/** Set the item from which to get the tip information
|
|
|
|
@param item the item from which to get the tip information
|
|
|
|
@param rect the rectangle around which the tip will be shown
|
|
|
|
@param pixmap the pixmap to be shown. If 0, no pixmap is shown
|
|
|
|
*/
|
2007-10-01 08:00:48 +00:00
|
|
|
void setItem( const KFileItem &item, const QRect &rect = QRect(),
|
2004-11-21 14:55:42 +00:00
|
|
|
const QPixmap *pixmap = 0 );
|
|
|
|
|
|
|
|
virtual bool eventFilter( QObject *, QEvent *e );
|
|
|
|
|
|
|
|
protected:
|
2007-10-02 09:55:31 +00:00
|
|
|
virtual void paintEvent( QPaintEvent *ev );
|
2004-11-21 14:55:42 +00:00
|
|
|
virtual void resizeEvent( QResizeEvent * );
|
|
|
|
|
2006-01-20 11:09:06 +00:00
|
|
|
private Q_SLOTS:
|
2007-04-30 08:31:55 +00:00
|
|
|
void gotPreview( const KFileItem&, const QPixmap& );
|
2004-11-21 14:55:42 +00:00
|
|
|
void gotPreviewResult();
|
|
|
|
|
|
|
|
void startDelayed();
|
|
|
|
void showTip();
|
|
|
|
void hideTip();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setFilter( bool enable );
|
|
|
|
|
|
|
|
void reposition();
|
|
|
|
|
|
|
|
QLabel* m_iconLabel;
|
|
|
|
QLabel* m_textLabel;
|
|
|
|
bool m_on : 1;
|
|
|
|
bool m_preview : 1; // shall the preview icon be shown
|
|
|
|
bool m_filter : 1;
|
|
|
|
QPixmap m_corners[4];
|
|
|
|
int m_corner;
|
|
|
|
int m_num;
|
2007-10-02 09:55:31 +00:00
|
|
|
QScrollArea* m_view;
|
2007-10-01 08:00:48 +00:00
|
|
|
KFileItem m_item;
|
2004-11-21 14:55:42 +00:00
|
|
|
KIO::PreviewJob* m_previewJob;
|
|
|
|
QRect m_rect;
|
|
|
|
QTimer* m_timer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|