commondocparts.cc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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, 2011 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. #include "commandlineparserbase.hh"
  21. #include "outputter.hh"
  22. #include <QFile>
  23. /*!
  24. Output the name and version of the program, and also whether we are using a patched qt
  25. \param o The outputter to output to
  26. */
  27. void CommandLineParserBase::outputName(Outputter * o) const {
  28. o->beginSection("Name");
  29. o->paragraph(appName()+" "+appVersion());
  30. o->endSection();
  31. }
  32. /*!
  33. Output copyright stuff
  34. \param o The outputter to output to
  35. */
  36. void CommandLineParserBase::outputLicense(Outputter * o) const {
  37. o->beginSection("License");
  38. o->paragraph("Copyright (c) 2010-2014 wkhtmltopdf authors");
  39. QFile file(":/LICENSE");
  40. file.open(QIODevice::ReadOnly | QIODevice::Text);
  41. QTextStream stream(&file);
  42. o->verbatim(stream.readAll());
  43. o->endSection();
  44. }
  45. /*!
  46. Output list of authors
  47. \param o The outputter to output to
  48. */
  49. void CommandLineParserBase::outputAuthors(Outputter * o) const {
  50. o->beginSection("Authors");
  51. QFile file(":/AUTHORS");
  52. file.open(QIODevice::ReadOnly | QIODevice::Text);
  53. QTextStream stream(&file);
  54. o->verbatim(stream.readAll());
  55. o->endSection();
  56. }
  57. /*!
  58. Output information on the problems with the static version
  59. \param o The outputter to output to
  60. */
  61. void CommandLineParserBase::outputStaticProblems(Outputter * o) const {
  62. o->beginSection("Static version");
  63. o->beginParagraph();
  64. o->text("On the wkhtmltopdf website you can download a static version of wkhtmltopdf ");
  65. o->link("http://wkhtmltopdf.org/downloads.html");
  66. o->text(". This static binary will work on most systems and comes with a build in patched QT.");
  67. o->endParagraph();
  68. o->beginParagraph();
  69. o->text("Unfortunately the static binary is not particularly static, on Linux it depends "
  70. "on both glibc and openssl, furthermore you will need to have an xserver installed "
  71. "but not necessary running. You will need to have different fonts install including "
  72. "xfonts-scalable (Type1), and msttcorefonts.");
  73. o->endParagraph();
  74. o->endSection();
  75. }
  76. /*!
  77. Output documentation about the proxy settings
  78. \param o The outputter to output to
  79. */
  80. void CommandLineParserBase::outputProxyDoc(Outputter * o) const {
  81. o->beginSection("Specifying A Proxy");
  82. o->paragraph(
  83. "By default proxy information will be read from the environment"
  84. " variables: proxy, all_proxy and http_proxy, proxy options can"
  85. " also by specified with the -p switch");
  86. o->verbatim(
  87. "<type> := \"http://\" | \"socks5://\"\n"
  88. "<serif> := <username> (\":\" <password>)? \"@\"\n"
  89. "<proxy> := \"None\" | <type>? <string>? <host> (\":\" <port>)?\n");
  90. o->paragraph("Here are some examples (In case you are unfamiliar with the BNF):");
  91. o->verbatim("http://user:password@myproxyserver:8080\n"
  92. "socks5://myproxyserver\n"
  93. "None\n");
  94. o->endSection();
  95. }