author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/graphics/opie-eye/slave/slavereciever.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
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.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
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 @@ | |||
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 | /* OPIE */ | ||
9 | #include <opie2/odebug.h> | ||
8 | #include <qpe/qcopenvelope_qws.h> | 10 | #include <qpe/qcopenvelope_qws.h> |
9 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | using namespace Opie::Core; | ||
10 | 13 | ||
14 | /* QT */ | ||
11 | #include <qtimer.h> | 15 | #include <qtimer.h> |
12 | 16 | ||
13 | static SlaveObjects* _slaveObj = 0; | 17 | static SlaveObjects* _slaveObj = 0; |
14 | 18 | ||
15 | QDataStream & operator << (QDataStream & str, bool b) | 19 | QDataStream & operator << (QDataStream & str, bool b) |
16 | { | 20 | { |
17 | str << Q_INT8(b); | 21 | str << Q_INT8(b); |
18 | return str; | 22 | return str; |
19 | } | 23 | } |
20 | 24 | ||
21 | QDataStream & operator >> (QDataStream & str, bool & b) | 25 | QDataStream & operator >> (QDataStream & str, bool & b) |
22 | { | 26 | { |
@@ -28,25 +32,25 @@ QDataStream & operator >> (QDataStream & str, bool & b) | |||
28 | 32 | ||
29 | 33 | ||
30 | 34 | ||
31 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { | 35 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { |
32 | return s << inf.file << inf.pixmap << inf.width << inf.height; | 36 | return s << inf.file << inf.pixmap << inf.width << inf.height; |
33 | } | 37 | } |
34 | 38 | ||
35 | /* | 39 | /* |
36 | * GUI sends no QPIxmap!!! | 40 | * GUI sends no QPIxmap!!! |
37 | */ | 41 | */ |
38 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { | 42 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { |
39 | s >> inf.file >> inf.width >> inf.height; | 43 | s >> inf.file >> inf.width >> inf.height; |
40 | qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height ); | 44 | owarn << "Recieved " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; |
41 | return s; | 45 | return s; |
42 | } | 46 | } |
43 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { | 47 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { |
44 | return s << i.kind << i.file << i.info; | 48 | return s << i.kind << i.file << i.info; |
45 | } | 49 | } |
46 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { | 50 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { |
47 | s >> i.kind >> i.file >> i.info; | 51 | s >> i.kind >> i.file >> i.info; |
48 | return s; | 52 | return s; |
49 | } | 53 | } |
50 | 54 | ||
51 | 55 | ||
52 | 56 | ||
@@ -73,60 +77,60 @@ SlaveReciever::SlaveReciever( QObject* par) | |||
73 | SlaveObjects *obj = slaveObjects(); // won't be changed | 77 | SlaveObjects *obj = slaveObjects(); // won't be changed |
74 | SlaveMap::Iterator it; | 78 | SlaveMap::Iterator it; |
75 | SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! | 79 | SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! |
76 | for(it = map->begin(); it != map->end(); ++it ) { | 80 | for(it = map->begin(); it != map->end(); ++it ) { |
77 | obj->insert( it.key(), (*it.data())() ); | 81 | obj->insert( it.key(), (*it.data())() ); |
78 | } | 82 | } |
79 | } | 83 | } |
80 | 84 | ||
81 | SlaveReciever::~SlaveReciever() { | 85 | SlaveReciever::~SlaveReciever() { |
82 | } | 86 | } |
83 | 87 | ||
84 | void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { | 88 | void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { |
85 | qWarning( "String is %s", string.data() ); | 89 | owarn << "String is " << string.data() << "" << oendl; |
86 | QDataStream stream(ar, IO_ReadOnly ); | 90 | QDataStream stream(ar, IO_ReadOnly ); |
87 | QStringList lst; | 91 | QStringList lst; |
88 | static ImageInfo inf; | 92 | static ImageInfo inf; |
89 | static PixmapInfo pix; | 93 | static PixmapInfo pix; |
90 | 94 | ||
91 | if ( string == "thumbInfo(QString)" ) { | 95 | if ( string == "thumbInfo(QString)" ) { |
92 | stream >> inf.file; | 96 | stream >> inf.file; |
93 | m_inList.append(inf); | 97 | m_inList.append(inf); |
94 | }else if ( string == "thumbInfos(QStringList)" ) { | 98 | }else if ( string == "thumbInfos(QStringList)" ) { |
95 | stream >> lst; | 99 | stream >> lst; |
96 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 100 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
97 | qWarning( "Adding thumbinfo for file "+ *it ); | 101 | owarn << "Adding thumbinfo for file "+ *it << oendl; |
98 | inf.file = (*it); | 102 | inf.file = (*it); |
99 | m_inList.append(inf); | 103 | m_inList.append(inf); |
100 | } | 104 | } |
101 | }else if ( string == "fullInfo(QString)" ) { | 105 | }else if ( string == "fullInfo(QString)" ) { |
102 | inf.kind = true; | 106 | inf.kind = true; |
103 | stream >> inf.file; | 107 | stream >> inf.file; |
104 | m_inList.append(inf); | 108 | m_inList.append(inf); |
105 | }else if ( string == "fullInfos(QStringList)" ) { | 109 | }else if ( string == "fullInfos(QStringList)" ) { |
106 | stream >> lst; | 110 | stream >> lst; |
107 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 111 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
108 | qWarning( "Adding fullInfo for"+ *it ); | 112 | owarn << "Adding fullInfo for"+ *it << oendl; |
109 | inf.file = (*it); | 113 | inf.file = (*it); |
110 | inf.kind = true; | 114 | inf.kind = true; |
111 | m_inList.append(inf); | 115 | m_inList.append(inf); |
112 | } | 116 | } |
113 | }else if ( string == "pixmapInfo(QString,int,int)" ) { | 117 | }else if ( string == "pixmapInfo(QString,int,int)" ) { |
114 | stream >> pix.file >> pix.width >> pix.height; | 118 | stream >> pix.file >> pix.width >> pix.height; |
115 | m_inPix.append(pix); | 119 | m_inPix.append(pix); |
116 | }else if ( string == "pixmapInfos(PixmapInfos)" ) { | 120 | }else if ( string == "pixmapInfos(PixmapInfos)" ) { |
117 | PixmapList list; | 121 | PixmapList list; |
118 | stream >> list; | 122 | stream >> list; |
119 | for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { | 123 | for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { |
120 | qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height ); | 124 | owarn << "Got " << (*it).width << " " << (*it).height << " " + (*it).file << oendl; |
121 | m_inPix.append(*it); | 125 | m_inPix.append(*it); |
122 | } | 126 | } |
123 | }else if ( string == "refUp()" ) { | 127 | }else if ( string == "refUp()" ) { |
124 | m_refs++; | 128 | m_refs++; |
125 | }else if ( string == "refDown()" ) { | 129 | }else if ( string == "refDown()" ) { |
126 | m_refs--; | 130 | m_refs--; |
127 | } | 131 | } |
128 | 132 | ||
129 | if (!m_inf->isActive() && !m_inList.isEmpty() ) | 133 | if (!m_inf->isActive() && !m_inList.isEmpty() ) |
130 | m_inf->start(5); | 134 | m_inf->start(5); |
131 | 135 | ||
132 | if (!m_pix->isActive() && !m_inPix.isEmpty() ) | 136 | if (!m_pix->isActive() && !m_inPix.isEmpty() ) |
@@ -172,55 +176,55 @@ void SlaveReciever::slotImageInfo() { | |||
172 | } | 176 | } |
173 | 177 | ||
174 | void SlaveReciever::slotThumbNail() { | 178 | void SlaveReciever::slotThumbNail() { |
175 | PixmapInfo inf = m_inPix.first(); | 179 | PixmapInfo inf = m_inPix.first(); |
176 | m_inPix.remove( inf ); | 180 | m_inPix.remove( inf ); |
177 | 181 | ||
178 | static SlaveObjects::Iterator it; | 182 | static SlaveObjects::Iterator it; |
179 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! | 183 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! |
180 | for(it = map->begin(); it != map->end(); ++it ) { | 184 | for(it = map->begin(); it != map->end(); ++it ) { |
181 | SlaveInterface* iface = it.data(); | 185 | SlaveInterface* iface = it.data(); |
182 | if( iface->supports(inf.file ) ) { | 186 | if( iface->supports(inf.file ) ) { |
183 | /* pixmap */ | 187 | /* pixmap */ |
184 | qWarning( "Asking for thumbNail in size %d %d for "+inf.file, inf.width, inf.height ); | 188 | owarn << "Asking for thumbNail in size " << inf.width << " " << inf.height << " for "+inf.file << oendl; |
185 | inf.pixmap = iface->pixmap(inf.file, 64, 64); | 189 | inf.pixmap = iface->pixmap(inf.file, 64, 64); |
186 | m_outPix.append( inf ); | 190 | m_outPix.append( inf ); |
187 | break; | 191 | break; |
188 | } | 192 | } |
189 | } | 193 | } |
190 | 194 | ||
191 | 195 | ||
192 | 196 | ||
193 | if(m_inPix.isEmpty() ) | 197 | if(m_inPix.isEmpty() ) |
194 | m_pix->stop(); | 198 | m_pix->stop(); |
195 | if(!m_out->isActive() && !m_outPix.isEmpty() ) | 199 | if(!m_out->isActive() && !m_outPix.isEmpty() ) |
196 | m_out->start(100); | 200 | m_out->start(100); |
197 | } | 201 | } |
198 | 202 | ||
199 | void SlaveReciever::slotSend() { | 203 | void SlaveReciever::slotSend() { |
200 | 204 | ||
201 | m_out->stop(); | 205 | m_out->stop(); |
202 | 206 | ||
203 | qWarning( "Sending %d %d", outPix().count(), outInf().count() ); | 207 | owarn << "Sending " << outPix().count() << " " << outInf().count() << "" << oendl; |
204 | /* queue it and send */ | 208 | /* queue it and send */ |
205 | /* if this ever gets a service introduce request queues | 209 | /* if this ever gets a service introduce request queues |
206 | * so we can differinatate between different clients | 210 | * so we can differinatate between different clients |
207 | */ | 211 | */ |
208 | if (! m_outPix.isEmpty() ) { | 212 | if (! m_outPix.isEmpty() ) { |
209 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); | 213 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); |
210 | answer << outPix(); | 214 | answer << outPix(); |
211 | for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { | 215 | for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { |
212 | qWarning( "Sending out %s %d %d", (*it).file.latin1(), (*it).width, (*it).height ); | 216 | owarn << "Sending out " << (*it).file.latin1() << " " << (*it).width << " " << (*it).height << "" << oendl; |
213 | } | 217 | } |
214 | } | 218 | } |
215 | if ( !m_outList.isEmpty() ) { | 219 | if ( !m_outList.isEmpty() ) { |
216 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); | 220 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); |
217 | answer << outInf(); | 221 | answer << outInf(); |
218 | for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { | 222 | for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { |
219 | qWarning( "Sending out2 " + (*it).file ); | 223 | owarn << "Sending out2 " + (*it).file << oendl; |
220 | } | 224 | } |
221 | } | 225 | } |
222 | 226 | ||
223 | m_outList.clear(); | 227 | m_outList.clear(); |
224 | m_outPix.clear(); | 228 | m_outPix.clear(); |
225 | } | 229 | } |
226 | 230 | ||