Skip to content

Commit 54754f1

Browse files
author
marco
committedOct 15, 2011
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 10d81dd + fb6d551 commit 54754f1

File tree

11 files changed

+359
-233
lines changed

11 files changed

+359
-233
lines changed
 

‎src/app/qgsbrowserdockwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void QgsBrowserDockWidget::refreshModel( const QModelIndex& index )
269269
for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
270270
{
271271
QModelIndex idx = mModel->index( i, 0, index );
272-
if ( mBrowserView->isExpanded( idx ) )
272+
if ( mBrowserView->isExpanded( idx ) || !mModel->hasChildren( idx ) )
273273
{
274274
refreshModel( idx );
275275
}

‎src/browser/qgsbrowser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ void QgsBrowser::refresh( const QModelIndex& index )
531531
for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
532532
{
533533
QModelIndex idx = mModel->index( i, 0, index );
534-
if ( treeView->isExpanded( idx ) )
534+
if ( treeView->isExpanded( idx ) || !mModel->hasChildren( idx ) )
535535
{
536536
refresh( idx );
537537
}

‎src/core/qgsdataitem.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,3 +565,16 @@ void QgsDirectoryParamWidget::showHideColumn()
565565
}
566566
settings.setValue( "/dataitem/directoryHiddenColumns", lst );
567567
}
568+
569+
570+
QgsErrorItem::QgsErrorItem( QgsDataItem* parent, QString error, QString path )
571+
: QgsDataItem( QgsDataItem::Error, parent, error, path )
572+
{
573+
mIcon = QIcon( getThemePixmap( "/mIconDelete.png" ) );
574+
575+
mPopulated = true; // no more children
576+
}
577+
578+
QgsErrorItem::~QgsErrorItem()
579+
{
580+
}

‎src/core/qgsdataitem.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class CORE_EXPORT QgsDataItem : public QObject
4646
Collection,
4747
Directory,
4848
Layer,
49+
Error,
4950
};
5051

5152
QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, QString name, QString path );
@@ -225,6 +226,24 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
225226
static QVector<QLibrary*> mLibraries;
226227
};
227228

229+
/**
230+
Data item that can be used to report problems (e.g. network error)
231+
*/
232+
class CORE_EXPORT QgsErrorItem : public QgsDataItem
233+
{
234+
Q_OBJECT
235+
public:
236+
237+
QgsErrorItem( QgsDataItem* parent, QString error, QString path );
238+
~QgsErrorItem();
239+
240+
//QVector<QgsDataItem*> createChildren();
241+
//virtual bool equal( const QgsDataItem *other );
242+
};
243+
244+
245+
// ---------
246+
228247
class QgsDirectoryParamWidget : public QTreeWidget
229248
{
230249
Q_OBJECT

‎src/providers/postgres/qgspostgresdataitems.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ QVector<QgsDataItem*> QgsPGConnectionItem::createChildren()
2929
QgsDebugMsg( "mConnInfo = " + mConnInfo );
3030

3131
if ( !pgProvider->supportedLayers( mLayerProperties, true, false, false ) )
32+
{
33+
children.append( new QgsErrorItem( this, tr( "Failed to retrieve layers" ), mPath + "/error" ) );
3234
return children;
35+
}
3336

3437
QMap<QString, QVector<QgsPostgresLayerProperty> > schemasMap;
3538
foreach( QgsPostgresLayerProperty layerProperty, mLayerProperties )

‎src/providers/wfs/qgswfsdataitems.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ QVector<QgsDataItem*> QgsWFSConnectionItem::createChildren()
5757
}
5858
else
5959
{
60-
// TODO: return an "error" item
60+
layers.append( new QgsErrorItem( this, tr( "Failed to retrieve layers" ), mPath + "/error" ) );
6161
}
6262

6363
mConn->deleteLater();

‎src/providers/wms/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ SET (WMS_SRCS
33
qgswmsprovider.cpp
44
qgswmssourceselect.cpp
55
qgswmsconnection.cpp
6+
qgswmsdataitems.cpp
67
)
78
SET (WMS_MOC_HDRS
89
qgswmsprovider.h
910
qgswmssourceselect.h
1011
qgswmsconnection.h
12+
qgswmsdataitems.h
1113
)
1214

1315
QT4_WRAP_CPP (WMS_MOC_SRCS ${WMS_MOC_HDRS})

