author | zecke <zecke> | 2004-04-07 23:57:11 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-07 23:57:11 (UTC) |
commit | c968f44205a5da7dc37029e701f527450692e39a (patch) (unidiff) | |
tree | 2739918a38d2b12c446c34b77ee9d74425fdf51c | |
parent | 10ec13c9068e7e4ca0acf75e5843ebd91e4e8566 (diff) | |
download | opie-c968f44205a5da7dc37029e701f527450692e39a.zip opie-c968f44205a5da7dc37029e701f527450692e39a.tar.gz opie-c968f44205a5da7dc37029e701f527450692e39a.tar.bz2 |
Enter folders on Return
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index c07a1e5..7e4164b 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -82,96 +82,98 @@ namespace { | |||
82 | 82 | ||
83 | if ( m_isDir ) | 83 | if ( m_isDir ) |
84 | return _dirPix; | 84 | return _dirPix; |
85 | else{ | 85 | else{ |
86 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { | 86 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { |
87 | currentView()->dirLister()->imageInfo( m_path ); | 87 | currentView()->dirLister()->imageInfo( m_path ); |
88 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); | 88 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); |
89 | } | 89 | } |
90 | 90 | ||
91 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); | 91 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); |
92 | if ( !m_pix && !g_stringPix.contains( m_path )) { | 92 | if ( !m_pix && !g_stringPix.contains( m_path )) { |
93 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); | 93 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); |
94 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); | 94 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); |
95 | } | 95 | } |
96 | return m_pix ? m_pix : _unkPix; | 96 | return m_pix ? m_pix : _unkPix; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | inline void IconViewItem::setText( const QString& str ) { | 99 | inline void IconViewItem::setText( const QString& str ) { |
100 | QString text = QIconViewItem::text()+"\n"+str; | 100 | QString text = QIconViewItem::text()+"\n"+str; |
101 | m_noInfo = true; | 101 | m_noInfo = true; |
102 | QIconViewItem::setText( text ); | 102 | QIconViewItem::setText( text ); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | /* | 107 | /* |
108 | * Set up the GUI.. initialize the slave set up gui | 108 | * Set up the GUI.. initialize the slave set up gui |
109 | * and also load a dir | 109 | * and also load a dir |
110 | */ | 110 | */ |
111 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 111 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
112 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 112 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
113 | { | 113 | { |
114 | { | 114 | { |
115 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 115 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
116 | } | 116 | } |
117 | m_path = QDir::homeDirPath(); | 117 | m_path = QDir::homeDirPath(); |
118 | 118 | ||
119 | QHBox *hbox = new QHBox( this ); | 119 | QHBox *hbox = new QHBox( this ); |
120 | QLabel* lbl = new QLabel( hbox ); | 120 | QLabel* lbl = new QLabel( hbox ); |
121 | lbl->setText( tr("View as" ) ); | 121 | lbl->setText( tr("View as" ) ); |
122 | 122 | ||
123 | m_views = new QComboBox( hbox, "View As" ); | 123 | m_views = new QComboBox( hbox, "View As" ); |
124 | connect( m_views, SIGNAL(activated(int)), | 124 | connect( m_views, SIGNAL(activated(int)), |
125 | this, SLOT(slotViewChanged(int)) ); | 125 | this, SLOT(slotViewChanged(int)) ); |
126 | 126 | ||
127 | m_view= new QIconView( this ); | 127 | m_view= new QIconView( this ); |
128 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 128 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
129 | this, SLOT(slotClicked(QIconViewItem*)) ); | 129 | this, SLOT(slotClicked(QIconViewItem*)) ); |
130 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | ||
131 | this, SLOT(slotClicked(QIconViewItem*)) ); | ||
130 | 132 | ||
131 | m_view->setArrangement( QIconView::LeftToRight ); | 133 | m_view->setArrangement( QIconView::LeftToRight ); |
132 | m_view->setItemTextPos( QIconView::Right ); | 134 | m_view->setItemTextPos( QIconView::Right ); |
133 | 135 | ||
134 | int dw = QApplication::desktop()->width(); | 136 | int dw = QApplication::desktop()->width(); |
135 | int viewerWidth = dw-style().scrollBarExtent().width(); | 137 | int viewerWidth = dw-style().scrollBarExtent().width(); |
136 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | 138 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
137 | m_view->setGridY( fontMetrics().height()*2+40 ); | 139 | m_view->setGridY( fontMetrics().height()*2+40 ); |
138 | 140 | ||
139 | 141 | ||
140 | initKeys(); | 142 | initKeys(); |
141 | 143 | ||
142 | loadViews(); | 144 | loadViews(); |
143 | slotViewChanged( m_views->currentItem() ); | 145 | slotViewChanged( m_views->currentItem() ); |
144 | } | 146 | } |
145 | 147 | ||
146 | /* | 148 | /* |
147 | * Unref the slave and save the keyboard manager | 149 | * Unref the slave and save the keyboard manager |
148 | */ | 150 | */ |
149 | PIconView::~PIconView() { | 151 | PIconView::~PIconView() { |
150 | { | 152 | { |
151 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 153 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
152 | } | 154 | } |
153 | m_viewManager->save(); | 155 | m_viewManager->save(); |
154 | delete m_viewManager; | 156 | delete m_viewManager; |
155 | } | 157 | } |
156 | 158 | ||
157 | Opie::Ui::OKeyConfigManager* PIconView::manager() { | 159 | Opie::Ui::OKeyConfigManager* PIconView::manager() { |
158 | return m_viewManager; | 160 | return m_viewManager; |
159 | } | 161 | } |
160 | 162 | ||
161 | 163 | ||
162 | /* | 164 | /* |
163 | * init the KeyBoard Shortcuts | 165 | * init the KeyBoard Shortcuts |
164 | * called from the c'tor | 166 | * called from the c'tor |
165 | */ | 167 | */ |
166 | void PIconView::initKeys() { | 168 | void PIconView::initKeys() { |
167 | Opie::Ui::OKeyPair::List lst; | 169 | Opie::Ui::OKeyPair::List lst; |
168 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | 170 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); |
169 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | 171 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); |
170 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | 172 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); |
171 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | 173 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); |
172 | lst.append( Opie::Ui::OKeyPair::returnKey() ); | 174 | lst.append( Opie::Ui::OKeyPair::returnKey() ); |
173 | 175 | ||
174 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 176 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
175 | lst, false,this, "keyconfig name" ); | 177 | lst, false,this, "keyconfig name" ); |
176 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 178 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
177 | Resource::loadPixmap("beam"), BeamItem, | 179 | Resource::loadPixmap("beam"), BeamItem, |
@@ -366,91 +368,90 @@ void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | |||
366 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 368 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
367 | m_updatet = true; | 369 | m_updatet = true; |
368 | 370 | ||
369 | item->setText( str ); | 371 | item->setText( str ); |
370 | g_stringInf.remove( _path ); | 372 | g_stringInf.remove( _path ); |
371 | } | 373 | } |
372 | 374 | ||
373 | /* | 375 | /* |
374 | * got thumbnail and see if it is visible so we need to update later | 376 | * got thumbnail and see if it is visible so we need to update later |
375 | */ | 377 | */ |
376 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | 378 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { |
377 | IconViewItem* item = g_stringPix[_path]; | 379 | IconViewItem* item = g_stringPix[_path]; |
378 | if (!item ) | 380 | if (!item ) |
379 | return; | 381 | return; |
380 | 382 | ||
381 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 383 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
382 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 384 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
383 | m_updatet = true; | 385 | m_updatet = true; |
384 | 386 | ||
385 | if (pix.width()>0) | 387 | if (pix.width()>0) |
386 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); | 388 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); |
387 | 389 | ||
388 | 390 | ||
389 | g_stringPix.remove( _path ); | 391 | g_stringPix.remove( _path ); |
390 | } | 392 | } |
391 | 393 | ||
392 | 394 | ||
393 | /* | 395 | /* |
394 | * FIXME rename | 396 | * FIXME rename |
395 | */ | 397 | */ |
396 | void PIconView::slotRename() { | 398 | void PIconView::slotRename() { |
397 | 399 | ||
398 | } | 400 | } |
399 | 401 | ||
400 | 402 | ||
401 | /* | 403 | /* |
402 | * BEAM the current file | 404 | * BEAM the current file |
403 | */ | 405 | */ |
404 | void PIconView::slotBeam() { | 406 | void PIconView::slotBeam() { |
405 | bool isDir; | 407 | bool isDir; |
406 | QString pa = currentFileName( isDir ); | 408 | QString pa = currentFileName( isDir ); |
407 | if ( isDir && pa.isEmpty() ) | 409 | if ( isDir && pa.isEmpty() ) |
408 | return; | 410 | return; |
409 | 411 | ||
410 | Ir* ir = new Ir( this ); | 412 | Ir* ir = new Ir( this ); |
411 | connect( ir, SIGNAL(done(Ir*)), | 413 | connect( ir, SIGNAL(done(Ir*)), |
412 | this, SLOT(slotBeamDone(Ir*))); | 414 | this, SLOT(slotBeamDone(Ir*))); |
413 | ir->send(pa, tr( "Image" ) ); | 415 | ir->send(pa, tr( "Image" ) ); |
414 | |||
415 | } | 416 | } |
416 | 417 | ||
417 | /* | 418 | /* |
418 | * BEAM done clean up | 419 | * BEAM done clean up |
419 | */ | 420 | */ |
420 | void PIconView::slotBeamDone( Ir* ir) { | 421 | void PIconView::slotBeamDone( Ir* ir) { |
421 | delete ir; | 422 | delete ir; |
422 | } | 423 | } |
423 | 424 | ||
424 | void PIconView::slotStart() { | 425 | void PIconView::slotStart() { |
425 | m_view->viewport()->setUpdatesEnabled( false ); | 426 | m_view->viewport()->setUpdatesEnabled( false ); |
426 | } | 427 | } |
427 | 428 | ||
428 | void PIconView::slotEnd() { | 429 | void PIconView::slotEnd() { |
429 | if ( m_updatet ) | 430 | if ( m_updatet ) |
430 | m_view->arrangeItemsInGrid( ); | 431 | m_view->arrangeItemsInGrid( ); |
431 | m_view->viewport()->setUpdatesEnabled( true ); | 432 | m_view->viewport()->setUpdatesEnabled( true ); |
432 | m_updatet = false; | 433 | m_updatet = false; |
433 | } | 434 | } |
434 | 435 | ||
435 | void PIconView::slotShowImage() | 436 | void PIconView::slotShowImage() |
436 | { | 437 | { |
437 | bool isDir = false; | 438 | bool isDir = false; |
438 | QString name = currentFileName(isDir); | 439 | QString name = currentFileName(isDir); |
439 | if (isDir) return; | 440 | if (isDir) return; |
440 | 441 | ||
441 | slotShowImage( name ); | 442 | slotShowImage( name ); |
442 | } | 443 | } |
443 | void PIconView::slotShowImage( const QString& name) { | 444 | void PIconView::slotShowImage( const QString& name) { |
444 | emit sig_display( name ); | 445 | emit sig_display( name ); |
445 | } | 446 | } |
446 | void PIconView::slotImageInfo() { | 447 | void PIconView::slotImageInfo() { |
447 | bool isDir = false; | 448 | bool isDir = false; |
448 | QString name = currentFileName(isDir); | 449 | QString name = currentFileName(isDir); |
449 | if (isDir) return; | 450 | if (isDir) return; |
450 | 451 | ||
451 | slotImageInfo( name ); | 452 | slotImageInfo( name ); |
452 | } | 453 | } |
453 | 454 | ||
454 | void PIconView::slotImageInfo( const QString& name) { | 455 | void PIconView::slotImageInfo( const QString& name) { |
455 | emit sig_showInfo( name ); | 456 | emit sig_showInfo( name ); |
456 | } | 457 | } |