/src/libtomahawk/jobview/JobStatusItem.h

http://github.com/tomahawk-player/tomahawk · 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. #ifndef JOB_STATUS_ITEM
  19. #define JOB_STATUS_ITEM
  20. #include "DllMacro.h"
  21. #include <QObject>
  22. #include <QMetaType>
  23. class QStyledItemDelegate;
  24. class QPixmap;
  25. /**
  26. * Implement your own JobStatusItem if you want to add some sort of job status entry in the JobStatusView.
  27. *
  28. * Status items have 3 columns:
  29. * ________________________________
  30. * | icon | main col | right col|
  31. * _________________________________
  32. *
  33. * The right column may be empty.
  34. *
  35. */
  36. class DLLEXPORT JobStatusItem : public QObject
  37. {
  38. Q_OBJECT
  39. public:
  40. explicit JobStatusItem();
  41. virtual ~JobStatusItem();
  42. virtual QString type() const = 0;
  43. virtual int weight() const { return 1; }
  44. /// Please cache this.
  45. virtual QPixmap icon() const = 0;
  46. virtual QString mainText() const = 0;
  47. virtual QString rightColumnText() const { return QString(); };
  48. virtual void activated();
  49. /**
  50. * If collapse item is true, sending multiple items of the same type will "collapse" them into one
  51. * instead of showing each individually. In this case, the right column from the item will be ignored
  52. * and a count will be shown instead.
  53. */
  54. virtual bool collapseItem() const;
  55. virtual bool allowMultiLine() const;
  56. virtual int concurrentJobLimit() const;
  57. virtual bool hasCustomDelegate() const;
  58. virtual void createDelegate( QObject* parent );
  59. virtual QStyledItemDelegate* customDelegate() const;
  60. qint64 age() const { return m_createdOn; }
  61. signals:
  62. /// Ask for an update
  63. void statusChanged();
  64. /// Job is finished, will be deleted by the model
  65. void finished();
  66. private:
  67. qint64 m_createdOn;
  68. };
  69. Q_DECLARE_METATYPE( JobStatusItem* );
  70. #endif