summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp2
-rw-r--r--noncore/apps/opie-reader/opie-reader.control4
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index 6251812..fc9cffb 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -614,193 +614,193 @@ void QTReader::printIt()
}
#endif
}
*/
//
// Called when the widget needs to be updated.
//
void QTReader::paintEvent( QPaintEvent * )
{
QPainter paint( this );
drawIt( &paint );
}
//
// Called when the widget has been resized.
// Moves the button group to the upper right corner
// of the widget.
/*
void QTReader::resizeEvent( QResizeEvent * )
{
// qDebug("resize:(%u,%u)", width(), height());
// bgroup->move( width()-bgroup->width(), 0 );
}
*/
//
// Create and display our widget.
//
/*
int main( int argc, tchar **argv )
{
QApplication app( argc, argv );
QTReader draw;
app.setMainWidget( &draw );
draw.setCaption("Qt Example - Drawdemo");
draw.show();
return app.exec();
}
*/
bool QTReader::locate(unsigned long n) {
//printf("Locate\n");
buffdoc.locate(n);
// qDebug("&buffdoc.located");
fillbuffer();
// qDebug("&Buffer filled");
update();
// qDebug("&Located");
return true;
}
unsigned int QTReader::screenlines()
{
// int linespacing = (tight) ? m_ascent : m_ascent+m_descent;
// return (height()-m_descent)/(m_linespacing);
return (height()-2)/(m_linespacing);
};
bool QTReader::fillbuffer() {
//printf("Fillbuffer\n");
m_scrolldy = 0;
int ch;
bool ret = false;
int delta = screenlines();
// qDebug("fillbuffer:%u-%u",delta,numlines);
if (delta != numlines)
{
if (textarray != NULL)
{
for (int i = 0; i < numlines; i++) delete textarray[i];
delete [] textarray;
delete [] locnarray;
}
numlines = delta;
textarray = new CBuffer*[numlines];
locnarray = new size_t[numlines];
for (int i = 0; i < numlines; i++) textarray[i] = new CBuffer;
}
// qDebug("fillbuffer:pagepos:%u",pagepos);
unsigned int oldpagepos = pagepos;
// if (textarray != NULL)
// pagepos = locnarray[0];
// else
pagepos = locate();
for (int i = 0; i < delta; i++)
{
locnarray[i] = locate();
ch = getline(textarray[i]);
// if (ch == EOF) {
if (!ch)
{
if (i == 0)
{
- pagepos = oldpagepos;
+ locate(oldpagepos);
return false;
}
else
{
ret = true;
for (int j = i+1; j < delta; j++)
{
locnarray[j] = locnarray[j-1];
(*(textarray[j]))[0] = '\0';
}
break;
}
}
if (ch == '\012') ret = true;
}
mylastpos = locate();
// qDebug("fillbuffer:lastpos:%u",mylastpos);
return true;
}
void QTReader::dopagedn()
{
if (m_overlap == 0)
{
if (locate() != mylastpos) jumpto(mylastpos);
}
else
{
if (m_overlap >= screenlines()) m_overlap = screenlines()/2;
jumpto(locnarray[screenlines()-m_overlap]);
}
if (fillbuffer())
{
update();
}
}
void QTReader::dopageup()
{
CBuffer** buff = textarray;
unsigned int *loc = new unsigned int[numlines];
int cbptr = 0;
if (locate() != mylastpos) jumpto(mylastpos);
if (m_overlap >= screenlines()) m_overlap = screenlines()/2;
unsigned int target = locnarray[m_overlap];
if (buffdoc.hasrandomaccess())
{
unsigned int delta = locate()-pagelocate();
if (delta < 64) delta = 64;
if (delta % 2 != 0) delta++;
if (target % 2 != 0) target++;
do
{
delta <<= 1;
if (delta >= target)
{
delta = target;
jumpto(0);
for (int i = 0; i < numlines; i++)
{
loc[i] = locate();
getline(buff[i]);
}
break;
}
jumpto(target-delta);
do
{
getline(buff[0]);
#ifdef WS
//printf("Trying:%s\n",buff[0]);
#endif
if (locate() > target) continue;
}
while (!buffdoc.iseol());
for (int i = 0; i < numlines; i++)
{
loc[i] = locate();
getline(buff[i]);
#ifdef WS
//printf("Filling:%s\n",buff[i]);
#endif
}
}
while (locate() >= target && delta < 4096);
#ifdef WS
//printf("Delta:%u\n",delta);
#endif
}
else
{
jumpto(0);
for (int i = 0; i < numlines; i++)
{
loc[i] = locate();
diff --git a/noncore/apps/opie-reader/opie-reader.control b/noncore/apps/opie-reader/opie-reader.control
index e8c98bb..1c28648 100644
--- a/noncore/apps/opie-reader/opie-reader.control
+++ b/noncore/apps/opie-reader/opie-reader.control
@@ -1,9 +1,9 @@
Files: bin/uqtreader apps/Applications/uqtreader.desktop pics/uqtreader.png pics/panel-arrow-down.png
Priority: optional
Section: applications
Maintainer: Tim Wentford <timwentford@hotmail.com>
Architecture: arm
-Version: 0_3r_beta_UTF8
-Depends:
+Version: $QPE_VERSION-$SUB_VERSION
+Depends: zlib
License: GPL
Description: E-Book reader