Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/channeldocker/channelmodel.h
Show All 13 Lines | |||||
14 | * along with this program; if not, write to the Free Software | 14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #ifndef CHANNELMODEL_H | 18 | #ifndef CHANNELMODEL_H | ||
19 | #define CHANNELMODEL_H | 19 | #define CHANNELMODEL_H | ||
20 | 20 | | |||
21 | #include <QModelIndex> | 21 | #include <QModelIndex> | ||
22 | #include <QSize> | ||||
23 | #include <kis_types.h> | ||||
22 | 24 | | |||
23 | class KoColorSpace; | 25 | class KoColorSpace; | ||
24 | 26 | class KisCanvas2; | |||
25 | #include <kis_types.h> | | |||
26 | 27 | | |||
27 | class ChannelModel : public QAbstractTableModel | 28 | class ChannelModel : public QAbstractTableModel | ||
28 | { | 29 | { | ||
29 | Q_OBJECT | 30 | Q_OBJECT | ||
30 | public: | 31 | public: | ||
31 | ChannelModel(QObject* parent = 0); | 32 | ChannelModel(QObject* parent = 0); | ||
32 | virtual ~ChannelModel(); | 33 | virtual ~ChannelModel(); | ||
33 | 34 | | |||
34 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; | 35 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; | ||
35 | virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; | 36 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; | ||
36 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; | 37 | int rowCount(const QModelIndex& parent = QModelIndex()) const; | ||
37 | virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; | 38 | int columnCount(const QModelIndex& parent = QModelIndex()) const; | ||
38 | virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); | 39 | bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); | ||
39 | virtual Qt::ItemFlags flags(const QModelIndex& index) const; | 40 | Qt::ItemFlags flags(const QModelIndex& index) const; | ||
41 | void unsetCanvas( void ); | ||||
42 | | ||||
43 | //set maximum size of the thumbnail image. This should be set based on screen resolution, etc. | ||||
44 | void setThumbnailSizeLimit(QSize size); | ||||
40 | 45 | | |||
41 | public Q_SLOTS: | 46 | public Q_SLOTS: | ||
42 | void slotLayerActivated(KisLayerSP layer); | 47 | void slotSetCanvas(KisCanvas2* canvas); | ||
43 | void slotColorSpaceChanged(const KoColorSpace *colorSpace); | 48 | void slotColorSpaceChanged(const KoColorSpace *colorSpace); | ||
49 | void updateData(KisCanvas2 *canvas); | ||||
50 | void rowActivated(const QModelIndex &index); | ||||
51 | | ||||
44 | Q_SIGNALS: | 52 | Q_SIGNALS: | ||
45 | void channelFlagsChanged(); | 53 | void channelFlagsChanged(); | ||
54 | | ||||
55 | private: | ||||
56 | void updateThumbnails(); | ||||
57 | | ||||
46 | private: | 58 | private: | ||
47 | KisLayerWSP m_currentLayer; | 59 | KisCanvas2* m_canvas; | ||
60 | QVector<QImage> m_thumbnails; | ||||
61 | QSize m_thumbnailSizeLimit; | ||||
62 | int m_oversampleRatio; | ||||
63 | int m_channelCount; | ||||
48 | }; | 64 | }; | ||
49 | 65 | | |||
66 | | ||||
50 | #endif // CHANNELMODEL_H | 67 | #endif // CHANNELMODEL_H |