~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/grass/qgsgrassmodel.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
                              qgsgrasstree.h 
 
2
                              qgsgrasstree.h
3
3
                             -------------------
4
4
    begin                : February, 2006
5
5
    copyright            : (C) 2006 by Radim Blazek
16
16
#ifndef QGSGRASSMODEL_H
17
17
#define QGSGRASSMODEL_H
18
18
 
19
 
class QCloseEvent;
20
 
class QString;
21
 
class QDomNode;
22
 
class QDomElement;
23
 
class QModelIndex;
24
 
class QVariant;
25
 
 
26
 
#include <QTreeWidget>
27
19
#include <QAbstractItemModel>
28
20
#include <QIcon>
29
21
 
35
27
 */
36
28
class QgsGrassModel: public QAbstractItemModel
37
29
{
38
 
    Q_OBJECT;
 
30
    Q_OBJECT
39
31
 
40
 
public:
 
32
  public:
41
33
    //! Constructor
42
 
    QgsGrassModel ( QObject * parent = 0 );
 
34
    QgsGrassModel( QObject * parent = 0 );
43
35
    //! Destructor
44
36
    ~QgsGrassModel();
45
37
 
46
38
    //! Item types
47
39
    enum ItemType { None, Gisbase, Location, Mapset, Rasters, Vectors, Raster,
48
 
                Vector, VectorLayer, Regions, Region };
 
40
                    Vector, VectorLayer, Regions, Region
 
41
                };
49
42
 
50
43
    //! Set GISBASE and LOCATION_NAME
51
 
    void setLocation ( const QString &gisbase, const QString &location );
 
44
    void setLocation( const QString &gisbase, const QString &location );
52
45
 
53
46
    // Refresh populated node
54
47
    void refresh();
55
 
    
 
48
 
56
49
    // Refresh item
57
 
    void refreshItem(QgsGrassModelItem *item) ;
 
50
    void refreshItem( QgsGrassModelItem *item ) ;
58
51
 
59
52
    // Remove items missing in the list
60
 
    void removeItems ( QgsGrassModelItem *item, QStringList list ) ;
61
 
    
 
53
    void removeItems( QgsGrassModelItem *item, QStringList list ) ;
 
54
 
62
55
    // Add items missing in children
63
 
    void addItems ( QgsGrassModelItem *item, QStringList list, int type ) ;
 
56
    void addItems( QgsGrassModelItem *item, QStringList list, int type ) ;
64
57
 
65
58
    //! Item type
66
 
    int itemType(const QModelIndex &index) const;
67
 
    
68
 
    //! Item URI if it is a map 
69
 
    QString uri(const QModelIndex &index) const;
70
 
 
71
 
    // Index 
72
 
    QModelIndex index ( QgsGrassModelItem *item ) ;
 
59
    int itemType( const QModelIndex &index ) const;
 
60
 
 
61
    //! Item URI if it is a map
 
62
    QString uri( const QModelIndex &index ) const;
 
63
 
 
64
    // Index
 
65
    QModelIndex index( QgsGrassModelItem *item ) ;
73
66
 
74
67
    // Name
75
 
    QString itemName(const QModelIndex &index);
 
68
    QString itemName( const QModelIndex &index );
76
69
 
77
70
    // Item mapset (raster and vector)
78
 
    QString itemMapset(const QModelIndex &index);
 
71
    QString itemMapset( const QModelIndex &index );
79
72
 
80
73
    // Item map (raster and vector)
81
 
    QString itemMap(const QModelIndex &index);
 
74
    QString itemMap( const QModelIndex &index );
82
75
 
83
76
    // Get info in HTML format
84
 
    QString itemInfo(const QModelIndex &index);
85
 
 
86
 
    // Reimplemented QAbstractItemModel methods 
87
 
    QModelIndex index ( int row, int column, 
88
 
               const QModelIndex & parent = QModelIndex() ) const;
89
 
 
90
 
    QModelIndex parent ( const QModelIndex & index ) const;
91
 
 
92
 
    int rowCount ( const QModelIndex & parent ) const;
93
 
 
94
 
    int columnCount ( const QModelIndex & parent ) const;
95
 
 
96
 
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
97
 
 
98
 
    QVariant headerData(int section, Qt::Orientation orientation,
99
 
                           int role = Qt::DisplayRole) const;
100
 
    Qt::ItemFlags flags(const QModelIndex &index) const;
101
 
 
102
 
private:
 
77
    QString itemInfo( const QModelIndex &index );
 
78
 
 
79
    // Reimplemented QAbstractItemModel methods
 
80
    QModelIndex index( int row, int column,
 
81
                       const QModelIndex & parent = QModelIndex() ) const;
 
82
 
 
83
    QModelIndex parent( const QModelIndex & index ) const;
 
84
 
 
85
    int rowCount( const QModelIndex & parent ) const;
 
86
 
 
87
    int columnCount( const QModelIndex & parent ) const;
 
88
 
 
89
    QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
 
90
 
 
91
    QVariant headerData( int section, Qt::Orientation orientation,
 
92
                         int role = Qt::DisplayRole ) const;
 
93
    Qt::ItemFlags flags( const QModelIndex &index ) const;
 
94
 
 
95
  private:
103
96
    //! Current GISBASE
104
97
    QString mGisbase;
105
98
 
107
100
    QString mLocation;
108
101
 
109
102
    //! Root node for current location
110
 
    QgsGrassModelItem *mRoot; 
 
103
    QgsGrassModelItem *mRoot;
111
104
 
112
105
    //! Icons
113
106
    QIcon mIconDirectory;