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 | |
---|
21 | #include "arghandler.inl" |
---|
22 | #include "imagecommandlineparser.hh" |
---|
23 | #include <qglobal.h> |
---|
24 | |
---|
25 | ImageCommandLineParser::ImageCommandLineParser(wkhtmltopdf::settings::ImageGlobal & s): |
---|
26 | settings(s) { |
---|
27 | mode(global); |
---|
28 | section("General Options"); |
---|
29 | addDocArgs(); |
---|
30 | addWebArgs(s.web); |
---|
31 | |
---|
32 | extended(false); |
---|
33 | qthack(false); |
---|
34 | addarg("quiet", 'q', "Be less verbose", new ConstSetter<bool>(s.quiet,true)); |
---|
35 | addarg("width",0,"Set screen width, note that this is used only as a guide line. Use --disable-smart-width to make it strict.", new IntSetter(s.screenWidth,"int")); |
---|
36 | addarg("height",0,"Set screen height (default is calculated from page content)", new IntSetter(s.screenHeight, "int")); |
---|
37 | // addarg("scale-w",0,"Set width for resizing", new IntSetter(s.scale.width,"int")); |
---|
38 | // addarg("scale-h",0,"Set height for resizing", new IntSetter(s.scale.height,"int")); |
---|
39 | |
---|
40 | addarg("crop-x",0,"Set x coordinate for cropping", new IntSetter(s.crop.left,"int")); |
---|
41 | addarg("crop-y",0,"Set y coordinate for cropping", new IntSetter(s.crop.top,"int")); |
---|
42 | addarg("crop-w",0,"Set width for cropping", new IntSetter(s.crop.width,"int")); |
---|
43 | addarg("crop-h",0,"Set height for cropping", new IntSetter(s.crop.height,"int")); |
---|
44 | addarg("format",'f',"Output file format", new QStrSetter(s.fmt, "format") ); |
---|
45 | addarg("quality",0,"Output image quality (between 0 and 100)", new IntSetter(s.quality, "int") ); |
---|
46 | |
---|
47 | extended(true); |
---|
48 | qthack(true); |
---|
49 | addarg("disable-smart-width", 0, "Use the specified width even if it is not large enough for the content", new ConstSetter<bool>(s.smartWidth, false)); |
---|
50 | addarg("enable-smart-width", 0, "Extend --width to fit unbreakable content", new ConstSetter<bool>(s.smartWidth, true)); |
---|
51 | addarg("transparent",0,"Make the background transparent in pngs", new ConstSetter<bool>(s.transparent, true)); |
---|
52 | #ifdef Q_OS_UNIX |
---|
53 | addarg("use-xserver",0,"Use the X server (some plugins and other stuff might not work without X11)", new ConstSetter<bool>(s.useGraphics,true)); |
---|
54 | #endif |
---|
55 | addGlobalLoadArgs(s.loadGlobal); |
---|
56 | addPageLoadArgs(s.loadPage); |
---|
57 | } |
---|