2010-07-27 19:43:32 +00:00
|
|
|
/*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2010-07-27 19:43:32 +00:00
|
|
|
*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
2010-07-27 19:43:32 +00:00
|
|
|
*
|
2010-10-01 20:22:51 +00:00
|
|
|
* $Id$
|
2010-07-27 19:43:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QTR_TORRENT_DELEGATE_H
|
|
|
|
#define QTR_TORRENT_DELEGATE_H
|
|
|
|
|
|
|
|
#include <QItemDelegate>
|
|
|
|
#include <QSize>
|
|
|
|
|
|
|
|
class QPainter;
|
|
|
|
class QStyleOptionViewItem;
|
|
|
|
class QStyle;
|
|
|
|
class Session;
|
|
|
|
class TrackerInfo;
|
|
|
|
|
|
|
|
class TrackerDelegate: public QItemDelegate
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
TrackerDelegate( QObject * parent=0 ): QItemDelegate(parent), myShowMore(false) { }
|
|
|
|
virtual ~TrackerDelegate( ) { }
|
|
|
|
|
|
|
|
public:
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
|
|
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setShowMore( bool b );
|
|
|
|
|
|
|
|
protected:
|
2010-12-12 16:43:19 +00:00
|
|
|
QString getText( const TrackerInfo& ) const;
|
2010-07-27 19:43:32 +00:00
|
|
|
QSize margin( const QStyle& style ) const;
|
|
|
|
virtual QSize sizeHint( const QStyleOptionViewItem&, const TrackerInfo& ) const;
|
|
|
|
void drawTracker( QPainter*, const QStyleOptionViewItem&, const TrackerInfo& ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool myShowMore;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|