Skip to content
Permalink
Browse files

Merge pull request #1634 from slarosa/usermap_about

Adds Developers Map in About dialog
  • Loading branch information
NathanW2 committed Dec 26, 2014
2 parents 68743f9 + 2aa2292 commit 1e7cc2ccbd322fbfcda370839e4c207e08dfa010
@@ -20,7 +20,7 @@ ELSE(TXT2TAGS_EXECUTABLE)
)
ENDIF(TXT2TAGS_EXECUTABLE)

SET(QGIS_DOC_FILES ${QGIS_DOC_FILES} index.html news.html favicon.ico style.css AUTHORS CONTRIBUTORS SPONSORS DONORS TRANSLATORS LICENSE)
SET(QGIS_DOC_FILES ${QGIS_DOC_FILES} index.html news.html developersmap.html contributors.json favicon.ico style.css AUTHORS CONTRIBUTORS SPONSORS DONORS TRANSLATORS LICENSE)

INSTALL(FILES ${QGIS_DOC_FILES} DESTINATION ${QGIS_DATA_DIR}/doc)
INSTALL(FILES ../images/icons/qgis-icon-60x60.png DESTINATION ${QGIS_DATA_DIR}/doc/images)
@@ -0,0 +1,33 @@
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<style type="text/css">
body { padding: 0; margin: 0; }
html, body, #developers-map { height: 100%; }
</style>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<link rel="points" type="application/json" href="contributors.json">
</head>
<body>
<div id="developers-map"></div>
<script>
var developersMapTiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
maxZooom: 18,
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
});

$.getJSON($('link[rel="points"]').attr("href"), function(data) {
var geojson = L.geoJson(data, {
onEachFeature: function (feature, layer) {
layer.bindPopup("<b>Name:</b> " + feature.properties.Name +
"<br><b>Committer:</b> " + feature.properties.Committer);
}
});
var map = L.map('developers-map').fitBounds(geojson.getBounds());
developersMapTiles.addTo(map);
geojson.addTo(map);
});
</script>
</body>
</html>
@@ -110,7 +110,13 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
* but don't have commit access. */
static const QString contributorsFilePath();

/**Returns the path to the sponsors file.*/
/** Returns the path to the developers map file.
* The developers map was created by using leaflet framework,
* it shows the doc/contributors.json file.
* @note this function was added in version 2.7 */
static const QString developersMapFilePath();

/**Returns the path to the sponsors file. */
static const QString sponsorsFilePath();

/** Returns the path to the donors file. */
@@ -24,6 +24,7 @@
#include <QTextStream>
#include <QImageReader>
#include <QSqlDatabase>
#include <QTcpSocket>

/* Uncomment this block to use preloaded images
#include <map>
@@ -51,6 +52,17 @@ void QgsAbout::init()
{
setPluginInfo();

// check internet connection in order to hide/show the developers map widget
int DEVELOPERS_MAP_INDEX = 5;
QTcpSocket socket;
QString host = "qgis.org";
int port = 80;
socket.connectToHost( host, port );
if ( socket.waitForConnected( 1000 ) )
setDevelopersMap();
else
mOptionsListWidget->item( DEVELOPERS_MAP_INDEX )->setHidden( true );

// set the 60x60 icon pixmap
QPixmap icon( QgsApplication::iconsPath() + "qgis-icon-60x60.png" );
qgisIcon->setPixmap( icon );
@@ -303,3 +315,10 @@ QString QgsAbout::fileSystemSafe( QString fileName )

return result;
}

void QgsAbout::setDevelopersMap()
{
developersMapView->settings()->setAttribute( QWebSettings::JavascriptEnabled, true );
QUrl url = QUrl::fromLocalFile( QgsApplication::developersMapFilePath() );
developersMapView->load( url );
}
@@ -33,6 +33,7 @@ class APP_EXPORT QgsAbout : public QgsOptionsDialogBase, private Ui::QgsAbout
void setWhatsNew();
void setLicence();
void setPluginInfo();
void setDevelopersMap();
void init();
void openUrl( QString url );

@@ -439,6 +439,10 @@ const QString QgsApplication::contributorsFilePath()
{
return ABISYM( mPkgDataPath ) + QString( "/doc/CONTRIBUTORS" );
}
const QString QgsApplication::developersMapFilePath()
{
return ABISYM( mPkgDataPath ) + QString( "/doc/developersmap.html" );
}
/*!
Returns the path to the sponsors file.
*/
@@ -84,7 +84,13 @@ class CORE_EXPORT QgsApplication : public QApplication
* but don't have commit access. */
static const QString contributorsFilePath();

/**Returns the path to the sponsors file.*/
/** Returns the path to the developers map file.
* The developers map was created by using leaflet framework,
* it shows the doc/contributors.json file.
* @note this function was added in version 2.7 */
static const QString developersMapFilePath();

/** Returns the path to the sponsors file. */
static const QString sponsorsFilePath();

/** Returns the path to the donors file. */
@@ -105,6 +105,11 @@
<string>Contributors</string>
</property>
</item>
<item>
<property name="text">
<string>Developers Map</string>
</property>
</item>
<item>
<property name="text">
<string>Translators</string>
@@ -191,8 +196,8 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item>
<widget class="QWebView" name="txtVersion" native="true">
<property name="url" stdset="0">
<widget class="QWebView" name="txtVersion">
<property name="url">
<url>
<string>about:blank</string>
</url>
@@ -359,14 +364,30 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="developersMap">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWebView" name="developersMapView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_5">
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWebView" name="txtTranslators" native="true">
<property name="url" stdset="0">
<widget class="QWebView" name="txtTranslators">
<property name="url">
<url>
<string>about:blank</string>
</url>

0 comments on commit 1e7cc2c

Please sign in to comment.
You can’t perform that action at this time.