summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-13 22:21:20 (UTC)
committer zecke <zecke>2004-04-13 22:21:20 (UTC)
commit79558e549b0ce1fa17fe79fc437859d137ad821f (patch) (unidiff)
treef8a504778d5a95abaed9f1cf3e451e31c94c5681
parente61f3d63c310e4e560bc38f41c1390f246b5f670 (diff)
downloadopie-79558e549b0ce1fa17fe79fc437859d137ad821f.zip
opie-79558e549b0ce1fa17fe79fc437859d137ad821f.tar.gz
opie-79558e549b0ce1fa17fe79fc437859d137ad821f.tar.bz2
First bits of different IconView Views
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp36
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h3
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp5
-rw-r--r--noncore/graphics/opie-eye/phunk_view.pro6
4 files changed, 47 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 2a49786..a06844a 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -1,457 +1,491 @@
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#include <gui/imageinfoui.h> 9#include <gui/imageinfoui.h>
10#include <gui/imagescrollview.h> 10#include <gui/imagescrollview.h>
11 11
12#include <iface/dirview.h> 12#include <iface/dirview.h>
13#include <iface/dirlister.h> 13#include <iface/dirlister.h>
14 14
15#include <opie2/oconfig.h> 15#include <opie2/oconfig.h>
16#include <opie2/okeyconfigwidget.h> 16#include <opie2/okeyconfigwidget.h>
17#include <opie2/odebug.h> 17#include <opie2/odebug.h>
18 18
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/qpemessagebox.h> 20#include <qpe/qpemessagebox.h>
21#include <qpe/ir.h> 21#include <qpe/ir.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qiconview.h> 25#include <qiconview.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qmainwindow.h> 31#include <qmainwindow.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qstyle.h> 33#include <qstyle.h>
34 34
35 35
36using Opie::Core::OKeyConfigItem; 36using Opie::Core::OKeyConfigItem;
37 37
38/* 38/*
39 * The Icons, Request Cache and IconViewItem for the IconView 39 * The Icons, Request Cache and IconViewItem for the IconView
40 */ 40 */
41namespace { 41namespace {
42 static QPixmap* _dirPix = 0; 42 static QPixmap* _dirPix = 0;
43 static QPixmap* _unkPix = 0; 43 static QPixmap* _unkPix = 0;
44 static QPixmap* _picPix = 0;
44 class IconViewItem : public QIconViewItem { 45 class IconViewItem : public QIconViewItem {
45 public: 46 public:
46 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); 47 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false);
47 QPixmap* pixmap()const; 48 QPixmap* pixmap()const;
48 QString path()const { return m_path; } 49 QString path()const { return m_path; }
49 bool isDir()const { return m_isDir; } 50 bool isDir()const { return m_isDir; }
50 void setText( const QString& ); 51 void setText( const QString& );
51 52
53 protected:
54 mutable QPixmap* m_pix;
52 55
53 private: 56 private:
54 mutable QPixmap* m_pix;
55 QString m_path; 57 QString m_path;
56 bool m_isDir : 1; 58 bool m_isDir : 1;
57 bool m_noInfo :1; 59 bool m_noInfo :1;
58 }; 60 };
61 class TextViewItem : public IconViewItem {
62 TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false );
63 QPixmap *pixmap()const;
64 void setText( const QString& );
65 };
66 class ThumbViewItem : public IconViewItem {
67 ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false );
68 QPixmap *pixmap()const;
69 void setText( const QString& );
70 };
59 71
60 72
61/* 73/*
62 * If we request an Image or String 74 * If we request an Image or String
63 * we add it to the map 75 * we add it to the map
64 */ 76 */
65 static QMap<QString, IconViewItem*> g_stringInf; 77 static QMap<QString, IconViewItem*> g_stringInf;
66 static QMap<QString, IconViewItem*> g_stringPix; 78 static QMap<QString, IconViewItem*> g_stringPix;
67 79
68 IconViewItem::IconViewItem( QIconView* view,const QString& path, 80 IconViewItem::IconViewItem( QIconView* view,const QString& path,
69 const QString& name, bool isDir ) 81 const QString& name, bool isDir )
70 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), 82 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
71 m_noInfo( false ) 83 m_noInfo( false )
72 { 84 {
73 if ( isDir && !_dirPix ) 85 if ( isDir && !_dirPix )
74 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); 86 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
75 else if ( !isDir && !_unkPix ) 87 else if ( !isDir && !_unkPix )
76 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); 88 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
77 } 89 }
78 inline QPixmap* IconViewItem::pixmap()const { 90 inline QPixmap* IconViewItem::pixmap()const {
79// qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", 91// qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d",
80// rect().x(),rect().y(),rect().width(),rect().height(), 92// rect().x(),rect().y(),rect().width(),rect().height(),
81// iconView()->contentsX(), iconView()->contentsY()); 93// iconView()->contentsX(), iconView()->contentsY());
82 94
83 if ( m_isDir ) 95 if ( m_isDir )
84 return _dirPix; 96 return _dirPix;
85 else{ 97 else{
86 if (!m_noInfo && !g_stringInf.contains( m_path ) ) { 98 if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
87 currentView()->dirLister()->imageInfo( m_path ); 99 currentView()->dirLister()->imageInfo( m_path );
88 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); 100 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
89 } 101 }
90 102
91 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 103 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
92 if ( !m_pix && !g_stringPix.contains( m_path )) { 104 if ( !m_pix && !g_stringPix.contains( m_path )) {
93 currentView()->dirLister()->thumbNail( m_path, 64, 64 ); 105 currentView()->dirLister()->thumbNail( m_path, 64, 64 );
94 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 106 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
95 } 107 }
96 return m_pix ? m_pix : _unkPix; 108 return m_pix ? m_pix : _unkPix;
97 } 109 }
98 } 110 }
99 inline void IconViewItem::setText( const QString& str ) { 111 inline void IconViewItem::setText( const QString& str ) {
100 QString text = QIconViewItem::text()+"\n"+str; 112 QString text = QIconViewItem::text()+"\n"+str;
101 m_noInfo = true; 113 m_noInfo = true;
102 QIconViewItem::setText( text ); 114 QIconViewItem::setText( text );
103 } 115 }
104} 116}
105 117
106 118
107/* 119/*
108 * Set up the GUI.. initialize the slave set up gui 120 * Set up the GUI.. initialize the slave set up gui
109 * and also load a dir 121 * and also load a dir
110 */ 122 */
111PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 123PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
112 : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) 124 : QVBox( wid ), m_cfg( cfg ), m_updatet( false )
113{ 125{
114 { 126 {
115 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 127 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
116 } 128 }
117 m_path = QDir::homeDirPath(); 129 m_path = QDir::homeDirPath();
130 m_mode = 0;
118 131
119 QHBox *hbox = new QHBox( this ); 132 QHBox *hbox = new QHBox( this );
120 QLabel* lbl = new QLabel( hbox ); 133 QLabel* lbl = new QLabel( hbox );
121 lbl->setText( tr("View as" ) ); 134 lbl->setText( tr("View as" ) );
122 135
123 m_views = new QComboBox( hbox, "View As" ); 136 m_views = new QComboBox( hbox, "View As" );
124 connect( m_views, SIGNAL(activated(int)), 137 connect( m_views, SIGNAL(activated(int)),
125 this, SLOT(slotViewChanged(int)) ); 138 this, SLOT(slotViewChanged(int)) );
126 139
127 m_view= new QIconView( this ); 140 m_view= new QIconView( this );
128 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 141 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
129 this, SLOT(slotClicked(QIconViewItem*)) ); 142 this, SLOT(slotClicked(QIconViewItem*)) );
130 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 143 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
131 this, SLOT(slotClicked(QIconViewItem*)) ); 144 this, SLOT(slotClicked(QIconViewItem*)) );
132 145
133 m_view->setArrangement( QIconView::LeftToRight ); 146 m_view->setArrangement( QIconView::LeftToRight );
134 m_view->setItemTextPos( QIconView::Right ); 147 m_view->setItemTextPos( QIconView::Right );
135 148
136 int dw = QApplication::desktop()->width(); 149 int dw = QApplication::desktop()->width();
137 int viewerWidth = dw-style().scrollBarExtent().width(); 150 int viewerWidth = dw-style().scrollBarExtent().width();
138 m_view->setGridX( viewerWidth-3*m_view->spacing()); 151 m_view->setGridX( viewerWidth-3*m_view->spacing());
139 m_view->setGridY( fontMetrics().height()*2+40 ); 152 m_view->setGridY( fontMetrics().height()*2+40 );
140 153
141 154
142 initKeys(); 155 initKeys();
143 156
144 loadViews(); 157 loadViews();
145 slotViewChanged( m_views->currentItem() ); 158 slotViewChanged( m_views->currentItem() );
146} 159}
147 160
148/* 161/*
149 * Unref the slave and save the keyboard manager 162 * Unref the slave and save the keyboard manager
150 */ 163 */
151PIconView::~PIconView() { 164PIconView::~PIconView() {
152 { 165 {
153 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 166 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
154 } 167 }
155 m_viewManager->save(); 168 m_viewManager->save();
156 delete m_viewManager; 169 delete m_viewManager;
157} 170}
158 171
159Opie::Core::OKeyConfigManager* PIconView::manager() { 172Opie::Core::OKeyConfigManager* PIconView::manager() {
160 return m_viewManager; 173 return m_viewManager;
161} 174}
162 175
163 176
164/* 177/*
165 * init the KeyBoard Shortcuts 178 * init the KeyBoard Shortcuts
166 * called from the c'tor 179 * called from the c'tor
167 */ 180 */
168void PIconView::initKeys() { 181void PIconView::initKeys() {
169 Opie::Core::OKeyPair::List lst; 182 Opie::Core::OKeyPair::List lst;
170 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 183 lst.append( Opie::Core::OKeyPair::upArrowKey() );
171 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 184 lst.append( Opie::Core::OKeyPair::downArrowKey() );
172 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 185 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
173 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 186 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
174 lst.append( Opie::Core::OKeyPair::returnKey() ); 187 lst.append( Opie::Core::OKeyPair::returnKey() );
175 188
176 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", 189 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
177 lst, false,this, "keyconfig name" ); 190 lst, false,this, "keyconfig name" );
178 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", 191 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
179 Resource::loadPixmap("beam"), BeamItem, 192 Resource::loadPixmap("beam"), BeamItem,
180 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), 193 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
181 this, SLOT(slotBeam())) ); 194 this, SLOT(slotBeam())) );
182 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", 195 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
183 Resource::loadPixmap("trash"), DeleteItem, 196 Resource::loadPixmap("trash"), DeleteItem,
184 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), 197 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
185 this, SLOT(slotTrash())) ); 198 this, SLOT(slotTrash())) );
186 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", 199 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
187 Resource::loadPixmap("1to1"), ViewItem, 200 Resource::loadPixmap("1to1"), ViewItem,
188 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 201 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
189 this, SLOT(slotShowImage()))); 202 this, SLOT(slotShowImage())));
190 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", 203 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
191 Resource::loadPixmap("DocumentTypeWord"), InfoItem, 204 Resource::loadPixmap("DocumentTypeWord"), InfoItem,
192 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), 205 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
193 this, SLOT(slotImageInfo()) ) ); 206 this, SLOT(slotImageInfo()) ) );
194 m_viewManager->load(); 207 m_viewManager->load();
195 m_viewManager->handleWidget( m_view ); 208 m_viewManager->handleWidget( m_view );
196} 209}
197 210
198 211
199/* 212/*
200 * change one dir up 213 * change one dir up
201 */ 214 */
202void PIconView::slotDirUp() { 215void PIconView::slotDirUp() {
203 QDir dir( m_path ); 216 QDir dir( m_path );
204 dir.cdUp(); 217 dir.cdUp();
205 slotChangeDir( dir.absPath() ); 218 slotChangeDir( dir.absPath() );
206} 219}
207 220
208/* 221/*
209 * change the dir 222 * change the dir
210 */ 223 */
211void PIconView::slotChangeDir(const QString& path) { 224void PIconView::slotChangeDir(const QString& path) {
212 if ( !currentView() ) 225 if ( !currentView() )
213 return; 226 return;
214 227
215 PDirLister *lister = currentView()->dirLister(); 228 PDirLister *lister = currentView()->dirLister();
216 if (!lister ) 229 if (!lister )
217 return; 230 return;
218 231
219 /* 232 /*
220 * Say what we want and take what we get 233 * Say what we want and take what we get
221 */ 234 */
222 lister->setStartPath( path ); 235 lister->setStartPath( path );
223 m_path = lister->currentPath(); 236 m_path = lister->currentPath();
224 237
225 m_view->viewport()->setUpdatesEnabled( false ); 238 m_view->viewport()->setUpdatesEnabled( false );
226 m_view->clear(); 239 m_view->clear();
227 240
228 /* 241 /*
229 * add files and folders 242 * add files and folders
230 */ 243 */
231 addFolders( lister->folders() ); 244 addFolders( lister->folders() );
232 addFiles( lister->files() ); 245 addFiles( lister->files() );
233 m_view->viewport()->setUpdatesEnabled( true ); 246 m_view->viewport()->setUpdatesEnabled( true );
234 247
235 // Also invalidate the cache. We can't cancel the operations anyway 248 // Also invalidate the cache. We can't cancel the operations anyway
236 g_stringPix.clear(); 249 g_stringPix.clear();
237 g_stringInf.clear(); 250 g_stringInf.clear();
238 251
239 // looks ugly 252 // looks ugly
240 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); 253 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) );
241} 254}
242 255
243/** 256/**
244 * get the current file name 257 * get the current file name
245 * @param isDir see if this is a dir or real file 258 * @param isDir see if this is a dir or real file
246 */ 259 */
247QString PIconView::currentFileName(bool &isDir)const { 260QString PIconView::currentFileName(bool &isDir)const {
248 isDir = false; 261 isDir = false;
249 QIconViewItem* _it = m_view->currentItem(); 262 QIconViewItem* _it = m_view->currentItem();
250 if ( !_it ) 263 if ( !_it )
251 return QString::null; 264 return QString::null;
252 265
253 IconViewItem* it = static_cast<IconViewItem*>( _it ); 266 IconViewItem* it = static_cast<IconViewItem*>( _it );
254 isDir = it->isDir(); 267 isDir = it->isDir();
255 return it->path(); 268 return it->path();
256} 269}
257 270
258void PIconView::slotTrash() { 271void PIconView::slotTrash() {
259 bool isDir; 272 bool isDir;
260 QString pa = currentFileName( isDir ); 273 QString pa = currentFileName( isDir );
261 if ( isDir && pa.isEmpty() ) 274 if ( isDir && pa.isEmpty() )
262 return; 275 return;
263 276
264 if (!QPEMessageBox::confirmDelete( this, 277 if (!QPEMessageBox::confirmDelete( this,
265 tr("Delete Image" ), 278 tr("Delete Image" ),
266 tr("the Image %1" ).arg(pa))) 279 tr("the Image %1" ).arg(pa)))
267 return 280 return
268 281
269 282
270 currentView()->dirLister()->deleteImage( pa ); 283 currentView()->dirLister()->deleteImage( pa );
271 delete m_view->currentItem(); 284 delete m_view->currentItem();
272} 285}
273 286
274/* 287/*
275 * see what views are available 288 * see what views are available
276 */ 289 */
277void PIconView::loadViews() { 290void PIconView::loadViews() {
278 ViewMap::Iterator it; 291 ViewMap::Iterator it;
279 ViewMap* map = viewMap(); 292 ViewMap* map = viewMap();
280 for ( it = map->begin(); it != map->end(); ++it ) 293 for ( it = map->begin(); it != map->end(); ++it )
281 m_views->insertItem( QObject::tr(it.key() ) ); 294 m_views->insertItem( QObject::tr(it.key() ) );
282} 295}
283 296
284void PIconView::resetView() { 297void PIconView::resetView() {
285 slotViewChanged(m_views->currentItem()); 298 slotViewChanged(m_views->currentItem());
286} 299}
287 300
288/* 301/*
289 *swicth view reloadDir and connect signals 302 *swicth view reloadDir and connect signals
290 */ 303 */
291void PIconView::slotViewChanged( int i) { 304void PIconView::slotViewChanged( int i) {
292 if (!m_views->count() ) { 305 if (!m_views->count() ) {
293 setCurrentView( 0l); 306 setCurrentView( 0l);
294 return; 307 return;
295 } 308 }
296 309
297 PDirView* cur = currentView(); 310 PDirView* cur = currentView();
298 delete cur; 311 delete cur;
299 QString str = m_views->text(i); 312 QString str = m_views->text(i);
300 cur = (*(*viewMap())[str])(*m_cfg); 313 cur = (*(*viewMap())[str])(*m_cfg);
301 setCurrentView( cur ); 314 setCurrentView( cur );
302 315
303 /* connect to the signals of the lister */ 316 /* connect to the signals of the lister */
304 PDirLister* lis = cur->dirLister(); 317 PDirLister* lis = cur->dirLister();
305 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), 318 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
306 this, SLOT( slotThumbInfo(const QString&, const QString&))); 319 this, SLOT( slotThumbInfo(const QString&, const QString&)));
307 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 320 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
308 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 321 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
309 connect(lis, SIGNAL(sig_start()), 322 connect(lis, SIGNAL(sig_start()),
310 this, SLOT(slotStart())); 323 this, SLOT(slotStart()));
311 connect(lis, SIGNAL(sig_end()) , 324 connect(lis, SIGNAL(sig_end()) ,
312 this, SLOT(slotEnd()) ); 325 this, SLOT(slotEnd()) );
313 326
314 327
315 /* reload now */ 328 /* reload now */
316 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 329 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
317} 330}
318 331
319 332
320void PIconView::slotReloadDir() { 333void PIconView::slotReloadDir() {
321 slotChangeDir( m_path ); 334 slotChangeDir( m_path );
322} 335}
323 336
324 337
325/* 338/*
326 * add files and folders 339 * add files and folders
327 */ 340 */
328void PIconView::addFolders( const QStringList& lst) { 341void PIconView::addFolders( const QStringList& lst) {
329 QStringList::ConstIterator it; 342 QStringList::ConstIterator it;
330 343
331 for(it=lst.begin(); it != lst.end(); ++it ) 344 for(it=lst.begin(); it != lst.end(); ++it )
332 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); 345 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
333 346
334 347
335} 348}
336 349
337void PIconView::addFiles( const QStringList& lst) { 350void PIconView::addFiles( const QStringList& lst) {
338 QStringList::ConstIterator it; 351 QStringList::ConstIterator it;
339 for (it=lst.begin(); it!= lst.end(); ++it ) 352 for (it=lst.begin(); it!= lst.end(); ++it )
340 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); 353 (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
341 354
342} 355}
343 356
344/* 357/*
345 * user clicked on the item. Change dir or view 358 * user clicked on the item. Change dir or view
346 */ 359 */
347void PIconView::slotClicked(QIconViewItem* _it) { 360void PIconView::slotClicked(QIconViewItem* _it) {
348 if(!_it ) 361 if(!_it )
349 return; 362 return;
350 363
351 IconViewItem* it = static_cast<IconViewItem*>(_it); 364 IconViewItem* it = static_cast<IconViewItem*>(_it);
352 if( it->isDir() ) 365 if( it->isDir() )
353 slotChangeDir( it->path() ); 366 slotChangeDir( it->path() );
354 else // view image 367 else // view image
355 slotShowImage(); 368 slotShowImage();
356} 369}
357 370
358/* 371/*
359 * got thumb info add to the cache if items is visible 372 * got thumb info add to the cache if items is visible
360 * we later need update after processing of slave is done 373 * we later need update after processing of slave is done
361 */ 374 */
362void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 375void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
363 IconViewItem* item = g_stringInf[_path]; 376 IconViewItem* item = g_stringInf[_path];
364 if (!item ) 377 if (!item )
365 return; 378 return;
366 379
367 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 380 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
368 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 381 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
369 m_updatet = true; 382 m_updatet = true;
370 383
371 item->setText( str ); 384 item->setText( str );
372 g_stringInf.remove( _path ); 385 g_stringInf.remove( _path );
373} 386}
374 387
375/* 388/*
376 * got thumbnail and see if it is visible so we need to update later 389 * got thumbnail and see if it is visible so we need to update later
377 */ 390 */
378void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 391void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
379 IconViewItem* item = g_stringPix[_path]; 392 IconViewItem* item = g_stringPix[_path];
380 if (!item ) 393 if (!item )
381 return; 394 return;
382 395
383 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 396 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
384 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 397 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
385 m_updatet = true; 398 m_updatet = true;
386 399
387 if (pix.width()>0) 400 if (pix.width()>0)
388 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 401 PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
389 402
390 403
391 g_stringPix.remove( _path ); 404 g_stringPix.remove( _path );
392} 405}
393 406
394 407
395/* 408/*
396 * FIXME rename 409 * FIXME rename
397 */ 410 */
398void PIconView::slotRename() { 411void PIconView::slotRename() {
399 412
400} 413}
401 414
402 415
403/* 416/*
404 * BEAM the current file 417 * BEAM the current file
405 */ 418 */
406void PIconView::slotBeam() { 419void PIconView::slotBeam() {
407 bool isDir; 420 bool isDir;
408 QString pa = currentFileName( isDir ); 421 QString pa = currentFileName( isDir );
409 if ( isDir && pa.isEmpty() ) 422 if ( isDir && pa.isEmpty() )
410 return; 423 return;
411 424
412 Ir* ir = new Ir( this ); 425 Ir* ir = new Ir( this );
413 connect( ir, SIGNAL(done(Ir*)), 426 connect( ir, SIGNAL(done(Ir*)),
414 this, SLOT(slotBeamDone(Ir*))); 427 this, SLOT(slotBeamDone(Ir*)));
415 ir->send(pa, tr( "Image" ) ); 428 ir->send(pa, tr( "Image" ) );
416} 429}
417 430
418/* 431/*
419 * BEAM done clean up 432 * BEAM done clean up
420 */ 433 */
421void PIconView::slotBeamDone( Ir* ir) { 434void PIconView::slotBeamDone( Ir* ir) {
422 delete ir; 435 delete ir;
423} 436}
424 437
425void PIconView::slotStart() { 438void PIconView::slotStart() {
426 m_view->viewport()->setUpdatesEnabled( false ); 439 m_view->viewport()->setUpdatesEnabled( false );
427} 440}
428 441
429void PIconView::slotEnd() { 442void PIconView::slotEnd() {
430 if ( m_updatet ) 443 if ( m_updatet )
431 m_view->arrangeItemsInGrid( ); 444 m_view->arrangeItemsInGrid( );
432 m_view->viewport()->setUpdatesEnabled( true ); 445 m_view->viewport()->setUpdatesEnabled( true );
433 m_updatet = false; 446 m_updatet = false;
434} 447}
435 448
436void PIconView::slotShowImage() 449void PIconView::slotShowImage()
437{ 450{
438 bool isDir = false; 451 bool isDir = false;
439 QString name = currentFileName(isDir); 452 QString name = currentFileName(isDir);
440 if (isDir) return; 453 if (isDir) return;
441 454
442 slotShowImage( name ); 455 slotShowImage( name );
443} 456}
444void PIconView::slotShowImage( const QString& name) { 457void PIconView::slotShowImage( const QString& name) {
445 emit sig_display( name ); 458 emit sig_display( name );
446} 459}
447void PIconView::slotImageInfo() { 460void PIconView::slotImageInfo() {
448 bool isDir = false; 461 bool isDir = false;
449 QString name = currentFileName(isDir); 462 QString name = currentFileName(isDir);
450 if (isDir) return; 463 if (isDir) return;
451 464
452 slotImageInfo( name ); 465 slotImageInfo( name );
453} 466}
454 467
455void PIconView::slotImageInfo( const QString& name) { 468void PIconView::slotImageInfo( const QString& name) {
456 emit sig_showInfo( name ); 469 emit sig_showInfo( name );
457} 470}
471
472
473void PIconView::slotChangeMode( int mode ) {
474 if ( mode >= 0 && mode <= 3 )
475 m_mode = mode;
476
477 QIconView::ItemTextPos pos;
478 switch( m_mode ) {
479 case 1:
480 pos = QIconView::Bottom;
481 break;
482 case 2:
483 case 0:
484 default:
485 pos = QIconView::Right;
486 break;
487 }
488 m_view->setItemTextPos( pos );
489
490 slotReloadDir();
491}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 9cf7b3e..af41aef 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -1,82 +1,85 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_ICON_VIEW_H 6#ifndef PHUNK_ICON_VIEW_H
7#define PHUNK_ICON_VIEW_H 7#define PHUNK_ICON_VIEW_H
8 8
9#include <qvbox.h> 9#include <qvbox.h>
10 10
11 11
12class QIconView; 12class QIconView;
13class QIconViewItem; 13class QIconViewItem;
14class QComboBox; 14class QComboBox;
15class PIconViewItem; 15class PIconViewItem;
16class PDirLister; 16class PDirLister;
17class Ir; 17class Ir;
18 18
19namespace Opie { 19namespace Opie {
20namespace Core{ 20namespace Core{
21 class OConfig; 21 class OConfig;
22 class OKeyConfigManager; 22 class OKeyConfigManager;
23} 23}
24} 24}
25 25
26class PIconView : public QVBox { 26class PIconView : public QVBox {
27 Q_OBJECT 27 Q_OBJECT
28 friend class PIconViewItem; 28 friend class PIconViewItem;
29 enum ActionIds { 29 enum ActionIds {
30 BeamItem, DeleteItem, ViewItem, InfoItem 30 BeamItem, DeleteItem, ViewItem, InfoItem
31 }; 31 };
32public: 32public:
33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); 33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
34 ~PIconView(); 34 ~PIconView();
35 void resetView(); 35 void resetView();
36 Opie::Core::OKeyConfigManager* manager(); 36 Opie::Core::OKeyConfigManager* manager();
37 37
38signals: 38signals:
39 void sig_showInfo( const QString& ); 39 void sig_showInfo( const QString& );
40 void sig_display( const QString& ); 40 void sig_display( const QString& );
41 41
42private: 42private:
43 void initKeys(); 43 void initKeys();
44 QString currentFileName(bool &isDir)const; 44 QString currentFileName(bool &isDir)const;
45 void loadViews(); 45 void loadViews();
46 46
47private slots: 47private slots:
48 void slotDirUp(); 48 void slotDirUp();
49 void slotChangeDir(const QString&); 49 void slotChangeDir(const QString&);
50 void slotTrash(); 50 void slotTrash();
51 void slotViewChanged( int ); 51 void slotViewChanged( int );
52 void slotReloadDir(); 52 void slotReloadDir();
53 void slotRename(); 53 void slotRename();
54 void slotBeam(); 54 void slotBeam();
55 void slotBeamDone( Ir* ); 55 void slotBeamDone( Ir* );
56 56
57 void slotShowImage(); 57 void slotShowImage();
58 void slotShowImage( const QString& ); 58 void slotShowImage( const QString& );
59 void slotImageInfo(); 59 void slotImageInfo();
60 void slotImageInfo( const QString& ); 60 void slotImageInfo( const QString& );
61 61
62 void slotStart(); 62 void slotStart();
63 void slotEnd(); 63 void slotEnd();
64 64
65/* for performance reasons make it inline in the future */ 65/* for performance reasons make it inline in the future */
66 void addFolders( const QStringList& ); 66 void addFolders( const QStringList& );
67 void addFiles( const QStringList& ); 67 void addFiles( const QStringList& );
68 void slotClicked(QIconViewItem* ); 68 void slotClicked(QIconViewItem* );
69 69
70/**/ 70/**/
71 void slotThumbInfo(const QString&, const QString&); 71 void slotThumbInfo(const QString&, const QString&);
72 void slotThumbNail(const QString&, const QPixmap&); 72 void slotThumbNail(const QString&, const QPixmap&);
73
74 void slotChangeMode( int );
73private: 75private:
74 Opie::Core::OKeyConfigManager *m_viewManager; 76 Opie::Core::OKeyConfigManager *m_viewManager;
75 Opie::Core::OConfig *m_cfg; 77 Opie::Core::OConfig *m_cfg;
76 QComboBox* m_views; 78 QComboBox* m_views;
77 QIconView* m_view; 79 QIconView* m_view;
78 QString m_path; 80 QString m_path;
79 bool m_updatet : 1; 81 bool m_updatet : 1;
82 int m_mode;
80}; 83};
81 84
82#endif 85#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ef23f79..dd9cced 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,308 +1,313 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5#include "mainwindow.h" 5#include "mainwindow.h"
6 6
7#include "iconview.h" 7#include "iconview.h"
8#include "filesystem.h" 8#include "filesystem.h"
9#include "imageinfoui.h" 9#include "imageinfoui.h"
10#include "imageview.h" 10#include "imageview.h"
11#include "viewmodebutton.h"
11 12
12#include <iface/ifaceinfo.h> 13#include <iface/ifaceinfo.h>
13#include <iface/dirview.h> 14#include <iface/dirview.h>
14 15
15#include <opie2/odebug.h> 16#include <opie2/odebug.h>
16#include <opie2/owidgetstack.h> 17#include <opie2/owidgetstack.h>
17#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
18#include <opie2/otabwidget.h> 19#include <opie2/otabwidget.h>
19#include <opie2/okeyconfigwidget.h> 20#include <opie2/okeyconfigwidget.h>
20 21
21#include <qpe/resource.h> 22#include <qpe/resource.h>
22#include <qpe/config.h> 23#include <qpe/config.h>
23#include <qpe/ir.h> 24#include <qpe/ir.h>
24#include <qpe/applnk.h> 25#include <qpe/applnk.h>
25 26
26#include <qtoolbar.h> 27#include <qtoolbar.h>
27#include <qtoolbutton.h> 28#include <qtoolbutton.h>
28#include <qlayout.h> 29#include <qlayout.h>
29#include <qdialog.h> 30#include <qdialog.h>
30#include <qmap.h> 31#include <qmap.h>
31#include <qtimer.h> 32#include <qtimer.h>
32 33
33 34
34 35
35 36
36OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 37OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
37 38
38PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 39PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
39 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 40 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
40{ 41{
41 setCaption( QObject::tr("Opie Eye Caramba" ) ); 42 setCaption( QObject::tr("Opie Eye Caramba" ) );
42 m_cfg = new Opie::Core::OConfig("phunkview"); 43 m_cfg = new Opie::Core::OConfig("phunkview");
43 m_cfg->setGroup("Zecke_view" ); 44 m_cfg->setGroup("Zecke_view" );
44// qDebug( "Process-wide OApplication object @ %0x", oApp ); 45// qDebug( "Process-wide OApplication object @ %0x", oApp );
45 /* 46 /*
46 * Initialize ToolBar and IconView 47 * Initialize ToolBar and IconView
47 * And Connect Them 48 * And Connect Them
48 */ 49 */
49 QToolBar *bar = new QToolBar( this ); 50 QToolBar *bar = new QToolBar( this );
50 bar->setHorizontalStretchable( true ); 51 bar->setHorizontalStretchable( true );
51 setToolBarsMovable( false ); 52 setToolBarsMovable( false );
52 53
53 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
54 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
55 56
56 m_view = new PIconView( m_stack, m_cfg ); 57 m_view = new PIconView( m_stack, m_cfg );
57 m_stack->addWidget( m_view, IconView ); 58 m_stack->addWidget( m_view, IconView );
58 m_stack->raiseWidget( IconView ); 59 m_stack->raiseWidget( IconView );
59 connect(m_view, SIGNAL(sig_display(const QString&)), 60 connect(m_view, SIGNAL(sig_display(const QString&)),
60 this, SLOT(slotDisplay(const QString&))); 61 this, SLOT(slotDisplay(const QString&)));
61 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 62 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
62 this, SLOT(slotShowInfo(const QString&)) ); 63 this, SLOT(slotShowInfo(const QString&)) );
63 64
64 QToolButton *btn = new QToolButton( bar ); 65 QToolButton *btn = new QToolButton( bar );
65 btn->setIconSet( Resource::loadIconSet( "up" ) ); 66 btn->setIconSet( Resource::loadIconSet( "up" ) );
66 connect( btn, SIGNAL(clicked()), 67 connect( btn, SIGNAL(clicked()),
67 m_view, SLOT(slotDirUp()) ); 68 m_view, SLOT(slotDirUp()) );
68 69
69 btn = new PFileSystem( bar ); 70 btn = new PFileSystem( bar );
70 connect( btn, SIGNAL( changeDir( const QString& ) ), 71 connect( btn, SIGNAL( changeDir( const QString& ) ),
71 m_view, SLOT(slotChangeDir( const QString& ) ) ); 72 m_view, SLOT(slotChangeDir( const QString& ) ) );
72 73
73 btn = new QToolButton( bar ); 74 btn = new QToolButton( bar );
74 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 75 btn->setIconSet( Resource::loadIconSet( "edit" ) );
75 connect( btn, SIGNAL(clicked()), 76 connect( btn, SIGNAL(clicked()),
76 m_view, SLOT(slotRename()) ); 77 m_view, SLOT(slotRename()) );
77 78
78 if ( Ir::supported() ) { 79 if ( Ir::supported() ) {
79 btn = new QToolButton( bar ); 80 btn = new QToolButton( bar );
80 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 81 btn->setIconSet( Resource::loadIconSet( "beam" ) );
81 connect( btn, SIGNAL(clicked()), 82 connect( btn, SIGNAL(clicked()),
82 m_view, SLOT(slotBeam()) ); 83 m_view, SLOT(slotBeam()) );
83 } 84 }
84 85
85 btn = new QToolButton( bar ); 86 btn = new QToolButton( bar );
86 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 87 btn->setIconSet( Resource::loadIconSet( "trash" ) );
87 connect( btn, SIGNAL(clicked() ), 88 connect( btn, SIGNAL(clicked() ),
88 m_view, SLOT(slotTrash() ) ); 89 m_view, SLOT(slotTrash() ) );
89 90
91 btn = new ViewModeButton( bar );
92 connect( btn, SIGNAL(changeMode(int)),
93 m_view, SLOT(slotChangeMode(int)));
94
90 btn = new QToolButton( bar ); 95 btn = new QToolButton( bar );
91 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 96 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
92 connect( btn, SIGNAL(clicked() ), 97 connect( btn, SIGNAL(clicked() ),
93 this, SLOT(slotConfig() ) ); 98 this, SLOT(slotConfig() ) );
94 99
95 rotateButton = new QToolButton(bar); 100 rotateButton = new QToolButton(bar);
96 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 101 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
97 rotateButton->setToggleButton(true); 102 rotateButton->setToggleButton(true);
98 rotateButton->setOn(true); 103 rotateButton->setOn(true);
99 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 104 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
100 autoRotate = true; 105 autoRotate = true;
101 106
102 btn = new QToolButton(bar); 107 btn = new QToolButton(bar);
103 btn->setIconSet( Resource::loadIconSet( "1to1" ) ); 108 btn->setIconSet( Resource::loadIconSet( "1to1" ) );
104 btn->setToggleButton(true); 109 btn->setToggleButton(true);
105 btn->setOn(false); 110 btn->setOn(false);
106 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 111 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
107 autoScale = true; 112 autoScale = true;
108 113
109 btn = new QToolButton(bar); 114 btn = new QToolButton(bar);
110 btn->setIconSet( Resource::loadIconSet( "mag" ) ); 115 btn->setIconSet( Resource::loadIconSet( "mag" ) );
111 btn->setToggleButton(true); 116 btn->setToggleButton(true);
112 btn->setOn(true); 117 btn->setOn(true);
113 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 118 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
114 zoomerOn = true; 119 zoomerOn = true;
115} 120}
116 121
117PMainWindow::~PMainWindow() { 122PMainWindow::~PMainWindow() {
118 odebug << "Shutting down" << oendl; 123 odebug << "Shutting down" << oendl;
119} 124}
120 125
121void PMainWindow::slotZoomerToggled(bool how) 126void PMainWindow::slotZoomerToggled(bool how)
122{ 127{
123 zoomerOn = how; 128 zoomerOn = how;
124 if (m_disp) { 129 if (m_disp) {
125 m_disp->setShowZoomer(zoomerOn); 130 m_disp->setShowZoomer(zoomerOn);
126 } 131 }
127} 132}
128 133
129void PMainWindow::slotRotateToggled(bool how) 134void PMainWindow::slotRotateToggled(bool how)
130{ 135{
131 autoRotate = how; 136 autoRotate = how;
132 if (m_disp) { 137 if (m_disp) {
133 m_disp->setAutoRotate(how); 138 m_disp->setAutoRotate(how);
134 } 139 }
135} 140}
136 141
137void PMainWindow::slotScaleToggled(bool how) 142void PMainWindow::slotScaleToggled(bool how)
138{ 143{
139 autoScale = !how; 144 autoScale = !how;
140 if (m_disp) { 145 if (m_disp) {
141 m_disp->setAutoScale(autoScale); 146 m_disp->setAutoScale(autoScale);
142 } 147 }
143 if (!autoScale && autoRotate) { 148 if (!autoScale && autoRotate) {
144 rotateButton->setOn(false); 149 rotateButton->setOn(false);
145 } 150 }
146 rotateButton->setEnabled(!how); 151 rotateButton->setEnabled(!how);
147} 152}
148 153
149void PMainWindow::slotConfig() { 154void PMainWindow::slotConfig() {
150 /* 155 /*
151 * have a tab with the possible views 156 * have a tab with the possible views
152 * a tab for globals image cache size.. scaled loading 157 * a tab for globals image cache size.. scaled loading
153 * and one tab for the KeyConfigs 158 * and one tab for the KeyConfigs
154 */ 159 */
155 QDialog dlg(this, 0, true); 160 QDialog dlg(this, 0, true);
156 dlg.setCaption( tr("Phunk View - Config" ) ); 161 dlg.setCaption( tr("Phunk View - Config" ) );
157 162
158 QHBoxLayout *lay = new QHBoxLayout(&dlg); 163 QHBoxLayout *lay = new QHBoxLayout(&dlg);
159 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 164 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
160 lay->addWidget( wid ); 165 lay->addWidget( wid );
161 ViewMap *vM = viewMap(); 166 ViewMap *vM = viewMap();
162 ViewMap::Iterator _it = vM->begin(); 167 ViewMap::Iterator _it = vM->begin();
163 QMap<PDirView*, QWidget*> lst; 168 QMap<PDirView*, QWidget*> lst;
164 169
165 for( ; _it != vM->end(); ++_it ) { 170 for( ; _it != vM->end(); ++_it ) {
166 PDirView *view = (_it.data())(*m_cfg); 171 PDirView *view = (_it.data())(*m_cfg);
167 PInterfaceInfo *inf = view->interfaceInfo(); 172 PInterfaceInfo *inf = view->interfaceInfo();
168 QWidget *_wid = inf->configWidget( *m_cfg ); 173 QWidget *_wid = inf->configWidget( *m_cfg );
169 _wid->reparent(wid, QPoint() ); 174 _wid->reparent(wid, QPoint() );
170 lst.insert( view, _wid ); 175 lst.insert( view, _wid );
171 wid->addTab( _wid, "fileopen", inf->name() ); 176 wid->addTab( _wid, "fileopen", inf->name() );
172 } 177 }
173 178
174/* 179/*
175 * Add the KeyConfigWidget 180 * Add the KeyConfigWidget
176 */ 181 */
177 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 182 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
178 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 183 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
179 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 184 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
180 185
181 if ( !m_info ) { 186 if ( !m_info ) {
182 initInfo(); 187 initInfo();
183 } 188 }
184 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 189 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
185 190
186 if ( !m_disp ) { 191 if ( !m_disp ) {
187 initDisp(); 192 initDisp();
188 } 193 }
189 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 194 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
190 195
191 keyWid->load(); 196 keyWid->load();
192 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 197 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
193 198
194 199
195 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 200 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
196 201
197/* 202/*
198 * clean up 203 * clean up
199 *apply changes 204 *apply changes
200 */ 205 */
201 206
202 QMap<PDirView*, QWidget*>::Iterator it; 207 QMap<PDirView*, QWidget*>::Iterator it;
203 for ( it = lst.begin(); it != lst.end(); ++it ) { 208 for ( it = lst.begin(); it != lst.end(); ++it ) {
204 if ( act ) 209 if ( act )
205 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 210 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
206 delete it.key(); 211 delete it.key();
207 } 212 }
208 213
209 214
210 if ( act ) { 215 if ( act ) {
211 m_view->resetView(); 216 m_view->resetView();
212 keyWid->save(); 217 keyWid->save();
213 m_disp->manager()->save(); 218 m_disp->manager()->save();
214 m_info->manager()->save(); 219 m_info->manager()->save();
215 m_view->manager()->save(); 220 m_view->manager()->save();
216 } 221 }
217 delete keyWid; 222 delete keyWid;
218} 223}
219 224
220/* 225/*
221 * create a new image info component 226 * create a new image info component
222 * and detach the current one 227 * and detach the current one
223 * we will make the other delete on exit 228 * we will make the other delete on exit
224 */ 229 */
225template<class T> 230template<class T>
226void PMainWindow::initT( const char* name, T** ptr, int id) { 231void PMainWindow::initT( const char* name, T** ptr, int id) {
227 if ( *ptr ) { 232 if ( *ptr ) {
228 (*ptr)->disconnect(this, SLOT(slotReturn())); 233 (*ptr)->disconnect(this, SLOT(slotReturn()));
229 (*ptr)->setDestructiveClose(); 234 (*ptr)->setDestructiveClose();
230 m_stack->removeWidget( *ptr ); 235 m_stack->removeWidget( *ptr );
231 } 236 }
232 *ptr = new T(m_cfg, m_stack, name ); 237 *ptr = new T(m_cfg, m_stack, name );
233 m_stack->addWidget( *ptr, id ); 238 m_stack->addWidget( *ptr, id );
234 239
235 connect(*ptr, SIGNAL(sig_return()), 240 connect(*ptr, SIGNAL(sig_return()),
236 this,SLOT(slotReturn())); 241 this,SLOT(slotReturn()));
237 242
238} 243}
239void PMainWindow::initInfo() { 244void PMainWindow::initInfo() {
240 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 245 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
241 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 246 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
242} 247}
243void PMainWindow::initDisp() { 248void PMainWindow::initDisp() {
244 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 249 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
245 if (m_disp) { 250 if (m_disp) {
246 m_disp->setAutoScale(autoScale); 251 m_disp->setAutoScale(autoScale);
247 m_disp->setAutoRotate(autoRotate); 252 m_disp->setAutoRotate(autoRotate);
248 m_disp->setShowZoomer(zoomerOn); 253 m_disp->setShowZoomer(zoomerOn);
249 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 254 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
250 } 255 }
251} 256}
252 257
253/** 258/**
254 * With big Screen the plan could be to 'detach' the image 259 * With big Screen the plan could be to 'detach' the image
255 * window if visible and to create a ne wone 260 * window if visible and to create a ne wone
256 * init* already supports it but I make no use of it for 261 * init* already supports it but I make no use of it for
257 * now. We set filename and raise 262 * now. We set filename and raise
258 * 263 *
259 * ### FIXME and talk to alwin 264 * ### FIXME and talk to alwin
260 */ 265 */
261void PMainWindow::slotShowInfo( const QString& inf ) { 266void PMainWindow::slotShowInfo( const QString& inf ) {
262 if ( !m_info ) { 267 if ( !m_info ) {
263 initInfo(); 268 initInfo();
264 } 269 }
265 m_info->setPath( inf ); 270 m_info->setPath( inf );
266 m_stack->raiseWidget( ImageInfo ); 271 m_stack->raiseWidget( ImageInfo );
267} 272}
268 273
269void PMainWindow::slotDisplay( const QString& inf ) { 274void PMainWindow::slotDisplay( const QString& inf ) {
270 if ( !m_disp ) { 275 if ( !m_disp ) {
271 initDisp(); 276 initDisp();
272 } 277 }
273 m_disp->setImage( inf ); 278 m_disp->setImage( inf );
274 m_stack->raiseWidget( ImageDisplay ); 279 m_stack->raiseWidget( ImageDisplay );
275} 280}
276 281
277void PMainWindow::slotReturn() { 282void PMainWindow::slotReturn() {
278 raiseIconView(); 283 raiseIconView();
279} 284}
280 285
281 286
282void PMainWindow::closeEvent( QCloseEvent* ev ) { 287void PMainWindow::closeEvent( QCloseEvent* ev ) {
283 /* 288 /*
284 * return from view 289 * return from view
285 * or properly quit 290 * or properly quit
286 */ 291 */
287 if ( m_stack->visibleWidget() == m_info || 292 if ( m_stack->visibleWidget() == m_info ||
288 m_stack->visibleWidget() == m_disp ) { 293 m_stack->visibleWidget() == m_disp ) {
289 raiseIconView(); 294 raiseIconView();
290 ev->ignore(); 295 ev->ignore();
291 return; 296 return;
292 } 297 }
293 ev->accept(); 298 ev->accept();
294 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 299 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
295} 300}
296 301
297void PMainWindow::raiseIconView() { 302void PMainWindow::raiseIconView() {
298 m_stack->raiseWidget( IconView ); 303 m_stack->raiseWidget( IconView );
299} 304}
300 305
301void PMainWindow::setDocument( const QString& showImg ) { 306void PMainWindow::setDocument( const QString& showImg ) {
302 QString file = showImg; 307 QString file = showImg;
303 DocLnk lnk(showImg); 308 DocLnk lnk(showImg);
304 if (lnk.isValid() ) 309 if (lnk.isValid() )
305 file = lnk.file(); 310 file = lnk.file();
306 311
307 slotDisplay( file ); 312 slotDisplay( file );
308} 313}
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro
index e9abe72..e9459ad 100644
--- a/noncore/graphics/opie-eye/phunk_view.pro
+++ b/noncore/graphics/opie-eye/phunk_view.pro
@@ -1,40 +1,42 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2DESTDIR = $(OPIEDIR)/bin 2DESTDIR = $(OPIEDIR)/bin
3TEMPLATE = app 3TEMPLATE = app
4TARGET = opie-eye 4TARGET = opie-eye
5# the name of the resulting object 5# the name of the resulting object
6 6
7HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ 7HEADERS = 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 gui/imageinfoui.h gui/imagescrollview.h \ 13 gui/imageinfoui.h gui/imagescrollview.h \
14 gui/imageview.h \ 14 gui/imageview.h \
15 lib/oimagezoomer.h 15 lib/oimagezoomer.h \
16 gui/viewmodebutton.h
16 17
17# A list header files 18# A list header files
18 19
19 20
20SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ 21SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \
21 lib/imagecache.cpp lib/viewmap.cpp \ 22 lib/imagecache.cpp lib/viewmap.cpp \
22 impl/dir/dir_dirview.cpp iface/dirlister.cpp \ 23 impl/dir/dir_dirview.cpp iface/dirlister.cpp \
23 iface/dirview.cpp impl/dir/dir_lister.cpp \ 24 iface/dirview.cpp impl/dir/dir_lister.cpp \
24 impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ 25 impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \
25 gui/imageinfoui.cpp gui/imagescrollview.cpp \ 26 gui/imageinfoui.cpp gui/imagescrollview.cpp \
26 gui/imageview.cpp \ 27 gui/imageview.cpp \
27 lib/oimagezoomer.cpp 28 lib/oimagezoomer.cpp \
29 gui/viewmodebutton.cpp
28# A list of source files 30# A list of source files
29 31
30INTERFACES = 32INTERFACES =
31# list of ui files 33# list of ui files
32 34
33INCLUDEPATH += . $(OPIEDIR)/include 35INCLUDEPATH += . $(OPIEDIR)/include
34DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
35 37
36 38
37 39
38LIBS += -lqpe -lopiecore2 -lopieui2 40LIBS += -lqpe -lopiecore2 -lopieui2
39 41
40include ( $(OPIEDIR)/include.pro ) 42include ( $(OPIEDIR)/include.pro )