~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to stage/part/tools/animationtool/KPrCollectionItemModel.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
 * Copyright (C) 2012 Paul Mendez <paulestebanms@gmail.com>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Library General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library 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 GNU
 
12
 * Library General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Library General Public License
 
15
 * along with this library; see the file COPYING.LIB.  If not, write to
 
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 * Boston, MA 02110-1301, USA.
 
18
 */
 
19
 
 
20
// Heavily based in CollectionItemModel work of Peter Simonsson <peter.simonsson@gmail.com>
 
21
 
 
22
#ifndef KPRCOLLECTIONITEMMODEL_H
 
23
#define KPRCOLLECTIONITEMMODEL_H
 
24
 
 
25
#include <QAbstractItemModel>
 
26
#include <QList>
 
27
#include <QString>
 
28
#include <QIcon>
 
29
#include <KoXmlReader.h>
 
30
 
 
31
/**
 
32
 * Struct containing the information stored in CollectionItemModel item
 
33
 */
 
34
struct KPrCollectionItem
 
35
{
 
36
    QString id;                     //animation id
 
37
    QString name;                   //animation name (text to be displayed on animations view)
 
38
    QString toolTip;                // text of animation tool tip
 
39
    QIcon icon;                     // icon of the animation type
 
40
    KoXmlElement animationContext;  //xml data used to instantiate animations of this type
 
41
};
 
42
 
 
43
/** Model used to store predefined animations data */
 
44
class KPrCollectionItemModel : public QAbstractListModel
 
45
{
 
46
    Q_OBJECT
 
47
public:
 
48
    KPrCollectionItemModel(QObject* parent = 0);
 
49
 
 
50
    virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
 
51
    virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
 
52
    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
 
53
 
 
54
    /**
 
55
     * @brief Set the list of KoCollectionItem to be stored in the model
 
56
     *
 
57
     * @param List of KPrCollectionItem
 
58
     */
 
59
    void setAnimationClassList(const QList<KPrCollectionItem> &newlist);
 
60
 
 
61
    QList<KPrCollectionItem> animationClassList() const {return m_animationClassList;}
 
62
 
 
63
    /**
 
64
     * @brief Return the xml context for the animation on index
 
65
     *
 
66
     * @param index of the animation
 
67
     */
 
68
    KoXmlElement animationContext(const QModelIndex &index) const;
 
69
 
 
70
private:
 
71
    QList<KPrCollectionItem> m_animationClassList;
 
72
    QString m_family;
 
73
};
 
74
#endif // KPRCOLLECTIONITEMMODEL_H