/src/libtomahawk/jobview/JobStatusItem.h
C Header | 86 lines | 34 code | 16 blank | 36 comment | 0 complexity | 2d73730802c095134fed328c44edb13f MD5 | raw file
1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === 2 * 3 * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org> 4 * 5 * Tomahawk is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Tomahawk is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19#ifndef JOB_STATUS_ITEM 20#define JOB_STATUS_ITEM 21 22#include "DllMacro.h" 23 24#include <QObject> 25#include <QMetaType> 26 27class QStyledItemDelegate; 28class QPixmap; 29 30/** 31 * Implement your own JobStatusItem if you want to add some sort of job status entry in the JobStatusView. 32 * 33 * Status items have 3 columns: 34 * ________________________________ 35 * | icon | main col | right col| 36 * _________________________________ 37 * 38 * The right column may be empty. 39 * 40 */ 41class DLLEXPORT JobStatusItem : public QObject 42{ 43 Q_OBJECT 44public: 45 explicit JobStatusItem(); 46 virtual ~JobStatusItem(); 47 48 virtual QString type() const = 0; 49 virtual int weight() const { return 1; } 50 51 /// Please cache this. 52 virtual QPixmap icon() const = 0; 53 virtual QString mainText() const = 0; 54 virtual QString rightColumnText() const { return QString(); }; 55 56 virtual void activated(); 57 58 /** 59 * If collapse item is true, sending multiple items of the same type will "collapse" them into one 60 * instead of showing each individually. In this case, the right column from the item will be ignored 61 * and a count will be shown instead. 62 */ 63 virtual bool collapseItem() const; 64 virtual bool allowMultiLine() const; 65 66 virtual int concurrentJobLimit() const; 67 68 virtual bool hasCustomDelegate() const; 69 virtual void createDelegate( QObject* parent ); 70 virtual QStyledItemDelegate* customDelegate() const; 71 72 qint64 age() const { return m_createdOn; } 73signals: 74 /// Ask for an update 75 void statusChanged(); 76 77 /// Job is finished, will be deleted by the model 78 void finished(); 79 80private: 81 qint64 m_createdOn; 82}; 83 84Q_DECLARE_METATYPE( JobStatusItem* ); 85 86#endif