~ubuntu-branches/ubuntu/saucy/qgis/saucy

« back to all changes in this revision

Viewing changes to src/app/qgswmssourceselect.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-04-24 15:12:20 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120424151220-r88g00af5fpn5fc3
Tags: 1.7.4+1.7.5~20120320-1
The "Sometimes they come back" release.

* Branching from Qgis tree and adapting to current Debian Policy and
  standards. The target tree is currently set to release-1.7.
  (closes: #661491, #606304, #615683, #616182, #600308)
* Policy bumped to 3.9.3.
* Moving to debhelper compatibility level 9.
* Source format is now 3.0 with quilt support.
* Merged with 2bf42287 upstream git snapshot.
* Migrated to dh_python2 instead of python-central.
  (closes: #617048)
* Snapshot in qgis.org release-1.7: c936d031
* Added an automagic creation of a lintian override for sqlite embedding.
  This is required for uploading currently.
* Added missing ${misc:Depends} to make lintian happy.
* Copyright notes updated and debian/copyright moved to format 1.0.
* More licenses notices now reported in debian/copyright. Thanks ftpmasters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    Q_OBJECT
47
47
 
48
48
  public:
49
 
 
50
49
    //! Constructor
51
50
    QgsWMSSourceSelect( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
52
51
    //! Destructor
53
52
    ~QgsWMSSourceSelect();
54
 
    //! Populate the connection list combo box
55
 
    void populateConnectionList();
56
 
 
57
 
    //! Connection name
58
 
    QString connName();
59
 
 
60
 
    //! Connection info (uri)
61
 
    QString connectionInfo();
62
 
 
63
 
    //! Connection Proxy Host
64
 
    QString connProxyHost();
65
 
 
66
 
    //! Connection Proxy Port
67
 
    int connProxyPort();
68
 
 
69
 
    //! Connection Proxy User
70
 
    QString connProxyUser();
71
 
 
72
 
    //! Connection Proxy Pass
73
 
    QString connProxyPass();
74
 
 
75
 
    //! String list containing the selected layers
76
 
    QStringList selectedLayers();
77
 
 
78
 
    //! String list containing the visual styles selected for the selected layers - this corresponds with the output from selectedLayers()
79
 
    QStringList selectedStylesForSelectedLayers();
80
 
 
81
 
    //! String containing the MIME type of the preferred image encoding
82
 
    QString selectedImageEncoding();
83
 
 
84
 
    //! String containing the selected WMS-format CRS
85
 
    QString selectedCrs();
86
 
 
87
 
    //! Stores which server is now selected.
88
 
    void serverChanged();
89
 
 
90
 
    //! Set the server connection combo box to that stored in the config file.
91
 
    void setConnectionListPosition();
92
53
 
93
54
  public slots:
94
55
 
98
59
    void on_btnEdit_clicked();
99
60
    //! Deletes the selected connection
100
61
    void on_btnDelete_clicked();
 
62
    //! Saves connections to the file
 
63
    void on_btnSave_clicked();
 
64
    //! Loads connections from the file
 
65
    void on_btnLoad_clicked();
101
66
 
102
67
    /*! Connects to the database using the stored connection parameters.
103
68
    * Once connected, available layers are displayed.
107
72
    //! Determines the layers the user selected
108
73
    void addClicked();
109
74
 
 
75
    void searchFinished();
110
76
 
111
77
    //! Opens the Spatial Reference System dialog.
112
78
    void on_btnChangeSpatialRefSys_clicked();
113
79
 
114
 
    //! Signaled when a layer selection is changed.  Ensures that only one style is selected per layer.
 
80
    //! Signaled when a layer selection is changed.
115
81
    void on_lstLayers_itemSelectionChanged();
116
82
 
117
83
    //! Set status message to theMessage
118
 
    void showStatusMessage( QString const & theMessage );
 
84
    void showStatusMessage( QString const &theMessage );
119
85
 
120
86
    //! show whatever error is exposed by the QgsWmsProvider.
121
 
    void showError( QgsWmsProvider * wms );
 
87
    void showError( QgsWmsProvider *wms );
122
88
 
123
89
    //! Stores the selected datasource whenerver it is changed
124
90
    void on_cmbConnections_activated( int );
129
95
    void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
130
96
 
131
97
  private:
 
98
    //! Populate the connection list combo box
 
99
    void populateConnectionList();
 
100
 
 
101
    //! Connection name
 
102
    QString connName();
 
103
 
 
104
    //! Connection info (uri)
 
105
    QString connectionInfo();
 
106
 
 
107
    //! Connection Proxy Host
 
108
    QString connProxyHost();
 
109
 
 
110
    //! Connection Proxy Port
 
111
    int connProxyPort();
 
112
 
 
113
    //! Connection Proxy User
 
114
    QString connProxyUser();
 
115
 
 
116
    //! Connection Proxy Pass
 
117
    QString connProxyPass();
 
118
 
 
119
    //! Set the server connection combo box to that stored in the config file.
 
120
    void setConnectionListPosition();
132
121
 
133
122
    //! Add a few example servers to the list.
134
123
    void addDefaultServers();
135
124
 
 
125
    //! Selected CRS
 
126
    QString mCRS;
 
127
 
 
128
    //! Common CRSs for selected layers
 
129
    QSet<QString> mCRSs;
 
130
 
 
131
    //! Supported formats
 
132
    QStringList mFormats;
 
133
 
 
134
    //! Labels for supported formats
 
135
    QStringList mLabels;
 
136
 
 
137
    //! Map mime types to supported formats
 
138
    QMap<QString, int> mMimeMap;
 
139
 
136
140
    /**
137
141
     * \brief Populate the layer list - private for now.
138
142
     *
139
 
     * \retval FALSE if the layers could not be retrieved or parsed -
 
143
     * \retval false if the layers could not be retrieved or parsed -
140
144
     *         see mWmsProvider->errorString() for more info
141
145
     */
142
 
    bool populateLayerList( QgsWmsProvider* wmsProvider );
143
 
 
144
 
    //! Populate the image encoding button group - private for now.
145
 
    void populateImageEncodingGroup( QgsWmsProvider* wmsProvider );
 
146
    bool populateLayerList( QgsWmsProvider *wmsProvider );
146
147
 
147
148
    //! create an item including possible parents
148
 
    QgsNumericSortTreeWidgetItem *createItem( int id, const QStringList &names, QMap<int, QgsNumericSortTreeWidgetItem *> &items, int &layerAndStyleCount, const QMap<int, int> &layerParents, const QMap<int, QStringList> &layerParentNames );
 
149
    QgsNumericSortTreeWidgetItem *createItem( int id,
 
150
        const QStringList &names,
 
151
        QMap<int, QgsNumericSortTreeWidgetItem *> &items,
 
152
        int &layerAndStyleCount,
 
153
        const QMap<int, int> &layerParents,
 
154
        const QMap<int, QStringList> &layerParentNames );
149
155
 
150
 
    //! Returns a textual description for the EpsgCrsId number
151
 
    QString descriptionForEpsg( long epsg );
 
156
    //! Returns a textual description for the authority id
 
157
    QString descriptionForAuthId( QString authId );
152
158
 
153
159
    //! Keeps the layer order list up-to-date with changed layers and styles
154
160
    void updateLayerOrderTab( const QStringList& newLayerList, const QStringList& newStyleList );
155
161
 
156
162
    //! Name for selected connection
157
 
    QString m_connName;
 
163
    QString mConnName;
158
164
 
159
165
    //! URI for selected connection
160
 
    QString m_connectionInfo;
161
 
 
162
 
    //! Proxy Host for selected connection
163
 
    QString m_connProxyHost;
164
 
 
165
 
    //! Proxy Port for selected connection
166
 
    int m_connProxyPort;
167
 
 
168
 
    //! Proxy User for selected connection
169
 
    QString m_connProxyUser;
170
 
 
171
 
    //! Proxy Pass for selected connection
172
 
    QString m_connProxyPass;
173
 
 
174
 
    //QStringList m_selectedLayers;
175
 
    //QStringList m_selectedStylesForSelectedLayers;
176
 
    long m_Epsg;
177
 
 
178
 
    QMap<QString, QString> m_selectedStyleIdForLayer;
179
 
 
180
 
    //! The mime type, the text to use in the button and a unique number
181
 
    QMap<QString, QPair<QString, int> > m_PotentialFormats;
 
166
    QString mConnectionInfo;
 
167
 
 
168
    //! layer name derived from latest layer selection (updated as long it's not edited manually)
 
169
    QString mLastLayerName;
182
170
 
183
171
    //! The widget that controls the image format radio buttons
184
 
    QButtonGroup* m_imageFormatGroup;
185
 
    QHBoxLayout* m_imageFormatLayout;
186
 
 
187
 
    QPushButton * mAddButton;
188
 
 
189
 
    //! The WMS provider that retrieves information for this dialog
190
 
    QgsWmsProvider * mWmsProvider;
191
 
 
192
 
 
193
 
    bool retrieveSearchResults( const QString& searchTerm, QByteArray& httpResponse );
 
172
    QButtonGroup *mImageFormatGroup;
 
173
 
 
174
    QPushButton *mAddButton;
 
175
 
 
176
    QMap<QString, QString> mCrsNames;
 
177
 
194
178
    void addWMSListRow( const QDomElement& item, int row );
195
179
    void addWMSListItem( const QDomElement& el, int row, int column );
196
180
 
 
181
    void applySelectionConstraints( QTreeWidgetItem *item );
 
182
    void collectNamedLayers( QTreeWidgetItem *item, QStringList &layers, QStringList &styles );
 
183
    void enableLayersForCrs( QTreeWidgetItem *item );
 
184
 
 
185
    void collectSelectedLayers( QStringList &layers, QStringList &styles );
 
186
    QString selectedImageEncoding();
 
187
 
 
188
    QList<QTreeWidgetItem*> mCurrentSelection;
 
189
    QTableWidgetItem* mCurrentTileset;
 
190
 
197
191
  private slots:
198
192
    void on_btnSearch_clicked();
199
193
    void on_btnAddWMS_clicked();
200
 
    void wmsSelectionChanged();
 
194
    void on_tableWidgetWMSList_itemSelectionChanged();
 
195
    void on_lstTilesets_itemClicked( QTableWidgetItem *item );
201
196
    void on_mLayerUpButton_clicked();
202
197
    void on_mLayerDownButton_clicked();
 
198
    void updateButtons();
203
199
};
204
200
 
205
201