Skip to content
Permalink
Browse files
Provide the means to add some pre-defined wms servers to the server
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 010f337154f8a724f2ef73540ada5d2a4b0fe074
Showing with 253 additions and 207 deletions.
  1. +46 −13 src/gui/qgsserversourceselect.cpp
  2. +6 −0 src/gui/qgsserversourceselect.h
  3. +201 −194 src/ui/qgsserversourceselectbase.ui
@@ -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()
{
@@ -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,
@@ -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
@@ -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.
*

0 comments on commit 010f337

Please sign in to comment.