-
Notifications
You must be signed in to change notification settings - Fork 4
/
spritemodel.h
69 lines (53 loc) · 2.12 KB
/
spritemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef SPRITEMODEL_H
#define SPRITEMODEL_H
#include <QAbstractListModel>
#include <QStringList>
#include <QList>
#include "spritefile.h"
#include "picturefile.h"
#include "resourcehandler.h"
class SpriteModel : public QAbstractListModel
{
Q_OBJECT
public:
SpriteModel( QObject *parent = 0, quint8 resourceType = 0, TibiaFile *tibiaFile = 0 );
~SpriteModel( void );
void setDragMimeFormat( const QString& mimeType );
void setDropMimeFormats( const QStringList& mimeTypes );
void setItemFlags( Qt::ItemFlags flags );
void clear( void );
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
virtual Qt::ItemFlags flags( const QModelIndex& index ) const;
virtual int rowCount( const QModelIndex& parent ) const;
QMimeData *mimeData( const QModelIndexList& indexes ) const;
ResourceList getResourceList( void ) const {
return m_resourceList;
}
void setResourceList( const ResourceList& sprites );
void setSupportedDropActions( Qt::DropActions actions );
virtual Qt::DropActions supportedDropActions( void ) const;
virtual QStringList mimeTypes( void ) const;
virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex& parent );
qint32 getIndexByResource( SharedResource& obj ) const;
public slots:
void addSprite( quint8, SharedResource& obj, qint32 index = -1 );
bool removeSprite( quint8, qint32 index );
void setSprite( quint8, qint32 index, SharedResource& obj );
void addSprites( quint8, ResourceList& resources );
void removeSprites( quint8, quint32 );
signals:
void addedSprites( quint8, quint32 );
void removedSprites( quint8, quint32 );
void changedSprite( quint8, quint32 );
void decodeMimeDrop( const QMimeData *data, int row, const QModelIndex& parent );
private:
quint8 m_resourceType;
TibiaFile *m_tibiaFile;
QString m_dragMimeType;
QStringList m_dropMimeTypes;
Qt::DropActions m_dropActions;
Qt::ItemFlags m_itemFlags;
ResourceList m_resourceList;
};
Q_DECLARE_METATYPE( SharedResource )
#endif // SPRITEMODEL_H