‎src/providers/wms/qgswmsdataitems.cpp

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
#include "qgswmsdataitems.h"
2+
3+
#include "qgslogger.h"
4+
5+
#include "qgswmsconnection.h"
6+
#include "qgswmssourceselect.h"
7+
8+
#include "qgsnewhttpconnection.h"
9+
10+
// ---------------------------------------------------------------------------
11+
QgsWMSConnectionItem::QgsWMSConnectionItem( QgsDataItem* parent, QString name, QString path )
12+
: QgsDataCollectionItem( parent, name, path )
13+
{
14+
}
15+
16+
QgsWMSConnectionItem::~QgsWMSConnectionItem()
17+
{
18+
}
19+
20+
QVector<QgsDataItem*> QgsWMSConnectionItem::createChildren()
21+
{
22+
QgsDebugMsg( "Entered" );
23+
QVector<QgsDataItem*> children;
24+
QgsWMSConnection connection( mName );
25+
QgsWmsProvider *wmsProvider = connection.provider( );
26+
if ( !wmsProvider )
27+
return children;
28+
29+
QString mConnInfo = connection.connectionInfo();
30+
QgsDebugMsg( "mConnInfo = " + mConnInfo );
31+
32+
// Attention: supportedLayers() gives tree leafes, not top level
33+
if ( !wmsProvider->supportedLayers( mLayerProperties ) )
34+
{
35+
children.append( new QgsErrorItem( this, tr( "Failed to retrieve layers" ), mPath + "/error" ) );
36+
return children;
37+
}
38+
39+
QgsWmsCapabilitiesProperty mCapabilitiesProperty = wmsProvider->capabilitiesProperty();
40+
QgsWmsCapabilityProperty capabilityProperty = mCapabilitiesProperty.capability;
41+
42+
// Top level layer is present max once
43+
// <element name="Capability">
44+
// <element ref="wms:Layer" minOccurs="0"/> - default maxOccurs=1
45+
QgsWmsLayerProperty topLayerProperty = capabilityProperty.layer;
46+
foreach( QgsWmsLayerProperty layerProperty, topLayerProperty.layer )
47+
{
48+
// Attention, the name may be empty
49+
QgsDebugMsg( QString::number( layerProperty.orderId ) + " " + layerProperty.name + " " + layerProperty.title );
50+
QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name;
51+
52+
QgsWMSLayerItem * layer = new QgsWMSLayerItem( this, layerProperty.title, mPath + "/" + pathName, mCapabilitiesProperty, mConnInfo, layerProperty );
53+
54+
children.append( layer );
55+
}
56+
return children;
57+
}
58+
59+
bool QgsWMSConnectionItem::equal( const QgsDataItem *other )
60+
{
61+
if ( type() != other->type() )
62+
{
63+
return false;
64+
}
65+
const QgsWMSConnectionItem *o = dynamic_cast<const QgsWMSConnectionItem *>( other );
66+
return ( mPath == o->mPath && mName == o->mName && mConnInfo == o->mConnInfo );
67+
}
68+
69+
QList<QAction*> QgsWMSConnectionItem::actions()
70+
{
71+
QList<QAction*> lst;
72+
73+
QAction* actionEdit = new QAction( tr( "Edit..." ), this );
74+
connect( actionEdit, SIGNAL( triggered() ), this, SLOT( editConnection() ) );
75+
lst.append( actionEdit );
76+
77+
QAction* actionDelete = new QAction( tr( "Delete" ), this );
78+
connect( actionDelete, SIGNAL( triggered() ), this, SLOT( deleteConnection() ) );
79+
lst.append( actionDelete );
80+
81+
return lst;
82+
}
83+
84+
void QgsWMSConnectionItem::editConnection()
85+
{
86+
QgsNewHttpConnection nc( 0, "/Qgis/connections-wms/", mName );
87+
88+
if ( nc.exec() )
89+
{
90+
// the parent should be updated
91+
mParent->refresh();
92+
}
93+
}
94+
95+
void QgsWMSConnectionItem::deleteConnection()
96+
{
97+
QgsWMSConnection::deleteConnection( mName );
98+
// the parent should be updated
99+
mParent->refresh();
100+
}
101+
102+
103+
// ---------------------------------------------------------------------------
104+
105+
QgsWMSLayerItem::QgsWMSLayerItem( QgsDataItem* parent, QString name, QString path, QgsWmsCapabilitiesProperty capabilitiesProperty, QString connInfo, QgsWmsLayerProperty layerProperty )
106+
: QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, "wms" ),
107+
mCapabilitiesProperty( capabilitiesProperty ),
108+
mConnInfo( connInfo ),
109+
mLayerProperty( layerProperty )
110+
//mProviderKey ("wms"),
111+
//mLayerType ( QgsLayerItem::Raster )
112+
{
113+
mUri = createUri();
114+
// Populate everything, it costs nothing, all info about layers is collected
115+
foreach( QgsWmsLayerProperty layerProperty, mLayerProperty.layer )
116+
{
117+
// Attention, the name may be empty
118+
QgsDebugMsg( QString::number( layerProperty.orderId ) + " " + layerProperty.name + " " + layerProperty.title );
119+
QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name;
120+
QgsWMSLayerItem * layer = new QgsWMSLayerItem( this, layerProperty.title, mPath + "/" + pathName, mCapabilitiesProperty, mConnInfo, layerProperty );
121+
mChildren.append( layer );
122+
}
123+
124+
if ( mChildren.size() == 0 )
125+
{
126+
mIcon = QIcon( getThemePixmap( "mIconWmsLayer.png" ) );
127+
}
128+
mPopulated = true;
129+
}
130+
131+
QgsWMSLayerItem::~QgsWMSLayerItem()
132+
{
133+
}
134+
135+
QString QgsWMSLayerItem::createUri()
136+
{
137+
QString uri;
138+
if ( mLayerProperty.name.isEmpty() )
139+
return uri; // layer collection
140+
141+
QString rasterLayerPath = mConnInfo;
142+
QString baseName = mLayerProperty.name;
143+
144+
// Number of styles must match number of layers
145+
QStringList layers;
146+
layers << mLayerProperty.name;
147+
QStringList styles;
148+
if ( mLayerProperty.style.size() > 0 )
149+
{
150+
styles.append( mLayerProperty.style[0].name );
151+
}
152+
else
153+
{
154+
styles << ""; // TODO: use loadDefaultStyleFlag
155+
}
156+
157+
QString format;
158+
// get first supporte by qt and server
159+
QVector<QgsWmsSupportedFormat> formats = QgsWmsProvider::supportedFormats();
160+
foreach( QgsWmsSupportedFormat f, formats )
161+
{
162+
if ( mCapabilitiesProperty.capability.request.getMap.format.indexOf( f.format ) >= 0 )
163+
{
164+
format = f.format;
165+
break;
166+
}
167+
}
168+
QString crs;
169+
// get first known if possible
170+
QgsCoordinateReferenceSystem testCrs;
171+
foreach( QString c, mLayerProperty.crs )
172+
{
173+
testCrs.createFromOgcWmsCrs( c );
174+
if ( testCrs.isValid() )
175+
{
176+
crs = c;
177+
break;
178+
}
179+
}
180+
if ( crs.isEmpty() && mLayerProperty.crs.size() > 0 )
181+
{
182+
crs = mLayerProperty.crs[0];
183+
}
184+
uri = rasterLayerPath + "|layers=" + layers.join( "," ) + "|styles=" + styles.join( "," ) + "|format=" + format + "|crs=" + crs;
185+
186+
return uri;
187+
}
188+
189+
// ---------------------------------------------------------------------------
190+
QgsWMSRootItem::QgsWMSRootItem( QgsDataItem* parent, QString name, QString path )
191+
: QgsDataCollectionItem( parent, name, path )
192+
{
193+
mIcon = QIcon( getThemePixmap( "mIconWms.png" ) );
194+
195+
populate();
196+
}
197+
198+
QgsWMSRootItem::~QgsWMSRootItem()
199+
{
200+
}
201+
202+
QVector<QgsDataItem*>QgsWMSRootItem::createChildren()
203+
{
204+
QVector<QgsDataItem*> connections;
205+
206+
foreach( QString connName, QgsWMSConnection::connectionList() )
207+
{
208+
QgsDataItem * conn = new QgsWMSConnectionItem( this, connName, mPath + "/" + connName );
209+
connections.append( conn );
210+
}
211+
return connections;
212+
}
213+
214+
QList<QAction*> QgsWMSRootItem::actions()
215+
{
216+
QList<QAction*> lst;
217+
218+
QAction* actionNew = new QAction( tr( "New..." ), this );
219+
connect( actionNew, SIGNAL( triggered() ), this, SLOT( newConnection() ) );
220+
lst.append( actionNew );
221+
222+
return lst;
223+
}
224+
225+
226+
QWidget * QgsWMSRootItem::paramWidget()
227+
{
228+
QgsWMSSourceSelect *select = new QgsWMSSourceSelect( 0, 0, true, true );
229+
connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) );
230+
return select;
231+
}
232+
void QgsWMSRootItem::connectionsChanged()
233+
{
234+
refresh();
235+
}
236+
237+
void QgsWMSRootItem::newConnection()
238+
{
239+
QgsNewHttpConnection nc( 0 );
240+
241+
if ( nc.exec() )
242+
{
243+
refresh();
244+
}
245+
}
246+
247+
248+
// ---------------------------------------------------------------------------
249+
250+
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
251+
{
252+
Q_UNUSED( thePath );
253+
254+
return new QgsWMSRootItem( parentItem, "WMS", "wms:" );
255+
}
256+

