// Copyright (C) 2009 by Arnaud Dupuis // a.dupuis@infinityperl.org // http://www.infinityperl.org // // 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 3 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; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA #ifndef ASSUMA_UPDATEDELEGATE #define ASSUMA_UPDATEDELEGATE #include <QItemDelegate> /*! \class AssumaUpdateDelegate * \brief A delegate class to modify behaviour of items in QListWidget. * * This delegate class allow items from various item views to display HTML formatted text. * By HTML please understand the Qt supported HTML subset. */ class AssumaUpdateDialog; class AssumaUpdateDelegate : public QItemDelegate { Q_OBJECT public: enum Roles { DescriptionRole = Qt::UserRole + 20, VersionRole = Qt::UserRole + 21, NameRole = Qt::UserRole + 22, TagRole = Qt::UserRole + 23, UpdateReasonRole = Qt::UserRole + 24, UpdateReasonTypeRole = Qt::UserRole + 25, CriticityRole = Qt::UserRole + 26, FileRole = Qt::UserRole + 27, ChecksumRole = Qt::UserRole + 28, OSRole = Qt::UserRole + 29, OSDistributionRole = Qt::UserRole + 30, OSDistributionCheckFileRole = Qt::UserRole + 31, ProgressRole = Qt::UserRole + 32, ProgressTextRole = Qt::UserRole + 33, ProgressMinRole = Qt::UserRole + 34, ProgressMaxRole = Qt::UserRole + 35, DownloadSpeed = Qt::UserRole + 36, DownloadSpeedUnit = Qt::UserRole + 37, }; //! Constructor /*! Construct a new delegate. Usually, you should never call this directly, use <itemview_object>->setItemDelegate() instead. \param parent the parent object. */ AssumaUpdateDelegate( QObject *parent = 0 ); /*! Paint the delegate. This method is inheritated from QItemDelegate (the default delegate) and once again you are not supposed to call it by yourself. */ void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; /*! Returns the item (delegate) size hint. \return item size hint (optimal size). */ QSize sizeHint ( const QStyleOptionViewItem &, const QModelIndex & ) const ; //void drawDecoration ( QPainter * , const QStyleOptionViewItem & , const QRect & , const QPixmap & ) const; }; #endif