Commit Graph

65 Commits

Author SHA1 Message Date
Damien Elmes
dc6ebca944 filter middle click pastes 2018-03-02 11:16:02 +10:00
Damien Elmes
118326df1e remove format literals so we can support python 3.5 2018-01-16 16:07:30 +10:00
Damien Elmes
41205bd5ca allow user to override scaling
which may help wth issues like
https://anki.tenderapp.com/discussions/beta-testing/918-text-size-in-ubuntu-1710
and
https://anki.tenderapp.com/discussions/ankidesktop/25708-anki-with-high-dpi-screen
2017-11-27 11:01:15 +10:00
Damien Elmes
1d3e5787a2 separate basic and extended paste modes
- basic mode is the default, and includes only HTML elements that can be
added/edited easily with the default editor
- extended mode is enabled by holding down shift and includes a bunch of
other HTML elements
2017-10-25 20:20:28 +10:00
Damien Elmes
33c5b5f9e7 remove lodpi hack, don't assume physical DPI is always 72 2017-10-05 16:42:46 +10:00
Damien Elmes
e1a4c52175 pass opts to main window; force zoom factor to 1 on lodpi 2017-10-03 12:12:57 +10:00
Damien Elmes
d530134218 option to disable qt's hidpi scaling
https://anki.tenderapp.com/discussions/beta-testing/765-problem-with-the-ui-of-anki
2017-10-02 16:26:23 +10:00
Damien Elmes
a4b45af5a9 fix scrollbar appearing in toolbar
https://anki.tenderapp.com/discussions/beta-testing/675-anki-210-beta-10/page/2#comment_43239350
2017-08-28 21:15:38 +10:00
Damien Elmes
a8ce74a784 compensate for qt's integer scaling on windows
fixes

https://anki.tenderapp.com/discussions/beta-testing/687-high-resolution-display-scaling-issue
2017-08-15 14:47:03 +10:00
Damien Elmes
ba16b8714b remove images and move away from qt resources
- the bulk of image use is in webviews, so we move almost all used
images to web/imgs, as it's easier to manage
- change AnkiWebView to always use the local media server as a base, as
much of the UI has come to depend on it
- remove images from a few areas, as they felt dated
- delete a bunch of unused images
- href=# links were being opened in a browser window, so the code now
ignores them - the HTML should really be updated to return false in the
onclick handler
- update a few icons
2017-08-11 20:59:43 +10:00
Damien Elmes
f3f90842dc move the inline css and some more js into separate files
- stdHtml() css= arg now takes a list of files like js=
- the files are loaded in the head of the document so that styling
that comes later in the document can easily override it

fixes:
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7/page/1#comment_43164447
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7#comment_43177130
2017-08-10 19:02:32 +10:00
Damien Elmes
c8e8225395 remove unused bodyClass arg 2017-08-10 18:10:50 +10:00
Damien Elmes
a57b913450 opt in to qt's full hidpi support
doesn't seem to affect the webviews on Linux, so we need to keep the old
zoom code around for now
2017-08-10 15:02:46 +10:00
Damien Elmes
c74cbf6108 fix media server port allocation
the old code was allowing the main thread to read .port before it had
been updated, and was binding to sockets that were already in use on
Windows. instead, we use a system-assigned free port and block the main
thread until it's been allocated
2017-08-08 14:56:34 +10:00
Damien Elmes
538119201c ensure deferred js is executed on the correct page
setHtml() and deferred js now share a single queue, to ensure that js
calls are delivered to the correct page

also remove the onLoadFinished hook, which is no longer used
2017-08-07 16:01:35 +10:00
Damien Elmes
9c63714e80 delay setHtml() until previous page has fully loaded
based on 0241eb70dc
2017-08-07 15:15:31 +10:00
Damien Elmes
b0213b9fd7 ignore webchannel events received after webview deleted
thanks to David for the report
2017-08-07 14:51:42 +10:00
Damien Elmes
a11035b2fa Revert "fix TypeError: channel.execCallbacks[message.id] is not a function"
This reverts commit 331239de05.

