Chris@43: Chris@58: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@43: Chris@43: /* Chris@59: Sonic Visualiser Chris@59: An audio file viewer and annotation editor. Chris@59: Centre for Digital Music, Queen Mary, University of London. Chris@59: This file copyright 2006 Chris Cannam. Chris@43: Chris@59: This program is free software; you can redistribute it and/or Chris@59: modify it under the terms of the GNU General Public License as Chris@59: published by the Free Software Foundation; either version 2 of the Chris@59: License, or (at your option) any later version. See the file Chris@59: COPYING included with this distribution for more information. Chris@43: */ Chris@43: Chris@43: #ifndef _LAYER_TREE_H_ Chris@43: #define _LAYER_TREE_H_ Chris@43: Chris@43: #include Chris@43: Chris@374: #include Chris@374: Chris@43: class PaneStack; Chris@56: class View; Chris@374: class Pane; Chris@56: class Layer; Chris@298: class PropertyContainer; Chris@374: class Model; Chris@374: Chris@374: class ModelDataModel : public QAbstractItemModel Chris@374: { Chris@374: Q_OBJECT Chris@374: Chris@374: public: Chris@374: ModelDataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0); Chris@374: virtual ~ModelDataModel(); Chris@374: Chris@374: QVariant data(const QModelIndex &index, int role) const; Chris@374: Chris@374: bool setData(const QModelIndex &index, const QVariant &value, int role); Chris@374: Chris@374: Qt::ItemFlags flags(const QModelIndex &index) const; Chris@374: Chris@374: QVariant headerData(int section, Qt::Orientation orientation, Chris@374: int role = Qt::DisplayRole) const; Chris@374: Chris@374: QModelIndex index(int row, int column, Chris@374: const QModelIndex &parent = QModelIndex()) const; Chris@374: Chris@374: QModelIndex parent(const QModelIndex &index) const; Chris@374: Chris@374: int rowCount(const QModelIndex &parent = QModelIndex()) const; Chris@374: int columnCount(const QModelIndex &parent = QModelIndex()) const; Chris@374: Chris@374: protected slots: Chris@374: void paneAdded(); Chris@374: void paneDeleted(); Chris@374: void propertyContainerAdded(PropertyContainer *); Chris@374: void propertyContainerRemoved(PropertyContainer *); Chris@374: void propertyContainerSelected(PropertyContainer *); Chris@374: void propertyContainerPropertyChanged(PropertyContainer *); Chris@374: void playParametersAudibilityChanged(bool); Chris@374: void paneLayerModelChanged(); Chris@374: void rebuildModelSet(); Chris@374: Chris@374: protected: Chris@374: PaneStack *m_stack; Chris@374: bool m_waveModelsOnly; Chris@374: int m_modelTypeColumn; Chris@374: int m_modelNameColumn; Chris@374: int m_modelMakerColumn; Chris@374: int m_modelSourceColumn; Chris@374: int m_columnCount; Chris@374: Chris@374: std::set m_models; Chris@374: }; Chris@43: Chris@43: class LayerTreeModel : public QAbstractItemModel Chris@43: { Chris@43: Q_OBJECT Chris@43: Chris@43: public: Chris@43: LayerTreeModel(PaneStack *stack, QObject *parent = 0); Chris@43: virtual ~LayerTreeModel(); Chris@43: Chris@43: QVariant data(const QModelIndex &index, int role) const; Chris@43: Chris@298: bool setData(const QModelIndex &index, const QVariant &value, int role); Chris@298: Chris@56: Qt::ItemFlags flags(const QModelIndex &index) const; Chris@43: Chris@56: QVariant headerData(int section, Qt::Orientation orientation, Chris@56: int role = Qt::DisplayRole) const; Chris@43: Chris@43: QModelIndex index(int row, int column, Chris@43: const QModelIndex &parent = QModelIndex()) const; Chris@43: Chris@43: QModelIndex parent(const QModelIndex &index) const; Chris@43: Chris@43: int rowCount(const QModelIndex &parent = QModelIndex()) const; Chris@43: int columnCount(const QModelIndex &parent = QModelIndex()) const; Chris@43: Chris@298: protected slots: Chris@374: void paneAdded(); Chris@374: void paneAboutToBeDeleted(Pane *); Chris@298: void propertyContainerAdded(PropertyContainer *); Chris@298: void propertyContainerRemoved(PropertyContainer *); Chris@298: void propertyContainerSelected(PropertyContainer *); Chris@298: void propertyContainerPropertyChanged(PropertyContainer *); Chris@374: void paneLayerModelChanged(); Chris@298: void playParametersAudibilityChanged(bool); Chris@374: Chris@374: protected: Chris@374: PaneStack *m_stack; Chris@374: std::set m_deletedPanes; Chris@374: int m_layerNameColumn; Chris@374: int m_layerVisibleColumn; Chris@374: int m_layerPlayedColumn; Chris@374: int m_modelNameColumn; Chris@374: int m_columnCount; Chris@43: }; Chris@43: Chris@43: #endif