‎src/providers/wms/qgswmsdataitems.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#ifndef QGSWMSDATAITEMS_H
2+
#define QGSWMSDATAITEMS_H
3+
4+
#include "qgswmsprovider.h"
5+
6+
class QgsWMSConnectionItem : public QgsDataCollectionItem
7+
{
8+
Q_OBJECT
9+
public:
10+
QgsWMSConnectionItem( QgsDataItem* parent, QString name, QString path );
11+
~QgsWMSConnectionItem();
12+
13+
QVector<QgsDataItem*> createChildren();
14+
virtual bool equal( const QgsDataItem *other );
15+
16+
virtual QList<QAction*> actions();
17+
18+
QgsWmsCapabilitiesProperty mCapabilitiesProperty;
19+
QString mConnInfo;
20+
QVector<QgsWmsLayerProperty> mLayerProperties;
21+
22+
public slots:
23+
void editConnection();
24+
void deleteConnection();
25+
};
26+
27+
// WMS Layers may be nested, so that they may be both QgsDataCollectionItem and QgsLayerItem
28+
// We have to use QgsDataCollectionItem and support layer methods if necessary
29+
class QgsWMSLayerItem : public QgsLayerItem
30+
{
31+
Q_OBJECT
32+
public:
33+
QgsWMSLayerItem( QgsDataItem* parent, QString name, QString path,
34+
QgsWmsCapabilitiesProperty capabilitiesProperty, QString connInfo, QgsWmsLayerProperty layerProperties );
35+
~QgsWMSLayerItem();
36+
37+
QString createUri();
38+
39+
QgsWmsCapabilitiesProperty mCapabilitiesProperty;
40+
QString mConnInfo;
41+
QgsWmsLayerProperty mLayerProperty;
42+
};
43+
44+
class QgsWMSRootItem : public QgsDataCollectionItem
45+
{
46+
Q_OBJECT
47+
public:
48+
QgsWMSRootItem( QgsDataItem* parent, QString name, QString path );
49+
~QgsWMSRootItem();
50+
51+
QVector<QgsDataItem*> createChildren();
52+
53+
virtual QList<QAction*> actions();
54+
55+
virtual QWidget * paramWidget();
56+
57+
public slots:
58+
void connectionsChanged();
59+
60+
void newConnection();
61+
};
62+
63+
#endif // QGSWMSDATAITEMS_H

