annotate widgets/LayerTree.h @ 1534:bfd8b22fd67c

Fix #1904 Scrolling colour 3d plot does not always work when in View normalisation mode. We shouldn't imagine we've just invalidated the cache if the truth is that we've only just created the renderer
author Chris Cannam
date Wed, 09 Oct 2019 13:45:17 +0100
parents 0769eaacc6bf
children
rev   line source
Chris@43 1
Chris@58 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@43 3
Chris@43 4 /*
Chris@59 5 Sonic Visualiser
Chris@59 6 An audio file viewer and annotation editor.
Chris@59 7 Centre for Digital Music, Queen Mary, University of London.
Chris@59 8 This file copyright 2006 Chris Cannam.
Chris@43 9
Chris@59 10 This program is free software; you can redistribute it and/or
Chris@59 11 modify it under the terms of the GNU General Public License as
Chris@59 12 published by the Free Software Foundation; either version 2 of the
Chris@59 13 License, or (at your option) any later version. See the file
Chris@59 14 COPYING included with this distribution for more information.
Chris@43 15 */
Chris@43 16
Chris@1407 17 #ifndef SV_LAYER_TREE_H
Chris@1407 18 #define SV_LAYER_TREE_H
Chris@43 19
Chris@43 20 #include <QAbstractItemModel>
Chris@43 21
Chris@1477 22 #include "data/model/Model.h"
Chris@1477 23
Chris@336 24 #include <set>
Chris@336 25
Chris@43 26 class PaneStack;
Chris@56 27 class View;
Chris@336 28 class Pane;
Chris@56 29 class Layer;
Chris@298 30 class PropertyContainer;
Chris@336 31
Chris@392 32 class ModelMetadataModel : public QAbstractItemModel
Chris@336 33 {
Chris@336 34 Q_OBJECT
Chris@336 35
Chris@336 36 public:
Chris@392 37 ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0);
Chris@392 38 virtual ~ModelMetadataModel();
Chris@336 39
Chris@1406 40 QVariant data(const QModelIndex &index, int role) const override;
Chris@336 41
Chris@1406 42 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
Chris@336 43
Chris@1406 44 Qt::ItemFlags flags(const QModelIndex &index) const override;
Chris@336 45
Chris@336 46 QVariant headerData(int section, Qt::Orientation orientation,
Chris@1406 47 int role = Qt::DisplayRole) const override;
Chris@336 48
Chris@336 49 QModelIndex index(int row, int column,
Chris@1406 50 const QModelIndex &parent = QModelIndex()) const override;
Chris@336 51
Chris@1406 52 QModelIndex parent(const QModelIndex &index) const override;
Chris@336 53
Chris@1406 54 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Chris@1406 55 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
Chris@336 56
Chris@336 57 protected slots:
Chris@336 58 void paneAdded();
Chris@336 59 void paneDeleted();
Chris@336 60 void propertyContainerAdded(PropertyContainer *);
Chris@336 61 void propertyContainerRemoved(PropertyContainer *);
Chris@336 62 void propertyContainerSelected(PropertyContainer *);
Chris@336 63 void propertyContainerPropertyChanged(PropertyContainer *);
Chris@336 64 void playParametersAudibilityChanged(bool);
Chris@336 65 void paneLayerModelChanged();
Chris@336 66 void rebuildModelSet();
Chris@336 67
Chris@336 68 protected:
Chris@336 69 PaneStack *m_stack;
Chris@336 70 bool m_waveModelsOnly;
Chris@336 71 int m_modelTypeColumn;
Chris@336 72 int m_modelNameColumn;
Chris@336 73 int m_modelMakerColumn;
Chris@336 74 int m_modelSourceColumn;
Chris@336 75 int m_columnCount;
Chris@336 76
Chris@1477 77 std::set<ModelId> m_models;
Chris@336 78 };
Chris@43 79
Chris@43 80 class LayerTreeModel : public QAbstractItemModel
Chris@43 81 {
Chris@43 82 Q_OBJECT
Chris@43 83
Chris@43 84 public:
Chris@43 85 LayerTreeModel(PaneStack *stack, QObject *parent = 0);
Chris@43 86 virtual ~LayerTreeModel();
Chris@43 87
Chris@1406 88 QVariant data(const QModelIndex &index, int role) const override;
Chris@43 89
Chris@1406 90 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
Chris@298 91
Chris@1406 92 Qt::ItemFlags flags(const QModelIndex &index) const override;
Chris@43 93
Chris@56 94 QVariant headerData(int section, Qt::Orientation orientation,
Chris@1406 95 int role = Qt::DisplayRole) const override;
Chris@43 96
Chris@43 97 QModelIndex index(int row, int column,
Chris@1406 98 const QModelIndex &parent = QModelIndex()) const override;
Chris@43 99
Chris@1406 100 QModelIndex parent(const QModelIndex &index) const override;
Chris@43 101
Chris@1406 102 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Chris@1406 103 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
Chris@43 104
Chris@298 105 protected slots:
Chris@336 106 void paneAdded();
Chris@336 107 void paneAboutToBeDeleted(Pane *);
Chris@298 108 void propertyContainerAdded(PropertyContainer *);
Chris@298 109 void propertyContainerRemoved(PropertyContainer *);
Chris@298 110 void propertyContainerSelected(PropertyContainer *);
Chris@298 111 void propertyContainerPropertyChanged(PropertyContainer *);
Chris@336 112 void paneLayerModelChanged();
Chris@298 113 void playParametersAudibilityChanged(bool);
Chris@336 114
Chris@336 115 protected:
Chris@336 116 PaneStack *m_stack;
Chris@336 117 std::set<QObject *> m_deletedPanes;
Chris@336 118 int m_layerNameColumn;
Chris@336 119 int m_layerVisibleColumn;
Chris@336 120 int m_layerPlayedColumn;
Chris@336 121 int m_modelNameColumn;
Chris@336 122 int m_columnCount;
Chris@43 123 };
Chris@43 124
Chris@43 125 #endif