loadsettings.hh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Copyright 2010, 2012 wkhtmltopdf authors
  2. //
  3. // This file is part of wkhtmltopdf.
  4. //
  5. // wkhtmltopdf is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Lesser General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // wkhtmltopdf is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with wkhtmltopdf. If not, see <http://www.gnu.org/licenses/>.
  17. #ifndef __LOADSETTINGS_HH__
  18. #define __LOADSETTINGS_HH__
  19. #include <QNetworkProxy>
  20. #include <QString>
  21. #include <wkhtmltox/dllbegin.inc>
  22. namespace wkhtmltopdf {
  23. namespace settings {
  24. /*! \brief Settings considering proxy */
  25. struct DLL_PUBLIC Proxy {
  26. Proxy();
  27. //! Type of proxy to use
  28. QNetworkProxy::ProxyType type;
  29. //! The port of the proxy to use
  30. int port;
  31. //! The host name of the proxy to use or NULL
  32. QString host;
  33. //! Username for the said proxy or NULL
  34. QString user;
  35. //! Password for the said proxy or NULL
  36. QString password;
  37. };
  38. struct DLL_PUBLIC PostItem {
  39. QString name;
  40. QString value;
  41. bool file;
  42. };
  43. struct DLL_PUBLIC LoadGlobal {
  44. LoadGlobal();
  45. //! Path of the cookie jar file
  46. QString cookieJar;
  47. };
  48. struct DLL_PUBLIC LoadPage {
  49. LoadPage();
  50. enum LoadErrorHandling {
  51. abort,
  52. skip,
  53. ignore
  54. };
  55. //! Username used for http auth login
  56. QString username;
  57. //! Password used for http auth login
  58. QString password;
  59. //! How many milliseconds should we wait for a Javascript redirect
  60. int jsdelay;
  61. //! What window.status value should we wait for
  62. QString windowStatus;
  63. //! What zoom factor should we apply when printing
  64. // TODO MOVE
  65. float zoomFactor;
  66. //! Map of custom header variables
  67. QList< QPair<QString, QString> > customHeaders;
  68. //! Set if the custom header should be repeated for each resource request
  69. bool repeatCustomHeaders;
  70. //! Map of cookies
  71. QList< QPair<QString, QString> > cookies;
  72. QList< PostItem > post;
  73. //! Block access to local files for the given page
  74. bool blockLocalFileAccess;
  75. //! If access to local files is not allowed in general, allow it for these files
  76. QList< QString > allowed;
  77. //! Stop Javascript from running too long
  78. bool stopSlowScripts;
  79. //! Output Javascript debug messages
  80. bool debugJavascript;
  81. //! What should we do about load errors
  82. LoadErrorHandling loadErrorHandling;
  83. LoadErrorHandling mediaLoadErrorHandling;
  84. //! Proxy related settings
  85. Proxy proxy;
  86. //! Additional javascript to run on a page once it has loaded
  87. QList< QString > runScript;
  88. QString checkboxSvg;
  89. QString checkboxCheckedSvg;
  90. QString radiobuttonSvg;
  91. QString radiobuttonCheckedSvg;
  92. QString cacheDir;
  93. static QList<QString> mediaFilesExtensions;
  94. // Hosts to bypass
  95. QList< QString > bypassProxyForHosts;
  96. };
  97. DLL_PUBLIC LoadPage::LoadErrorHandling strToLoadErrorHandling(const char * s, bool * ok=0);
  98. DLL_PUBLIC QString loadErrorHandlingToStr(LoadPage::LoadErrorHandling leh);
  99. DLL_PUBLIC Proxy strToProxy(const char * s, bool * ok=0);
  100. DLL_PUBLIC QString proxyToStr(const Proxy & proxy);
  101. }
  102. }
  103. #include <wkhtmltox/dllend.inc>
  104. #endif //__LOADSETTINGS_HH__