summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/lib/slavemaster.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/lib/slavemaster.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/lib/slavemaster.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/noncore/graphics/opie-eye/lib/slavemaster.cpp b/noncore/graphics/opie-eye/lib/slavemaster.cpp
index 5bb7ab8..d7165cc 100644
--- a/noncore/graphics/opie-eye/lib/slavemaster.cpp
+++ b/noncore/graphics/opie-eye/lib/slavemaster.cpp
@@ -18,25 +18,25 @@ QDataStream & operator << (QDataStream & str, bool b)
18QDataStream & operator >> (QDataStream & str, bool & b) 18QDataStream & operator >> (QDataStream & str, bool & b)
19{ 19{
20 Q_INT8 l; 20 Q_INT8 l;
21 str >> l; 21 str >> l;
22 b = bool(l); 22 b = bool(l);
23 return str; 23 return str;
24} 24}
25 25
26/* 26/*
27 * ! We don't put a Pixmap in!!!! 27 * ! We don't put a Pixmap in!!!!
28 */ 28 */
29QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { 29QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
30 owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; 30 owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl;
31 return s << inf.file << inf.width << inf.height; 31 return s << inf.file << inf.width << inf.height;
32} 32}
33QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { 33QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
34 s >> inf.file >> inf.pixmap >> inf.width >> inf.height; 34 s >> inf.file >> inf.pixmap >> inf.width >> inf.height;
35 return s; 35 return s;
36} 36}
37QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { 37QDataStream &operator<<( QDataStream& s, const ImageInfo& i) {
38 return s << i.kind << i.file << i.info; 38 return s << i.kind << i.file << i.info;
39} 39}
40QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { 40QDataStream &operator>>( QDataStream& s, ImageInfo& i ) {
41 s >> i.kind >> i.file >> i.info; 41 s >> i.kind >> i.file >> i.info;
42 return s; 42 return s;
@@ -73,52 +73,52 @@ void SlaveMaster::thumbInfo( const QString& str) {
73} 73}
74 74
75void SlaveMaster::imageInfo( const QString& str ) { 75void SlaveMaster::imageInfo( const QString& str ) {
76 m_inImageInfo.append( str ); 76 m_inImageInfo.append( str );
77 if ( !m_started ) { 77 if ( !m_started ) {
78 QTimer::singleShot( 0, this, SLOT(slotTimerStart())); 78 QTimer::singleShot( 0, this, SLOT(slotTimerStart()));
79 m_started = true; 79 m_started = true;
80 } 80 }
81} 81}
82 82
83void SlaveMaster::thumbNail( const QString& str, int w, int h ) { 83void SlaveMaster::thumbNail( const QString& str, int w, int h ) {
84 if ( str.isEmpty() ) { 84 if ( str.isEmpty() ) {
85 owarn << "Asking for empty nail" << oendl; 85 owarn << "Asking for empty nail" << oendl;
86 return; 86 return;
87 } 87 }
88 owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl; 88 owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl;
89 PixmapInfo item; 89 PixmapInfo item;
90 item.file = str; item.width = w; item.height = h; 90 item.file = str; item.width = w; item.height = h;
91 item.pixmap = QPixmap(); 91 item.pixmap = QPixmap();
92 m_inThumbNail.append( item ); 92 m_inThumbNail.append( item );
93 93
94 if ( !m_started ) { 94 if ( !m_started ) {
95 QTimer::singleShot( 0, this, SLOT(slotTimerStart())); 95 QTimer::singleShot( 0, this, SLOT(slotTimerStart()));
96 m_started = true; 96 m_started = true;
97 } 97 }
98} 98}
99 99
100 100
101void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { 101void SlaveMaster::recieve( const QCString& str, const QByteArray& at) {
102 102
103 ImageInfos infos; 103 ImageInfos infos;
104 PixmapInfos pixinfos; 104 PixmapInfos pixinfos;
105 105
106 QDataStream stream( at, IO_ReadOnly ); 106 QDataStream stream( at, IO_ReadOnly );
107 if ( str == "pixmapsHandled(PixmapList)" ) 107 if ( str == "pixmapsHandled(PixmapList)" )
108 stream >> pixinfos; 108 stream >> pixinfos;
109 else if ( str == "pixmapsHandled(StringList)" ) 109 else if ( str == "pixmapsHandled(StringList)" )
110 stream >> infos; 110 stream >> infos;
111 111
112 owarn << "PixInfos " << pixinfos.count() << "" << oendl; 112 owarn << "PixInfos " << pixinfos.count() << "" << oendl;
113 113
114 bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() ); 114 bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() );
115 if ( got_data ) { 115 if ( got_data ) {
116 emit sig_start(); 116 emit sig_start();
117 for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) { 117 for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) {
118 if ( (*_it).kind ) 118 if ( (*_it).kind )
119 emit sig_fullInfo( (*_it).file, (*_it).info ); 119 emit sig_fullInfo( (*_it).file, (*_it).info );
120 else 120 else
121 emit sig_thumbInfo( (*_it).file, (*_it).info ); 121 emit sig_thumbInfo( (*_it).file, (*_it).info );
122 } 122 }
123 123
124 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) 124 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it )
@@ -140,15 +140,31 @@ void SlaveMaster::slotTimerStart() {
140 } 140 }
141 if ( !m_inThumbNail.isEmpty() ) { 141 if ( !m_inThumbNail.isEmpty() ) {
142 QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); 142 QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" );
143 env << m_inThumbNail; 143 env << m_inThumbNail;
144 } 144 }
145 145
146 146
147 m_inThumbInfo.clear(); 147 m_inThumbInfo.clear();
148 m_inImageInfo.clear(); 148 m_inImageInfo.clear();
149 m_inThumbNail.clear(); 149 m_inThumbNail.clear();
150} 150}
151 151
152QImage SlaveMaster::image( const QString& str, PDirLister::Factor, int ) { 152QImage SlaveMaster::image( const QString& , PDirLister::Factor, int ) {
153 return QImage(); 153 return QImage();
154} 154}
155
156
157namespace SlaveHelper {
158void slaveConnectSignals( QObject* target ) {
159 SlaveMaster* master = SlaveMaster::self();
160
161 QObject::connect( master, SIGNAL(sig_start()), target, SIGNAL(sig_start()) );
162 QObject::connect( master, SIGNAL(sig_end()), target, SIGNAL(sig_end()) );
163 QObject::connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)),
164 target, SIGNAL(sig_thumbInfo(const QString&, const QString&)) );
165 QObject::connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
166 target, SIGNAL(sig_fullInfo(const QString&, const QString&)) );
167 QObject::connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)),
168 target, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) );
169}
170}