This commit caused the blur event from the editor to fire after the saveNow()
callback had run, which broke the reviewer when returning from editcurrent.
Reverting for now, as the actual error is harmless AFAICT.
2017-08-06 15:12:28 +10:00
Damien Elmes
331239de05 fix TypeError: channel.execCallbacks[message.id] is not a function
we need to avoid calling setHtml() until the bridge command has
had a chance to pass its return code back down the channel
2017-08-06 13:46:18 +10:00
Damien Elmes
718b4b35d1 don't translate js console msgs 2017-08-06 13:10:51 +10:00
Damien Elmes
37d3996be0 move height resizing to webview; remove onLoaded from toolbar/reviewer 2017-08-02 16:22:54 +10:00
Damien Elmes
7d14a96889 automatically defer eval() calls until DOM loaded 2017-08-02 16:17:08 +10:00
Damien Elmes
66500f5262 move webview js into separate file 2017-08-01 17:04:55 +10:00
Damien Elmes
cd76281695 avoid errors caused by calling setHtml() before previous page loaded 2017-08-01 14:30:04 +10:00
Damien Elmes
7ad6966943 split js code out into separate files, mathjax improvements
- js code that was previously bundled in .py files is now in the
web folder
- add helpers to create links to bundled files, and update
stdHtml() to accept a list of javascript files to include
instead of text
- render MathJax in card layout and preview screens - these should be
updated in the future to update the document dynamically like the
reviewer does
- start media server earlier so it can be used to serve content for
the toolbar, etc
- work around a bug in WebEngine on Windows that could cause the
media server to hang
2017-07-28 16:35:45 +10:00
Damien Elmes
d99dcaafdc don't open separate browser window on iframe load
https://anki.tenderapp.com/discussions/beta-testing/627-anki-210-beta-1#comment_43008395
2017-07-17 12:40:38 +10:00
Damien Elmes
ea5f2bb0ef don't need to set bgcol when the window is transparent 2017-06-24 19:15:14 +10:00
Damien Elmes
7bd33242cf disable pinch to zoom gesture 2017-06-23 14:34:56 +10:00
Damien Elmes
a3bdd04d42 set bgcol in ankiwebview 2017-06-23 13:07:59 +10:00
Damien Elmes
59f877737e start webview as transparent to reduce flicker 2017-06-22 18:01:01 +10:00
Damien Elmes
7d86984a12 turn off webview cache to reduce memory footprint 2017-06-22 17:06:33 +10:00
Damien Elmes
34dcf64d76 another attempt at fixing key handling
we can't use an event filter on the top level webview, because it
ignores the return value of the filter and leads to Anki thinking
keys have been pressed twice

and if we use an event filter on the focusProxy(), the
keypress/release events are sent even when a text field is currently
focused, leading to shortcuts being triggered when typing in the answer

to solve this, we move away from handling the key press events
directly, and instead install shortcuts for the events we want to
trigger. in addition to the global shortcuts, each state can install
its own shortcuts, which we remove when transitioning to a new state

also remove the unused canFocus argument to ankiwebview, and accept a parent
argument as required by the code in forms/
2017-06-22 16:39:31 +10:00
Damien Elmes
22f2fdf7d6 fix esc key in type answer field
without the change, the selection disappears but typed characters
still go to the input area
2017-06-22 15:10:47 +10:00
Damien Elmes
76e508e25d various key handling fixes
- key presses while a webview is focused no longer make it to the
main window's keyPressEvent() routine, so AnkiWebView now uses its
event filter to pass the key events to the main window
- move the shared key handling out of keyPressEvent into
globalKeyHandler()
- make sure all key handling routines return true or false to
indicate if an event was handled or not
- remove focus when esc hit in the main window, to retain old
behaviour of allowing esc to clear focus from the type answer box
2017-06-06 15:56:21 +10:00
Damien Elmes
a44dc7f174 prevent backspace key from going back a page 2017-01-17 13:39:38 +10:00
Damien Elmes
a172af11a1 use in-memory cache for webengine
no need to persist things to disk, as we have a local copy in most
cases anyway
2017-01-08 20:02:49 +10:00
Damien Elmes
f465dbd8ad use helvetica on mac 2016-07-26 10:34:16 +10:00
Damien Elmes
37bac3979c select all shortcut in fields 2016-07-14 11:56:18 +10:00
Damien Elmes
8fdda2bb9c tweak win button size 2016-07-12 16:40:13 +10:00
Damien Elmes
74de1face7 specify font size again on osx
we lose the native button appearance, but the text is too small to
read on OSX otherwise
2016-07-12 16:28:14 +10:00
Damien Elmes
166c6f4b3c remove debug statement 2016-07-12 13:43:21 +10:00
Damien Elmes
46dae2507b tweaks to UI font on win/lin 2016-07-08 16:17:06 +10:00
Damien Elmes
7d0eb6dd39 ignore copy/paste shortcuts except on mac 2016-07-07 23:34:19 +10:00
Damien Elmes
258a10edc7 add titles to various webviews to make them easy to locate 2016-07-07 17:23:13 +10:00
Damien Elmes
2d5affd3f2 Revert "hack around broken qwebchannel behaviour"
This reverts commit 447718c605.
2016-07-05 12:26:08 +10:00
Damien Elmes
447718c605 hack around broken qwebchannel behaviour
https://bugreports.qt.io/browse/QTBUG-53411
2016-07-04 16:25:24 +10:00
Damien Elmes
704610ef8f remove button styling
qt5.7 loses system styling when zoom applied
2016-07-04 16:24:43 +10:00
Damien Elmes
eb3208e1e7 QKeySequence.Cancel is not in 5.5 2016-06-28 15:52:13 +10:00
Damien Elmes
8a7107ad8e tweak button appearance on osx 2016-06-22 14:43:59 +10:00
Damien Elmes
4e2bd3f739 resize toolbars to fit content 2016-06-07 14:27:33 +10:00