‎src/providers/wms/qgswmsprovider.cpp

Lines changed: 0 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,188 +3165,3 @@ QGISEXTERN int dataCapabilities()
31653165
{
31663166
return QgsDataProvider::Net;
31673167
}
3168-
// ---------------------------------------------------------------------------
3169-
QgsWMSConnectionItem::QgsWMSConnectionItem( QgsDataItem* parent, QString name, QString path )
3170-
: QgsDataCollectionItem( parent, name, path )
3171-
{
3172-
}
3173-
3174-
QgsWMSConnectionItem::~QgsWMSConnectionItem()
3175-
{
3176-
}
3177-
3178-
QVector<QgsDataItem*> QgsWMSConnectionItem::createChildren()
3179-
{
3180-
QgsDebugMsg( "Entered" );
3181-
QVector<QgsDataItem*> children;
3182-
QgsWMSConnection connection( mName );
3183-
QgsWmsProvider *wmsProvider = connection.provider( );
3184-
if ( !wmsProvider )
3185-
return children;
3186-
3187-
QString mConnInfo = connection.connectionInfo();
3188-
QgsDebugMsg( "mConnInfo = " + mConnInfo );
3189-
3190-
// Attention: supportedLayers() gives tree leafes, not top level
3191-
if ( !wmsProvider->supportedLayers( mLayerProperties ) )
3192-
return children;
3193-
3194-
QgsWmsCapabilitiesProperty mCapabilitiesProperty = wmsProvider->capabilitiesProperty();
3195-
QgsWmsCapabilityProperty capabilityProperty = mCapabilitiesProperty.capability;
3196-
3197-
// Top level layer is present max once
3198-
// <element name="Capability">
3199-
// <element ref="wms:Layer" minOccurs="0"/> - default maxOccurs=1
3200-
QgsWmsLayerProperty topLayerProperty = capabilityProperty.layer;
3201-
foreach( QgsWmsLayerProperty layerProperty, topLayerProperty.layer )
3202-
{
3203-
// Attention, the name may be empty
3204-
QgsDebugMsg( QString::number( layerProperty.orderId ) + " " + layerProperty.name + " " + layerProperty.title );
3205-
QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name;
3206-
3207-
QgsWMSLayerItem * layer = new QgsWMSLayerItem( this, layerProperty.title, mPath + "/" + pathName, mCapabilitiesProperty, mConnInfo, layerProperty );
3208-
3209-
children.append( layer );
3210-
}
3211-
return children;
3212-
}
3213-
3214-
bool QgsWMSConnectionItem::equal( const QgsDataItem *other )
3215-
{
3216-
if ( type() != other->type() )
3217-
{
3218-
return false;
3219-
}
3220-
const QgsWMSConnectionItem *o = dynamic_cast<const QgsWMSConnectionItem *>( other );
3221-
return ( mPath == o->mPath && mName == o->mName && mConnInfo == o->mConnInfo );
3222-
}
3223-
// ---------------------------------------------------------------------------
3224-
QgsWMSLayerItem::QgsWMSLayerItem( QgsDataItem* parent, QString name, QString path, QgsWmsCapabilitiesProperty capabilitiesProperty, QString connInfo, QgsWmsLayerProperty layerProperty )
3225-
: QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, "wms" ),
3226-
mCapabilitiesProperty( capabilitiesProperty ),
3227-
mConnInfo( connInfo ),
3228-
mLayerProperty( layerProperty )
3229-
//mProviderKey ("wms"),
3230-
//mLayerType ( QgsLayerItem::Raster )
3231-
{
3232-
mUri = createUri();
3233-
// Populate everything, it costs nothing, all info about layers is collected
3234-
foreach( QgsWmsLayerProperty layerProperty, mLayerProperty.layer )
3235-
{
3236-
// Attention, the name may be empty
3237-
QgsDebugMsg( QString::number( layerProperty.orderId ) + " " + layerProperty.name + " " + layerProperty.title );
3238-
QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name;
3239-
QgsWMSLayerItem * layer = new QgsWMSLayerItem( this, layerProperty.title, mPath + "/" + pathName, mCapabilitiesProperty, mConnInfo, layerProperty );
3240-
mChildren.append( layer );
3241-
}
3242-
3243-
if ( mChildren.size() == 0 )
3244-
{
3245-
mIcon = QIcon( getThemePixmap( "mIconWmsLayer.png" ) );
3246-
}
3247-
mPopulated = true;
3248-
}
3249-
3250-
QgsWMSLayerItem::~QgsWMSLayerItem()
3251-
{
3252-
}
3253-
3254-
QString QgsWMSLayerItem::createUri()
3255-
{
3256-
QString uri;
3257-
if ( mLayerProperty.name.isEmpty() )
3258-
return uri; // layer collection
3259-
3260-
QString rasterLayerPath = mConnInfo;
3261-
QString baseName = mLayerProperty.name;
3262-
3263-
// Number of styles must match number of layers
3264-
QStringList layers;
3265-
layers << mLayerProperty.name;
3266-
QStringList styles;
3267-
if ( mLayerProperty.style.size() > 0 )
3268-
{
3269-
styles.append( mLayerProperty.style[0].name );
3270-
}
3271-
else
3272-
{
3273-
styles << ""; // TODO: use loadDefaultStyleFlag
3274-
}
3275-
3276-
QString format;
3277-
// get first supporte by qt and server
3278-
QVector<QgsWmsSupportedFormat> formats = QgsWmsProvider::supportedFormats();
3279-
foreach( QgsWmsSupportedFormat f, formats )
3280-
{
3281-
if ( mCapabilitiesProperty.capability.request.getMap.format.indexOf( f.format ) >= 0 )
3282-
{
3283-
format = f.format;
3284-
break;
3285-
}
3286-
}
3287-
QString crs;
3288-
// get first known if possible
3289-
QgsCoordinateReferenceSystem testCrs;
3290-
foreach( QString c, mLayerProperty.crs )
3291-
{
3292-
testCrs.createFromOgcWmsCrs( c );
3293-
if ( testCrs.isValid() )
3294-
{
3295-
crs = c;
3296-
break;
3297-
}
3298-
}
3299-
if ( crs.isEmpty() && mLayerProperty.crs.size() > 0 )
3300-
{
3301-
crs = mLayerProperty.crs[0];
3302-
}
3303-
uri = rasterLayerPath + "|layers=" + layers.join( "," ) + "|styles=" + styles.join( "," ) + "|format=" + format + "|crs=" + crs;
3304-
3305-
return uri;
3306-
}
3307-
3308-
// ---------------------------------------------------------------------------
3309-
QgsWMSRootItem::QgsWMSRootItem( QgsDataItem* parent, QString name, QString path )
3310-
: QgsDataCollectionItem( parent, name, path )
3311-
{
3312-
mIcon = QIcon( getThemePixmap( "mIconWms.png" ) );
3313-
3314-
populate();
3315-
}
3316-
3317-
QgsWMSRootItem::~QgsWMSRootItem()
3318-
{
3319-
}
3320-
3321-
QVector<QgsDataItem*>QgsWMSRootItem::createChildren()
3322-
{
3323-
QVector<QgsDataItem*> connections;
3324-
3325-
foreach( QString connName, QgsWMSConnection::connectionList() )
3326-
{
3327-
QgsDataItem * conn = new QgsWMSConnectionItem( this, connName, mPath + "/" + connName );
3328-
connections.append( conn );
3329-
}
3330-
return connections;
3331-
}
3332-
3333-
QWidget * QgsWMSRootItem::paramWidget()
3334-
{
3335-
QgsWMSSourceSelect *select = new QgsWMSSourceSelect( 0, 0, true, true );
3336-
connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) );
3337-
return select;
3338-
}
3339-
void QgsWMSRootItem::connectionsChanged()
3340-
{
3341-
refresh();
3342-
}
3343-
3344-
// ---------------------------------------------------------------------------
3345-
3346-
QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
3347-
{
3348-
Q_UNUSED( thePath );
3349-
3350-
return new QgsWMSRootItem( parentItem, "WMS", "wms:" );
3351-
}
3352-

