Simplify some config types by using valid_values.
This commit is contained in:
parent
c986bde170
commit
d558155620
@ -218,12 +218,23 @@ General/miscellaneous options.
|
||||
=== ignore-case
|
||||
Whether to find text on a page case-insensitively.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+: Search case-insensitively
|
||||
* +false+: Search case-sensitively
|
||||
* +smart+: Search case-sensitively if there are capital chars
|
||||
|
||||
Default: +pass:[smart]+
|
||||
|
||||
[[general-wrap-search]]
|
||||
=== wrap-search
|
||||
Whether to wrap finding text to the top when arriving at the end.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[general-startpage]]
|
||||
@ -248,6 +259,11 @@ Default: +pass:[naive]+
|
||||
=== auto-save-config
|
||||
Whether to save the config automatically on quit.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[general-editor]]
|
||||
@ -268,6 +284,11 @@ Default: +pass:[utf-8]+
|
||||
=== private-browsing
|
||||
Do not record visited pages in the history or store web page icons.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[general-developer-extras]]
|
||||
@ -276,12 +297,22 @@ Enable extra tools for Web developers.
|
||||
|
||||
This needs to be enabled for `:inspector` to work and also adds an _Inspect_ entry to the context menu.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[general-print-element-backgrounds]]
|
||||
=== print-element-backgrounds
|
||||
Whether the background color and images are also drawn when the page is printed.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[general-xss-auditing]]
|
||||
@ -290,12 +321,22 @@ Whether load requests should be monitored for cross-site scripting attempts.
|
||||
|
||||
Suspicious scripts will be blocked and reported in the inspector's JavaScript console. Enabling this feature might have an impact on performance.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[general-site-specific-quirks]]
|
||||
=== site-specific-quirks
|
||||
Enable workarounds for broken sites.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[general-default-encoding]]
|
||||
@ -355,12 +396,22 @@ Default: +pass:[never]+
|
||||
=== display-statusbar-messages
|
||||
Whether to display javascript statusbar messages.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[ui-zoom-text-only]]
|
||||
=== zoom-text-only
|
||||
Whether the zoom factor on a frame applies only to the text or to all content.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[ui-frame-flattening]]
|
||||
@ -369,6 +420,11 @@ Whether to expand each subframe to its contents.
|
||||
|
||||
This will flatten all the frames to become one scrollable page.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[ui-user-stylesheet]]
|
||||
@ -390,6 +446,11 @@ Settings related to the network.
|
||||
=== do-not-track
|
||||
Value to send in the `DNT` header.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[network-accept-language]]
|
||||
@ -421,12 +482,23 @@ Default: +pass:[system]+
|
||||
=== ssl-strict
|
||||
Whether to validate SSL handshakes.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
* +ask+
|
||||
|
||||
Default: +pass:[ask]+
|
||||
|
||||
[[network-dns-prefetch]]
|
||||
=== dns-prefetch
|
||||
Whether to try to pre-fetch DNS entries to speed up browsing.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
== completion
|
||||
@ -436,6 +508,11 @@ Options related to completion and command history.
|
||||
=== show
|
||||
Whether to show the autocompletion window.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[completion-height]]
|
||||
@ -456,12 +533,22 @@ Default: +pass:[100]+
|
||||
=== quick-complete
|
||||
Whether to move on to the next part when there's only one possible completion left.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[completion-shrink]]
|
||||
=== shrink
|
||||
Whether to shrink the completion to be smaller than the configured size if there are no scrollbars.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
== input
|
||||
@ -477,18 +564,33 @@ Default: +pass:[500]+
|
||||
=== insert-mode-on-plugins
|
||||
Whether to switch to insert mode when clicking flash and other plugins.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[input-auto-leave-insert-mode]]
|
||||
=== auto-leave-insert-mode
|
||||
Whether to leave insert mode if a non-editable element is clicked.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[input-auto-insert-mode]]
|
||||
=== auto-insert-mode
|
||||
Whether to automatically enter insert mode if an editable element is focused after page load.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[input-forward-unbound-keys]]
|
||||
@ -509,12 +611,22 @@ Enables or disables the Spatial Navigation feature
|
||||
|
||||
Spatial navigation consists in the ability to navigate between focusable elements in a Web page, such as hyperlinks and form controls, by using Left, Right, Up and Down arrow keys. For example, if a user presses the Right key, heuristics determine whether there is an element he might be trying to reach towards the right and which element he probably wants.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[input-links-included-in-focus-chain]]
|
||||
=== links-included-in-focus-chain
|
||||
Whether hyperlinks should be included in the keyboard focus chain.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
== tabs
|
||||
@ -524,6 +636,11 @@ Configuration of the tab bar.
|
||||
=== background-tabs
|
||||
Whether to open new tabs (middleclick/ctrl+click) in background.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[tabs-select-on-remove]]
|
||||
@ -580,18 +697,33 @@ Default: +pass:[ignore]+
|
||||
=== auto-hide
|
||||
Hide the tabbar if only one tab is open.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[tabs-wrap]]
|
||||
=== wrap
|
||||
Whether to wrap when changing tabs.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[tabs-movable]]
|
||||
=== movable
|
||||
Whether tabs should be movable.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[tabs-close-mouse-button]]
|
||||
@ -623,6 +755,11 @@ Default: +pass:[north]+
|
||||
=== show-favicons
|
||||
Whether to show favicons in the tab bar.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[tabs-width]]
|
||||
@ -647,6 +784,11 @@ Default: +pass:[3]+
|
||||
=== tabs-are-windows
|
||||
Whether to open windows instead of tabs.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
== storage
|
||||
@ -696,6 +838,11 @@ Default: empty
|
||||
=== offline-storage-database
|
||||
Whether support for the HTML 5 offline storage feature is enabled.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[storage-offline-web-application-storage]]
|
||||
@ -706,12 +853,22 @@ An application cache acts like an HTTP cache in some sense. For documents that u
|
||||
|
||||
The feature is described in details at: http://dev.w3.org/html5/spec/Overview.html#appcache
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[storage-local-storage]]
|
||||
=== local-storage
|
||||
Whether support for the HTML 5 local storage feature is enabled.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[storage-cache-size]]
|
||||
@ -727,12 +884,22 @@ Loaded plugins/scripts and allowed actions.
|
||||
=== allow-images
|
||||
Whether images are automatically loaded in web pages.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[content-allow-javascript]]
|
||||
=== allow-javascript
|
||||
Enables or disables the running of JavaScript programs.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[content-allow-plugins]]
|
||||
@ -741,36 +908,66 @@ Enables or disables plugins in Web pages.
|
||||
|
||||
Qt plugins with a mimetype such as "application/x-qt-plugin" are not affected by this setting.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[content-javascript-can-open-windows]]
|
||||
=== javascript-can-open-windows
|
||||
Whether JavaScript programs can open new windows.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[content-javascript-can-close-windows]]
|
||||
=== javascript-can-close-windows
|
||||
Whether JavaScript programs can close windows.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[content-javascript-can-access-clipboard]]
|
||||
=== javascript-can-access-clipboard
|
||||
Whether JavaScript programs can read or write to the clipboard.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[content-local-content-can-access-remote-urls]]
|
||||
=== local-content-can-access-remote-urls
|
||||
Whether locally loaded documents are allowed to access remote urls.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[content-local-content-can-access-file-urls]]
|
||||
=== local-content-can-access-file-urls
|
||||
Whether locally loaded documents are allowed to access other local urls.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[content-cookies-accept]]
|
||||
@ -788,6 +985,11 @@ Default: +pass:[default]+
|
||||
=== cookies-store
|
||||
Whether to store cookies.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[content-host-block-lists]]
|
||||
@ -838,12 +1040,22 @@ Default: +pass:[asdfghjkl]+
|
||||
=== uppercase
|
||||
Make chars in hint strings uppercase.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[hints-auto-follow]]
|
||||
=== auto-follow
|
||||
Whether to auto-follow a hint if there's only one left.
|
||||
|
||||
Valid values:
|
||||
|
||||
* +true+
|
||||
* +false+
|
||||
|
||||
Default: +pass:[true]+
|
||||
|
||||
[[hints-next-regexes]]
|
||||
|
@ -246,6 +246,8 @@ class Bool(BaseType):
|
||||
_BOOLEAN_STATES = {'1': True, 'yes': True, 'true': True, 'on': True,
|
||||
'0': False, 'no': False, 'false': False, 'off': False}
|
||||
|
||||
valid_values = ValidValues('true', 'false')
|
||||
|
||||
def transform(self, value):
|
||||
if not value:
|
||||
return None
|
||||
@ -261,14 +263,13 @@ class Bool(BaseType):
|
||||
if value.lower() not in Bool._BOOLEAN_STATES:
|
||||
raise ValidationError(value, "must be a boolean!")
|
||||
|
||||
def complete(self):
|
||||
return [('true', ''), ('false', '')]
|
||||
|
||||
|
||||
class BoolAsk(Bool):
|
||||
|
||||
"""A yes/no/ask question."""
|
||||
|
||||
valid_values = ValidValues('true', 'false', 'ask')
|
||||
|
||||
def transform(self, value):
|
||||
if value.lower() == 'ask':
|
||||
return 'ask'
|
||||
@ -281,9 +282,6 @@ class BoolAsk(Bool):
|
||||
else:
|
||||
super().validate(value)
|
||||
|
||||
def complete(self):
|
||||
return [('true', ''), ('false', ''), ('ask', '')]
|
||||
|
||||
|
||||
class Int(BaseType):
|
||||
|
||||
@ -562,11 +560,6 @@ class ColorSystem(BaseType):
|
||||
('hsl', "Interpolate in the HSL color system."))
|
||||
|
||||
def validate(self, value):
|
||||
if not value:
|
||||
if self._none_ok:
|
||||
return
|
||||
else:
|
||||
raise ValidationError(value, "may not be empty!")
|
||||
super().validate(value.lower())
|
||||
|
||||
def transform(self, value):
|
||||
@ -1137,14 +1130,9 @@ class AutoSearch(BaseType):
|
||||
|
||||
def __init__(self, none_ok=False):
|
||||
super().__init__(none_ok)
|
||||
self.booltype = Bool()
|
||||
self.booltype = Bool(none_ok=none_ok)
|
||||
|
||||
def validate(self, value):
|
||||
if not value:
|
||||
if self._none_ok:
|
||||
return
|
||||
else:
|
||||
raise ValidationError(value, "may not be empty!")
|
||||
if value.lower() in ('naive', 'dns'):
|
||||
pass
|
||||
else:
|
||||
@ -1290,6 +1278,11 @@ class IgnoreCase(Bool):
|
||||
|
||||
"""Whether to ignore case when searching."""
|
||||
|
||||
valid_values = ValidValues(('true', "Search case-insensitively"),
|
||||
('false', "Search case-sensitively"),
|
||||
('smart', "Search case-sensitively if there "
|
||||
"are capital chars"))
|
||||
|
||||
def transform(self, value):
|
||||
if value.lower() == 'smart':
|
||||
return 'smart'
|
||||
@ -1302,12 +1295,6 @@ class IgnoreCase(Bool):
|
||||
else:
|
||||
super().validate(value)
|
||||
|
||||
def complete(self):
|
||||
return [('true', 'Search case-insensitively'),
|
||||
('false', 'Search case-sensitively'),
|
||||
('smart', 'Search case-sensitively if there are capital '
|
||||
'chars')]
|
||||
|
||||
|
||||
class NewInstanceOpenTarget(BaseType):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user