Commit Graph

4112 Commits

Author SHA1 Message Date
Florian Bruhin
994546f04d Use an OrderedDict for WebHistory.
We need the URLs in the correct order to get the newest items anyways.
2015-03-13 19:44:15 +01:00
Florian Bruhin
94f694bd77 Add an utils.newest_slice.
This takes an iterable and uses itertools.islice to get the n newest elements
from it.
2015-03-13 19:25:48 +01:00
Florian Bruhin
96da7d9fe6 Fix lint. 2015-03-13 16:26:27 +01:00
Florian Bruhin
74892ac8e4 Initialize completions lazily and only once.
Before, we initialized the completions once for every window spawned, which was
a waste of CPU-time and RAM.

Now we only initialize them once, when the user uses the completion for the
first time.
2015-03-13 16:25:13 +01:00
Florian Bruhin
cef49864d9 Refactor websettings and save/restore defaults.
This makes qutebrowser.config.websettings much easier to understand, and saves
all defaults so it can restore them properly when a setting is set to an empty
string.

Before, when we set the fonts to empty strings instead of the true default, in
some cases anti-aliasing was broken.

Fixes #549.
2015-03-13 10:03:17 +01:00
Florian Bruhin
ccce2eddad Add logging for websettings init.
See #549.
2015-03-12 22:41:12 +01:00
Florian Bruhin
389feab1df Make sure args are not int in new_item().
Otherwise we would construct a QStandardItem with the
QStandardItem(int rows, int columns = 1) constructor, which will most likely
not do what we want.
2015-03-12 15:35:53 +01:00
Florian Bruhin
dbd121a079 Set data of existing item. 2015-03-12 15:34:32 +01:00
Florian Bruhin
97dd86735a Improve types of history model values.
- HistoryItem.atime now always should be an int/float.
- The data for the sort role should also be an int, not a string.
  A float would also work, but maybe be slower for no real benefit.
2015-03-12 15:34:32 +01:00
Florian Bruhin
8023b1456d Make it possible to configure the timestamp format. 2015-03-12 15:25:39 +01:00
Florian Bruhin
7a28b6c821 Fix lint. 2015-03-12 14:55:54 +01:00
Florian Bruhin
299dbfa56a history: Remove unneeded _old_hit and _old_miss.
The need for those were removed in #548.
2015-03-12 14:46:49 +01:00
Jimmy
61e732f217 history: simplify 2015-03-12 21:35:56 +13:00
Jimmy
1efe18ecc6 Prevent duplicates in history completion.
Two things here. One is to use `WebHistory._new_history` only as a to-save
queue, so we now add entries to `_old_urls` when they are first created and
can now no longer iterate of `_new_history` in `__iter__()`.

Second is to stop blindly tacking new history entries on the end of the
history completion model. It does involve iterating over the model to find the
existing entry but we only do that if we know the duplicate is there, which is
fast to check.

This also ads another point of mutation to the history completion model which
may prove problematic if it leads to more segfaults.
2015-03-12 20:15:03 +13:00
Jimmy
734268187c Clean up incomprehensible comment. 2015-03-12 20:12:59 +13:00
Florian Bruhin
9ee19be70d Convert the atime to float in HistoryEntry. 2015-03-12 08:07:40 +01:00
Florian Bruhin
0b975db4dd Refactor how completions are organized. 2015-03-11 23:07:58 +01:00
Florian Bruhin
34b24aafa8 Fix lint 2015-03-11 22:22:49 +01:00
Florian Bruhin
fe4f32606d Use CompletionFilterModel's sort implementation. 2015-03-11 21:50:16 +01:00
Jimmy
834832e3ba Web history changed signal now emits the new entry.
Each new HistoryEntry is emitted after being added to the global history
store. Current members of the HistoryEntry are `url` and `atime`. `title`
should be coming soon.
2015-03-11 21:50:16 +01:00
Jimmy
59948a038c Add new UrlCompletion model which includes web history and quickmarks.
I went to some effort to avoid duplipcating code which which leads to some
arguably ugly class method calling.
2015-03-11 21:50:16 +01:00
Jimmy
f6a7ef3985 Add url history completion for open.
Adds a basic completion model implementation around the global browser
history and registers that for the open command.

