1 // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*- 2 // vi:set ts=4 sts=4 sw=4 noet : 3 // 4 // Copyright 2010, 2012 wkhtmltopdf authors 5 // 6 // This file is part of wkhtmltopdf. 7 // 8 // wkhtmltopdf is free software: you can redistribute it and/or modify 9 // it under the terms of the GNU Lesser General Public License as published by 10 // the Free Software Foundation, either version 3 of the License, or 11 // (at your option) any later version. 12 // 13 // wkhtmltopdf is distributed in the hope that it will be useful, 14 // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 // GNU General Public License for more details. 17 // 18 // You should have received a copy of the GNU Lesser General Public License 19 // along with wkhtmltopdf. If not, see <http://www.gnu.org/licenses/>. 20 21 #ifndef __LOADSETTINGS_HH__ 22 #define __LOADSETTINGS_HH__ 23 24 #include <QNetworkProxy> 25 #include <QString> 26 27 #include <dllbegin.inc> 28 namespace wkhtmltopdf { 29 namespace settings { 30 31 /*! \brief Settings considering proxy */ 32 struct DLL_PUBLIC Proxy { 33 Proxy(); 34 //! Type of proxy to use 35 QNetworkProxy::ProxyType type; 36 //! The port of the proxy to use 37 int port; 38 //! The host name of the proxy to use or NULL 39 QString host; 40 //! Username for the said proxy or NULL 41 QString user; 42 //! Password for the said proxy or NULL 43 QString password; 44 }; 45 46 struct DLL_PUBLIC PostItem { 47 QString name; 48 QString value; 49 bool file; 50 }; 51 52 struct DLL_PUBLIC LoadGlobal { 53 LoadGlobal(); 54 //! Path of the cookie jar file 55 QString cookieJar; 56 }; 57 58 struct DLL_PUBLIC LoadPage { 59 LoadPage(); 60 61 enum LoadErrorHandling { 62 abort, 63 skip, 64 ignore 65 }; 66 67 //! Username used for http auth login 68 QString username; 69 70 //! Password used for http auth login 71 QString password; 72 73 //! Path to the ssl client cert private key in OpenSSL PEM format 74 QString clientSslKeyPath; 75 76 //! Password to ssl client cert private key 77 QString clientSslKeyPassword; 78 79 //! Path to the ssl client cert public key in OpenSSL PEM format, optionally followed by intermediate ca and trusted certs 80 QString clientSslCrtPath; 81 82 //! How many milliseconds should we wait for a Javascript redirect 83 int jsdelay; 84 85 //! What window.status value should we wait for 86 QString windowStatus; 87 88 //! What zoom factor should we apply when printing 89 // TODO MOVE 90 float zoomFactor; 91 92 //! Map of custom header variables 93 QList< QPair<QString, QString> > customHeaders; 94 95 //! Set if the custom header should be repeated for each resource request 96 bool repeatCustomHeaders; 97 98 //! Map of cookies 99 QList< QPair<QString, QString> > cookies; 100 101 QList< PostItem > post; 102 103 //! Block access to local files for the given page 104 bool blockLocalFileAccess; 105 106 //! If access to local files is not allowed in general, allow it for these files 107 QList< QString > allowed; 108 109 //! Stop Javascript from running too long 110 bool stopSlowScripts; 111 112 //! Output Javascript debug messages 113 bool debugJavascript; 114 115 //! What should we do about load errors 116 LoadErrorHandling loadErrorHandling; 117 LoadErrorHandling mediaLoadErrorHandling; 118 119 //! Proxy related settings 120 Proxy proxy; 121 122 //! Additional javascript to run on a page once it has loaded 123 QList< QString > runScript; 124 125 QString checkboxSvg; 126 QString checkboxCheckedSvg; 127 QString radiobuttonSvg; 128 QString radiobuttonCheckedSvg; 129 130 QString cacheDir; 131 static QList<QString> mediaFilesExtensions; 132 133 // Hosts to bypass 134 QList< QString > bypassProxyForHosts; 135 136 //! Whether to use the proxy for resolving hostnames 137 bool proxyHostNameLookup; 138 }; 139 140 DLL_PUBLIC LoadPage::LoadErrorHandling strToLoadErrorHandling(const char * s, bool * ok=0); 141 DLL_PUBLIC QString loadErrorHandlingToStr(LoadPage::LoadErrorHandling leh); 142 143 DLL_PUBLIC Proxy strToProxy(const char * s, bool * ok=0); 144 DLL_PUBLIC QString proxyToStr(const Proxy & proxy); 145 146 } 147 } 148 #include <dllend.inc> 149 #endif //__LOADSETTINGS_HH__ 150