PageRenderTime 182ms CodeModel.GetById 100ms app.highlight 5ms RepoModel.GetById 76ms app.codeStats 0ms

/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
19#ifndef CATEGORY_ITEM_H
20#define CATEGORY_ITEM_H
21
22#include "SourceTreeItem.h"
23
24class CategoryAddItem : public SourceTreeItem
25{
26    Q_OBJECT
27public:
28    CategoryAddItem( SourcesModel* model, SourceTreeItem* parent, SourcesModel::CategoryType type );
29    ~CategoryAddItem();
30
31    virtual Qt::ItemFlags flags() const;
32    virtual QString text() const;
33    virtual void activate();
34    virtual QIcon icon() const;
35    virtual int peerSortValue() const;
36
37    virtual bool willAcceptDrag(const QMimeData* data) const;
38    virtual DropTypes supportedDropTypes(const QMimeData* data) const;
39    virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action);
40
41private slots:
42    void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
43
44    // Do the rename only after the revision is loaded
45    void playlistToRenameLoaded();
46
47private:
48    SourcesModel::CategoryType m_categoryType;
49    QIcon m_icon;
50
51};
52
53class CategoryItem : public SourceTreeItem
54{
55    Q_OBJECT
56public:
57    CategoryItem( SourcesModel* model, SourceTreeItem* parent, SourcesModel::CategoryType category, bool showAddItem );
58
59    virtual QString text() const;
60    virtual void activate();
61    virtual int peerSortValue() const;
62    virtual Qt::ItemFlags flags() const;
63
64    // inserts an item at the end, but before the category add item
65    void insertItem( SourceTreeItem* item );
66    void insertItems( QList< SourceTreeItem* > item );
67
68    SourcesModel::CategoryType categoryType();
69
70private:
71    SourcesModel::CategoryType m_category;
72    CategoryAddItem* m_addItem;
73    bool m_showAdd;
74};
75
76
77#endif