summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/slave
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/slave') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/slave/jpeg_slave.cpp18
-rw-r--r--noncore/graphics/opie-eye/slave/main.cpp16
-rw-r--r--noncore/graphics/opie-eye/slave/slave.pro6
-rw-r--r--noncore/graphics/opie-eye/slave/slavereciever.cpp22
-rw-r--r--noncore/graphics/opie-eye/slave/thumbnailtool.cpp11
5 files changed, 43 insertions, 30 deletions
diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
index 086b47f..fb7d5de 100644
--- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
@@ -1,19 +1,23 @@
#include "jpeg_slave.h"
-
#include "thumbnailtool.h"
PHUNK_VIEW_INTERFACE( "JPEG", JpegSlave )
-#include <qtopia/timestring.h>
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qobject.h>
#include <qimage.h>
/**
exif.h
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
@@ -110,25 +114,25 @@ public:
int getCompressionLevel() { return CompressionLevel; }
QString getUserComment() { return UserComment; }
QString getComment() { return Comment; }
QImage getThumbnail();
bool isThumbnailSane();
bool isNullThumbnail() { return !isThumbnailSane(); }
};
class FatalError {
const char* ex;
public:
FatalError(const char* s) { ex = s; }
- void debug_print() const { qWarning("exception: %s", ex ); }
+ void debug_print() const { owarn << "exception: " << ex << "" << oendl; }
};
static unsigned char * LastExifRefd;
static int ExifSettingsLength;
static double FocalplaneXRes;
static double FocalplaneUnits;
static int MotorolaOrder = 0;
static int SectionsRead;
//static int HaveAll;
@@ -253,25 +257,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
int marker = 0;
int got;
unsigned int ll,lh;
unsigned int itemlen;
uchar * Data;
for (a=0;a<7;a++){
marker = infile.getch();
if (marker != 0xff) break;
if (a >= 6){
- qWarning( "too many padding bytes" );
+ owarn << "too many padding bytes" << oendl;
return false;
}
}
if (marker == 0xff){
// 0xff is legal padding, but if we get that many, something's wrong.
return false;
}
Sections[SectionsRead].Type = marker;
@@ -318,25 +322,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
return false;
}
Sections[SectionsRead].Data = Data;
Sections[SectionsRead].Size = size;
Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;
SectionsRead ++;
//HaveAll = 1;
}
return true;
case M_EOI: // in case it's a tables-only JPEG stream
- qWarning( "No image in jpeg!" );
+ owarn << "No image in jpeg!" << oendl;
return false;
case M_COM: // Comment section
// pieczy 2002-02-12
// now the User comment goes to UserComment
// so we can store a Comment section also in READ_EXIF mode
process_COM(Data, itemlen);
break;
case M_JFIF:
// Regular jpegs always have this tag, exif images have the exif
// marker instead, althogh ACDsee will write images with both markers.
@@ -717,25 +721,25 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa
if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){
Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries));
// There is at least one jpeg from an HP camera having an Offset of almost MAXUINT.
// Adding OffsetBase to it produces an overflow, so compare with ExifLength here.
// See http://bugs.kde.org/show_bug.cgi?id=54542
if (Offset && Offset < ExifLength){
SubdirStart = OffsetBase + Offset;
if (SubdirStart > OffsetBase+ExifLength){
if (SubdirStart < OffsetBase+ExifLength+20){
// Jhead 1.3 or earlier would crop the whole directory!
// As Jhead produces this form of format incorrectness,
// I'll just let it pass silently
- qWarning( "Thumbnail removed with Jhead 1.3 or earlier" );
+ owarn << "Thumbnail removed with Jhead 1.3 or earlier" << oendl;
}else{
return;
}
}else{
if (SubdirStart <= OffsetBase+ExifLength){
ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
}
}
}
}else{
// The exif header ends before the last next directory pointer.
}
@@ -904,25 +908,25 @@ ExifData::ExifData()
//--------------------------------------------------------------------------
bool ExifData::scan(const QString & path)
{
int ret;
QFile f(path);
f.open(IO_ReadOnly);
// Scan the JPEG headers.
ret = ReadJpegSections(f, READ_EXIF);
if (ret == false){
- qWarning( "Not JPEG file!" );
+ owarn << "Not JPEG file!" << oendl;
DiscardData();
f.close();
return false;
}
f.close();
DiscardData();
//now make the strings clean,
// for exmaple my Casio is a "QV-4000 "
CameraMake = CameraMake.stripWhiteSpace();
CameraModel = CameraModel.stripWhiteSpace();
UserComment = UserComment.stripWhiteSpace();
diff --git a/noncore/graphics/opie-eye/slave/main.cpp b/noncore/graphics/opie-eye/slave/main.cpp
index 37020e6..5b90483 100644
--- a/noncore/graphics/opie-eye/slave/main.cpp
+++ b/noncore/graphics/opie-eye/slave/main.cpp
@@ -22,38 +22,38 @@ int main( int argc, char* argv[] ) {
&rec, SLOT(recieveAnswer(const QCString&,const QByteArray&)));
QObject::connect(qApp,SIGNAL(appMessage(const QCString&, const QByteArray&)),
&rec, SLOT(recieveAnswer(const QCString&,const QByteArray&)));
return app.exec();
}
#ifdef DEBUG_IT
int main( int argc, char* argv[] ) {
QString str = QString::fromLatin1(argv[2] );
QApplication app( argc, argv );
GifSlave slave;
- qWarning( str +" "+slave.iconViewName(str ) );
- qWarning( str+" "+slave.fullImageInfo( str ) );
+ owarn << str +" "+slave.iconViewName(str ) << oendl;
+ owarn << str+" "+slave.fullImageInfo( str ) << oendl;
PNGSlave pngslave;
- qWarning( str + " " + pngslave.iconViewName(str) );
- qWarning( str + " " + pngslave.fullImageInfo(str));
+ owarn << str + " " + pngslave.iconViewName(str) << oendl;
+ owarn << str + " " + pngslave.fullImageInfo(str) << oendl;
JpegSlave jpgslave;
- qWarning( str + " " + jpgslave.iconViewName(str ) );
- qWarning( str + " " + jpgslave.fullImageInfo( str ) );
+ owarn << str + " " + jpgslave.iconViewName(str ) << oendl;
+ owarn << str + " " + jpgslave.fullImageInfo( str ) << oendl;
//return app.exec();
QPixmap pix = ThumbNailTool::getThumb( str, 24, 24 );
if ( pix.isNull() ) {
- qWarning( "No Thumbnail" );
+ owarn << "No Thumbnail" << oendl;
pix = slave.pixmap(str, 24, 24);
}
if (!pix.isNull() ) {
- qWarning( "Saving Thumbnail" );
+ owarn << "Saving Thumbnail" << oendl;
ThumbNailTool::putThumb( str, pix, 24, 24 );
}
}
#endif
diff --git a/noncore/graphics/opie-eye/slave/slave.pro b/noncore/graphics/opie-eye/slave/slave.pro
index 3f42495..903d667 100644
--- a/noncore/graphics/opie-eye/slave/slave.pro
+++ b/noncore/graphics/opie-eye/slave/slave.pro
@@ -1,18 +1,18 @@
-CONFIG += qte
+CONFIG = qt
TEMPLATE = app
TARGET = opie-eye_slave
DESTDIR = $(OPIEDIR)/bin
HEADERS = gif_slave.h slaveiface.h slavereciever.h \
thumbnailtool.h png_slave.h jpeg_slave.h \
../iface/slaveiface.h
SOURCES = main.cpp gif_slave.cpp slavereciever.cpp \
slaveiface.cpp thumbnailtool.cpp png_slave.cpp \
jpeg_slave.cpp
INCLUDEPATH += $(OPIEDIR)/include ../
DEPENDSPATH += $(OPIEDIR)/include
-LIBS += -lqpe
+LIBS += -lqpe -lopiecore2
-include ( $(OPIEDIR)/include.pro ) \ No newline at end of file
+include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp
index bbbbb30..82b3d23 100644
--- a/noncore/graphics/opie-eye/slave/slavereciever.cpp
+++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp
@@ -1,22 +1,26 @@
/*
* GPLv2 zecke@handhelds.org
*/
#include "slavereciever.h"
#include "slaveiface.h"
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+/* QT */
#include <qtimer.h>
static SlaveObjects* _slaveObj = 0;
QDataStream & operator << (QDataStream & str, bool b)
{
str << Q_INT8(b);
return str;
}
QDataStream & operator >> (QDataStream & str, bool & b)
{
@@ -28,25 +32,25 @@ QDataStream & operator >> (QDataStream & str, bool & b)
QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
return s << inf.file << inf.pixmap << inf.width << inf.height;
}
/*
* GUI sends no QPIxmap!!!
*/
QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
s >> inf.file >> inf.width >> inf.height;
- qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height );
+ owarn << "Recieved " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl;
return s;
}
QDataStream &operator<<( QDataStream& s, const ImageInfo& i) {
return s << i.kind << i.file << i.info;
}
QDataStream &operator>>( QDataStream& s, ImageInfo& i ) {
s >> i.kind >> i.file >> i.info;
return s;
}
@@ -73,60 +77,60 @@ SlaveReciever::SlaveReciever( QObject* par)
SlaveObjects *obj = slaveObjects(); // won't be changed
SlaveMap::Iterator it;
SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!!
for(it = map->begin(); it != map->end(); ++it ) {
obj->insert( it.key(), (*it.data())() );
}
}
SlaveReciever::~SlaveReciever() {
}
void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) {
- qWarning( "String is %s", string.data() );
+ owarn << "String is " << string.data() << "" << oendl;
QDataStream stream(ar, IO_ReadOnly );
QStringList lst;
static ImageInfo inf;
static PixmapInfo pix;
if ( string == "thumbInfo(QString)" ) {
stream >> inf.file;
m_inList.append(inf);
}else if ( string == "thumbInfos(QStringList)" ) {
stream >> lst;
for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
- qWarning( "Adding thumbinfo for file "+ *it );
+ owarn << "Adding thumbinfo for file "+ *it << oendl;
inf.file = (*it);
m_inList.append(inf);
}
}else if ( string == "fullInfo(QString)" ) {
inf.kind = true;
stream >> inf.file;
m_inList.append(inf);
}else if ( string == "fullInfos(QStringList)" ) {
stream >> lst;
for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
- qWarning( "Adding fullInfo for"+ *it );
+ owarn << "Adding fullInfo for"+ *it << oendl;
inf.file = (*it);
inf.kind = true;
m_inList.append(inf);
}
}else if ( string == "pixmapInfo(QString,int,int)" ) {
stream >> pix.file >> pix.width >> pix.height;
m_inPix.append(pix);
}else if ( string == "pixmapInfos(PixmapInfos)" ) {
PixmapList list;
stream >> list;
for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) {
- qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height );
+ owarn << "Got " << (*it).width << " " << (*it).height << " " + (*it).file << oendl;
m_inPix.append(*it);
}
}else if ( string == "refUp()" ) {
m_refs++;
}else if ( string == "refDown()" ) {
m_refs--;
}
if (!m_inf->isActive() && !m_inList.isEmpty() )
m_inf->start(5);
if (!m_pix->isActive() && !m_inPix.isEmpty() )
@@ -172,55 +176,55 @@ void SlaveReciever::slotImageInfo() {
}
void SlaveReciever::slotThumbNail() {
PixmapInfo inf = m_inPix.first();
m_inPix.remove( inf );
static SlaveObjects::Iterator it;
static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!!
for(it = map->begin(); it != map->end(); ++it ) {
SlaveInterface* iface = it.data();
if( iface->supports(inf.file ) ) {
/* pixmap */
- qWarning( "Asking for thumbNail in size %d %d for "+inf.file, inf.width, inf.height );
+ owarn << "Asking for thumbNail in size " << inf.width << " " << inf.height << " for "+inf.file << oendl;
inf.pixmap = iface->pixmap(inf.file, 64, 64);
m_outPix.append( inf );
break;
}
}
if(m_inPix.isEmpty() )
m_pix->stop();
if(!m_out->isActive() && !m_outPix.isEmpty() )
m_out->start(100);
}
void SlaveReciever::slotSend() {
m_out->stop();
- qWarning( "Sending %d %d", outPix().count(), outInf().count() );
+ owarn << "Sending " << outPix().count() << " " << outInf().count() << "" << oendl;
/* queue it and send */
/* if this ever gets a service introduce request queues
* so we can differinatate between different clients
*/
if (! m_outPix.isEmpty() ) {
QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" );
answer << outPix();
for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) {
- qWarning( "Sending out %s %d %d", (*it).file.latin1(), (*it).width, (*it).height );
+ owarn << "Sending out " << (*it).file.latin1() << " " << (*it).width << " " << (*it).height << "" << oendl;
}
}
if ( !m_outList.isEmpty() ) {
QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" );
answer << outInf();
for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) {
- qWarning( "Sending out2 " + (*it).file );
+ owarn << "Sending out2 " + (*it).file << oendl;
}
}
m_outList.clear();
m_outPix.clear();
}
diff --git a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp
index a202457..d2e169c 100644
--- a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp
+++ b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp
@@ -1,14 +1,19 @@
#include "thumbnailtool.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qfileinfo.h>
#include <qdir.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qstring.h>
static bool makeThumbDir( const QFileInfo& inf, bool make = false) {
QDir dir( inf.dirPath()+ "/.opie-eye" );
if ( !dir.exists() )
if ( make )
return dir.mkdir(QString::null);
else
@@ -17,40 +22,40 @@ static bool makeThumbDir( const QFileInfo& inf, bool make = false) {
}
/*
* check if the Opie opie-eye dir exists
* check if a thumbnail exists
* load the thumbnail
* /foo/bar/imagefoo.gif
* check for a png in /foo/bar/.opie-eye/%dx%d-imagefoo.gif
*/
QPixmap ThumbNailTool::getThumb( const QString& path, int width, int height ) {
QFileInfo inf( path );
- qWarning( "Get Thumb" );
+ owarn << "Get Thumb" << oendl;
if ( !makeThumbDir( inf ) ) {
QPixmap pix;
return pix;
}
QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() );
- qWarning( inf.dirPath()+str );
+ owarn << inf.dirPath()+str << oendl;
return QPixmap( inf.dirPath()+str,"PNG" );
}
void ThumbNailTool::putThumb( const QString& path, const QPixmap& pix, int width, int height ) {
QFileInfo inf( path );
makeThumbDir( inf, true );
QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() );
- qWarning( inf.dirPath()+str );
+ owarn << inf.dirPath()+str << oendl;
pix.save( inf.dirPath()+str, "PNG" );
}
QPixmap ThumbNailTool::scaleImage( QImage& img, int w, int h ) {
double hs = (double)h / (double)img.height() ;
double ws = (double)w / (double)img.width() ;
double scaleFactor = (hs > ws) ? ws : hs;
int smoothW = (int)(scaleFactor * img.width());
int smoothH = (int)(scaleFactor * img.height());
QPixmap pixmap;
if ( img.width() <= w && img.height() <= h )