Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 160 lines (127 sloc) 5.638 kB
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
1 /*
2 This file is part of the PhantomJS project from Ofi Labs.
3
4 Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
5 Copyright (C) 2011 execjosh, http://execjosh.blogspot.com
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 * Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 * Neither the name of the <organization> nor the
16 names of its contributors may be used to endorse or promote products
17 derived from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
23 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
ad53b9b @execjosh Rename "PhantomConfig" to "Config"
execjosh authored
31 #ifndef CONFIG_H
32 #define CONFIG_H
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
33
34 #include <QString>
3c790d8 @execjosh Migrate command-line argument processing logic to Config
execjosh authored
35 #include <QStringList>
d91c5af @jgornick Added ability to specify SOCKS5 proxy type.
jgornick authored
36 #include <QNetworkProxy>
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
37
8f89ddc @execjosh Make Config extend QObject
execjosh authored
38 class Config: QObject
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
39 {
8f89ddc @execjosh Make Config extend QObject
execjosh authored
40 Q_OBJECT
5449251 @ariya Unify the name to 'cookiesFile' everywhere.
authored
41 Q_PROPERTY(QString cookiesFile READ cookiesFile WRITE setCookiesFile)
8f89ddc @execjosh Make Config extend QObject
execjosh authored
42 Q_PROPERTY(bool diskCacheEnabled READ diskCacheEnabled WRITE setDiskCacheEnabled)
cebe64e @ariya Config to limit the disk cache size.
authored
43 Q_PROPERTY(int maxDiskCacheSize READ maxDiskCacheSize WRITE setMaxDiskCacheSize)
8f89ddc @execjosh Make Config extend QObject
execjosh authored
44 Q_PROPERTY(bool ignoreSslErrors READ ignoreSslErrors WRITE setIgnoreSslErrors)
059e725 @ariya Rename option/config to localToRemoteUrlAccess(Enabled).
authored
45 Q_PROPERTY(bool localToRemoteUrlAccessEnabled READ localToRemoteUrlAccessEnabled WRITE setLocalToRemoteUrlAccessEnabled)
8f89ddc @execjosh Make Config extend QObject
execjosh authored
46 Q_PROPERTY(QString outputEncoding READ outputEncoding WRITE setOutputEncoding)
d91c5af @jgornick Added ability to specify SOCKS5 proxy type.
jgornick authored
47 Q_PROPERTY(QString proxyType READ proxyType WRITE setProxyType)
8f89ddc @execjosh Make Config extend QObject
execjosh authored
48 Q_PROPERTY(QString proxy READ proxy WRITE setProxy)
7615582 @hownowstephen Proxy authentication support.
hownowstephen authored
49 Q_PROPERTY(QString proxyAuth READ proxyAuth WRITE setProxyAuth)
8f89ddc @execjosh Make Config extend QObject
execjosh authored
50 Q_PROPERTY(QString scriptEncoding READ scriptEncoding WRITE setScriptEncoding)
c12f1aa @ariya Control web security setting.
authored
51 Q_PROPERTY(bool webSecurityEnabled READ webSecurityEnabled WRITE setWebSecurityEnabled)
8f89ddc @execjosh Make Config extend QObject
execjosh authored
52
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
53 public:
8f89ddc @execjosh Make Config extend QObject
execjosh authored
54 Config(QObject *parent = 0);
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
55
3c790d8 @execjosh Migrate command-line argument processing logic to Config
execjosh authored
56 void init(const QStringList *const args);
57 void processArgs(const QStringList &args);
26f7185 @execjosh Implement JSON config loader
execjosh authored
58 void loadJsonFile(const QString &filePath);
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
59
f5f4361 @execjosh Migrate page settings to PhantomConfig
execjosh authored
60 bool autoLoadImages() const;
61 void setAutoLoadImages(const bool value);
62
5449251 @ariya Unify the name to 'cookiesFile' everywhere.
authored
63 QString cookiesFile() const;
64 void setCookiesFile(const QString &cookiesFile);
a445b2d @execjosh Migrate network access manager settings to PhantomConfig
execjosh authored
65
66 bool diskCacheEnabled() const;
67 void setDiskCacheEnabled(const bool value);
68
cebe64e @ariya Config to limit the disk cache size.
authored
69 int maxDiskCacheSize() const;
70 void setMaxDiskCacheSize(int maxDiskCacheSize);
71
a445b2d @execjosh Migrate network access manager settings to PhantomConfig
execjosh authored
72 bool ignoreSslErrors() const;
73 void setIgnoreSslErrors(const bool value);
74
059e725 @ariya Rename option/config to localToRemoteUrlAccess(Enabled).
authored
75 bool localToRemoteUrlAccessEnabled() const;
76 void setLocalToRemoteUrlAccessEnabled(const bool value);
f5f4361 @execjosh Migrate page settings to PhantomConfig
execjosh authored
77
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
78 QString outputEncoding() const;
79 void setOutputEncoding(const QString &value);
80
d91c5af @jgornick Added ability to specify SOCKS5 proxy type.
jgornick authored
81 QString proxyType() const;
82 void setProxyType(const QString value);
83
8f89ddc @execjosh Make Config extend QObject
execjosh authored
84 QString proxy() const;
5441f51 @execjosh Migrate proxy settings to PhantomConfig
execjosh authored
85 void setProxy(const QString &value);
86 QString proxyHost() const;
87 int proxyPort() const;
88
7615582 @hownowstephen Proxy authentication support.
hownowstephen authored
89 QString proxyAuth() const;
90 void setProxyAuth(const QString &value);
91 QString proxyAuthUser() const;
92 QString proxyAuthPass() const;
93 void setProxyAuthUser(const QString &value);
94 void setProxyAuthPass(const QString &value);
95
3c790d8 @execjosh Migrate command-line argument processing logic to Config
execjosh authored
96 QStringList scriptArgs() const;
97 void setScriptArgs(const QStringList &value);
98
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
99 QString scriptEncoding() const;
100 void setScriptEncoding(const QString &value);
101
3c790d8 @execjosh Migrate command-line argument processing logic to Config
execjosh authored
102 QString scriptFile() const;
103 void setScriptFile(const QString &value);
104
105 QString unknownOption() const;
106 void setUnknownOption(const QString &value);
107
108 bool versionFlag() const;
109 void setVersionFlag(const bool value);
110
610fb41 @lfranchi Add support for remotely debugging a script.
lfranchi authored
111 void setDebug(const bool value);
112 bool debug() const;
113
114 void setRemoteDebugPort(const int port);
115 int remoteDebugPort() const;
1250432 @execjosh Add conventional "--help" option
execjosh authored
116
e88e008 @jonleighton Add option to specify whether or not the remote debugger should autorun.
jonleighton authored
117 void setRemoteDebugAutorun(const bool value);
118 bool remoteDebugAutorun() const;
119
c12f1aa @ariya Control web security setting.
authored
120 bool webSecurityEnabled() const;
121 void setWebSecurityEnabled(const bool value);
122
1250432 @execjosh Add conventional "--help" option
execjosh authored
123 bool helpFlag() const;
124 void setHelpFlag(const bool value);
125
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
126 private:
127 void resetToDefaults();
5441f51 @execjosh Migrate proxy settings to PhantomConfig
execjosh authored
128 void setProxyHost(const QString &value);
129 void setProxyPort(const int value);
af71868 @mintbridge add basic http auth support to networkaccessmanager, and add the abil…
mintbridge authored
130 void setAuthUser(const QString &value);
131 void setAuthPass(const QString &value);
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
132
f5f4361 @execjosh Migrate page settings to PhantomConfig
execjosh authored
133 bool m_autoLoadImages;
5449251 @ariya Unify the name to 'cookiesFile' everywhere.
authored
134 QString m_cookiesFile;
a445b2d @execjosh Migrate network access manager settings to PhantomConfig
execjosh authored
135 bool m_diskCacheEnabled;
cebe64e @ariya Config to limit the disk cache size.
authored
136 int m_maxDiskCacheSize;
a445b2d @execjosh Migrate network access manager settings to PhantomConfig
execjosh authored
137 bool m_ignoreSslErrors;
059e725 @ariya Rename option/config to localToRemoteUrlAccess(Enabled).
authored
138 bool m_localToRemoteUrlAccessEnabled;
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
139 QString m_outputEncoding;
d91c5af @jgornick Added ability to specify SOCKS5 proxy type.
jgornick authored
140 QString m_proxyType;
5441f51 @execjosh Migrate proxy settings to PhantomConfig
execjosh authored
141 QString m_proxyHost;
142 int m_proxyPort;
7615582 @hownowstephen Proxy authentication support.
hownowstephen authored
143 QString m_proxyAuthUser;
144 QString m_proxyAuthPass;
3c790d8 @execjosh Migrate command-line argument processing logic to Config
execjosh authored
145 QStringList m_scriptArgs;
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
146 QString m_scriptEncoding;
3c790d8 @execjosh Migrate command-line argument processing logic to Config
execjosh authored
147 QString m_scriptFile;
148 QString m_unknownOption;
149 bool m_versionFlag;
af71868 @mintbridge add basic http auth support to networkaccessmanager, and add the abil…
mintbridge authored
150 QString m_authUser;
151 QString m_authPass;
610fb41 @lfranchi Add support for remotely debugging a script.
lfranchi authored
152 bool m_debug;
153 int m_remoteDebugPort;
e88e008 @jonleighton Add option to specify whether or not the remote debugger should autorun.
jonleighton authored
154 bool m_remoteDebugAutorun;
c12f1aa @ariya Control web security setting.
authored
155 bool m_webSecurityEnabled;
1250432 @execjosh Add conventional "--help" option
execjosh authored
156 bool m_helpFlag;
a75f7c9 @execjosh Create PhantomConfig and migrate output and script encoding settings
execjosh authored
157 };
158
ad53b9b @execjosh Rename "PhantomConfig" to "Config"
execjosh authored
159 #endif // CONFIG_H
Something went wrong with that request. Please try again.