summaryrefslogtreecommitdiff
authorleseb <leseb>2002-06-23 17:47:21 (UTC)
committer leseb <leseb>2002-06-23 17:47:21 (UTC)
commit3251c55f854ecbd4ece8bf169177ffac28081aaa (patch) (unidiff)
treebeaf75deb513c8ef4a3ea222135308241fe09f6f
parent7c22b9cbf92650c432a84537f4b9c3d810e7dc75 (diff)
downloadopie-3251c55f854ecbd4ece8bf169177ffac28081aaa.zip
opie-3251c55f854ecbd4ece8bf169177ffac28081aaa.tar.gz
opie-3251c55f854ecbd4ece8bf169177ffac28081aaa.tar.bz2
Remove old format reading (XPM gzipped)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.pro3
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp21
2 files changed, 2 insertions, 22 deletions
diff --git a/noncore/graphics/drawpad/drawpad.pro b/noncore/graphics/drawpad/drawpad.pro
index 6bea193..8f70cc6 100644
--- a/noncore/graphics/drawpad/drawpad.pro
+++ b/noncore/graphics/drawpad/drawpad.pro
@@ -34,18 +34,17 @@ SOURCES = drawpad.cpp \
34 page.cpp \ 34 page.cpp \
35 pageinformationdialog.cpp \ 35 pageinformationdialog.cpp \
36 pointtool.cpp \ 36 pointtool.cpp \
37 rectangletool.cpp \ 37 rectangletool.cpp \
38 shapetool.cpp \ 38 shapetool.cpp \
39 texttool.cpp \ 39 texttool.cpp \
40 thumbnailview.cpp \ 40 thumbnailview.cpp \
41 tool.cpp 41 tool.cpp
42 INCLUDEPATH+= $(OPIEDIR)/include \ 42 INCLUDEPATH+= $(OPIEDIR)/include
43 $(QTDIR)/src/3rdparty/zlib
44 DEPENDPATH+= $(OPIEDIR)/include 43 DEPENDPATH+= $(OPIEDIR)/include
45 LIBS += -lqpe -lopie 44 LIBS += -lqpe -lopie
46 DESTDIR = $(OPIEDIR)/bin 45 DESTDIR = $(OPIEDIR)/bin
47 TARGET = drawpad 46 TARGET = drawpad
48 47
49 TRANSLATIONS= ../../i18n/de/drawpad.ts 48 TRANSLATIONS= ../../i18n/de/drawpad.ts
50 TRANSLATIONS+= ../../i18n/en/drawpad.ts 49 TRANSLATIONS+= ../../i18n/en/drawpad.ts
51 TRANSLATIONS+= ../../i18n/es/drawpad.ts 50 TRANSLATIONS+= ../../i18n/es/drawpad.ts
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index ae1b554..5437068 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -23,18 +23,16 @@
23 23
24#include <qbuffer.h> 24#include <qbuffer.h>
25#include <qimage.h> 25#include <qimage.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qtextcodec.h> 27#include <qtextcodec.h>
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qxml.h> 29#include <qxml.h>
30 30
31#include <zlib.h>
32
33const int PAGE_BACKUPS = 99; 31const int PAGE_BACKUPS = 99;
34 32
35class DrawPadCanvasXmlHandler: public QXmlDefaultHandler 33class DrawPadCanvasXmlHandler: public QXmlDefaultHandler
36{ 34{
37public: 35public:
38 DrawPadCanvasXmlHandler(); 36 DrawPadCanvasXmlHandler();
39 ~DrawPadCanvasXmlHandler(); 37 ~DrawPadCanvasXmlHandler();
40 38
@@ -88,20 +86,16 @@ bool DrawPadCanvasXmlHandler::startElement(const QString& namespaceURI, const QS
88 } else if (qName == "title") { 86 } else if (qName == "title") {
89 m_state = InTitle; 87 m_state = InTitle;
90 } else if (qName == "date") { 88 } else if (qName == "date") {
91 m_state = InDate; 89 m_state = InDate;
92 } else if (qName == "data") { 90 } else if (qName == "data") {
93 m_state = InData; 91 m_state = InData;
94 m_dataLenght = atts.value("length").toULong(); 92 m_dataLenght = atts.value("length").toULong();
95 m_dataFormat = atts.value("format"); 93 m_dataFormat = atts.value("format");
96
97 if (m_dataFormat.isEmpty()) {
98 m_dataFormat = "XPM";
99 }
100 } 94 }
101 95
102 return true; 96 return true;
103} 97}
104 98
105bool DrawPadCanvasXmlHandler::endElement(const QString& namespaceURI, const QString& localName, 99bool DrawPadCanvasXmlHandler::endElement(const QString& namespaceURI, const QString& localName,
106 const QString& qName) 100 const QString& qName)
107{ 101{
@@ -145,31 +139,18 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch)
145 r += l - '0'; 139 r += l - '0';
146 } else { 140 } else {
147 r += l - 'a' + 10; 141 r += l - 'a' + 10;
148 } 142 }
149 143
150 byteArray[i] = r; 144 byteArray[i] = r;
151 } 145 }
152 146
153
154 QImage image; 147 QImage image;
155 148 image.loadFromData((const uchar*)byteArray.data(), m_dataLenght, m_dataFormat);
156 if (m_dataFormat == "XPM") {
157 if (m_dataLenght < ch.length() * 5) {
158 m_dataLenght = ch.length() * 5;
159 }
160
161 QByteArray byteArrayUnzipped(m_dataLenght);
162 ::uncompress((uchar*)byteArrayUnzipped.data(), &m_dataLenght, (uchar*)byteArray.data(), byteArray.size());
163
164 image.loadFromData((const uchar*)byteArrayUnzipped.data(), m_dataLenght, m_dataFormat);
165 } else {
166 image.loadFromData((const uchar*)byteArray.data(), m_dataLenght, m_dataFormat);
167 }
168 149
169 Page* page = new Page(m_title, image.width(), image.height()); 150 Page* page = new Page(m_title, image.width(), image.height());
170 page->setLastModified(m_date); 151 page->setLastModified(m_date);
171 page->convertFromImage(image); 152 page->convertFromImage(image);
172 m_pages.append(page); 153 m_pages.append(page);
173 } 154 }
174 155
175 return true; 156 return true;