loadsettings.hh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Copyright 2010 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. #ifdef __WKHTMLTOX_UNDEF_QT_DLL__
  20. #ifdef QT_DLL
  21. #undef QT_DLL
  22. #endif
  23. #endif
  24. #include <QNetworkProxy>
  25. #include <QString>
  26. #include <wkhtmltox/dllbegin.inc>
  27. namespace wkhtmltopdf {
  28. namespace settings {
  29. /*! \brief Settings consdering proxy */
  30. struct DLL_PUBLIC Proxy {
  31. Proxy();
  32. //! Type of proxy to use
  33. QNetworkProxy::ProxyType type;
  34. //! The port of the proxy to use
  35. int port;
  36. //! The host name of the proxy to use or NULL
  37. QString host;
  38. //! Username for the said proxy or NULL
  39. QString user;
  40. //! Password for the said proxy or NULL
  41. QString password;
  42. };
  43. struct DLL_PUBLIC PostItem {
  44. QString name;
  45. QString value;
  46. bool file;
  47. };
  48. struct DLL_PUBLIC LoadGlobal {
  49. LoadGlobal();
  50. //! Path of the cookie jar file
  51. QString cookieJar;
  52. };
  53. struct DLL_PUBLIC LoadPage {
  54. LoadPage();
  55. enum LoadErrorHandling {
  56. abort,
  57. skip,
  58. ignore
  59. };
  60. //! Username used for http auth login
  61. QString username;
  62. //! Password used for http auth login
  63. QString password;
  64. //! How many milliseconds should we wait for a Javascript redirect
  65. int jsdelay;
  66. //! What zoom factor should we apply when printing
  67. // TODO MOVE
  68. float zoomFactor;
  69. //! Map of custum header variables
  70. QList< QPair<QString, QString> > customHeaders;
  71. //! Set if the custom header should be repeated for each resource request
  72. bool repeatCustomHeaders;
  73. //! Map of cookies
  74. QList< QPair<QString, QString> > cookies;
  75. QList< PostItem > post;
  76. //! Block access to local files for the given page
  77. bool blockLocalFileAccess;
  78. //! If access to local files is not allowed in general, allow it for these files
  79. QList< QString > allowed;
  80. //! Stop Javascript from running too long
  81. bool stopSlowScripts;
  82. //! Output Javascript debug messages
  83. bool debugJavascript;
  84. //! What should we do about load errors
  85. LoadErrorHandling loadErrorHandling;
  86. //! Proxy related settings
  87. Proxy proxy;
  88. //! Additional javascript to run on a page once it has loaded
  89. QList< QString > runScript;
  90. };
  91. DLL_PUBLIC LoadPage::LoadErrorHandling strToLoadErrorHandling(const char * s, bool * ok=0);
  92. DLL_PUBLIC QString loadErrorHandlingToStr(LoadPage::LoadErrorHandling leh);
  93. DLL_PUBLIC Proxy strToProxy(const char * s, bool * ok=0);
  94. DLL_PUBLIC QString proxyToStr(const Proxy & proxy);
  95. }
  96. }
  97. #include <wkhtmltox/dllend.inc>
  98. #endif //__LOADSETTINGS_HH__