2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
Commit Graph

1263 Commits

Author SHA1 Message Date
Tigran Aivazian
a0cfcba266 Merge remote-tracking branch 'upstream/master' 2012-09-25 22:04:50 +01:00
{Qingping,Dave} Hou
3fd3ff3680 Merge pull request #319 from dpavlin/crengine-upstream
bump crengine version to cr3.0.57-15
2012-09-25 13:41:54 -07:00
Dobrica Pavlinusic
a9bff12d8e version: cr3.0.57-15
This might help fix #316 since upstream has cache changes
2012-09-25 21:54:04 +02:00
Dobrica Pavlinusic
d936f86f04 fix shortcuts beyond last one 2012-09-25 21:16:03 +02:00
Dobrica Pavlinusic
88828fd478 check if there is at least one page link before drawing shortcuts 2012-09-25 19:28:16 +02:00
Dobrica Pavlinusic
ee7b0ca41e ignore all non-page links 2012-09-25 19:04:46 +02:00
Dobrica Pavlinusic
fc22f5ed93 check if getPageLinks returned links before use 2012-09-25 18:31:42 +02:00
Tigran Aivazian
df65245e70 Bug in CREReader:ZipContentExt().
Even after restoring to the previous version, this function had a slight
bug that would cause a crash on valid .zip files (e.g.
mupdf-thirdparty.zip in kindlepdfviewer make tree). The reason is
because the value of s may be not nil, but the string.match() would
return nil and so string.lower() would get nil as an argument and crash.
So, we have to guard against this carefully.
2012-09-25 17:06:49 +01:00
Tigran Aivazian
bc3c3f6a38 Oops, left the pointer to emulator binary, sorry. 2012-09-25 16:56:42 +01:00
Tigran Aivazian
96ac2bef8d Simplify the calling of filechooser.
The FileChooser:choose() method returns only a single argument,
so we can get rid of the second return value in reader.lua and
simplify the code a bit.
2012-09-25 16:54:37 +01:00
Tigran Aivazian
67efe2d4ca Use util.isEmulated for screenshot. 2012-09-25 15:01:35 +01:00
Tigran Aivazian
9e3ebe9496 Show the real time, not the cpu usage spent on making screenshot. 2012-09-25 14:51:43 +01:00
Tigran Aivazian
37dc2d9530 Get rid of the compilation warning. 2012-09-25 14:46:47 +01:00
Dobrica Pavlinusic
16c5171432 removed refresh which will be called after anyway 2012-09-25 15:39:20 +02:00
Dobrica Pavlinusic
01b1f5ba66 move 30 link shortcuts around using fireway 2012-09-25 15:36:13 +02:00
Dobrica Pavlinušić
4d09763224 Merge pull request #315 from tigran123/master
Pulling bits from kpdfdjview branch (plus other fixes)
2012-09-25 06:11:02 -07:00
Dobrica Pavlinusic
cc222c6525 fix DOT and SYM bindings, added ENTER 2012-09-25 15:00:58 +02:00
Tigran Aivazian
1a119660ea Display better messages on failing to open a file.
1. Usually the error messages from the :open() method are too
long (except for crereader files) and won't be shown.
So, I extract the first 30 bytes from the error message (if there is
one) and show that. But if there is no error message then just display
the generic "Error opening document ". Otherwise, as was currently the
case, the error message is present but is too long and so we get
absolutely nothing, not even a generic one. But in the Debug output we
can show the entire error message as there is no restriction on the
length.
2. Use showInfoMsgWithDelay() instead of InfoMessage:show() followed by
util.sleep().
3. Remove the dependency on keys.lua. This was needed when we were
detecting emulation by comparing the physical value of some KEY_ but now
we use util.isEmulated() so there is no need for it anymore.
2012-09-25 13:48:21 +01:00
Tigran Aivazian
416c62ca61 Tidy up debug support.
1. Make "-d" switch passed to reader.lua enable all debugging
2. Enable debugging for now (development stage) to preserve the current
behaviour. But for the production release I advise to: a) disable it by
not passing "-d" and b) redirect standard output (not just standard
error) of reader.lua to crash.log in kpdf.sh
3. Comment out debug printf()s in pdf.c
2012-09-25 13:11:21 +01:00
Tigran Aivazian
385f74222a Create static directories at build, not runtime.
Instead of calling lfs.mkdir() to create "./history" and "./screenshots"
at runtime it is easier to create them at package build time.
I hesitated whether to add "./clipboard" to this list but decided
against it as we can perhaps change current directory and then
all the code manipulating clipboard would break, so I left it as is.
2012-09-25 13:00:34 +01:00
Tigran Aivazian
ba1e739543 Guard against trying to see "Unpacked size" for corrupt zip files.
Print "Invalid" in the "Unpacked" field for corrupt zip files.
More generally, the FormatSize() function returns the string "Invalid"
if whatever passed to it is not a number.
2012-09-25 12:31:11 +01:00
Tigran Aivazian
b297ee2c71 Use generic FileExists()
This change should have been in the previous commit, sorry.
2012-09-25 12:24:48 +01:00
Tigran Aivazian
2fdecb7b40 Don't assert() around io.popen() and use generic FileExists(). 2012-09-25 12:19:34 +01:00
Tigran Aivazian
ac46f7237f Fix a typo "Q to E" -> "Q to P" in Active Keys helppage. 2012-09-25 12:11:11 +01:00
Tigran Aivazian
504425cd89 Fix for the issue #314 introduced by a commit in #310
When I rewrote the function CREReader:ZipContentExt() I lost
the code path leading to "Error unzipping file." message.
This was now restored, plus two required changes:
1. There is no need to surround io.popen() with assert() as it
never fails, not even if the command is non-existent. Besides,
even if it did, crashing the whole viewer just because for
some reason we can't unzip the file is not a good idea.
2. The "while tmp" after tmp=assert() assignment is meaningless.
Even after removing assert() it is still meaningless because io.popen()
can never return nil, oddly enough.
2012-09-25 11:55:16 +01:00
Tigran Aivazian
864be87fc2 Tidy up BatteryLevel() function.
1. Remove assert() around io.popen() as this function never fails, even
when opening a pipe to a non-existent program.
2. Remove the second assert() as well, because it is not wise to fail the whole
application just because we don't know or cannot ascertain the battery
level.
3. Guard against the failure of gasgauge-info (e.g. on emulator where it
does not exist, so, effectively "fails") by checking what we read from
the pipe and return "?" if need be.
2012-09-25 11:08:06 +01:00
Tigran Aivazian
06a0b27664 Allow clearing both internal and document caches via Menu
Bind the key "C" in Menu to clear internal tile cache and key "D" to
clear the document cache.
2012-09-25 10:55:31 +01:00
Tigran Aivazian
16623b5b08 Cleanup of djvu.c
1. Use the proper <string.h> header.
2. Typo fixes and whitespace changes.
3. Comment out debug printf() about cache size.
4. Remove obsolete comment(s).
2012-09-25 10:48:43 +01:00
Tigran Aivazian
4b5c33d4cd Optimize building djvulibre.
1. Don't build xmltools in the emulator
2. Remove duplicate --disable-desktopfiles
3. Don't build LFS support. The largest DjVu file I have ever published
was a highres facsimile edition of the London Walton Polyglot (1657)
which was a "mere" 1GB in size and I don't think anyone produced
anything bigger. Besides, storing DjVu files >2GB in size (even if
they existed, which I doubt) on a Kindle with only 3GB total storage
space is _exceedingly_ unlikely.
2012-09-25 10:32:39 +01:00
Dobrica Pavlinušić
cee63d6078 Merge pull request #313 from NuPogodi/master
removed two self:redrawCurrentPage() functions
2012-09-25 01:51:16 -07:00
NuPogodi
9403d1c120 remove self:redrawCurrentPage() in CREReader:gotoTocEntry(entry) 2012-09-25 02:21:19 +03:00
NuPogodi
d542982778 remove self:redrawCurrentPage() in UniReader:addJump(pageno) 2012-09-25 02:19:33 +03:00
Dobrica Pavlinusic
ac14ac4a21 show only page links 2012-09-25 00:04:11 +02:00
Dobrica Pavlinusic
8a7f2bd562 go only to page links 2012-09-25 00:03:32 +02:00
Dobrica Pavlinusic
a3f5de9e7a fix size of fonts according to globalzoom
And a few of one pixel up, one pixel down adjustemts, so that all
underlines get dimmed.
2012-09-24 23:57:49 +02:00
Dobrica Pavlinusic
1916f5038b draw links on page as underline 2012-09-24 23:24:10 +02:00
{Qingping,Dave} Hou
d1a4399170 Merge pull request #310 from tigran123/master
Fix a crash in getDiskSizeInfo() (in emulator) and use util.df function.
2012-09-24 13:54:32 -07:00
Tigran Aivazian
1e2429b3be Fix for the issue #311.
Children nodes that have no [apparent] parent should be adopted
by the "_HEAD" i.e. the root of the whole tree.
2012-09-24 21:33:47 +01:00
Tigran Aivazian
47b056861b Slightly shorter and more Lua-idiomatic way of reading lines. 2012-09-24 20:38:18 +01:00
Tigran Aivazian
43cbcbf319 Rewrite CREReader:ZipContentExt() function.
Technically, the only serious problem in this function was the code:
 local tmp = assert(io.popen('unzip -l \"'..fname..'\"', "r"))
 while tmp do
         s = tmp:read("*line")
         if i > 3 then tmp:close(); break; end
         i = i + 1
 end
