/src/sourcetree/items/categoryitems.h

http://github.com/tomahawk-player/tomahawk · C Header · 77 lines · 42 code · 16 blank · 19 comment · 0 complexity · f9b4004b64d38f800219ad9efb360515 MD5 · raw file

  1. /*
  2. * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. #ifndef CATEGORY_ITEM_H
  19. #define CATEGORY_ITEM_H
  20. #include "SourceTreeItem.h"
  21. class CategoryAddItem : public SourceTreeItem
  22. {
  23. Q_OBJECT
  24. public:
  25. CategoryAddItem( SourcesModel* model, SourceTreeItem* parent, SourcesModel::CategoryType type );
  26. ~CategoryAddItem();
  27. virtual Qt::ItemFlags flags() const;
  28. virtual QString text() const;
  29. virtual void activate();
  30. virtual QIcon icon() const;
  31. virtual int peerSortValue() const;
  32. virtual bool willAcceptDrag(const QMimeData* data) const;
  33. virtual DropTypes supportedDropTypes(const QMimeData* data) const;
  34. virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action);
  35. private slots:
  36. void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
  37. // Do the rename only after the revision is loaded
  38. void playlistToRenameLoaded();
  39. private:
  40. SourcesModel::CategoryType m_categoryType;
  41. QIcon m_icon;
  42. };
  43. class CategoryItem : public SourceTreeItem
  44. {
  45. Q_OBJECT
  46. public:
  47. CategoryItem( SourcesModel* model, SourceTreeItem* parent, SourcesModel::CategoryType category, bool showAddItem );
  48. virtual QString text() const;
  49. virtual void activate();
  50. virtual int peerSortValue() const;
  51. virtual Qt::ItemFlags flags() const;
  52. // inserts an item at the end, but before the category add item
  53. void insertItem( SourceTreeItem* item );
  54. void insertItems( QList< SourceTreeItem* > item );
  55. SourcesModel::CategoryType categoryType();
  56. private:
  57. SourcesModel::CategoryType m_category;
  58. CategoryAddItem* m_addItem;
  59. bool m_showAdd;
  60. };
  61. #endif