-rw-r--r-- | noncore/graphics/opie-eye/slave/jpeg_slave.cpp | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/slave/slavereciever.cpp | 11 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/slave/thumbnailtool.cpp | 3 |
3 files changed, 4 insertions, 13 deletions
diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp index 668ad13..0f41359 100644 --- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp +++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp | |||
@@ -178,22 +178,19 @@ QString JpegSlave::fullImageInfo( const QString& path) { | |||
178 | QPixmap JpegSlave::pixmap( const QString& path, int wid, int hei) { | 178 | QPixmap JpegSlave::pixmap( const QString& path, int wid, int hei) { |
179 | ExifData ImageInfo; | 179 | ExifData ImageInfo; |
180 | /* | 180 | /* |
181 | */ | 181 | */ |
182 | if ( !ImageInfo.scan( path ) || ImageInfo.isNullThumbnail() ) { | 182 | if ( !ImageInfo.scan( path ) || ImageInfo.isNullThumbnail() ) { |
183 | QImage img; | 183 | QImage img; |
184 | QImageIO iio( path, 0l ); | 184 | QImageIO iio( path, 0l ); |
185 | if (wid < ImageInfo.getWidth() || hei<ImageInfo.getHeight()) { | 185 | if (wid < ImageInfo.getWidth() || hei<ImageInfo.getHeight()) { |
186 | odebug << "Scaling "<<ImageInfo.getWidth()<<"x"<<ImageInfo.getHeight() | ||
187 | << " to "<<wid<<"x"<<hei<< " ("<<path<<")"<<oendl; | ||
188 | QString str = QString( "Fast Shrink( 4 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); | 186 | QString str = QString( "Fast Shrink( 4 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); |
189 | iio.setParameters( str.latin1() );// will be strdupped anyway | 187 | iio.setParameters( str.latin1() );// will be strdupped anyway |
190 | } else { | 188 | } else { |
191 | odebug << "Not scaling "<<ImageInfo.getWidth()<<"x"<<ImageInfo.getHeight()<< " ("<<path<<")"<<oendl; | ||
192 | } | 189 | } |
193 | img = iio.read() ? iio.image() : QImage(); | 190 | img = iio.read() ? iio.image() : QImage(); |
194 | return ThumbNailTool::scaleImage( img, wid,hei ); | 191 | return ThumbNailTool::scaleImage( img, wid,hei ); |
195 | }else{ | 192 | }else{ |
196 | QImage img = ImageInfo.getThumbnail(); | 193 | QImage img = ImageInfo.getThumbnail(); |
197 | return ThumbNailTool::scaleImage( img, wid,hei ); | 194 | return ThumbNailTool::scaleImage( img, wid,hei ); |
198 | } | 195 | } |
199 | } | 196 | } |
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp index 941a5df..3b11c04 100644 --- a/noncore/graphics/opie-eye/slave/slavereciever.cpp +++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp | |||
@@ -36,17 +36,16 @@ QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { | |||
36 | return s << inf.file << inf.pixmap << inf.width << inf.height; | 36 | return s << inf.file << inf.pixmap << inf.width << inf.height; |
37 | } | 37 | } |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * GUI sends no QPIxmap!!! | 40 | * GUI sends no QPIxmap!!! |
41 | */ | 41 | */ |
42 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { | 42 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { |
43 | s >> inf.file >> inf.width >> inf.height; | 43 | s >> inf.file >> inf.width >> inf.height; |
44 | owarn << "Recieved " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; | ||
45 | return s; | 44 | return s; |
46 | } | 45 | } |
47 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { | 46 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { |
48 | return s << i.kind << i.file << i.info; | 47 | return s << i.kind << i.file << i.info; |
49 | } | 48 | } |
50 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { | 49 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { |
51 | s >> i.kind >> i.file >> i.info; | 50 | s >> i.kind >> i.file >> i.info; |
52 | return s; | 51 | return s; |
@@ -81,54 +80,50 @@ SlaveReciever::SlaveReciever( QObject* par) | |||
81 | obj->insert( it.key(), (*it.data())() ); | 80 | obj->insert( it.key(), (*it.data())() ); |
82 | } | 81 | } |
83 | } | 82 | } |
84 | 83 | ||
85 | SlaveReciever::~SlaveReciever() { | 84 | SlaveReciever::~SlaveReciever() { |
86 | } | 85 | } |
87 | 86 | ||
88 | void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { | 87 | void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { |
89 | owarn << "String is " << string.data() << "" << oendl; | ||
90 | QDataStream stream(ar, IO_ReadOnly ); | 88 | QDataStream stream(ar, IO_ReadOnly ); |
91 | QStringList lst; | 89 | QStringList lst; |
92 | static ImageInfo inf; | 90 | static ImageInfo inf; |
93 | static PixmapInfo pix; | 91 | static PixmapInfo pix; |
94 | 92 | ||
95 | if ( string == "thumbInfo(QString)" ) { | 93 | if ( string == "thumbInfo(QString)" ) { |
96 | stream >> inf.file; | 94 | stream >> inf.file; |
97 | inf.kind = false; | 95 | inf.kind = false; |
98 | m_inList.append(inf); | 96 | m_inList.append(inf); |
99 | }else if ( string == "thumbInfos(QStringList)" ) { | 97 | }else if ( string == "thumbInfos(QStringList)" ) { |
100 | stream >> lst; | 98 | stream >> lst; |
101 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 99 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
102 | owarn << "Adding thumbinfo for file "+ *it << oendl; | ||
103 | inf.file = (*it); | 100 | inf.file = (*it); |
104 | inf.kind = false; | 101 | inf.kind = false; |
105 | m_inList.append(inf); | 102 | m_inList.append(inf); |
106 | } | 103 | } |
107 | }else if ( string == "fullInfo(QString)" ) { | 104 | }else if ( string == "fullInfo(QString)" ) { |
108 | inf.kind = true; | 105 | inf.kind = true; |
109 | stream >> inf.file; | 106 | stream >> inf.file; |
110 | m_inList.append(inf); | 107 | m_inList.append(inf); |
111 | }else if ( string == "fullInfos(QStringList)" ) { | 108 | }else if ( string == "fullInfos(QStringList)" ) { |
112 | stream >> lst; | 109 | stream >> lst; |
113 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 110 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
114 | owarn << "Adding fullInfo for"+ *it << oendl; | ||
115 | inf.file = (*it); | 111 | inf.file = (*it); |
116 | inf.kind = true; | 112 | inf.kind = true; |
117 | m_inList.append(inf); | 113 | m_inList.append(inf); |
118 | } | 114 | } |
119 | }else if ( string == "pixmapInfo(QString,int,int)" ) { | 115 | }else if ( string == "pixmapInfo(QString,int,int)" ) { |
120 | stream >> pix.file >> pix.width >> pix.height; | 116 | stream >> pix.file >> pix.width >> pix.height; |
121 | m_inPix.append(pix); | 117 | m_inPix.append(pix); |
122 | }else if ( string == "pixmapInfos(PixmapInfos)" ) { | 118 | }else if ( string == "pixmapInfos(PixmapInfos)" ) { |
123 | PixmapList list; | 119 | PixmapList list; |
124 | stream >> list; | 120 | stream >> list; |
125 | for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { | 121 | for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { |
126 | owarn << "Got " << (*it).width << " " << (*it).height << " " + (*it).file << oendl; | ||
127 | m_inPix.append(*it); | 122 | m_inPix.append(*it); |
128 | } | 123 | } |
129 | }else if ( string == "refUp()" ) { | 124 | }else if ( string == "refUp()" ) { |
130 | m_refs++; | 125 | m_refs++; |
131 | }else if ( string == "refDown()" ) { | 126 | }else if ( string == "refDown()" ) { |
132 | m_refs--; | 127 | m_refs--; |
133 | } | 128 | } |
134 | 129 | ||
@@ -182,17 +177,16 @@ void SlaveReciever::slotThumbNail() { | |||
182 | m_inPix.remove( inf ); | 177 | m_inPix.remove( inf ); |
183 | 178 | ||
184 | static SlaveObjects::Iterator it; | 179 | static SlaveObjects::Iterator it; |
185 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! | 180 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! |
186 | for(it = map->begin(); it != map->end(); ++it ) { | 181 | for(it = map->begin(); it != map->end(); ++it ) { |
187 | SlaveInterface* iface = it.data(); | 182 | SlaveInterface* iface = it.data(); |
188 | if( iface->supports(inf.file ) ) { | 183 | if( iface->supports(inf.file ) ) { |
189 | /* pixmap */ | 184 | /* pixmap */ |
190 | owarn << "Asking for thumbNail in size " << inf.width << " " << inf.height << " for "+inf.file << oendl; | ||
191 | if (inf.width>256||inf.height>256) { | 185 | if (inf.width>256||inf.height>256) { |
192 | owarn << "Scaling thumbnail to 64x64 'cause " << inf.width<<"x"<<inf.height<< | 186 | owarn << "Scaling thumbnail to 64x64 'cause " << inf.width<<"x"<<inf.height<< |
193 | " may be nonsense"; | 187 | " may be nonsense"; |
194 | inf.pixmap = iface->pixmap(inf.file, 64, 64); | 188 | inf.pixmap = iface->pixmap(inf.file, 64, 64); |
195 | }else { | 189 | }else { |
196 | inf.pixmap = iface->pixmap(inf.file, inf.width, inf.height); | 190 | inf.pixmap = iface->pixmap(inf.file, inf.width, inf.height); |
197 | } | 191 | } |
198 | m_outPix.append( inf ); | 192 | m_outPix.append( inf ); |
@@ -207,32 +201,35 @@ void SlaveReciever::slotThumbNail() { | |||
207 | if(!m_out->isActive() && !m_outPix.isEmpty() ) | 201 | if(!m_out->isActive() && !m_outPix.isEmpty() ) |
208 | m_out->start(100); | 202 | m_out->start(100); |
209 | } | 203 | } |
210 | 204 | ||
211 | void SlaveReciever::slotSend() { | 205 | void SlaveReciever::slotSend() { |
212 | 206 | ||
213 | m_out->stop(); | 207 | m_out->stop(); |
214 | 208 | ||
215 | owarn << "Sending " << outPix().count() << " " << outInf().count() << "" << oendl; | ||
216 | /* queue it and send */ | 209 | /* queue it and send */ |
217 | /* if this ever gets a service introduce request queues | 210 | /* if this ever gets a service introduce request queues |
218 | * so we can differinatate between different clients | 211 | * so we can differinatate between different clients |
219 | */ | 212 | */ |
220 | if (! m_outPix.isEmpty() ) { | 213 | if (! m_outPix.isEmpty() ) { |
221 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); | 214 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); |
222 | answer << outPix(); | 215 | answer << outPix(); |
216 | #if 0 | ||
223 | for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { | 217 | for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { |
224 | owarn << "Sending out " << (*it).file.latin1() << " " << (*it).width << " " << (*it).height << "" << oendl; | 218 | owarn << "Sending out " << (*it).file.latin1() << " " << (*it).width << " " << (*it).height << "" << oendl; |
225 | } | 219 | } |
220 | #endif | ||
226 | } | 221 | } |
227 | if ( !m_outList.isEmpty() ) { | 222 | if ( !m_outList.isEmpty() ) { |
228 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); | 223 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); |
229 | answer << outInf(); | 224 | answer << outInf(); |
225 | #if 0 | ||
230 | for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { | 226 | for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { |
231 | owarn << "Sending out2 " + (*it).file << oendl; | 227 | owarn << "Sending out2 " + (*it).file << oendl; |
232 | } | 228 | } |
229 | #endif | ||
233 | } | 230 | } |
234 | 231 | ||
235 | m_outList.clear(); | 232 | m_outList.clear(); |
236 | m_outPix.clear(); | 233 | m_outPix.clear(); |
237 | } | 234 | } |
238 | 235 | ||
diff --git a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp index d2e169c..62bb1e6 100644 --- a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp +++ b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp | |||
@@ -26,32 +26,29 @@ static bool makeThumbDir( const QFileInfo& inf, bool make = false) { | |||
26 | * check if the Opie opie-eye dir exists | 26 | * check if the Opie opie-eye dir exists |
27 | * check if a thumbnail exists | 27 | * check if a thumbnail exists |
28 | * load the thumbnail | 28 | * load the thumbnail |
29 | * /foo/bar/imagefoo.gif | 29 | * /foo/bar/imagefoo.gif |
30 | * check for a png in /foo/bar/.opie-eye/%dx%d-imagefoo.gif | 30 | * check for a png in /foo/bar/.opie-eye/%dx%d-imagefoo.gif |
31 | */ | 31 | */ |
32 | QPixmap ThumbNailTool::getThumb( const QString& path, int width, int height ) { | 32 | QPixmap ThumbNailTool::getThumb( const QString& path, int width, int height ) { |
33 | QFileInfo inf( path ); | 33 | QFileInfo inf( path ); |
34 | owarn << "Get Thumb" << oendl; | ||
35 | if ( !makeThumbDir( inf ) ) { | 34 | if ( !makeThumbDir( inf ) ) { |
36 | QPixmap pix; | 35 | QPixmap pix; |
37 | return pix; | 36 | return pix; |
38 | } | 37 | } |
39 | QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); | 38 | QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); |
40 | owarn << inf.dirPath()+str << oendl; | ||
41 | return QPixmap( inf.dirPath()+str,"PNG" ); | 39 | return QPixmap( inf.dirPath()+str,"PNG" ); |
42 | 40 | ||
43 | } | 41 | } |
44 | 42 | ||
45 | void ThumbNailTool::putThumb( const QString& path, const QPixmap& pix, int width, int height ) { | 43 | void ThumbNailTool::putThumb( const QString& path, const QPixmap& pix, int width, int height ) { |
46 | QFileInfo inf( path ); | 44 | QFileInfo inf( path ); |
47 | makeThumbDir( inf, true ); | 45 | makeThumbDir( inf, true ); |
48 | QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); | 46 | QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); |
49 | owarn << inf.dirPath()+str << oendl; | ||
50 | pix.save( inf.dirPath()+str, "PNG" ); | 47 | pix.save( inf.dirPath()+str, "PNG" ); |
51 | } | 48 | } |
52 | 49 | ||
53 | 50 | ||
54 | QPixmap ThumbNailTool::scaleImage( QImage& img, int w, int h ) { | 51 | QPixmap ThumbNailTool::scaleImage( QImage& img, int w, int h ) { |
55 | double hs = (double)h / (double)img.height() ; | 52 | double hs = (double)h / (double)img.height() ; |
56 | double ws = (double)w / (double)img.width() ; | 53 | double ws = (double)w / (double)img.width() ; |
57 | double scaleFactor = (hs > ws) ? ws : hs; | 54 | double scaleFactor = (hs > ws) ? ws : hs; |