From 4f7c3c4d0d634706d13950b3827714b168e279e3 Mon Sep 17 00:00:00 2001 From: ar Date: Thu, 27 May 2004 22:04:46 +0000 Subject: - convert qDebug to odebug --- (limited to 'noncore/apps/opie-reader') diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h index 29d0329..61531c0 100644 --- a/noncore/apps/opie-reader/BuffDoc.h +++ b/noncore/apps/opie-reader/BuffDoc.h @@ -21,24 +21,24 @@ class BuffDoc CFilterChain* filt; public: void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) - { - if (exp == NULL) - { - data = NULL; - len = 0; - } - else - { - exp->setSaveData(data, len, src, srclen); - } - } + { + if (exp == NULL) + { + data = NULL; + len = 0; + } + else + { + exp->setSaveData(data, len, src, srclen); + } + } void putSaveData(unsigned char*& src, unsigned short& srclen) - { - if (exp != NULL) - { - exp->putSaveData(src, srclen); - } - } + { + if (exp != NULL) + { + exp->putSaveData(src, srclen); + } + } #ifdef USEQPE void suspend() { if (exp != NULL) exp->suspend(); } void unsuspend() { if (exp != NULL) exp->unsuspend(); } @@ -47,47 +47,47 @@ class BuffDoc void unsuspend() {} #endif ~BuffDoc() - { - delete filt; - delete exp; - } + { + delete filt; + delete exp; + } BuffDoc() - { - exp = NULL; - filt = NULL; - lastword.empty(); -// // qDebug("Buffdoc created"); - } + { + exp = NULL; + filt = NULL; + lastword.empty(); + // odebug << "Buffdoc created" << oendl; + } bool empty() { return (exp == NULL); } void setfilter(CFilterChain* _f) - { - if (filt != NULL) delete filt; - filt = _f; - filt->setsource(exp); - } + { + if (filt != NULL) delete filt; + filt = _f; + filt->setsource(exp); + } CList* getbkmklist() { return exp->getbkmklist(); } bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } bool iseol() { return (lastword[0] == '\0'); } int openfile(QWidget* _parent, const char *src); tchar getch() - { - tchar ch = UEOF; - CStyle sty; - if (exp != NULL) - { - filt->getch(ch, sty); - } - return ch; - } + { + tchar ch = UEOF; + CStyle sty; + if (exp != NULL) + { + filt->getch(ch, sty); + } + return ch; + } void getch(tchar& ch, CStyle& sty) - { - if (exp != NULL) - { - filt->getch(ch, sty); - } - else - ch = UEOF; - } + { + if (exp != NULL) + { + filt->getch(ch, sty); + } + else + ch = UEOF; + } void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } @@ -103,15 +103,15 @@ class BuffDoc bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } int getpara(CBuffer& buff) - { - tchar ch; - int i = 0; - while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; - buff[i] = '\0'; - if (i == 0 && ch == UEOF) i = -1; - laststartline = exp->locate(); - return i; - } + { + tchar ch; + int i = 0; + while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; + buff[i] = '\0'; + if (i == 0 && ch == UEOF) i = -1; + laststartline = exp->locate(); + return i; + } void saveposn(size_t posn) { exp->saveposn(posn); } void writeposn(size_t posn) { exp->writeposn(posn); } bool forward(size_t& loc) { return exp->forward(loc); } diff --git a/noncore/apps/opie-reader/CEncoding.h b/noncore/apps/opie-reader/CEncoding.h index 463fba9..df0104a 100644 --- a/noncore/apps/opie-reader/CEncoding.h +++ b/noncore/apps/opie-reader/CEncoding.h @@ -60,15 +60,15 @@ class CGeneral8Bit : public CEncoding int m_index; public: CGeneral8Bit(int _i) : m_index(_i) - { -// qDebug("8Bit:%d", _i); -// qDebug("%s", unicodetable::iterator(_i)->mime); - } + { +// odebug << "8Bit: " << _i << oendl; +// odebug << unicodetable::iterator(_i)->mime << oendl; + } void getch(tchar& ch, CStyle& sty) - { - parent->getch(ch, sty); - ch = unicodetable::unicodevalue(m_index, ch); - } + { + parent->getch(ch, sty); + ch = unicodetable::unicodevalue(m_index, ch); + } }; #endif diff --git a/noncore/apps/opie-reader/CExpander.h b/noncore/apps/opie-reader/CExpander.h index 7b21d3e..9fae245 100644 --- a/noncore/apps/opie-reader/CExpander.h +++ b/noncore/apps/opie-reader/CExpander.h @@ -40,18 +40,18 @@ class CExpander unsigned long m_currentstart, m_currentend; public: #ifdef USEQPE - virtual void suspend() = 0; + virtual void suspend() = 0; virtual void unsuspend() = 0; #endif size_t getHome() { return m_homepos; } CExpander() : m_homepos(0), fname(NULL), m_scrWidth(240), m_currentstart(1), m_currentend(0) {}; virtual ~CExpander() { if (fname != NULL) delete [] fname; }; int openfile(const char *src) - { - bSuspended = false; - fname = strdup(src); - return OpenFile(src); - } + { + bSuspended = false; + fname = strdup(src); + return OpenFile(src); + } virtual int OpenFile(const char *src) = 0; virtual unsigned int locate() = 0; virtual void locate(unsigned int n) = 0; @@ -59,17 +59,17 @@ class CExpander virtual void sizes(unsigned long& file, unsigned long& text) = 0; virtual CList* getbkmklist() { return NULL; } virtual void getch(tchar& ch, CStyle& sty) - { - int ich = getch(); - ch = (ich == EOF) ? UEOF : ich; - sty.unset(); - } + { + int ich = getch(); + ch = (ich == EOF) ? UEOF : ich; + sty.unset(); + } virtual int getch() = 0; virtual linkType hyperlink(unsigned int n, QString& wrd) - { - locate(n); - return eLink; - } + { + locate(n); + return eLink; + } virtual MarkupType PreferredMarkup() = 0; virtual void saveposn(size_t posn) {} virtual void writeposn(size_t posn) {} @@ -77,75 +77,75 @@ class CExpander virtual bool back(size_t& loc) { return false; } virtual bool hasnavigation() { return false; } unsigned long startSection() - { - unsigned long current = locate(); - if (m_currentstart > current || current > m_currentend) - { - start2endSection(); - } - return m_currentstart; - } + { + unsigned long current = locate(); + if (m_currentstart > current || current > m_currentend) + { + start2endSection(); + } + return m_currentstart; + } unsigned long endSection() - { - unsigned long current = locate(); - if (m_currentstart > current || current > m_currentend) - { - start2endSection(); - } - return m_currentend; - } + { + unsigned long current = locate(); + if (m_currentstart > current || current > m_currentend) + { + start2endSection(); + } + return m_currentend; + } virtual void start2endSection() - { - m_currentstart = 0; - unsigned long file; - sizes(file, m_currentend); - } + { + m_currentstart = 0; + unsigned long file; + sizes(file, m_currentend); + } virtual QImage* getPicture(unsigned long tgt) { return NULL; } void setContinuous(bool _b) { m_continuous = _b; } #ifdef USEQPE virtual void suspend(FILE*& fin) { - bSuspended = true; - suspos = ftell(fin); - fclose(fin); - fin = NULL; - sustime = time(NULL); + bSuspended = true; + suspos = ftell(fin); + fclose(fin); + fin = NULL; + sustime = time(NULL); } virtual void unsuspend(FILE*& fin) { - if (bSuspended) - { - bSuspended = false; - int delay = time(NULL) - sustime; - if (delay < 10) sleep(10-delay); - fin = fopen(fname, "rb"); - for (int i = 0; fin == NULL && i < 5; i++) - { - sleep(5); - fin = fopen(fname, "rb"); - } - if (fin == NULL) - { - QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); - exit(0); - } - suspos = fseek(fin, suspos, SEEK_SET); - } + if (bSuspended) + { + bSuspended = false; + int delay = time(NULL) - sustime; + if (delay < 10) sleep(10-delay); + fin = fopen(fname, "rb"); + for (int i = 0; fin == NULL && i < 5; i++) + { + sleep(5); + fin = fopen(fname, "rb"); + } + if (fin == NULL) + { + QMessageBox::warning(NULL, PROGNAME, "Couldn't reopen file"); + exit(0); + } + suspos = fseek(fin, suspos, SEEK_SET); + } } #endif virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) - { - len = srclen; - data = new unsigned char[len]; - memcpy(data, src, len); - } + { + len = srclen; + data = new unsigned char[len]; + memcpy(data, src, len); + } virtual void putSaveData(unsigned char*& src, unsigned short& srclen) - { - if (srclen != 0) - { - qDebug("Don't know what to do with non-zero save data"); - } - } + { + if (srclen != 0) + { + qDebug("Don't know what to do with non-zero save data"); + } + } void setwidth(int w) { m_scrWidth = w; } }; #endif diff --git a/noncore/apps/opie-reader/Filedata.h b/noncore/apps/opie-reader/Filedata.h index 096dd31..1b85b71 100644 --- a/noncore/apps/opie-reader/Filedata.h +++ b/noncore/apps/opie-reader/Filedata.h @@ -9,43 +9,43 @@ class CFiledata bool m_own; public: CFiledata(tchar* d) - { - data = (unsigned char*)d; - m_own = false; - } + { + data = (unsigned char*)d; + m_own = false; + } CFiledata(time_t dt, tchar* nm) - { - int nlen = ustrlen(nm)+1; - data = new unsigned char[sizeof(time_t)+sizeof(tchar)*nlen]; - *((time_t *)data) = dt; - memcpy(data+sizeof(time_t), nm, sizeof(tchar)*nlen); - m_own = true; - } + { + int nlen = ustrlen(nm)+1; + data = new unsigned char[sizeof(time_t)+sizeof(tchar)*nlen]; + *((time_t *)data) = dt; + memcpy(data+sizeof(time_t), nm, sizeof(tchar)*nlen); + m_own = true; + } ~CFiledata() - { - if (m_own && data != NULL) - { - delete [] data; -// qDebug("~Filedata: deleting"); - } - else - { -// qDebug("~Filedata: not deleting"); - } - } + { + if (m_own && data != NULL) + { + delete [] data; +// odebug << "~Filedata: deleting" << oendl; + } + else + { +// odebug << "~Filedata: not deleting" << oendl; + } + } tchar* name() const { return (tchar*)(data+sizeof(time_t)); } time_t date() { return *((time_t *)data); } void setdate(time_t _t) { *((time_t *)data) = _t; } unsigned char* content() { return data; } size_t length() const { return sizeof(time_t)+sizeof(tchar)*(ustrlen(name())+1); } bool operator==(const CFiledata& rhs) - { - return ((length() == rhs.length()) && (memcmp(data, rhs.data, length()) == 0)); - } + { + return ((length() == rhs.length()) && (memcmp(data, rhs.data, length()) == 0)); + } bool samename(const CFiledata& rhs) - { - return (ustrcmp((tchar *)(data+sizeof(time_t)),(tchar *)(rhs.data+sizeof(time_t))) == 0); - } + { + return (ustrcmp((tchar *)(data+sizeof(time_t)),(tchar *)(rhs.data+sizeof(time_t))) == 0); + } }; #endif diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h index 5681496..e56b619 100644 --- a/noncore/apps/opie-reader/FontControl.h +++ b/noncore/apps/opie-reader/FontControl.h @@ -20,134 +20,134 @@ class FontControl unsigned char getBaseSize() { return m_basesize; } int gzoom(); FontControl(QString n = "helvetica", int size = 10) - : - m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) + : + m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) { - ChangeFont(n, size); + ChangeFont(n, size); } ~FontControl() - { - if (m_fontsizes != NULL) delete [] m_fontsizes; - } + { + if (m_fontsizes != NULL) delete [] m_fontsizes; + } void hasCourier(bool _b, const QString& _nm) - { - m_hasCourier = _b; - m_fixedfontname = _nm; - } + { + m_hasCourier = _b; + m_fixedfontname = _nm; + } QString& fixedfontname() { return m_fixedfontname; } bool hasCourier() { return m_hasCourier; } QString name() { return m_fontname; } int currentsize() { return m_fontsizes[m_size]; } int getsize(const CStyle& size) - { - int tgt = m_size+size.getFontSize(); - if (tgt < 0) - { - tgt = 0; - } - if (tgt >= m_maxsize) - { - tgt = m_maxsize - 1; - } - return m_fontsizes[tgt]; - } + { + int tgt = m_size+size.getFontSize(); + if (tgt < 0) + { + tgt = 0; + } + if (tgt >= m_maxsize) + { + tgt = m_maxsize - 1; + } + return m_fontsizes[tgt]; + } int ascent() { - QFont f(name(), currentsize()); - QFontMetrics fm(f); - return fm.ascent(); + QFont f(name(), currentsize()); + QFontMetrics fm(f); + return fm.ascent(); } int ascent(const CStyle& ch) { - QFont f(name(), getsize(ch)); - QFontMetrics fm(f); - return fm.ascent(); + QFont f(name(), getsize(ch)); + QFontMetrics fm(f); + return fm.ascent(); } int descent() { - QFont f(name(), currentsize()); - QFontMetrics fm(f); - return fm.descent(); + QFont f(name(), currentsize()); + QFontMetrics fm(f); + return fm.descent(); } int descent(const CStyle& ch) { - QFont f(name(), getsize(ch)); - QFontMetrics fm(f); - return fm.descent(); + QFont f(name(), getsize(ch)); + QFontMetrics fm(f); + return fm.descent(); } int lineSpacing() { - QFont f(name(), currentsize()); - QFontMetrics fm(f); - return fm.lineSpacing(); + QFont f(name(), currentsize()); + QFontMetrics fm(f); + return fm.lineSpacing(); } int lineSpacing(const CStyle& ch) { - QFont f(name(), getsize(ch)); - QFontMetrics fm(f); - return fm.lineSpacing(); + QFont f(name(), getsize(ch)); + QFontMetrics fm(f); + return fm.lineSpacing(); } bool decreasesize() - { + { /* - if (--m_size < 0) - { - m_size = 0; - return false; - } - else return true; + if (--m_size < 0) + { + m_size = 0; + return false; + } + else return true; */ - if (g_size-- == m_size) - { - if (--m_size < 0) - { - m_size = 0; - } - } -// qDebug("Font:%d Graphics:%d", m_size, g_size); - return true; - } + if (g_size-- == m_size) + { + if (--m_size < 0) + { + m_size = 0; + } + } +// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; + return true; + } bool increasesize() - { + { /* - if (++m_size >= m_maxsize) - { - m_size = m_maxsize - 1; - return false; - } - else return true; + if (++m_size >= m_maxsize) + { + m_size = m_maxsize - 1; + return false; + } + else return true; */ - if (g_size++ == m_size) - { - if (++m_size >= m_maxsize) - { - m_size = m_maxsize - 1; - } - } -// qDebug("Font:%d Graphics:%d", m_size, g_size); - return true; - } + if (g_size++ == m_size) + { + if (++m_size >= m_maxsize) + { + m_size = m_maxsize - 1; + } + } +// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; + return true; + } bool ChangeFont(QString& n) - { - return ChangeFont(n, currentsize()); - } + { + return ChangeFont(n, currentsize()); + } bool ChangeFont(QString& n, int tgt); void setlead(int _lead) - { - m_leading = _lead; - } + { + m_leading = _lead; + } int getlead() - { - return m_leading; - } + { + return m_leading; + } void setextraspace(int _lead) - { - m_extraspace = _lead; - } + { + m_extraspace = _lead; + } int getextraspace() - { - return m_extraspace; - } + { + return m_extraspace; + } }; #endif diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp index 9339595..b0d4e00 100644 --- a/noncore/apps/opie-reader/Palm2QImage.cpp +++ b/noncore/apps/opie-reader/Palm2QImage.cpp @@ -1,4 +1,12 @@ /* -*- mode: c; indent-tabs-mode: nil; -*- */ + +/* OPIE */ +#include + +/* QT */ +#include + +/* STD */ #include #include #include @@ -9,7 +17,6 @@ #include #include -#include /***********************************************************************/ /***********************************************************************/ @@ -42,10 +49,10 @@ typedef struct { } ColorMapEntry; static ColorMapEntry Palm8BitColormap[] = { - { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, - { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, - { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, - { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, + { 255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 }, + { 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 }, + { 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 }, + { 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 }, { 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 }, { 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 }, { 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 }, @@ -139,36 +146,38 @@ QImage* Palm2QImage transparent_index = palmimage[12]; compression_type = palmimage[13]; /* bytes 14 and 15 are reserved by Palm and always 0 */ - + #if 0 -// qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); +// odebug << "Palm image is " << width << "x" << height +// << ", " << bits_per_pixel << " bpp, version " << version +// << ", flags 0x" << flags << ", compression " << compression_type << oendl; #endif if (compression_type == PALM_COMPRESSION_PACKBITS) { -// qDebug ("Image uses packbits compression; not yet supported"); +// odebug << "Image uses packbits compression; not yet supported" << oendl; return NULL; } else if ((compression_type != PALM_COMPRESSION_NONE) && (compression_type != PALM_COMPRESSION_RLE) && (compression_type != PALM_COMPRESSION_SCANLINE)) { -// qDebug ("Image uses unknown compression, code 0x%x", compression_type); +// odebug << "Image uses unknown compression, code 0x" << compression_type << oendl; return NULL; } /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: - + 1, 2, or 4 bit grayscale 8-bit StaticColor using the Palm standard colormap 8-bit PseudoColor using a user-specified colormap 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue - + Each of these can be compressed with one of four compression schemes, "RLE", "Scanline", "PackBits", or none. - + We begin by constructing the colormap. */ if (flags & PALM_HAS_COLORMAP_FLAG) { -// qDebug("Palm images with custom colormaps are not currently supported.\n"); +// odebug << "Palm images with custom colormaps are not currently supported." << oendl; return NULL; } else if (bits_per_pixel == 1) { colormap = Palm1BitColormap; @@ -187,18 +196,20 @@ QImage* Palm2QImage palm_red_bits = palmimage[16]; palm_green_bits = palmimage[17]; palm_blue_bits = palmimage[18]; -// qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); +// odebug << "Bits:" << palm_red_bits << ", " << palm_green_bits << ", " << palm_blue_bits << oendl; if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { -// qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); +// odebug << "Can't handle this format DirectColor image -- too wide in some color (" +// << palm_red_bits << ":" << palm_green_bits << ":" << palm_blue_bits << oendl; return NULL; } if (bits_per_pixel > (8 * sizeof(unsigned long))) { -// qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); +// odebug << "Can't handle this format DirectColor image -- too many bits per pixel (" +// << bits_per_pixel << ")" << oendl; return NULL; } imagedatastart = palmimage + 24; } else { -// qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); +// odebug << "Unknown bits-per-pixel of " << bits_per_pixel << " encountered" << oendl; return NULL; } @@ -213,26 +224,27 @@ QImage* Palm2QImage lastrow = new unsigned char[bytes_per_row * width]; for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { -// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); +// odebug << "inval:" << inval << " palm_ptr:" << palm_ptr << " x_ptr:" << x_ptr +// << " bpr:" << bytes_per_row << oendl; /* first, uncompress the Palm image */ if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { for (j = 0; j < bytes_per_row; ) { - incount = *palm_ptr++; - inval = *palm_ptr++; - memset(rowbuf + j, inval, incount); - j += incount; + incount = *palm_ptr++; + inval = *palm_ptr++; + memset(rowbuf + j, inval, incount); + j += incount; } } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { for (j = 0; j < bytes_per_row; j += 8) { - incount = *palm_ptr++; - inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; - for (inbit = 0; inbit < inval; inbit += 1) { - if (incount & (1 << (7 - inbit))) - rowbuf[j + inbit] = *palm_ptr++; - else - rowbuf[j + inbit] = lastrow[j + inbit]; - } + incount = *palm_ptr++; + inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; + for (inbit = 0; inbit < inval; inbit += 1) { + if (incount & (1 << (7 - inbit))) + rowbuf[j + inbit] = *palm_ptr++; + else + rowbuf[j + inbit] = lastrow[j + inbit]; + } } memcpy (lastrow, rowbuf, bytes_per_row); } else if (((flags & PALM_IS_COMPRESSED_FLAG) && @@ -243,12 +255,12 @@ QImage* Palm2QImage palm_ptr += bytes_per_row; } else { - qDebug("Case 4"); - qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); - qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); - qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); - qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); - qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); + odebug << "Case 4" << oendl; + odebug << "Is compressed:" << (((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true") << oendl; + odebug << "Has colourmap:" << (((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true") << oendl; + odebug << "Has transparency:" << (((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true") << oendl; + odebug << "Direct colour:" << (((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true") << oendl; + odebug << "four byte field:" << (((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true") << oendl; memcpy (rowbuf, palm_ptr, bytes_per_row); palm_ptr += bytes_per_row; } @@ -256,37 +268,36 @@ QImage* Palm2QImage if (colormap) { mask = (1 << bits_per_pixel) - 1; for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { - inval = ((*inbyte) & (mask << inbit)) >> inbit; - /* correct for oddity of the 8-bit color Palm pixmap... */ - if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; - /* now lookup the correct color and set the pixel in the GTK bitmap */ - QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); + inval = ((*inbyte) & (mask << inbit)) >> inbit; + /* correct for oddity of the 8-bit color Palm pixmap... */ + if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; + /* now lookup the correct color and set the pixel in the GTK bitmap */ + QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); qimage->setPixel(j, i, colour); - if (!inbit) { - ++inbyte; - inbit = 8 - bits_per_pixel; - } else { - inbit -= bits_per_pixel; - } + if (!inbit) { + ++inbyte; + inbit = 8 - bits_per_pixel; + } else { + inbit -= bits_per_pixel; + } } } else if (!colormap && bits_per_pixel == 16) { for (inbyte = rowbuf, j = 0; j < width; ++j) { - inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1]; + inval = ((unsigned short)inbyte[0] << (unsigned short)8) | inbyte[1]; /* - qDebug ("pixel is %d,%d (%d:%d:%d)", - j, i, - ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), - ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), - ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); + odebug << "pixel is " << j << "," << i << " (" + << (((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits)) << ":" + << (((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits)) << ":" + << (((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)) << ")" << oendl; */ - QRgb colour = qRgb( - ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), + QRgb colour = qRgb( + ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); qimage->setPixel(j, i, colour); - inbyte += 2; + inbyte += 2; } } } @@ -299,7 +310,7 @@ QImage* Palm2QImage QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b) { -//// qDebug("hrule [%d, %d]", w, h); +// odebug << "hrule [" << w << ", " << h << "]" << oendl; QPixmap* qimage = new QPixmap(w, h); qimage->fill(QColor(r,g,b)); QImage* ret = new QImage(qimage->convertToImage()); diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index dfbdfb9..f89de63 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h @@ -21,8 +21,8 @@ class QTReader : public QWidget { Q_OBJECT - static tchar pluckernextpart[]; - static tchar jplucknextpart[]; + static tchar pluckernextpart[]; + static tchar jplucknextpart[]; friend class QTReaderApp; void suspend(); void increaseScroll(); @@ -59,13 +59,13 @@ public: void zoomin(); void zoomout(); void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) - { - buffdoc.setSaveData(data, len, src, srclen); - } + { + buffdoc.setSaveData(data, len, src, srclen); + } void putSaveData(unsigned char*& src, unsigned short& srclen) - { - buffdoc.putSaveData(src, srclen); - } + { + buffdoc.putSaveData(src, srclen); + } bool empty(); void setContinuous(bool _b); void toggle_autoscroll(); @@ -75,7 +75,7 @@ public: { /* size_t nd = locate(); - jumpto(m_mark); + jumpto(m_mark); QString text; while (m_mark < nd) { @@ -91,73 +91,73 @@ public: /* void setText(bool oldfile) { - if (oldfile) - { - m_string = m_lastfile; - load_file((const tchar*)m_string); - } - else - { - m_string = QString::null; - } + if (oldfile) + { + m_string = m_lastfile; + load_file((const tchar*)m_string); + } + else + { + m_string = QString::null; + } }; */ void setlead(int _lead) - { - m_fontControl.setlead(_lead); - } + { + m_fontControl.setlead(_lead); + } int getlead() - { - return m_fontControl.getlead(); - } + { + return m_fontControl.getlead(); + } void setextraspace(int _lead) - { - m_fontControl.setextraspace(_lead); - } + { + m_fontControl.setextraspace(_lead); + } int getextraspace() - { - return m_fontControl.getextraspace(); - } + { + return m_fontControl.getextraspace(); + } void setpagemode(bool _b) { - m_bpagemode = _b; + m_bpagemode = _b; } void setmono(bool _b) { - m_bMonoSpaced = _b; - ChangeFont(m_fontControl.currentsize()); - locate(pagelocate()); + m_bMonoSpaced = _b; + ChangeFont(m_fontControl.currentsize()); + locate(pagelocate()); } void setencoding(int _f) - { - m_encd = _f; - setfilter(getfilter()); - } + { + m_encd = _f; + setfilter(getfilter()); + } MarkupType PreferredMarkup(); CEncoding* getencoding() - { -// qDebug("m_encd:%d", m_encd); - switch (m_encd) - { - case 4: -// qDebug("palm"); - return new CPalm; - case 1: -// qDebug("utf8"); - return new CUtf8; - case 2: -// qDebug("ucs16be"); - return new CUcs16be; - case 3: -// qDebug("ucs16le"); - return new CUcs16le; - case 0: -// qDebug("ascii"); - return new CAscii; - default: - return new CGeneral8Bit(m_encd-MAX_ENCODING+1); - } - } + { +// odebug << "m_encd:" << m_encd << oendl; + switch (m_encd) + { + case 4: +// odebug << "palm" << oendl; + return new CPalm; + case 1: +// odebug << "utf8" << oendl; + return new CUtf8; + case 2: +// odebug << "ucs16be" << oendl; + return new CUcs16be; + case 3: +// odebug << "ucs16le" << oendl; + return new CUcs16le; + case 0: +// odebug << "ascii" << oendl; + return new CAscii; + default: + return new CGeneral8Bit(m_encd-MAX_ENCODING+1); + } + } CFilterChain* getfilter() { CFilterChain * filt = new CFilterChain(getencoding()); @@ -189,7 +189,7 @@ private slots: void goHome(); void goBack(); void goForward(); - void doscroll(); + void doscroll(); void drawIt( QPainter * ); void paintEvent( QPaintEvent * ); // void resizeEvent( QResizeEvent * p ) { update(); } diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h index ab6f60e..fe3eebf 100644 --- a/noncore/apps/opie-reader/QTReaderApp.h +++ b/noncore/apps/opie-reader/QTReaderApp.h @@ -43,9 +43,9 @@ class QWidgetStack; class QToolButton; class QPopupMenu; class QToolBar; -#ifdef USEQPE +#ifdef USEQPE class QToolBar; -class QMenuBar; +class QMenuBar; #endif class CBkmkSelector; class QProgressBar; @@ -140,7 +140,7 @@ class QTReaderApp : public QMainWindow { Q_OBJECT - unsigned long m_savedpos; + unsigned long m_savedpos; int m_debounce; timeb m_lastkeytime; bool m_annoIsEditing; @@ -149,15 +149,15 @@ class QTReaderApp : public QMainWindow fontselector_action m_fontAction; void doAction(ActionTypes a, QKeyEvent* e); - public: + public: QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~QTReaderApp(); void handlekey(QKeyEvent* e); void hideEvent(QHideEvent*) - { - suspend(); - } + { + suspend(); + } void suspend(); void openFile( const QString & ); @@ -171,24 +171,24 @@ class QTReaderApp : public QMainWindow Bkmk* m_anno; // void resizeEvent(QResizeEvent* e); void closeEvent( QCloseEvent *e ); - void readbkmks(); - void do_mono(const QString&); - void do_jump(const QString&); - void do_settarget(const QString&); + void readbkmks(); + void do_mono(const QString&); + void do_jump(const QString&); + void do_settarget(const QString&); #ifdef _SCROLLPIPE -// void do_setpipetarget(const QString&); +// void do_setpipetarget(const QString&); #endif - void do_saveconfig(const QString&, bool); - bool readconfig(const QString&, bool); - bool PopulateConfig(const char*); - ActionTypes ActNameToInt(const QString&); + void do_saveconfig(const QString&, bool); + bool readconfig(const QString&, bool); + bool PopulateConfig(const char*); + ActionTypes ActNameToInt(const QString&); bool m_doAnnotation; bool m_doDictionary; bool m_doClipboard; bool m_fullscreen; bool m_loadedconfig; public: - void saveprefs(); + void saveprefs(); public slots: void setDocument(const QString&); private slots: @@ -207,17 +207,17 @@ private slots: void setTwoTouch(bool _b); void restoreFocus(); void OnAnnotation(bool _b) - { - m_doAnnotation = _b; - } + { + m_doAnnotation = _b; + } void OnDictionary(bool _b) - { - m_doDictionary = _b; - } + { + m_doDictionary = _b; + } void OnClipboard(bool _b) - { - m_doClipboard = _b; - } + { + m_doClipboard = _b; + } void OnWordSelected(const QString&, size_t, const QString&); void OnURLSelected(const QString& href); void showgraphic(QImage&); @@ -226,30 +226,30 @@ private slots: void addanno(); void showAnnotation(); void do_setencoding(int i); - void do_setfont(const QString&); - void buttonActionSelected(QAction*); -// void msgHandler(const QCString&, const QByteArray&); - void monospace(bool); - void jump(); - void settarget(); + void do_setfont(const QString&); + void buttonActionSelected(QAction*); +// void msgHandler(const QCString&, const QByteArray&); + void monospace(bool); + void jump(); + void settarget(); #ifdef _SCROLLPIPE -// void setpipetarget(); -// void setpause(bool); +// void setpipetarget(); +// void setpause(bool); #endif -// void setspacing(); - void setfont(); - void clearBkmkList(); - void listBkmkFiles(); - void editMark(); - void autoScroll(bool); - void addbkmk(); - void savebkmks(); -// void importFiles(); - void showprefs(); - void showtoolbarprefs(); - void infoClose(); - // void oldFile(); - void showinfo(); +// void setspacing(); + void setfont(); + void clearBkmkList(); + void listBkmkFiles(); + void editMark(); + void autoScroll(bool); + void addbkmk(); + void savebkmks(); +// void importFiles(); + void showprefs(); + void showtoolbarprefs(); + void infoClose(); + // void oldFile(); + void showinfo(); // void indentplus(); // void indentminus(); @@ -367,7 +367,7 @@ private slots: CBkmkSelector* bkmkselector; ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget, - m_upTarget, m_downTarget; + m_upTarget, m_downTarget; bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll; bool m_bcloseDisabled, m_disableesckey; size_t searchStart; @@ -382,11 +382,11 @@ private slots: QComboBox* m_fontSelector; // QToolBar /* *menu,*/ *fileBar; QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar; -#ifdef USEQPE - QMenuBar *mb; -#else - QMenuBar *mb; -#endif +#ifdef USEQPE + QMenuBar *mb; +#else + QMenuBar *mb; +#endif QFloatBar *searchBar, *regBar/*, *m_fontBar*/; QToolBar /* *searchBar, *regBar,*/ *m_fontBar; QLineEdit *searchEdit, *regEdit; @@ -399,8 +399,8 @@ private slots: /* void resizeEvent( QResizeEvent * r) { -// qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); -// qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); +// odebug << "resize:(" << r->oldSize().width() << "," << r->oldSize().height() << ")" << oendl; +// odebug << "resize:(" << r->size().width() << "," << r->size().height() << ")" << oendl; // bgroup->move( width()-bgroup->width(), 0 ); } */ -- cgit v0.9.0.2