1/* 2 Copyright (C) 2009 Robert Hogan <robert@roberthogan.net> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18*/ 19 20#include "config.h" 21#include <qwebkitversion.h> 22#include <WebKitVersion.h> 23 24/*! 25 \relates QWebPage 26 \since 4.6 27 Returns the version number of WebKit at run-time as a string (for 28 example, "531.3"). 29 30 This version is commonly used in WebKit based browsers as part 31 of the user agent string. Web servers and JavaScript might use 32 it to identify the presence of certain WebKit engine features 33 and behaviour. 34 35 The evolution of this version is bound to the releases of Apple's 36 Safari browser. For a version specific to the QtWebKit library, 37 see QTWEBKIT_VERSION 38 39 \sa QWebPage::userAgentForUrl() 40*/ 41QString qWebKitVersion() 42{ 43 return QString::fromLatin1("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION); 44} 45 46/*! 47 \relates QWebPage 48 \since 4.6 49 Returns the 'major' version number of WebKit at run-time as an integer 50 (for example, 531). This is the version of WebKit the application 51 was compiled against. 52 53 \sa qWebKitVersion() 54*/ 55int qWebKitMajorVersion() 56{ 57 return WEBKIT_MAJOR_VERSION; 58} 59 60/*! 61 \relates QWebPage 62 \since 4.6 63 Returns the 'minor' version number of WebKit at run-time as an integer 64 (for example, 3). This is the version of WebKit the application 65 was compiled against. 66 67 \sa qWebKitVersion() 68*/ 69int qWebKitMinorVersion() 70{ 71 return WEBKIT_MINOR_VERSION; 72} 73 74/*! 75 \macro QTWEBKIT_VERSION 76 \relates QWebPage 77 78 This macro expands a numeric value of the form 0xMMNNPP (MM = 79 major, NN = minor, PP = patch) that specifies QtWebKit's version 80 number. For example, if you compile your application against QtWebKit 81 2.1.2, the QTWEBKIT_VERSION macro will expand to 0x020102. 82 83 You can use QTWEBKIT_VERSION to use the latest QtWebKit API where 84 available. 85 86 \sa QT_VERSION 87*/ 88 89/*! 90 \macro QTWEBKIT_VERSION_STR 91 \relates QWebPage 92 93 This macro expands to a string that specifies QtWebKit's version number 94 (for example, "2.1.2"). This is the version against which the 95 application is compiled. 96 97 \sa QTWEBKIT_VERSION 98*/ 99 100/*! 101 \macro QTWEBKIT_VERSION_CHECK 102 \relates QWebPage 103 104 Turns the major, minor and patch numbers of a version into an 105 integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can 106 be compared with another similarly processed version id, for example 107 in a preprocessor statement: 108 109 \code 110 #if QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 1, 0) 111 // code to use API new in QtWebKit 2.1.0 112 #endif 113 \endcode 114*/ 115