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@336: #include Chris@336: Chris@43: class PaneStack; Chris@56: class View; Chris@336: class Pane; Chris@56: class Layer; Chris@298: class PropertyContainer; Chris@336: class Model; Chris@336: Chris@336: class ModelDataModel : public QAbstractItemModel Chris@336: { Chris@336: Q_OBJECT Chris@336: Chris@336: public: Chris@336: ModelDataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0); Chris@336: virtual ~ModelDataModel(); Chris@336: Chris@336: QVariant data(const QModelIndex &index, int role) const; Chris@336: Chris@336: bool setData(const QModelIndex &index, const QVariant &value, int role); Chris@336: Chris@336: Qt::ItemFlags flags(const QModelIndex &index) const; Chris@336: Chris@336: QVariant headerData(int section, Qt::Orientation orientation, Chris@336: int role = Qt::DisplayRole) const; Chris@336: Chris@336: QModelIndex index(int row, int column, Chris@336: const QModelIndex &parent = QModelIndex()) const; Chris@336: Chris@336: QModelIndex parent(const QModelIndex &index) const; Chris@336: Chris@336: int rowCount(const QModelIndex &parent = QModelIndex()) const; Chris@336: int columnCount(const QModelIndex &parent = QModelIndex()) const; Chris@336: Chris@336: protected slots: Chris@336: void paneAdded(); Chris@336: void paneDeleted(); Chris@336: void propertyContainerAdded(PropertyContainer *); Chris@336: void propertyContainerRemoved(PropertyContainer *); Chris@336: void propertyContainerSelected(PropertyContainer *); Chris@336: void propertyContainerPropertyChanged(PropertyContainer *); Chris@336: void playParametersAudibilityChanged(bool); Chris@336: void paneLayerModelChanged(); Chris@336: void rebuildModelSet(); Chris@336: Chris@336: protected: Chris@336: PaneStack *m_stack; Chris@336: bool m_waveModelsOnly; Chris@336: int m_modelTypeColumn; Chris@336: int m_modelNameColumn; Chris@336: int m_modelMakerColumn; Chris@336: int m_modelSourceColumn; Chris@336: int m_columnCount; Chris@336: Chris@336: std::set m_models; Chris@336: }; 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@336: void paneAdded(); Chris@336: void paneAboutToBeDeleted(Pane *); Chris@298: void propertyContainerAdded(PropertyContainer *); Chris@298: void propertyContainerRemoved(PropertyContainer *); Chris@298: void propertyContainerSelected(PropertyContainer *); Chris@298: void propertyContainerPropertyChanged(PropertyContainer *); Chris@336: void paneLayerModelChanged(); Chris@298: void playParametersAudibilityChanged(bool); Chris@336: Chris@336: protected: Chris@336: PaneStack *m_stack; Chris@336: std::set m_deletedPanes; Chris@336: int m_layerNameColumn; Chris@336: int m_layerVisibleColumn; Chris@336: int m_layerPlayedColumn; Chris@336: int m_modelNameColumn; Chris@336: int m_columnCount; Chris@43: }; Chris@43: Chris@43: #endif