source: wkhtmltox/trunk/fuentes/src/lib/loadsettings.hh @ 51

Last change on this file since 51 was 51, checked in by mabarracus, 4 years ago

wip

File size: 3.5 KB
Line 
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 <wkhtmltox/dllbegin.inc>
28namespace wkhtmltopdf {
29namespace settings {
30
31/*! \brief Settings considering proxy */
32struct 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
46struct DLL_PUBLIC PostItem {
47        QString name;
48        QString value;
49        bool file;
50};
51
52struct DLL_PUBLIC LoadGlobal {
53        LoadGlobal();
54        //! Path of the cookie jar file
55        QString cookieJar;
56};
57
58struct 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        //! How many milliseconds should we wait for a Javascript redirect
74        int jsdelay;
75
76        //! What window.status value should we wait for
77        QString windowStatus;
78
79        //! What zoom factor should we apply when printing
80        // TODO MOVE
81        float zoomFactor;
82
83        //! Map of custom header variables
84        QList< QPair<QString, QString> > customHeaders;
85
86        //! Set if the custom header should be repeated for each resource request
87        bool repeatCustomHeaders;
88
89        //! Map of cookies
90        QList< QPair<QString, QString> > cookies;
91
92        QList< PostItem > post;
93
94        //! Block access to local files for the given page
95        bool blockLocalFileAccess;
96
97        //! If access to local files is not allowed in general, allow it for these files
98        QList< QString > allowed;
99
100        //! Stop Javascript from running too long
101        bool stopSlowScripts;
102
103        //! Output Javascript debug messages
104        bool debugJavascript;
105
106        //! What should we do about load errors
107        LoadErrorHandling loadErrorHandling;
108        LoadErrorHandling mediaLoadErrorHandling;
109
110        //! Proxy related settings
111        Proxy proxy;
112
113        //! Additional javascript to run on a page once it has loaded
114        QList< QString > runScript;
115
116        QString checkboxSvg;
117        QString checkboxCheckedSvg;
118        QString radiobuttonSvg;
119        QString radiobuttonCheckedSvg;
120
121        QString cacheDir;
122        static QList<QString> mediaFilesExtensions;
123
124        // Hosts to bypass
125        QList< QString > bypassProxyForHosts;
126};
127
128DLL_PUBLIC LoadPage::LoadErrorHandling strToLoadErrorHandling(const char * s, bool * ok=0);
129DLL_PUBLIC QString loadErrorHandlingToStr(LoadPage::LoadErrorHandling leh);
130
131DLL_PUBLIC Proxy strToProxy(const char * s, bool * ok=0);
132DLL_PUBLIC QString proxyToStr(const Proxy & proxy);
133
134}
135}
136#include <wkhtmltox/dllend.inc>
137#endif //__LOADSETTINGS_HH__
Note: See TracBrowser for help on using the repository browser.