summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/slave/slavereciever.cpp
authorzecke <zecke>2004-03-23 00:36:37 (UTC)
committer zecke <zecke>2004-03-23 00:36:37 (UTC)
commitd7581f7cd0ba6adb43ee5c4bdeae696c0a16ae3b (patch) (unidiff)
treec65e9015323fb7fc4fec45038aa0f0a19b43252f /noncore/graphics/opie-eye/slave/slavereciever.cpp
parent428b687982966dc2efabaf6dbcc55ad0ea30aa10 (diff)
downloadopie-d7581f7cd0ba6adb43ee5c4bdeae696c0a16ae3b.zip
opie-d7581f7cd0ba6adb43ee5c4bdeae696c0a16ae3b.tar.gz
opie-d7581f7cd0ba6adb43ee5c4bdeae696c0a16ae3b.tar.bz2
Fix communication. It seems like QPixmap and QDataStream
do not mix well if the QPixmap is not valid.. invalidate image requests if we change the dir
Diffstat (limited to 'noncore/graphics/opie-eye/slave/slavereciever.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/slave/slavereciever.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp
index 951f3df..c8e33d4 100644
--- a/noncore/graphics/opie-eye/slave/slavereciever.cpp
+++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp
@@ -1,83 +1,88 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 */ 3 */
4 4
5#include "slavereciever.h" 5#include "slavereciever.h"
6#include "slaveiface.h" 6#include "slaveiface.h"
7 7
8#include <qpe/qcopenvelope_qws.h> 8#include <qpe/qcopenvelope_qws.h>
9#include <qpe/qpeapplication.h> 9#include <qpe/qpeapplication.h>
10 10
11#include <qtimer.h> 11#include <qtimer.h>
12 12
13static SlaveObjects* _slaveObj = 0; 13static SlaveObjects* _slaveObj = 0;
14 14
15QDataStream & operator << (QDataStream & str, bool b) 15QDataStream & operator << (QDataStream & str, bool b)
16{ 16{
17 str << Q_INT8(b); 17 str << Q_INT8(b);
18 return str; 18 return str;
19} 19}
20 20
21QDataStream & operator >> (QDataStream & str, bool & b) 21QDataStream & operator >> (QDataStream & str, bool & b)
22{ 22{
23 Q_INT8 l; 23 Q_INT8 l;
24 str >> l; 24 str >> l;
25 b = bool(l); 25 b = bool(l);
26 return str; 26 return str;
27} 27}
28 28
29 29
30 30
31QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { 31QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
32 return s << inf.file << inf.pixmap << inf.width << inf.height; 32 return s << inf.file << inf.pixmap << inf.width << inf.height;
33} 33}
34
35/*
36 * GUI sends no QPIxmap!!!
37 */
34QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { 38QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
35 s >> inf.file >> inf.pixmap >> inf.width >> inf.height; 39 s >> inf.file >> inf.width >> inf.height;
40 qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height );
36 return s; 41 return s;
37} 42}
38QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { 43QDataStream &operator<<( QDataStream& s, const ImageInfo& i) {
39 return s << i.kind << i.file << i.info; 44 return s << i.kind << i.file << i.info;
40} 45}
41QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { 46QDataStream &operator>>( QDataStream& s, ImageInfo& i ) {
42 s >> i.kind >> i.file >> i.info; 47 s >> i.kind >> i.file >> i.info;
43 return s; 48 return s;
44} 49}
45 50
46 51
47 52
48SlaveObjects* slaveObjects() { 53SlaveObjects* slaveObjects() {
49 if ( !_slaveObj ) 54 if ( !_slaveObj )
50 _slaveObj = new SlaveObjects; 55 _slaveObj = new SlaveObjects;
51 return _slaveObj; 56 return _slaveObj;
52} 57}
53 58
54SlaveReciever::SlaveReciever( QObject* par) 59SlaveReciever::SlaveReciever( QObject* par)
55 : QObject( par ) 60 : QObject( par )
56{ 61{
57 m_inf = new QTimer(this); 62 m_inf = new QTimer(this);
58 connect(m_inf,SIGNAL(timeout()), 63 connect(m_inf,SIGNAL(timeout()),
59 this, SLOT(slotImageInfo())); 64 this, SLOT(slotImageInfo()));
60 m_pix = new QTimer(this); 65 m_pix = new QTimer(this);
61 connect(m_pix,SIGNAL(timeout()), 66 connect(m_pix,SIGNAL(timeout()),
62 this, SLOT(slotThumbNail())); 67 this, SLOT(slotThumbNail()));
63 68
64 m_out = new QTimer(this); 69 m_out = new QTimer(this);
65 connect(m_out,SIGNAL(timeout()), 70 connect(m_out,SIGNAL(timeout()),
66 this, SLOT(slotSend())); 71 this, SLOT(slotSend()));
67 72
68 SlaveObjects *obj = slaveObjects(); // won't be changed 73 SlaveObjects *obj = slaveObjects(); // won't be changed
69 SlaveMap::Iterator it; 74 SlaveMap::Iterator it;
70 SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! 75 SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!!
71 for(it = map->begin(); it != map->end(); ++it ) { 76 for(it = map->begin(); it != map->end(); ++it ) {
72 obj->insert( it.key(), (*it.data())() ); 77 obj->insert( it.key(), (*it.data())() );
73 } 78 }
74} 79}
75 80
76SlaveReciever::~SlaveReciever() { 81SlaveReciever::~SlaveReciever() {
77} 82}
78 83
79void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { 84void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) {
80 qWarning( "String is %s", string.data() ); 85 qWarning( "String is %s", string.data() );
81 QDataStream stream(ar, IO_ReadOnly ); 86 QDataStream stream(ar, IO_ReadOnly );
82 QStringList lst; 87 QStringList lst;
83 static ImageInfo inf; 88 static ImageInfo inf;