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 "qwebkitglobal.h" 22 23#include <WebKitVersion.h> 24 25/*! 26 \relates QWebPage 27 \since 4.6 28 Returns the version number of WebKit at run-time as a string (for 29 example, "531.3"). 30 31 This version is commonly used in WebKit based browsers as part 32 of the user agent string. Web servers and JavaScript might use 33 it to identify the presence of certain WebKit engine features 34 and behaviour. 35 36 The evolution of this version is bound to the releases of Apple's 37 Safari browser. For a version specific to the Qt WebKit module, 38 see QTWEBKIT_VERSION 39 40 \sa QWebPage::userAgentForUrl() 41*/ 42QString qWebKitVersion() 43{ 44 return QString::fromLatin1("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION); 45} 46 47/*! 48 \relates QWebPage 49 \since 4.6 50 Returns the 'major' version number of WebKit at run-time as an integer 51 (for example, 531). This is the version of WebKit the application 52 was compiled against. 53 54 \sa qWebKitVersion() 55*/ 56int qWebKitMajorVersion() 57{ 58 return WEBKIT_MAJOR_VERSION; 59} 60 61/*! 62 \relates QWebPage 63 \since 4.6 64 Returns the 'minor' version number of WebKit at run-time as an integer 65 (for example, 3). This is the version of WebKit the application 66 was compiled against. 67 68 \sa qWebKitVersion() 69*/ 70int qWebKitMinorVersion() 71{ 72 return WEBKIT_MINOR_VERSION; 73} 74 75/*! 76 \macro QTWEBKIT_VERSION 77 \relates QWebPage 78 79 This macro expands a numeric value of the form 0xMMNNPP (MM = 80 major, NN = minor, PP = patch) that specifies Qt WebKit's version 81 number. For example, if you compile your application against Qt WebKit 82 2.1.2, the QTWEBKIT_VERSION macro will expand to 0x020102. 83 84 You can use QTWEBKIT_VERSION to use the latest Qt WebKit API where 85 available. 86 87 \sa QT_VERSION 88*/ 89 90/*! 91 \macro QTWEBKIT_VERSION_STR 92 \relates QWebPage 93 94 This macro expands to a string that specifies Qt WebKit's version number 95 (for example, "2.1.2"). This is the version against which the 96 application is compiled. 97 98 \sa QTWEBKIT_VERSION 99*/ 100 101/*! 102 \macro QTWEBKIT_VERSION_CHECK 103 \relates QWebPage 104 105 Turns the major, minor and patch numbers of a version into an 106 integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can 107 be compared with another similarly processed version id, for example 108 in a preprocessor statement: 109 110 \code 111 #if QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 1, 0) 112 // code to use API new in Qt WebKit 2.1.0 113 #endif 114 \endcode 115*/ 116