A better solution is to use QSocketNotifier and os.wakeup_fd to get notified
about new signals.
Thanks to Yuya Nishihara / TortoiseHG for the hint!
Fixes#555.
Before we limited the history items we could simply call WebHistory's
historyContains before iterating through all items in the history completion.
Now however it's possible an item is in the real WebHistory, but not actually
in the completion - so we always have to check the whole completion.
Before, if an URL was present early in the history and then again later, we
didn't move it to the end of the OrderedDict. This means it won't be loaded in
the completion.
Before, the item_added signal was emitted *after* an item was added, which
means the on_history_item_added slot always assumed the item already is in the
history.
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.
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.
Otherwise we would construct a QStandardItem with the
QStandardItem(int rows, int columns = 1) constructor, which will most likely
not do what we want.
- 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.
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.
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.