1 /*************************************************************************** 2 qgshelp.h 3 -------------------------------------- 4 Date : December 2016 5 Copyright : (C) 2016 by Alexander Bruy 6 Email : alexander dot bruy at gmail dot com 7 *************************************************************************** 8 * * 9 * This program is free software; you can redistribute it and/or modify * 10 * it under the terms of the GNU General Public License as published by * 11 * the Free Software Foundation; either version 2 of the License, or * 12 * (at your option) any later version. * 13 * * 14 ***************************************************************************/ 15 16 #ifndef QGSHELP_H 17 #define QGSHELP_H 18 19 #include "qgis_gui.h" 20 21 #include <QString> 22 #include <QUrl> 23 24 /** 25 * \ingroup gui 26 * \class QgsHelp 27 * \brief Helper class for showing help topic URI for the given key. 28 * 29 * Help can be stored online, on the local directory or on the intranet 30 * server. Location of the QGIS help can be configured in QGIS options. 31 * Multiple locations are supported, they will be used in order of 32 * preference, from top to bottom. 33 * 34 * URI construction takes in account following information: 35 * 36 * - QGIS version 37 * - language of the QGIS UI 38 * 39 * If no help found, default error page with information how to setup 40 * help system will be shown. 41 * 42 * \since QGIS 3.0 43 */ 44 class GUI_EXPORT QgsHelp 45 { 46 public: 47 48 /** 49 * Opens help topic for the given help key using default system 50 * web browser. If help topic not found, builtin error page shown. 51 * \param key key which identified help topic 52 * \since QGIS 3.0 53 */ 54 static void openHelp( const QString &key ); 55 56 /** 57 * Returns URI of the help topic for the given key. If help topic 58 * not found, URI of the builtin error page returned. 59 * \param key key which identified help topic 60 * \since QGIS 3.0 61 */ 62 static QUrl helpUrl( const QString &key ); 63 64 private: 65 66 /** 67 * Check if given URL accessible by issuing HTTP HEAD request. 68 * Returns TRUE if URL accessible, FALSE otherwise. 69 * \param url URL to check 70 * \since QGIS 3.0 71 */ 72 static bool urlExists( const QString &url ); 73 }; 74 75 #endif // QGSHELP_H 76