-rw-r--r-- | libopie2/opieui/okeyconfigwidget.h | 96 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/slave/slavereciever.cpp | 11 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/slave/slavereciever.h | 2 |
6 files changed, 116 insertions, 8 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.h b/libopie2/opieui/okeyconfigwidget.h new file mode 100644 index 0000000..d76ea46 --- a/dev/null +++ b/libopie2/opieui/okeyconfigwidget.h | |||
@@ -0,0 +1,96 @@ | |||
1 | #ifndef ODP_KEY_CONFIG_WIDGET_H | ||
2 | #define ODP_KEY_CONFIG_WIDGET_H | ||
3 | |||
4 | #include <opie2/oconfig.h> | ||
5 | |||
6 | #include <qstring.h> | ||
7 | #include <qpixmap.h> | ||
8 | #include <qbytearray.h> | ||
9 | #include <qhbox.h> | ||
10 | #include <qvaluelist.h> | ||
11 | |||
12 | class QKeyEvent; | ||
13 | |||
14 | namespace Opie { | ||
15 | namespace Ui { | ||
16 | |||
17 | class OKeyConfigItem { | ||
18 | friend class OKeyConfigManager; | ||
19 | public: | ||
20 | typedef QValueList<OKeyConfigItem> OKeyConfigItemList; | ||
21 | OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(), | ||
22 | const QPixmap& symbol = QPixmap(), | ||
23 | int key = 0, int mod = 0, | ||
24 | int default_key = 0, int default_modified = 0 ); | ||
25 | ~OKeyConfigItem(); | ||
26 | |||
27 | QString text()const; | ||
28 | QPixmap pixmap()const; | ||
29 | int key()const; | ||
30 | int modifier()const; | ||
31 | int defaultKey()const; | ||
32 | int defaultModifier()const; | ||
33 | |||
34 | void setText( const QString& text ); | ||
35 | void setPixmap( const QPixmap& ); | ||
36 | void setKey( int ); | ||
37 | void setModied( int ); | ||
38 | void setDefaultKey( int ); | ||
39 | void setDefaultModifier( int ); | ||
40 | |||
41 | bool isConfigured()const; | ||
42 | bool isEmpty()const; | ||
43 | private: | ||
44 | QString m_text; | ||
45 | QCString m_config; | ||
46 | QPixmap m_pix; | ||
47 | int m_key; | ||
48 | int m_mod; | ||
49 | int m_defKey; | ||
50 | int m_defMod; | ||
51 | class Private; | ||
52 | Private *d; | ||
53 | }; | ||
54 | |||
55 | |||
56 | class OKeyConfig : public QObject { | ||
57 | Q_OBJECT | ||
58 | public: | ||
59 | OKeyConfig(Opie::Core::OConfig *conf = 0, bool grabkeyboard); | ||
60 | ~OKeyConfig(); | ||
61 | |||
62 | void load(); | ||
63 | void save(); | ||
64 | |||
65 | OKeyConfigItem handleKeyEvent( QKeyEvent* ); | ||
66 | QString handleKeyEventString( QKeyEvent* ); | ||
67 | |||
68 | void addKeyConfig( const OKeyConfigItem& ); | ||
69 | void removeKeyConfig( const OKeyConfigItem& ); | ||
70 | signals: | ||
71 | void keyConfigChanged( OKeyConfig* ); | ||
72 | |||
73 | private: | ||
74 | OKeyConfigItemList m_keys; | ||
75 | }; | ||
76 | |||
77 | |||
78 | class OKeyConfigWidget : public QHBox { | ||
79 | Q_OBJECT | ||
80 | public: | ||
81 | enum ChangeMode { Imediate, Queu }; | ||
82 | OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
83 | OKeyConfigWidget( OKeyConfig *, QWidget* parent = 0, const char* = 0, WFlags = 0 ); | ||
84 | ~OKeyConfigWidget(); | ||
85 | |||
86 | void setChangeMode( enum ChangeMode ); | ||
87 | ChangeMode changeMode()const; | ||
88 | |||
89 | void reload(); | ||
90 | }; | ||
91 | |||
92 | } | ||
93 | } | ||
94 | |||
95 | |||
96 | #endif | ||
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 38a621e..729b64f 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -1,252 +1,255 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "iconview.h" | 6 | #include "iconview.h" |
7 | 7 | ||
8 | #include <lib/imagecache.h> | 8 | #include <lib/imagecache.h> |
9 | 9 | ||
10 | #include <iface/dirview.h> | 10 | #include <iface/dirview.h> |
11 | #include <iface/dirlister.h> | 11 | #include <iface/dirlister.h> |
12 | 12 | ||
13 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
14 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
15 | #include <qpe/qpemessagebox.h> | 15 | #include <qpe/qpemessagebox.h> |
16 | #include <qpe/ir.h> | 16 | #include <qpe/ir.h> |
17 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
18 | 18 | ||
19 | #include <qiconview.h> | 19 | #include <qiconview.h> |
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qhbox.h> | 21 | #include <qhbox.h> |
22 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
23 | #include <qdir.h> | 23 | #include <qdir.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | #include <qtimer.h> | 26 | #include <qtimer.h> |
27 | #include <qstyle.h> | 27 | #include <qstyle.h> |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | namespace { | 31 | namespace { |
32 | QPixmap* _dirPix = 0; | 32 | QPixmap* _dirPix = 0; |
33 | QPixmap* _unkPix = 0; | 33 | QPixmap* _unkPix = 0; |
34 | class IconViewItem : public QIconViewItem { | 34 | class IconViewItem : public QIconViewItem { |
35 | public: | 35 | public: |
36 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); | 36 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); |
37 | QPixmap* pixmap()const; | 37 | QPixmap* pixmap()const; |
38 | QString path()const { return m_path; } | 38 | QString path()const { return m_path; } |
39 | bool isDir()const { return m_isDir; } | 39 | bool isDir()const { return m_isDir; } |
40 | void setText( const QString& ); | 40 | void setText( const QString& ); |
41 | private: | 41 | private: |
42 | mutable QPixmap* m_pix; | 42 | mutable QPixmap* m_pix; |
43 | QString m_path; | 43 | QString m_path; |
44 | bool m_isDir : 1; | 44 | bool m_isDir : 1; |
45 | bool m_noInfo :1; | 45 | bool m_noInfo :1; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | ||
49 | /* | 49 | /* |
50 | * If we request an Image or String | 50 | * If we request an Image or String |
51 | * we add it to the map | 51 | * we add it to the map |
52 | */ | 52 | */ |
53 | QMap<QString, IconViewItem*> g_stringInf; | 53 | QMap<QString, IconViewItem*> g_stringInf; |
54 | QMap<QString, IconViewItem*> g_stringPix; | 54 | QMap<QString, IconViewItem*> g_stringPix; |
55 | 55 | ||
56 | IconViewItem::IconViewItem( QIconView* view,const QString& path, | 56 | IconViewItem::IconViewItem( QIconView* view,const QString& path, |
57 | const QString& name, bool isDir ) | 57 | const QString& name, bool isDir ) |
58 | : QIconViewItem( view ), m_path( path ), m_isDir( isDir ), | 58 | : QIconViewItem( view ), m_path( path ), m_isDir( isDir ), |
59 | m_noInfo( false ) | 59 | m_noInfo( false ) |
60 | { | 60 | { |
61 | QIconViewItem::setText( name ); | 61 | QIconViewItem::setText( name ); |
62 | if ( isDir && !_dirPix ) | 62 | if ( isDir && !_dirPix ) |
63 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); | 63 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); |
64 | else if ( !isDir && !_unkPix ) | 64 | else if ( !isDir && !_unkPix ) |
65 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); | 65 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); |
66 | } | 66 | } |
67 | inline QPixmap* IconViewItem::pixmap()const { | 67 | inline QPixmap* IconViewItem::pixmap()const { |
68 | if ( m_isDir ) | 68 | if ( m_isDir ) |
69 | return _dirPix; | 69 | return _dirPix; |
70 | else{ | 70 | else{ |
71 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { | 71 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { |
72 | currentView()->dirLister()->imageInfo( m_path ); | 72 | currentView()->dirLister()->imageInfo( m_path ); |
73 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); | 73 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); |
74 | } | 74 | } |
75 | 75 | ||
76 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); | 76 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); |
77 | if ( !m_pix && !g_stringPix.contains( m_path )) { | 77 | if ( !m_pix && !g_stringPix.contains( m_path )) { |
78 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); | 78 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); |
79 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); | 79 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); |
80 | } | 80 | } |
81 | return m_pix ? m_pix : _unkPix; | 81 | return m_pix ? m_pix : _unkPix; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | inline void IconViewItem::setText( const QString& str ) { | 84 | inline void IconViewItem::setText( const QString& str ) { |
85 | QString text = QIconViewItem::text()+"\n"+str; | 85 | QString text = QIconViewItem::text()+"\n"+str; |
86 | m_noInfo = true; | 86 | m_noInfo = true; |
87 | QIconViewItem::setText( text ); | 87 | QIconViewItem::setText( text ); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | PIconView::PIconView( QWidget* wid, Config* cfg ) | 92 | PIconView::PIconView( QWidget* wid, Config* cfg ) |
93 | : QVBox( wid ), m_cfg( cfg ) | 93 | : QVBox( wid ), m_cfg( cfg ) |
94 | { | 94 | { |
95 | { | 95 | { |
96 | // QCopEnvelope( "QPE/Application/opie-eye_slave", "foo()" ); | 96 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
97 | } | 97 | } |
98 | m_path = QDir::homeDirPath(); | 98 | m_path = QDir::homeDirPath(); |
99 | 99 | ||
100 | QHBox *hbox = new QHBox( this ); | 100 | QHBox *hbox = new QHBox( this ); |
101 | QLabel* lbl = new QLabel( hbox ); | 101 | QLabel* lbl = new QLabel( hbox ); |
102 | lbl->setText( tr("View as" ) ); | 102 | lbl->setText( tr("View as" ) ); |
103 | 103 | ||
104 | m_views = new QComboBox( hbox, "View As" ); | 104 | m_views = new QComboBox( hbox, "View As" ); |
105 | connect( m_views, SIGNAL(activated(int)), | 105 | connect( m_views, SIGNAL(activated(int)), |
106 | this, SLOT(slotViewChanged(int)) ); | 106 | this, SLOT(slotViewChanged(int)) ); |
107 | 107 | ||
108 | m_view= new QIconView( this ); | 108 | m_view= new QIconView( this ); |
109 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 109 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
110 | this, SLOT(slotClicked(QIconViewItem*)) ); | 110 | this, SLOT(slotClicked(QIconViewItem*)) ); |
111 | 111 | ||
112 | m_view->setArrangement( QIconView::LeftToRight ); | 112 | m_view->setArrangement( QIconView::LeftToRight ); |
113 | m_view->setItemTextPos( QIconView::Right ); | 113 | m_view->setItemTextPos( QIconView::Right ); |
114 | 114 | ||
115 | 115 | ||
116 | int dw = QApplication::desktop()->width(); | 116 | int dw = QApplication::desktop()->width(); |
117 | int viewerWidth = dw-style().scrollBarExtent().width(); | 117 | int viewerWidth = dw-style().scrollBarExtent().width(); |
118 | m_view->setGridX( viewerWidth-2*m_view->spacing() ); | 118 | m_view->setGridX( viewerWidth-2*m_view->spacing() ); |
119 | m_view->setGridY( fontMetrics().height()*2+40 ); | 119 | m_view->setGridY( fontMetrics().height()*2+40 ); |
120 | loadViews(); | 120 | loadViews(); |
121 | slotViewChanged( m_views->currentItem() ); | 121 | slotViewChanged( m_views->currentItem() ); |
122 | } | 122 | } |
123 | 123 | ||
124 | PIconView::~PIconView() { | 124 | PIconView::~PIconView() { |
125 | { | ||
126 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | ||
127 | } | ||
125 | } | 128 | } |
126 | 129 | ||
127 | void PIconView::slotDirUp() { | 130 | void PIconView::slotDirUp() { |
128 | QDir dir( m_path ); | 131 | QDir dir( m_path ); |
129 | dir.cdUp(); | 132 | dir.cdUp(); |
130 | slotChangeDir( dir.absPath() ); | 133 | slotChangeDir( dir.absPath() ); |
131 | 134 | ||
132 | } | 135 | } |
133 | 136 | ||
134 | void PIconView::slotChangeDir(const QString& path) { | 137 | void PIconView::slotChangeDir(const QString& path) { |
135 | if ( !currentView() ) | 138 | if ( !currentView() ) |
136 | return; | 139 | return; |
137 | 140 | ||
138 | PDirLister *lister = currentView()->dirLister(); | 141 | PDirLister *lister = currentView()->dirLister(); |
139 | if (!lister ) | 142 | if (!lister ) |
140 | return; | 143 | return; |
141 | 144 | ||
142 | lister->setStartPath( path ); | 145 | lister->setStartPath( path ); |
143 | m_path = lister->currentPath(); | 146 | m_path = lister->currentPath(); |
144 | 147 | ||
145 | m_view->clear(); | 148 | m_view->clear(); |
146 | addFolders( lister->folders() ); | 149 | addFolders( lister->folders() ); |
147 | addFiles( lister->files() ); | 150 | addFiles( lister->files() ); |
148 | 151 | ||
149 | // Also invalidate the cache. We can't cancel the operations anyway | 152 | // Also invalidate the cache. We can't cancel the operations anyway |
150 | g_stringPix.clear(); | 153 | g_stringPix.clear(); |
151 | g_stringInf.clear(); | 154 | g_stringInf.clear(); |
152 | 155 | ||
153 | // looks ugly | 156 | // looks ugly |
154 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); | 157 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); |
155 | } | 158 | } |
156 | 159 | ||
157 | QString PIconView::currentFileName(bool &isDir)const { | 160 | QString PIconView::currentFileName(bool &isDir)const { |
158 | isDir = false; | 161 | isDir = false; |
159 | QIconViewItem* _it = m_view->currentItem(); | 162 | QIconViewItem* _it = m_view->currentItem(); |
160 | if ( !_it ) | 163 | if ( !_it ) |
161 | return QString::null; | 164 | return QString::null; |
162 | 165 | ||
163 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 166 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
164 | isDir = it->isDir(); | 167 | isDir = it->isDir(); |
165 | return it->path(); | 168 | return it->path(); |
166 | } | 169 | } |
167 | 170 | ||
168 | void PIconView::slotTrash() { | 171 | void PIconView::slotTrash() { |
169 | bool isDir; | 172 | bool isDir; |
170 | QString pa = currentFileName( isDir ); | 173 | QString pa = currentFileName( isDir ); |
171 | if ( isDir && pa.isEmpty() ) | 174 | if ( isDir && pa.isEmpty() ) |
172 | return; | 175 | return; |
173 | 176 | ||
174 | if (!QPEMessageBox::confirmDelete( this, | 177 | if (!QPEMessageBox::confirmDelete( this, |
175 | tr("Delete Image" ), | 178 | tr("Delete Image" ), |
176 | tr("the Image %1" ).arg(pa))) | 179 | tr("the Image %1" ).arg(pa))) |
177 | return | 180 | return |
178 | 181 | ||
179 | 182 | ||
180 | currentView()->dirLister()->deleteImage( pa ); | 183 | currentView()->dirLister()->deleteImage( pa ); |
181 | delete m_view->currentItem(); | 184 | delete m_view->currentItem(); |
182 | } | 185 | } |
183 | void PIconView::loadViews() { | 186 | void PIconView::loadViews() { |
184 | ViewMap::Iterator it; | 187 | ViewMap::Iterator it; |
185 | ViewMap* map = viewMap(); | 188 | ViewMap* map = viewMap(); |
186 | for ( it = map->begin(); it != map->end(); ++it ) | 189 | for ( it = map->begin(); it != map->end(); ++it ) |
187 | m_views->insertItem( QObject::tr(it.key() ) ); | 190 | m_views->insertItem( QObject::tr(it.key() ) ); |
188 | } | 191 | } |
189 | 192 | ||
190 | void PIconView::resetView() { | 193 | void PIconView::resetView() { |
191 | slotViewChanged(m_views->currentItem()); | 194 | slotViewChanged(m_views->currentItem()); |
192 | } | 195 | } |
193 | 196 | ||
194 | void PIconView::slotViewChanged( int i) { | 197 | void PIconView::slotViewChanged( int i) { |
195 | if (!m_views->count() ) { | 198 | if (!m_views->count() ) { |
196 | setCurrentView( 0l); | 199 | setCurrentView( 0l); |
197 | return; | 200 | return; |
198 | } | 201 | } |
199 | 202 | ||
200 | PDirView* cur = currentView(); | 203 | PDirView* cur = currentView(); |
201 | delete cur; | 204 | delete cur; |
202 | QString str = m_views->text(i); | 205 | QString str = m_views->text(i); |
203 | cur = (*(*viewMap())[str])(*m_cfg); | 206 | cur = (*(*viewMap())[str])(*m_cfg); |
204 | setCurrentView( cur ); | 207 | setCurrentView( cur ); |
205 | 208 | ||
206 | /* connect to the signals of the lister */ | 209 | /* connect to the signals of the lister */ |
207 | PDirLister* lis = cur->dirLister(); | 210 | PDirLister* lis = cur->dirLister(); |
208 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 211 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |
209 | this, SLOT( slotThumbInfo(const QString&, const QString&))); | 212 | this, SLOT( slotThumbInfo(const QString&, const QString&))); |
210 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 213 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
211 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 214 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
212 | connect(lis, SIGNAL(sig_start()), | 215 | connect(lis, SIGNAL(sig_start()), |
213 | this, SLOT(slotStart())); | 216 | this, SLOT(slotStart())); |
214 | connect(lis, SIGNAL(sig_end()) , | 217 | connect(lis, SIGNAL(sig_end()) , |
215 | this, SLOT(slotEnd()) ); | 218 | this, SLOT(slotEnd()) ); |
216 | 219 | ||
217 | 220 | ||
218 | /* reload now */ | 221 | /* reload now */ |
219 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); | 222 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); |
220 | } | 223 | } |
221 | 224 | ||
222 | 225 | ||
223 | void PIconView::slotReloadDir() { | 226 | void PIconView::slotReloadDir() { |
224 | slotChangeDir( m_path ); | 227 | slotChangeDir( m_path ); |
225 | } | 228 | } |
226 | 229 | ||
227 | 230 | ||
228 | void PIconView::addFolders( const QStringList& lst) { | 231 | void PIconView::addFolders( const QStringList& lst) { |
229 | QStringList::ConstIterator it; | 232 | QStringList::ConstIterator it; |
230 | 233 | ||
231 | for(it=lst.begin(); it != lst.end(); ++it ) { | 234 | for(it=lst.begin(); it != lst.end(); ++it ) { |
232 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); | 235 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); |
233 | } | 236 | } |
234 | 237 | ||
235 | } | 238 | } |
236 | 239 | ||
237 | void PIconView::addFiles( const QStringList& lst) { | 240 | void PIconView::addFiles( const QStringList& lst) { |
238 | QStringList::ConstIterator it; | 241 | QStringList::ConstIterator it; |
239 | for (it=lst.begin(); it!= lst.end(); ++it ) | 242 | for (it=lst.begin(); it!= lst.end(); ++it ) |
240 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); | 243 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); |
241 | 244 | ||
242 | } | 245 | } |
243 | 246 | ||
244 | void PIconView::slotClicked(QIconViewItem* _it) { | 247 | void PIconView::slotClicked(QIconViewItem* _it) { |
245 | if(!_it ) | 248 | if(!_it ) |
246 | return; | 249 | return; |
247 | 250 | ||
248 | IconViewItem* it = static_cast<IconViewItem*>(_it); | 251 | IconViewItem* it = static_cast<IconViewItem*>(_it); |
249 | if( it->isDir() ) | 252 | if( it->isDir() ) |
250 | slotChangeDir( it->path() ); | 253 | slotChangeDir( it->path() ); |
251 | else // view image | 254 | else // view image |
252 | ; | 255 | ; |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 0a2fcab..ea765d1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -1,114 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <qtoolbar.h> | 6 | #include <qtoolbar.h> |
7 | #include <qtoolbutton.h> | 7 | #include <qtoolbutton.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qdialog.h> | 9 | #include <qdialog.h> |
10 | #include <qmap.h> | 10 | #include <qmap.h> |
11 | 11 | ||
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
14 | #include <qpe/ir.h> | 14 | #include <qpe/ir.h> |
15 | 15 | ||
16 | #include <opie/oapplicationfactory.h> | 16 | #include <opie2/oapplicationfactory.h> |
17 | #include <opie/otabwidget.h> | 17 | #include <opie2/otabwidget.h> |
18 | 18 | ||
19 | #include <iface/ifaceinfo.h> | 19 | #include <iface/ifaceinfo.h> |
20 | #include <iface/dirview.h> | 20 | #include <iface/dirview.h> |
21 | 21 | ||
22 | #include "iconview.h" | 22 | #include "iconview.h" |
23 | #include "filesystem.h" | 23 | #include "filesystem.h" |
24 | 24 | ||
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | 26 | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<PMainWindow> ) | 27 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> ) |
28 | 28 | ||
29 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 29 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
30 | : QMainWindow( wid, name, style ), m_cfg("phunkview") | 30 | : QMainWindow( wid, name, style ), m_cfg("phunkview") |
31 | { | 31 | { |
32 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 32 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
33 | m_cfg.setGroup("Zecke_view" ); | 33 | m_cfg.setGroup("Zecke_view" ); |
34 | /* | 34 | /* |
35 | * Initialize ToolBar and IconView | 35 | * Initialize ToolBar and IconView |
36 | * And Connect Them | 36 | * And Connect Them |
37 | */ | 37 | */ |
38 | QToolBar *bar = new QToolBar( this ); | 38 | QToolBar *bar = new QToolBar( this ); |
39 | bar->setHorizontalStretchable( true ); | 39 | bar->setHorizontalStretchable( true ); |
40 | setToolBarsMovable( false ); | 40 | setToolBarsMovable( false ); |
41 | 41 | ||
42 | m_view = new PIconView( this, &m_cfg ); | 42 | m_view = new PIconView( this, &m_cfg ); |
43 | setCentralWidget( m_view ); | 43 | setCentralWidget( m_view ); |
44 | 44 | ||
45 | QToolButton *btn = new QToolButton( bar ); | 45 | QToolButton *btn = new QToolButton( bar ); |
46 | btn->setIconSet( Resource::loadIconSet( "up" ) ); | 46 | btn->setIconSet( Resource::loadIconSet( "up" ) ); |
47 | connect( btn, SIGNAL(clicked()), | 47 | connect( btn, SIGNAL(clicked()), |
48 | m_view, SLOT(slotDirUp()) ); | 48 | m_view, SLOT(slotDirUp()) ); |
49 | 49 | ||
50 | btn = new PFileSystem( bar ); | 50 | btn = new PFileSystem( bar ); |
51 | connect( btn, SIGNAL( changeDir( const QString& ) ), | 51 | connect( btn, SIGNAL( changeDir( const QString& ) ), |
52 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 52 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
53 | 53 | ||
54 | btn = new QToolButton( bar ); | 54 | btn = new QToolButton( bar ); |
55 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); | 55 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); |
56 | connect( btn, SIGNAL(clicked()), | 56 | connect( btn, SIGNAL(clicked()), |
57 | m_view, SLOT(slotRename()) ); | 57 | m_view, SLOT(slotRename()) ); |
58 | 58 | ||
59 | if ( Ir::supported() ) { | 59 | if ( Ir::supported() ) { |
60 | btn = new QToolButton( bar ); | 60 | btn = new QToolButton( bar ); |
61 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); | 61 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); |
62 | connect( btn, SIGNAL(clicked()), | 62 | connect( btn, SIGNAL(clicked()), |
63 | m_view, SLOT(slotBeam()) ); | 63 | m_view, SLOT(slotBeam()) ); |
64 | } | 64 | } |
65 | 65 | ||
66 | btn = new QToolButton( bar ); | 66 | btn = new QToolButton( bar ); |
67 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); | 67 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); |
68 | connect( btn, SIGNAL(clicked() ), | 68 | connect( btn, SIGNAL(clicked() ), |
69 | m_view, SLOT(slotTrash() ) ); | 69 | m_view, SLOT(slotTrash() ) ); |
70 | 70 | ||
71 | btn = new QToolButton( bar ); | 71 | btn = new QToolButton( bar ); |
72 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 72 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
73 | connect( btn, SIGNAL(clicked() ), | 73 | connect( btn, SIGNAL(clicked() ), |
74 | this, SLOT(slotConfig() ) ); | 74 | this, SLOT(slotConfig() ) ); |
75 | 75 | ||
76 | } | 76 | } |
77 | 77 | ||
78 | PMainWindow::~PMainWindow() { | 78 | PMainWindow::~PMainWindow() { |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | void PMainWindow::slotConfig() { | 82 | void PMainWindow::slotConfig() { |
83 | QDialog dlg(this, 0, true); | 83 | QDialog dlg(this, 0, true); |
84 | dlg.setCaption( tr("Phunk View - Config" ) ); | 84 | dlg.setCaption( tr("Phunk View - Config" ) ); |
85 | 85 | ||
86 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 86 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
87 | OTabWidget *wid = new OTabWidget(&dlg ); | 87 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
88 | lay->addWidget( wid ); | 88 | lay->addWidget( wid ); |
89 | ViewMap *vM = viewMap(); | 89 | ViewMap *vM = viewMap(); |
90 | ViewMap::Iterator _it = vM->begin(); | 90 | ViewMap::Iterator _it = vM->begin(); |
91 | QMap<PDirView*, QWidget*> lst; | 91 | QMap<PDirView*, QWidget*> lst; |
92 | 92 | ||
93 | for( ; _it != vM->end(); ++_it ) { | 93 | for( ; _it != vM->end(); ++_it ) { |
94 | PDirView *view = (_it.data())(m_cfg); | 94 | PDirView *view = (_it.data())(m_cfg); |
95 | PInterfaceInfo *inf = view->interfaceInfo(); | 95 | PInterfaceInfo *inf = view->interfaceInfo(); |
96 | QWidget *_wid = inf->configWidget( m_cfg ); | 96 | QWidget *_wid = inf->configWidget( m_cfg ); |
97 | _wid->reparent(wid, QPoint() ); | 97 | _wid->reparent(wid, QPoint() ); |
98 | lst.insert( view, _wid ); | 98 | lst.insert( view, _wid ); |
99 | wid->addTab( _wid, QString::null, inf->name() ); | 99 | wid->addTab( _wid, QString::null, inf->name() ); |
100 | } | 100 | } |
101 | 101 | ||
102 | dlg.showMaximized(); | 102 | dlg.showMaximized(); |
103 | bool act = ( dlg.exec() == QDialog::Accepted ); | 103 | bool act = ( dlg.exec() == QDialog::Accepted ); |
104 | 104 | ||
105 | QMap<PDirView*, QWidget*>::Iterator it; | 105 | QMap<PDirView*, QWidget*>::Iterator it; |
106 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 106 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
107 | if ( act ) | 107 | if ( act ) |
108 | it.key()->interfaceInfo()->writeConfig(it.data(), m_cfg); | 108 | it.key()->interfaceInfo()->writeConfig(it.data(), m_cfg); |
109 | delete it.key(); | 109 | delete it.key(); |
110 | } | 110 | } |
111 | 111 | ||
112 | if ( act ) | 112 | if ( act ) |
113 | m_view->resetView(); | 113 | m_view->resetView(); |
114 | } | 114 | } |
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 21178ee..0bb5679 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -1,34 +1,34 @@ | |||
1 | CONFIG += qt warn_on #quick-app | 1 | CONFIG += qt warn_on #quick-app |
2 | DESTDIR = $(OPIEDIR)/bin | 2 | DESTDIR = $(OPIEDIR)/bin |
3 | TEMPLATE = app | 3 | TEMPLATE = app |
4 | TARGET = opie-eye | 4 | TARGET = opie-eye |
5 | # the name of the resulting object | 5 | # the name of the resulting object |
6 | 6 | ||
7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ | 7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ |
8 | lib/imagecache.h impl/dir/dir_dirview.h \ | 8 | lib/imagecache.h impl/dir/dir_dirview.h \ |
9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ | 9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ |
10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ | 10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ |
11 | lib/slavemaster.h \ | 11 | lib/slavemaster.h \ |
12 | iface/slaveiface.h | 12 | iface/slaveiface.h |
13 | 13 | ||
14 | # A list header files | 14 | # A list header files |
15 | 15 | ||
16 | 16 | ||
17 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | 17 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ |
18 | lib/imagecache.cpp lib/viewmap.cpp \ | 18 | lib/imagecache.cpp lib/viewmap.cpp \ |
19 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | 19 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ |
20 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 20 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
21 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp | 21 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp |
22 | # A list of source files | 22 | # A list of source files |
23 | 23 | ||
24 | INTERFACES = | 24 | INTERFACES = |
25 | # list of ui files | 25 | # list of ui files |
26 | 26 | ||
27 | INCLUDEPATH += . $(OPIEDIR)/include | 27 | INCLUDEPATH += . $(OPIEDIR)/include |
28 | DEPENDPATH += $(OPIEDIR)/include | 28 | DEPENDPATH += $(OPIEDIR)/include |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | LIBS += -lqpe -lopie | 32 | LIBS += -lqpe -lopieui2 |
33 | 33 | ||
34 | include ( $(OPIEDIR)/include.pro ) | 34 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp index c8e33d4..bbbbb30 100644 --- a/noncore/graphics/opie-eye/slave/slavereciever.cpp +++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp | |||
@@ -1,219 +1,226 @@ | |||
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 | ||
13 | static SlaveObjects* _slaveObj = 0; | 13 | static SlaveObjects* _slaveObj = 0; |
14 | 14 | ||
15 | QDataStream & operator << (QDataStream & str, bool b) | 15 | QDataStream & 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 | ||
21 | QDataStream & operator >> (QDataStream & str, bool & b) | 21 | QDataStream & 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 | ||
31 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { | 31 | QDataStream &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 | 34 | ||
35 | /* | 35 | /* |
36 | * GUI sends no QPIxmap!!! | 36 | * GUI sends no QPIxmap!!! |
37 | */ | 37 | */ |
38 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { | 38 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { |
39 | s >> inf.file >> 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 ); | 40 | qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height ); |
41 | return s; | 41 | return s; |
42 | } | 42 | } |
43 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { | 43 | QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { |
44 | return s << i.kind << i.file << i.info; | 44 | return s << i.kind << i.file << i.info; |
45 | } | 45 | } |
46 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { | 46 | QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { |
47 | s >> i.kind >> i.file >> i.info; | 47 | s >> i.kind >> i.file >> i.info; |
48 | return s; | 48 | return s; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | 52 | ||
53 | SlaveObjects* slaveObjects() { | 53 | SlaveObjects* slaveObjects() { |
54 | if ( !_slaveObj ) | 54 | if ( !_slaveObj ) |
55 | _slaveObj = new SlaveObjects; | 55 | _slaveObj = new SlaveObjects; |
56 | return _slaveObj; | 56 | return _slaveObj; |
57 | } | 57 | } |
58 | 58 | ||
59 | SlaveReciever::SlaveReciever( QObject* par) | 59 | SlaveReciever::SlaveReciever( QObject* par) |
60 | : QObject( par ) | 60 | : QObject( par ), m_refs( 0 ) |
61 | { | 61 | { |
62 | m_inf = new QTimer(this); | 62 | m_inf = new QTimer(this); |
63 | connect(m_inf,SIGNAL(timeout()), | 63 | connect(m_inf,SIGNAL(timeout()), |
64 | this, SLOT(slotImageInfo())); | 64 | this, SLOT(slotImageInfo())); |
65 | m_pix = new QTimer(this); | 65 | m_pix = new QTimer(this); |
66 | connect(m_pix,SIGNAL(timeout()), | 66 | connect(m_pix,SIGNAL(timeout()), |
67 | this, SLOT(slotThumbNail())); | 67 | this, SLOT(slotThumbNail())); |
68 | 68 | ||
69 | m_out = new QTimer(this); | 69 | m_out = new QTimer(this); |
70 | connect(m_out,SIGNAL(timeout()), | 70 | connect(m_out,SIGNAL(timeout()), |
71 | this, SLOT(slotSend())); | 71 | this, SLOT(slotSend())); |
72 | 72 | ||
73 | SlaveObjects *obj = slaveObjects(); // won't be changed | 73 | SlaveObjects *obj = slaveObjects(); // won't be changed |
74 | SlaveMap::Iterator it; | 74 | SlaveMap::Iterator it; |
75 | SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! | 75 | SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! |
76 | for(it = map->begin(); it != map->end(); ++it ) { | 76 | for(it = map->begin(); it != map->end(); ++it ) { |
77 | obj->insert( it.key(), (*it.data())() ); | 77 | obj->insert( it.key(), (*it.data())() ); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | SlaveReciever::~SlaveReciever() { | 81 | SlaveReciever::~SlaveReciever() { |
82 | } | 82 | } |
83 | 83 | ||
84 | void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { | 84 | void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { |
85 | qWarning( "String is %s", string.data() ); | 85 | qWarning( "String is %s", string.data() ); |
86 | QDataStream stream(ar, IO_ReadOnly ); | 86 | QDataStream stream(ar, IO_ReadOnly ); |
87 | QStringList lst; | 87 | QStringList lst; |
88 | static ImageInfo inf; | 88 | static ImageInfo inf; |
89 | static PixmapInfo pix; | 89 | static PixmapInfo pix; |
90 | 90 | ||
91 | if ( string == "thumbInfo(QString)" ) { | 91 | if ( string == "thumbInfo(QString)" ) { |
92 | stream >> inf.file; | 92 | stream >> inf.file; |
93 | m_inList.append(inf); | 93 | m_inList.append(inf); |
94 | }else if ( string == "thumbInfos(QStringList)" ) { | 94 | }else if ( string == "thumbInfos(QStringList)" ) { |
95 | stream >> lst; | 95 | stream >> lst; |
96 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 96 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
97 | qWarning( "Adding thumbinfo for file "+ *it ); | 97 | qWarning( "Adding thumbinfo for file "+ *it ); |
98 | inf.file = (*it); | 98 | inf.file = (*it); |
99 | m_inList.append(inf); | 99 | m_inList.append(inf); |
100 | } | 100 | } |
101 | }else if ( string == "fullInfo(QString)" ) { | 101 | }else if ( string == "fullInfo(QString)" ) { |
102 | inf.kind = true; | 102 | inf.kind = true; |
103 | stream >> inf.file; | 103 | stream >> inf.file; |
104 | m_inList.append(inf); | 104 | m_inList.append(inf); |
105 | }else if ( string == "fullInfos(QStringList)" ) { | 105 | }else if ( string == "fullInfos(QStringList)" ) { |
106 | stream >> lst; | 106 | stream >> lst; |
107 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 107 | for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
108 | qWarning( "Adding fullInfo for"+ *it ); | 108 | qWarning( "Adding fullInfo for"+ *it ); |
109 | inf.file = (*it); | 109 | inf.file = (*it); |
110 | inf.kind = true; | 110 | inf.kind = true; |
111 | m_inList.append(inf); | 111 | m_inList.append(inf); |
112 | } | 112 | } |
113 | }else if ( string == "pixmapInfo(QString,int,int)" ) { | 113 | }else if ( string == "pixmapInfo(QString,int,int)" ) { |
114 | stream >> pix.file >> pix.width >> pix.height; | 114 | stream >> pix.file >> pix.width >> pix.height; |
115 | m_inPix.append(pix); | 115 | m_inPix.append(pix); |
116 | }else if ( string == "pixmapInfos(PixmapInfos)" ) { | 116 | }else if ( string == "pixmapInfos(PixmapInfos)" ) { |
117 | PixmapList list; | 117 | PixmapList list; |
118 | stream >> list; | 118 | stream >> list; |
119 | for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { | 119 | for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { |
120 | qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height ); | 120 | qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height ); |
121 | m_inPix.append(*it); | 121 | m_inPix.append(*it); |
122 | } | 122 | } |
123 | }else if ( string == "refUp()" ) { | ||
124 | m_refs++; | ||
125 | }else if ( string == "refDown()" ) { | ||
126 | m_refs--; | ||
123 | } | 127 | } |
124 | 128 | ||
125 | if (!m_inf->isActive() && !m_inList.isEmpty() ) | 129 | if (!m_inf->isActive() && !m_inList.isEmpty() ) |
126 | m_inf->start(5); | 130 | m_inf->start(5); |
127 | 131 | ||
128 | if (!m_pix->isActive() && !m_inPix.isEmpty() ) | 132 | if (!m_pix->isActive() && !m_inPix.isEmpty() ) |
129 | m_pix->start(5); | 133 | m_pix->start(5); |
130 | 134 | ||
131 | QPEApplication::setKeepRunning(); | 135 | if ( m_refs ) |
136 | QPEApplication::setKeepRunning(); | ||
137 | else | ||
138 | qApp->quit(); | ||
132 | 139 | ||
133 | } | 140 | } |
134 | 141 | ||
135 | PixmapList SlaveReciever::outPix()const { | 142 | PixmapList SlaveReciever::outPix()const { |
136 | return m_outPix; | 143 | return m_outPix; |
137 | } | 144 | } |
138 | 145 | ||
139 | StringList SlaveReciever::outInf()const{ | 146 | StringList SlaveReciever::outInf()const{ |
140 | return m_outList; | 147 | return m_outList; |
141 | } | 148 | } |
142 | 149 | ||
143 | void SlaveReciever::slotImageInfo() { | 150 | void SlaveReciever::slotImageInfo() { |
144 | ImageInfo inf = m_inList.first(); | 151 | ImageInfo inf = m_inList.first(); |
145 | m_inList.remove( inf ); | 152 | m_inList.remove( inf ); |
146 | 153 | ||
147 | static SlaveObjects::Iterator it; | 154 | static SlaveObjects::Iterator it; |
148 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! | 155 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! |
149 | for(it = map->begin(); it != map->end(); ++it ) { | 156 | for(it = map->begin(); it != map->end(); ++it ) { |
150 | if( (*it)->supports(inf.file ) ) { | 157 | if( (*it)->supports(inf.file ) ) { |
151 | /* full image info */ | 158 | /* full image info */ |
152 | if (inf.kind ) | 159 | if (inf.kind ) |
153 | inf.info = (*it)->fullImageInfo( inf.file ); | 160 | inf.info = (*it)->fullImageInfo( inf.file ); |
154 | else | 161 | else |
155 | inf.info = (*it)->iconViewName( inf.file ); | 162 | inf.info = (*it)->iconViewName( inf.file ); |
156 | m_outList.append( inf ); | 163 | m_outList.append( inf ); |
157 | break; | 164 | break; |
158 | } | 165 | } |
159 | } | 166 | } |
160 | 167 | ||
161 | if (m_inList.isEmpty() ) | 168 | if (m_inList.isEmpty() ) |
162 | m_inf->stop(); | 169 | m_inf->stop(); |
163 | if (!m_out->isActive() && !m_outList.isEmpty() ) | 170 | if (!m_out->isActive() && !m_outList.isEmpty() ) |
164 | m_out->start( 100 ); | 171 | m_out->start( 100 ); |
165 | } | 172 | } |
166 | 173 | ||
167 | void SlaveReciever::slotThumbNail() { | 174 | void SlaveReciever::slotThumbNail() { |
168 | PixmapInfo inf = m_inPix.first(); | 175 | PixmapInfo inf = m_inPix.first(); |
169 | m_inPix.remove( inf ); | 176 | m_inPix.remove( inf ); |
170 | 177 | ||
171 | static SlaveObjects::Iterator it; | 178 | static SlaveObjects::Iterator it; |
172 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! | 179 | static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! |
173 | for(it = map->begin(); it != map->end(); ++it ) { | 180 | for(it = map->begin(); it != map->end(); ++it ) { |
174 | SlaveInterface* iface = it.data(); | 181 | SlaveInterface* iface = it.data(); |
175 | if( iface->supports(inf.file ) ) { | 182 | if( iface->supports(inf.file ) ) { |
176 | /* pixmap */ | 183 | /* pixmap */ |
177 | qWarning( "Asking for thumbNail in size %d %d for "+inf.file, inf.width, inf.height ); | 184 | qWarning( "Asking for thumbNail in size %d %d for "+inf.file, inf.width, inf.height ); |
178 | inf.pixmap = iface->pixmap(inf.file, 64, 64); | 185 | inf.pixmap = iface->pixmap(inf.file, 64, 64); |
179 | m_outPix.append( inf ); | 186 | m_outPix.append( inf ); |
180 | break; | 187 | break; |
181 | } | 188 | } |
182 | } | 189 | } |
183 | 190 | ||
184 | 191 | ||
185 | 192 | ||
186 | if(m_inPix.isEmpty() ) | 193 | if(m_inPix.isEmpty() ) |
187 | m_pix->stop(); | 194 | m_pix->stop(); |
188 | if(!m_out->isActive() && !m_outPix.isEmpty() ) | 195 | if(!m_out->isActive() && !m_outPix.isEmpty() ) |
189 | m_out->start(100); | 196 | m_out->start(100); |
190 | } | 197 | } |
191 | 198 | ||
192 | void SlaveReciever::slotSend() { | 199 | void SlaveReciever::slotSend() { |
193 | 200 | ||
194 | m_out->stop(); | 201 | m_out->stop(); |
195 | 202 | ||
196 | qWarning( "Sending %d %d", outPix().count(), outInf().count() ); | 203 | qWarning( "Sending %d %d", outPix().count(), outInf().count() ); |
197 | /* queue it and send */ | 204 | /* queue it and send */ |
198 | /* if this ever gets a service introduce request queues | 205 | /* if this ever gets a service introduce request queues |
199 | * so we can differinatate between different clients | 206 | * so we can differinatate between different clients |
200 | */ | 207 | */ |
201 | if (! m_outPix.isEmpty() ) { | 208 | if (! m_outPix.isEmpty() ) { |
202 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); | 209 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); |
203 | answer << outPix(); | 210 | answer << outPix(); |
204 | for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { | 211 | for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { |
205 | qWarning( "Sending out %s %d %d", (*it).file.latin1(), (*it).width, (*it).height ); | 212 | qWarning( "Sending out %s %d %d", (*it).file.latin1(), (*it).width, (*it).height ); |
206 | } | 213 | } |
207 | } | 214 | } |
208 | if ( !m_outList.isEmpty() ) { | 215 | if ( !m_outList.isEmpty() ) { |
209 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); | 216 | QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); |
210 | answer << outInf(); | 217 | answer << outInf(); |
211 | for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { | 218 | for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { |
212 | qWarning( "Sending out2 " + (*it).file ); | 219 | qWarning( "Sending out2 " + (*it).file ); |
213 | } | 220 | } |
214 | } | 221 | } |
215 | 222 | ||
216 | m_outList.clear(); | 223 | m_outList.clear(); |
217 | m_outPix.clear(); | 224 | m_outPix.clear(); |
218 | } | 225 | } |
219 | 226 | ||
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.h b/noncore/graphics/opie-eye/slave/slavereciever.h index 214bfc6..b5aaccf 100644 --- a/noncore/graphics/opie-eye/slave/slavereciever.h +++ b/noncore/graphics/opie-eye/slave/slavereciever.h | |||
@@ -1,58 +1,60 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 | 2 | * GPLv2 |
3 | */ | 3 | */ |
4 | 4 | ||
5 | 5 | ||
6 | #ifndef SLAVE_RECEIVER_H | 6 | #ifndef SLAVE_RECEIVER_H |
7 | #define SLAVE_RECEIVER_H | 7 | #define SLAVE_RECEIVER_H |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Receive Requests | 10 | * Receive Requests |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <iface/slaveiface.h> | 13 | #include <iface/slaveiface.h> |
14 | 14 | ||
15 | #include <qobject.h> | 15 | #include <qobject.h> |
16 | #include <qdatastream.h> | 16 | #include <qdatastream.h> |
17 | #include <qstringlist.h> | 17 | #include <qstringlist.h> |
18 | #include <qvaluelist.h> | 18 | #include <qvaluelist.h> |
19 | #include <qpixmap.h> | 19 | #include <qpixmap.h> |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | typedef QValueList<PixmapInfo> PixmapList; | 23 | typedef QValueList<PixmapInfo> PixmapList; |
24 | typedef QValueList<ImageInfo> StringList; | 24 | typedef QValueList<ImageInfo> StringList; |
25 | 25 | ||
26 | class QTimer; | 26 | class QTimer; |
27 | class QSocket; | 27 | class QSocket; |
28 | class SlaveReciever : public QObject { | 28 | class SlaveReciever : public QObject { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | friend QDataStream &operator<<( QDataStream&, const PixmapInfo& ); | 31 | friend QDataStream &operator<<( QDataStream&, const PixmapInfo& ); |
32 | friend QDataStream &operator>>( QDataStream&, PixmapInfo& ); | 32 | friend QDataStream &operator>>( QDataStream&, PixmapInfo& ); |
33 | friend QDataStream &operator<<( QDataStream&, const ImageInfo& ); | 33 | friend QDataStream &operator<<( QDataStream&, const ImageInfo& ); |
34 | friend QDataStream &operator>>( QDataStream&, ImageInfo ); | 34 | friend QDataStream &operator>>( QDataStream&, ImageInfo ); |
35 | public: | 35 | public: |
36 | 36 | ||
37 | enum Job { ImageInfoJob, FullImageInfoJob, ThumbNailJob }; | 37 | enum Job { ImageInfoJob, FullImageInfoJob, ThumbNailJob }; |
38 | SlaveReciever( QObject* parent ); | 38 | SlaveReciever( QObject* parent ); |
39 | ~SlaveReciever(); | 39 | ~SlaveReciever(); |
40 | 40 | ||
41 | public slots: | 41 | public slots: |
42 | void recieveAnswer( const QCString&, const QByteArray& ); | 42 | void recieveAnswer( const QCString&, const QByteArray& ); |
43 | public: | 43 | public: |
44 | PixmapList outPix()const; | 44 | PixmapList outPix()const; |
45 | StringList outInf()const; | 45 | StringList outInf()const; |
46 | 46 | ||
47 | private slots: | 47 | private slots: |
48 | void slotSend(); | 48 | void slotSend(); |
49 | void slotImageInfo(); | 49 | void slotImageInfo(); |
50 | void slotThumbNail(); | 50 | void slotThumbNail(); |
51 | private: | 51 | private: |
52 | QTimer *m_inf, *m_pix, *m_out; | 52 | QTimer *m_inf, *m_pix, *m_out; |
53 | StringList m_inList, m_outList; | 53 | StringList m_inList, m_outList; |
54 | PixmapList m_inPix, m_outPix; | 54 | PixmapList m_inPix, m_outPix; |
55 | private: | ||
56 | int m_refs; | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | 59 | ||
58 | #endif | 60 | #endif |