From 9952fc8aa68658beda5da57bb1782fa0574c91a8 Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Sat, 18 Oct 2014 14:12:59 +0200 Subject: [PATCH] Add Developers Map in About dialog --- doc/CMakeLists.txt | 2 +- doc/developersmap.html | 31 +++++++++++++++++++++++++++++++ python/core/qgsapplication.sip | 8 +++++++- src/app/qgsabout.cpp | 19 +++++++++++++++++++ src/app/qgsabout.h | 1 + src/core/qgsapplication.cpp | 4 ++++ src/core/qgsapplication.h | 8 +++++++- src/ui/qgsabout.ui | 31 ++++++++++++++++++++++++++----- 8 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 doc/developersmap.html diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 73c4f34855f8..ca6f146e2797 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -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) diff --git a/doc/developersmap.html b/doc/developersmap.html new file mode 100644 index 000000000000..14667e02f266 --- /dev/null +++ b/doc/developersmap.html @@ -0,0 +1,31 @@ + + + + + + + + + +
+ + + diff --git a/python/core/qgsapplication.sip b/python/core/qgsapplication.sip index 7ce2f1dd9399..9d2330e16560 100644 --- a/python/core/qgsapplication.sip +++ b/python/core/qgsapplication.sip @@ -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. */ diff --git a/src/app/qgsabout.cpp b/src/app/qgsabout.cpp index c420a2449d21..6f0f3832ca5f 100644 --- a/src/app/qgsabout.cpp +++ b/src/app/qgsabout.cpp @@ -24,6 +24,7 @@ #include #include #include +#include /* Uncomment this block to use preloaded images #include @@ -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 ); +} diff --git a/src/app/qgsabout.h b/src/app/qgsabout.h index 09302bd3464e..fdbfb476b8b0 100644 --- a/src/app/qgsabout.h +++ b/src/app/qgsabout.h @@ -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 ); diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 42ee677c96db..d77136aa26b8 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -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. */ diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index bb805a3fcad7..84febe5b7d76 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -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. */ diff --git a/src/ui/qgsabout.ui b/src/ui/qgsabout.ui index b11501c2630a..ca57efd7903a 100644 --- a/src/ui/qgsabout.ui +++ b/src/ui/qgsabout.ui @@ -105,6 +105,11 @@ Contributors + + + Developers Map + + Translators @@ -150,7 +155,7 @@ - 0 + 5 @@ -191,8 +196,8 @@ p, li { white-space: pre-wrap; } - - + + about:blank @@ -359,14 +364,30 @@ p, li { white-space: pre-wrap; } + + + + 0 + + + + + + about:blank + + + + + + 0 - - + + about:blank