Modifies WebHistory to add an __iter__ method and to use a dict instead of a
set to store an entire HistoryEntry for each archived item instead of just the
URL. Brief tests showed that the lookup time for set and dict are very
similar. They are at least on the same order of magnitude. Testing membership
of a list on the other hand, as was the case before a set was used, was four
orders of magnitude slower on my machine.
2015-03-11 21:50:16 +01:00
Florian Bruhin
0778e33142 Merge branch 'error800-master' 2015-03-11 21:49:49 +01:00
Florian Bruhin
4439ef8ddd Regenerate docs 2015-03-11 21:49:41 +01:00
Florian Bruhin
fb85a279f4 Merge branch 'master' of https://github.com/error800/qutebrowser into error800-master 2015-03-11 21:49:27 +01:00
Florian Bruhin
e8e6d8409b Adjust pylint exceptions. 2015-03-11 20:14:39 +01:00
Florian Bruhin
cd14ae2f1f Merge branch 'flvi0-master' 2015-03-11 17:49:14 +01:00
Florian Bruhin
1a4f7170a5 Regenerate docs 2015-03-11 17:49:07 +01:00
Florian Bruhin
12a82eb371 Add an unittest for foo::bar URLs.
See #544, #546.
2015-03-11 17:48:24 +01:00
Patric Schmitz
4fa64350ca Handle URLs with double-colon at the beginning as search strings
Closes #544. We might also merge #542 now.
2015-03-11 17:35:32 +01:00
error800
94666fe979 Removed default search engines. Closes #533. 2015-03-11 11:25:50 +01:00
Florian Bruhin
0f5391c4fa Scroll completion to top when showing it.
See #531.
2015-03-11 07:50:51 +01:00
Florian Bruhin
1b879faf84 completion: Highlight text case-insensitively.
See #531.
2015-03-11 07:50:45 +01:00
Florian Bruhin
5b4f6d39c2 Add a dumb sorting option to CompletionFilterModel.
This makes it possible to use Qt's QSortFilterProxyModel::lessThan option for
completions where it doesn't make sense to priorize matches starting with the
entered string, e.g. for URLs. In return, we get a *much* better performance
(several seconds when opening the completion).

See #531.
2015-03-11 07:50:33 +01:00
Florian Bruhin
5ab052c40f Regenerate docs. 2015-03-10 23:25:37 +01:00
Florian Bruhin
1ead66a4d5 quickmarks: Ignore empty and whitespace-only lines. 2015-03-10 23:25:02 +01:00
Florian Bruhin
2b06d4e684 Add documentation about how to write userscripts.
Closes #450.
2015-03-10 23:22:53 +01:00
Florian Bruhin
acc33b4f91 Add a -f/--force argument to :bind. 2015-03-10 22:32:11 +01:00
Florian Bruhin
aca44da26e Force saving with :save even w/o auto-save-config. 2015-03-10 22:24:34 +01:00
Florian Bruhin
596bff0772 Don't try to add tab repr in TabDeletedError.
This will always fail with another RuntimeError...
2015-03-10 22:16:41 +01:00
Florian Bruhin
d87a1bb2b4 Add a hints -> scatter option.
This is enabled by default to keep the same default behaviour which is like
Vimium - mixing e.g. single-char letters and double-char letters, and
scattering/shuffling the labels to have an uniform hint key distribution.

If disabled, the behaviour is more similiar to dwb, which has a fixed hint
string length and simply fills the string starting with the first possible hint
char.
2015-03-10 21:19:47 +01:00
Florian Bruhin
2f0522ebb0 Add a --rapid option to :hint, remove rapid target
This makes it possible to use rapid hinting for the run/hover/userscript/spawn
targets as well, and makes more sense anyways.
2015-03-10 19:40:30 +01:00
Florian Bruhin
4b6d49e926 Make QSslError hashable for Qt <= 5.4.
PyQt uses qHash() for __hash__, and qHash for QSslError was added with Qt 5.4.

This means 2da45e98ca raised TypeError there as
QSslError is unhashable.

For those older Qt versions, we implement __hash__ ourselves which does about
the same thing as Qt does, combining the DER (binary) representation of the
certificate and the error() (which is just a QEnum, hashable as int).
2015-03-10 08:29:56 +01:00
Florian Bruhin
2da45e98ca Auto-handle equal SSL errors for the same host.
For every (scheme, host, port) tuple, we save all SSL errors we asked the user
about, and if everything matches (scheme, host, port, error, certificate), we
don't ask the user again.

Fixes #422.
2015-03-10 07:58:40 +01:00
Florian Bruhin
8307b546b7 Adjust prompt size hint based on content.
See #26.
Fixes #506.

Related to 06cc982ab5.
2015-03-09 19:35:50 +01:00
Florian Bruhin
9ffb30a16f Ignore RuntimeError in mouserelease_insertmode.
It seems when clicking certain elements, the webview can get deleted before the
singleShot QTimer will activate.
2015-03-09 11:49:01 +01:00
Florian Bruhin
e78fa431c5 Hide Qt warning when aborting download reply. 2015-03-09 07:49:02 +01:00
Florian Bruhin
6a16875f50 Fix retrying of downloads from closed tabs.
Fixes #502.
2015-03-09 07:39:40 +01:00
Florian Bruhin
bfc114ae35 Fix lint 2015-03-08 23:15:35 +01:00
Florian Bruhin
bd3d091318 pylint/openencoding: Fix checking of nonconst mode 2015-03-08 22:31:29 +01:00