author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (unidiff) | |
tree | 96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/CExpander.cpp | |
parent | 279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff) | |
download | opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2 |
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/CExpander.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CExpander.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/CExpander.cpp b/noncore/apps/opie-reader/CExpander.cpp index e398d86..1158a7a 100644 --- a/noncore/apps/opie-reader/CExpander.cpp +++ b/noncore/apps/opie-reader/CExpander.cpp | |||
@@ -1,17 +1,20 @@ | |||
1 | #include "CExpander.h" | 1 | #include "CExpander.h" |
2 | #ifdef USEQPE | ||
3 | #include <qpe/global.h> | ||
4 | #endif | ||
2 | 5 | ||
3 | size_t CExpander::getHome() { return m_homepos; } | 6 | size_t CExpander::getHome() { return m_homepos; } |
4 | 7 | ||
5 | CExpander::CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; | 8 | CExpander::CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; |
6 | 9 | ||
7 | CExpander::~CExpander() { if (fname != NULL) delete [] fname; }; | 10 | CExpander::~CExpander() { if (fname != NULL) delete [] fname; }; |
8 | 11 | ||
9 | int CExpander::openfile(const char *src) | 12 | int CExpander::openfile(const char *src) |
10 | { | 13 | { |
11 | bSuspended = false; | 14 | bSuspended = false; |
12 | fname = strdup(src); | 15 | fname = strdup(src); |
13 | return OpenFile(src); | 16 | return OpenFile(src); |
14 | } | 17 | } |
15 | 18 | ||
16 | void CExpander::getch(tchar& ch, CStyle& sty, unsigned long& pos) | 19 | void CExpander::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
17 | { | 20 | { |
@@ -57,36 +60,41 @@ void CExpander::start2endSection() | |||
57 | #ifdef USEQPE | 60 | #ifdef USEQPE |
58 | void CExpander::suspend(FILE*& fin) | 61 | void CExpander::suspend(FILE*& fin) |
59 | { | 62 | { |
60 | bSuspended = true; | 63 | bSuspended = true; |
61 | suspos = ftell(fin); | 64 | suspos = ftell(fin); |
62 | fclose(fin); | 65 | fclose(fin); |
63 | fin = NULL; | 66 | fin = NULL; |
64 | sustime = time(NULL); | 67 | sustime = time(NULL); |
65 | } | 68 | } |
66 | 69 | ||
67 | void CExpander::unsuspend(FILE*& fin) | 70 | void CExpander::unsuspend(FILE*& fin) |
68 | { | 71 | { |
69 | if (bSuspended) | 72 | if (bSuspended) |
70 | { | 73 | { |
71 | bSuspended = false; | 74 | bSuspended = false; |
72 | int delay = time(NULL) - sustime; | 75 | int delay = time(NULL) - sustime; |
73 | if (delay < 10) sleep(10-delay); | 76 | if (delay < 10) |
77 | { | ||
78 | Global::statusMessage("Stalling"); | ||
79 | sleep(10-delay); | ||
80 | } | ||
74 | fin = fopen(fname, "rb"); | 81 | fin = fopen(fname, "rb"); |
75 | for (int i = 0; fin == NULL && i < 5; i++) | 82 | for (int i = 0; fin == NULL && i < 5; i++) |
76 | { | 83 | { |
84 | Global::statusMessage("Stalling"); | ||
77 | sleep(5); | 85 | sleep(5); |
78 | fin = fopen(fname, "rb"); | 86 | fin = fopen(fname, "rb"); |
79 | } | 87 | } |
80 | if (fin == NULL) | 88 | if (fin == NULL) |
81 | { | 89 | { |
82 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); | 90 | QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); |
83 | exit(0); | 91 | exit(0); |
84 | } | 92 | } |
85 | suspos = fseek(fin, suspos, SEEK_SET); | 93 | suspos = fseek(fin, suspos, SEEK_SET); |
86 | } | 94 | } |
87 | } | 95 | } |
88 | #endif | 96 | #endif |
89 | 97 | ||
90 | void CExpander::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 98 | void CExpander::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
91 | { | 99 | { |
92 | len = srclen; | 100 | len = srclen; |