It is meaningless to evaluate the truth of the return value of assert()
and the above code gives the impression that it relies on the
(undocumented and unreliable) fact that after tmp:close() tmp will be
nil, even though in actual fact it does because it breaks out of the
loop.
However, having looked at the function I saw that the whole thing
can be rewritten in a much simpler way:

 local tmp = assert(io.popen('unzip -l \"'..fname..'\" | head -4 | tail -1', "r"))
 s = tmp:read("*line")
 tmp:close()
2012-09-24 20:07:23 +01:00
Tigran Aivazian
6e0f0aef26 Fix a crash in getDiskSizeInfo() and use util.df function
1. When executed in the emulator the viewer will crash if you press
Right on any zip file in the filechooser. This is because the assertion
on "df /mnt/us | tail -1" will fail as "/mnt/us" is normally
non-existent.
2. The proper (faster, reliable, portable) way of obtaining the number
of total and free bytes on a filesystem is by using the statvfs(2)
system call via util.df Lua interface, see util.c.
3. Removed the "used" field in the function's return as unused and
unneeded.
2012-09-24 19:48:12 +01:00
Dobrica Pavlinusic
f2eeca73aa overlay keyboard shortcuts on top of links
This is example of user interface discussed in #309
2012-09-24 20:27:13 +02:00
Dobrica Pavlinusic
2774350ec6 transform coordinates to on-screen values 2012-09-24 17:49:03 +02:00
Dobrica Pavlinusic
0828468b12 try to draw inverted rectangles over links
This commit nicely shows that we need to translate link coordinates
2012-09-24 17:49:03 +02:00
Dobrica Pavlinusic
46afa82b52 add LF to end of debug message 2012-09-24 17:49:03 +02:00
Dobrica Pavlinusic
71ff602cd5 getPageLinks implementation for mupdf #72
This is rough first draft, and provides just dump of all links
available on pdf page. Binding to Shift+L is temporary and just for
debugging!
2012-09-24 17:49:03 +02:00
Dobrica Pavlinusic
e1fc748faf fix indenting to tabs 2012-09-24 17:49:03 +02:00
{Qingping,Dave} Hou
73719e7b2e Merge pull request #307 from NuPogodi/master
Added: Folder Info; fixed: crash in getUnpackedZipSize(); etc.
2012-09-24 08:40:51 -07:00
{Qingping,Dave} Hou
43b0dce322 Merge pull request #308 from dpavlin/git-rev
include git-rev in distribution zip
2012-09-24 08:38:13 -07:00
NuPogodi
6a2b0d044d filechooser: added support for calling folder info 2012-09-24 18:15:30 +03:00