‎src/providers/wms/qgswmsprovider.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -968,51 +968,6 @@ class QgsWmsProvider : public QgsRasterDataProvider
968968
QStringList mSupportedGetFeatureFormats;
969969
};
970970

971-
class QgsWMSConnectionItem : public QgsDataCollectionItem
972-
{
973-
public:
974-
QgsWMSConnectionItem( QgsDataItem* parent, QString name, QString path );
975-
~QgsWMSConnectionItem();
976-
977-
QVector<QgsDataItem*> createChildren();
978-
virtual bool equal( const QgsDataItem *other );
979-
980-
QgsWmsCapabilitiesProperty mCapabilitiesProperty;
981-
QString mConnInfo;
982-
QVector<QgsWmsLayerProperty> mLayerProperties;
983-
};
984-
985-
// WMS Layers may be nested, so that they may be both QgsDataCollectionItem and QgsLayerItem
986-
// We have to use QgsDataCollectionItem and support layer methods if necessary
987-
class QgsWMSLayerItem : public QgsLayerItem
988-
{
989-
Q_OBJECT
990-
public:
991-
QgsWMSLayerItem( QgsDataItem* parent, QString name, QString path,
992-
QgsWmsCapabilitiesProperty capabilitiesProperty, QString connInfo, QgsWmsLayerProperty layerProperties );
993-
~QgsWMSLayerItem();
994-
995-
QString createUri();
996-
997-
QgsWmsCapabilitiesProperty mCapabilitiesProperty;
998-
QString mConnInfo;
999-
QgsWmsLayerProperty mLayerProperty;
1000-
};
1001-
1002-
class QgsWMSRootItem : public QgsDataCollectionItem
1003-
{
1004-
Q_OBJECT
1005-
public:
1006-
QgsWMSRootItem( QgsDataItem* parent, QString name, QString path );
1007-
~QgsWMSRootItem();
1008-
1009-
QVector<QgsDataItem*> createChildren();
1010-
1011-
virtual QWidget * paramWidget();
1012-
1013-
public slots:
1014-
void connectionsChanged();
1015-
};
1016971

1017972
#endif
1018973

0 commit comments

Comments
 (0)
Please sign in to comment.