author | ar <ar> | 2004-05-03 21:35:18 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-03 21:35:18 (UTC) |
commit | 412619441fab46fc79c695a23ccf9e38135bdfad (patch) (side-by-side diff) | |
tree | 19d9b8af14cf6c345ef532bb32368b9c7b43c50f /noncore/apps/opie-reader/QTReader.cpp | |
parent | d1095d71394779557f446e2a67ba55bc62eec859 (diff) | |
download | opie-412619441fab46fc79c695a23ccf9e38135bdfad.zip opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.gz opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index d64abb4..b356ba5 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp @@ -59,73 +59,73 @@ QTReader::QTReader( QWidget *parent, const char *name, WFlags f) : #endif m_border(2) { m_overlap = 1; setKeyCompression ( true ); // init(); } /* QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) : QWidget(parent, name, f), m_textfont(0), m_textsize(1), textarray(NULL), numlines(0), bstripcr(true), bunindent(false), brepara(false), bdblspce(false), btight(false), bindenter(0), m_fm(NULL) { init(); -// // qDebug("Load_file(1)"); +// // odebug << "Load_file(1)" << oendl; load_file((const tchar*)filename); } */ /* void QTReader::mouseMoveEvent(QMouseEvent* _e) { mouseUpOn = !(_e->pos().x() == -1); - qDebug("MouseMove:[%d, %d]", _e->pos().x(), _e->pos().y()); + odebug << "MouseMove:[" << _e->pos().x() << ", " << _e->pos().y() << "]" << oendl; } */ long QTReader::real_delay() { return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing ); } void QTReader::mousePressEvent( QMouseEvent* _e ) { buffdoc.unsuspend(); if (_e->button() == RightButton) { -// qDebug("MousePress"); +// odebug << "MousePress" << oendl; mouseUpOn = false; if (m_swapmouse) { int lineno = 0; int ht = textarray[0]->lineSpacing(); while ((ht < _e->y()) && (lineno < numlines)) { ht += textarray[++lineno]->lineSpacing(); } size_t startpos, startoffset, tgt; getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt); processmousewordevent(startpos, startoffset, _e, lineno); } else processmousepositionevent(_e); } } void QTReader::processmousepositionevent( QMouseEvent* _e ) { if (buffdoc.hasnavigation()) { if (_e->y() > (2*height())/3) { @@ -296,71 +296,71 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse jumpto(currentpos); } } } else if (m_bMonoSpaced) { int chno = (_e->x()-textarray[lineno]->offset(width(), m_border))/m_charWidth; if (chno < ustrlen(textarray[lineno]->data())) { wrd[0] = textarray[lineno]->data()[chno]; } } else { CDrawBuffer* t = textarray[lineno]; int first = 0; int tgt = _e->x() - t->offset(width(), m_border); while (1) { int i = first+1; while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; if (t->width(i, true, width(), m_border) > tgt) { wrd = toQString(t->data()+first, i - first); -// qDebug("Got %s", (const char *)wrd); +// odebug << "Got " << (const char *)wrd << "" << oendl; break; } while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; if ((*t)[i] == 0) break; first = i; } } if (!wrd.isEmpty()) { -// qDebug("Selected:%s", (const char*)wrd); +// odebug << "Selected:" << wrd << "" << oendl; emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data())); } } void QTReader::mouseReleaseEvent( QMouseEvent* _e ) { buffdoc.unsuspend(); if (_e->button() == LeftButton) { if (mouseUpOn) { -// qDebug("MouseRelease"); +// odebug << "MouseRelease" << oendl; if (_e->x() > width() - m_border) { locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height()); return; } if (textarray[0] != NULL) { QString line; // int lineno = _e->y()/m_linespacing; int lineno = 0; int ht = textarray[0]->lineSpacing(); while ((ht < _e->y()) && (lineno < numlines)) { ht += textarray[++lineno]->lineSpacing(); } size_t startpos, startoffset, tgt; switch (getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt)) { case eLink: { size_t saveposn = pagelocate(); QString href; linkType lt = buffdoc.hyperlink(tgt, href); if (lt == eLink) @@ -373,65 +373,65 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e ) { if (lt == ePicture) { QImage* pm = buffdoc.getPicture(tgt); if (pm != NULL) { emit OnShowPicture(*pm); delete pm; } } else { // QString anchortext = textarray[lineno]->getanchortext(startoffset); if (!href.isEmpty()) { emit OnURLSelected(href); } } locate(pagelocate()); } return; } case ePicture: { -// qDebug("Picture:%x", tgt); +// odebug << "Picture:" << tgt << "" << oendl; QImage* pm = buffdoc.getPicture(tgt); if (pm != NULL) { emit OnShowPicture(*pm); delete pm; } else { locate(pagelocate()); } return; } case eNone: break; default: -// qDebug("Unknown linktype"); +// odebug << "Unknown linktype" << oendl; return; } if (m_swapmouse) processmousepositionevent(_e); else processmousewordevent(startpos, startoffset, _e, lineno); } } else { mouseUpOn = true; } } } void QTReader::focusInEvent(QFocusEvent* e) { if (m_autoScroll) timer->start(real_delay(), false); update(); } void QTReader::focusOutEvent(QFocusEvent* e) { if (m_autoScroll) @@ -675,49 +675,49 @@ void QTReader::setautoscroll(bool _sc) { if (_sc == m_autoScroll) return; if (m_autoScroll) { m_autoScroll = false; #ifdef USEQPE QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; #endif #ifdef _SCROLLPIPE if (m_pipeout != NULL) { pclose(m_pipeout); m_pipeout = NULL; } #endif } else { CDrawBuffer* reusebuffer = textarray[numlines]; if (reusebuffer == NULL || reusebuffer->eof()) return; m_autoScroll = true; #ifdef _SCROLLPIPE if (!m_pipetarget.isEmpty()) { -// qDebug("Opening pipe to %s", (const char*)m_pipetarget); +// odebug << "Opening pipe to " << m_pipetarget << "" << oendl; m_pipeout = popen((const char*)m_pipetarget, "w"); m_isPaused = false; } #endif autoscroll(); #ifdef USEQPE QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; // light is even not dimmed #endif } } bool QTReader::getline(CDrawBuffer *buff) { buffdoc.unsuspend(); if (m_bMonoSpaced) { return buffdoc.getline(buff ,width(), m_charWidth, m_border); } else { return buffdoc.getline(buff, width(), m_border); } } @@ -802,123 +802,123 @@ void QTReader::doscroll() } emit OnRedraw(); } } void QTReader::autoscroll() { timer->start(real_delay(), false); } void QTReader::setfont() { // m_fontControl.Change m_charWidth = (m_charpc*m_fontControl.currentsize())/100; if (m_charWidth <= 0) m_charWidth = 1; m_ascent = m_fontControl.ascent(); m_descent = m_fontControl.descent(); m_linespacing = m_fontControl.lineSpacing(); } void QTReader::drawFonts( QPainter *p ) { if (bDoUpdates) { -// qDebug("How refreshing..."); +// odebug << "How refreshing..." << oendl; if (buffdoc.empty()) return; setfont(); if (m_lastwidth != width()) { -// qDebug("Not Optimised %d", m_lastwidth); +// odebug << "Not Optimised " << m_lastwidth << "" << oendl; m_lastwidth = width(); m_lastheight = height(); buffdoc.setwidth(m_lastwidth-2*m_border); locate(pagelocate()); -// qDebug("Not Optimised %d", m_lastwidth); +// odebug << "Not Optimised " << m_lastwidth << "" << oendl; } else { int newht = height(); if (m_lastheight > newht) { -// qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht); +// odebug << "Optimised < " << numlines << " " << m_lastheight << " " << newht << "" << oendl; int ypos = 0; for (int i = 0; i < numlines; i++) { if ((ypos += textarray[i]->lineSpacing()) > newht) { numlines = i; jumpto(mylastpos = locnarray[i+1]); break; } } -// qDebug("Optimised < %d", numlines); +// odebug << "Optimised < " << numlines << "" << oendl; m_lastheight = newht; } else if (m_lastheight < newht) { -// qDebug("Optimised > %d", numlines); +// odebug << "Optimised > " << numlines << "" << oendl; int ypos = 0; for (int i = 0; i <= numlines; i++) { ypos += textarray[i]->lineSpacing(); } fillbuffer(numlines+1, ypos, newht); -// qDebug("Optimised > %d", numlines); +// odebug << "Optimised > " << numlines << "" << oendl; } if (numlines > 0) { int ypos = textarray[0]->ascent(); textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border); // int last = (m_showlast) ? numlines : numlines-1; // for (int i = 1; i <= last; i++) for (int i = 1; i < numlines; i++) { // ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2; ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; textarray[i]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border); } // mylastpos = locate(); } } m_scrolldy1 = m_scrolldy2 = m_scrollpart; if (m_border > 5 && !buffdoc.empty()) { p->fillRect(width()-2, 0, 2, height(), cyan); int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); int mid = (height()*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); p->fillRect(width()-2, mid-5, 2, 10, yellow); p->fillRect(width()-2, (height()*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*height()+sectionsize/2)/sectionsize, magenta); } emit OnRedraw(); } /* else { - qDebug("Not so refreshing..."); + odebug << "Not so refreshing..." << oendl; } */ } QString QTReader::firstword() { if (m_bMonoSpaced) { return toQString(textarray[0]->data()); } else { int start, end, len, j; for (j = 0; j < numlines; j++) { len = textarray[j]->length(); for (start = 0; start < len && !isalpha((*textarray[j])[start]); start++); if (start < len) break; } if (j < numlines) { QString ret = ""; for (end = start; end < len && isalpha((*textarray[j])[end]); end++) ret += (*textarray[j])[end]; @@ -1007,78 +1007,78 @@ void QTReader::printIt() return; drawIt( &paint ); } #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()); +// // odebug << "resize:(" << width() << "," << height() << ")" << oendl; // 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.unsuspend(); buffdoc.locate(n); -// // qDebug("&buffdoc.located"); +// // odebug << "&buffdoc.located" << oendl; fillbuffer(); -// // qDebug("&Buffer filled"); +// // odebug << "&Buffer filled" << oendl; update(); -// // qDebug("&Located"); +// // odebug << "&Located" << oendl; 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(int reuse, int ht, int newht) { buffdoc.unsuspend(); if (buffdoc.empty()) return false; if (newht < 0) m_lastheight = height(); else m_lastheight = newht; int ch; bool ret = false; unsigned int oldpagepos = locnarray[reuse]; int lastypos = ht, ypos = ht; numlines = reuse; while (ypos < m_lastheight || numlines < 2) @@ -1096,54 +1096,54 @@ bool QTReader::fillbuffer(int reuse, int ht, int newht) { if (numlines - reuse == 1 /*&& locnarray[numlines] == buffdoc.locate()*/) { locate(oldpagepos); return false; } else { --numlines; mylastpos = locate(); return true; } } } --numlines; mylastpos = locate(); m_scrolldy1 = m_scrolldy2 = m_scrollpart = m_lastheight - lastypos; return true; } void QTReader::dopagedn() { -// qDebug("HEIGHT(2):%d", m_lastheight); +// odebug << "HEIGHT(2):" << m_lastheight << "" << oendl; buffdoc.unsuspend(); int skip = 0, ypos = 0; if (locate() != mylastpos) { -//// qDebug("Jumping to %u", mylastpos); +//// odebug << "Jumping to " << mylastpos << "" << oendl; jumpto(mylastpos); } CDrawBuffer* reusebuffer = textarray[numlines]; if (reusebuffer != NULL && reusebuffer->eof()) return; if (reusebuffer != NULL) { for (int i = 0; i <= m_overlap; i++) { int offset = numlines - m_overlap + i; reusebuffer = textarray[offset]; size_t reuselocn = locnarray[offset]; textarray[offset] = textarray[i]; textarray[i] = reusebuffer; // reusebuffer->empty(); locnarray[offset] = locnarray[i]; locnarray[i] = reuselocn; ypos += textarray[i]->lineSpacing(); skip++; } } if (fillbuffer(skip, ypos)) { update(); } @@ -1292,55 +1292,55 @@ void QTReader::dopageup(unsigned int target) update(); } bool QTReader::load_file(const char *newfile, unsigned int _lcn) { // QMessageBox::information(this, "Name", name, 1); // QMessageBox::information(this, "load_file", newfile, 1); bool bRC = false; unsigned int lcn = _lcn; if (m_lastfile == newfile) { lcn = m_lastposn; } // QMessageBox::information(0, "Opening...", newfile); m_lastwidth = width(); m_lastheight = height(); if (buffdoc.openfile(this,newfile) == 0) { m_lastfile = newfile; buffdoc.setwidth(m_lastwidth-2*m_border); bRC = true; buffdoc.setContinuous(m_continuousDocument); -// // qDebug("buffdoc.openfile done"); +// // odebug << "buffdoc.openfile done" << oendl; locate(lcn); -// // qDebug("buffdoc.locate done"); +// // odebug << "buffdoc.locate done" << oendl; } setfilter(getfilter()); update(); -// // qDebug("Updated"); +// // odebug << "Updated" << oendl; return bRC; } void QTReader::lineDown() { int ypos = 0; int offset = numlines; for (int i = 0; i <= numlines; i++) { if ((ypos += textarray[numlines-i]->lineSpacing()) > height()) { offset = i-1; break; } } offset = numlines - offset; #ifdef _WINDOWS for (i = offset; i <= numlines; i++) #else for (int i = offset; i <= numlines; i++) #endif { CDrawBuffer* buff = textarray[i-offset]; |