Skip to content

Commit

Permalink
Provide the means to add some pre-defined wms servers to the server
Browse files Browse the repository at this point in the history
list. Addresses ticket #341.


git-svn-id: http://svn.osgeo.org/qgis/trunk@5942 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Oct 13, 2006
1 parent 65b5764 commit 010f337
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 207 deletions.
59 changes: 46 additions & 13 deletions src/gui/qgsserversourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ void QgsServerSourceSelect::populateConnectionList()
}
setConnectionListPosition();

if (keys.begin() != keys.end())
{
// Connections available - enable various buttons
btnConnect->setEnabled(TRUE);
btnEdit->setEnabled(TRUE);
btnDelete->setEnabled(TRUE);
}
if (keys.begin() == keys.end())
{
// No connections - disable various buttons
btnConnect->setEnabled(FALSE);
btnEdit->setEnabled(FALSE);
btnDelete->setEnabled(FALSE);
}
else
{
// No connections available - disable various buttons
btnConnect->setEnabled(FALSE);
btnEdit->setEnabled(FALSE);
btnDelete->setEnabled(FALSE);
}
{
// Connections - enable various buttons
btnConnect->setEnabled(TRUE);
btnEdit->setEnabled(TRUE);
btnDelete->setEnabled(TRUE);
}
}
void QgsServerSourceSelect::on_btnNew_clicked()
{
Expand Down Expand Up @@ -726,6 +726,11 @@ void QgsServerSourceSelect::on_cmbConnections_activated(int)
serverChanged();
}

void QgsServerSourceSelect::on_btnAddDefault_clicked()
{
addDefaultServers();
}

QString QgsServerSourceSelect::descriptionForEpsg(long epsg)
{
// We'll assume this function isn't called very often,
Expand All @@ -736,5 +741,33 @@ QString QgsServerSourceSelect::descriptionForEpsg(long epsg)
return qgisSrs.description();
}

void QgsServerSourceSelect::addDefaultServers()
{
QMap<QString, QString> exampleServers;
exampleServers["NASA (JPL)"] = "http://wms.jpl.nasa.gov/wms.cgi";
exampleServers["DM Solutions GMap"] = "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap";
exampleServers["TerraService"] = "http://terraservice.net/ogccapabilities.ashx";
// Nice to have the qgis users map, but I'm not sure of the URL at the moment.
// exampleServers["Qgis users map"] = "http://qgis.org/wms.cgi";

QSettings settings;
QString basePath("/Qgis/connections-wms/");
QMap<QString, QString>::const_iterator i = exampleServers.constBegin();
for (; i != exampleServers.constEnd(); ++i)
{
// Only do a server if it's name doesn't already exist.
QStringList keys = settings.subkeyList(basePath);
if (!keys.contains(i.key()))
{
QString path = basePath + i.key();
settings.setValue(path + "/proxyhost", "");
settings.setValue(path + "/proxyport", 80);
settings.setValue(path + "/proxyuser", "");
settings.setValue(path + "/proxypassword", "");
settings.setValue(path + "/url", i.value());
}
}
populateConnectionList();
}

// ENDS
6 changes: 6 additions & 0 deletions src/gui/qgsserversourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ public slots:
//! Stores the selected datasource whenerver it is changed
void on_cmbConnections_activated(int);

//! Add some default wms servers to the list
void on_btnAddDefault_clicked();

private:

//! Add a few example servers to the list.
void addDefaultServers();

/**
* \brief Populate the layer list - private for now.
*
Expand Down
Loading

0 comments on commit 010f337

Please sign in to comment.