svgui  1.9
LayerTree.h
Go to the documentation of this file.
00001 
00002 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00003 
00004 /*
00005     Sonic Visualiser
00006     An audio file viewer and annotation editor.
00007     Centre for Digital Music, Queen Mary, University of London.
00008     This file copyright 2006 Chris Cannam.
00009     
00010     This program is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU General Public License as
00012     published by the Free Software Foundation; either version 2 of the
00013     License, or (at your option) any later version.  See the file
00014     COPYING included with this distribution for more information.
00015 */
00016 
00017 #ifndef _LAYER_TREE_H_
00018 #define _LAYER_TREE_H_
00019 
00020 #include <QAbstractItemModel>
00021 
00022 #include <set>
00023 
00024 class PaneStack;
00025 class View;
00026 class Pane;
00027 class Layer;
00028 class PropertyContainer;
00029 class Model;
00030 
00031 class ModelMetadataModel : public QAbstractItemModel
00032 {
00033     Q_OBJECT
00034 
00035 public:
00036     ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0);
00037     virtual ~ModelMetadataModel();
00038 
00039     QVariant data(const QModelIndex &index, int role) const;
00040 
00041     bool setData(const QModelIndex &index, const QVariant &value, int role);
00042 
00043     Qt::ItemFlags flags(const QModelIndex &index) const;
00044 
00045     QVariant headerData(int section, Qt::Orientation orientation,
00046                         int role = Qt::DisplayRole) const;
00047 
00048     QModelIndex index(int row, int column,
00049                       const QModelIndex &parent = QModelIndex()) const;
00050 
00051     QModelIndex parent(const QModelIndex &index) const;
00052 
00053     int rowCount(const QModelIndex &parent = QModelIndex()) const;
00054     int columnCount(const QModelIndex &parent = QModelIndex()) const;
00055 
00056 protected slots:
00057     void paneAdded();
00058     void paneDeleted();
00059     void propertyContainerAdded(PropertyContainer *);
00060     void propertyContainerRemoved(PropertyContainer *);
00061     void propertyContainerSelected(PropertyContainer *);
00062     void propertyContainerPropertyChanged(PropertyContainer *);
00063     void playParametersAudibilityChanged(bool);
00064     void paneLayerModelChanged();
00065     void rebuildModelSet();
00066 
00067 protected:
00068     PaneStack *m_stack;
00069     bool m_waveModelsOnly;
00070     int m_modelTypeColumn;
00071     int m_modelNameColumn;
00072     int m_modelMakerColumn;
00073     int m_modelSourceColumn;
00074     int m_columnCount;
00075 
00076     std::set<Model *> m_models;
00077 };
00078 
00079 class LayerTreeModel : public QAbstractItemModel
00080 {
00081     Q_OBJECT
00082 
00083 public:
00084     LayerTreeModel(PaneStack *stack, QObject *parent = 0);
00085     virtual ~LayerTreeModel();
00086 
00087     QVariant data(const QModelIndex &index, int role) const;
00088 
00089     bool setData(const QModelIndex &index, const QVariant &value, int role);
00090 
00091     Qt::ItemFlags flags(const QModelIndex &index) const;
00092 
00093     QVariant headerData(int section, Qt::Orientation orientation,
00094                         int role = Qt::DisplayRole) const;
00095 
00096     QModelIndex index(int row, int column,
00097                       const QModelIndex &parent = QModelIndex()) const;
00098 
00099     QModelIndex parent(const QModelIndex &index) const;
00100 
00101     int rowCount(const QModelIndex &parent = QModelIndex()) const;
00102     int columnCount(const QModelIndex &parent = QModelIndex()) const;
00103 
00104 protected slots:
00105     void paneAdded();
00106     void paneAboutToBeDeleted(Pane *);
00107     void propertyContainerAdded(PropertyContainer *);
00108     void propertyContainerRemoved(PropertyContainer *);
00109     void propertyContainerSelected(PropertyContainer *);
00110     void propertyContainerPropertyChanged(PropertyContainer *);
00111     void paneLayerModelChanged();
00112     void playParametersAudibilityChanged(bool);
00113 
00114 protected:
00115     PaneStack *m_stack;
00116     std::set<QObject *> m_deletedPanes;
00117     int m_layerNameColumn;
00118     int m_layerVisibleColumn;
00119     int m_layerPlayedColumn;
00120     int m_modelNameColumn;
00121     int m_columnCount;
00122 };
00123 
00124 #endif