summaryrefslogtreecommitdiff
authoralwin <alwin>2004-10-30 02:18:52 (UTC)
committer alwin <alwin>2004-10-30 02:18:52 (UTC)
commit3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25 (patch) (unidiff)
tree087361e8ec23fcae50ab146d6d2e2d366a54fe74
parentdca4423e3b0966fe26ba4183e5b6ad4666c61e86 (diff)
downloadopie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.zip
opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.tar.gz
opie-3fcdb4e6f576f5e3eec072efe87a44bf58fdbf25.tar.bz2
slide show implemented
on next/previous images: if end/begin of list is reached it starts again on begin/end (it was required for slideshow so what ;) zecke: so we have a feature for OPIE 1.1.7 ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp94
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp28
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp1
5 files changed, 131 insertions, 4 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7196aba..0499af9 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -149,192 +149,196 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
149 : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) 149 : QVBox( wid ), m_cfg( cfg ), m_updatet( false )
150{ 150{
151 { 151 {
152 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 152 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
153 } 153 }
154 m_path = QDir::homeDirPath(); 154 m_path = QDir::homeDirPath();
155 m_mode = 0; 155 m_mode = 0;
156 156
157 QHBox *hbox = new QHBox( this ); 157 QHBox *hbox = new QHBox( this );
158 QLabel* lbl = new QLabel( hbox ); 158 QLabel* lbl = new QLabel( hbox );
159 lbl->setText( tr("View as" ) ); 159 lbl->setText( tr("View as" ) );
160 160
161 m_views = new QComboBox( hbox, "View As" ); 161 m_views = new QComboBox( hbox, "View As" );
162 162
163 m_view= new QIconView( this ); 163 m_view= new QIconView( this );
164 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 164 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
165 this, SLOT(slotClicked(QIconViewItem*)) ); 165 this, SLOT(slotClicked(QIconViewItem*)) );
166 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 166 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
167 this, SLOT(slotClicked(QIconViewItem*)) ); 167 this, SLOT(slotClicked(QIconViewItem*)) );
168 168
169 m_view->setArrangement( QIconView::LeftToRight ); 169 m_view->setArrangement( QIconView::LeftToRight );
170 170
171 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 171 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
172 QString lastView = m_cfg->readEntry("LastView",""); 172 QString lastView = m_cfg->readEntry("LastView","");
173 173
174 if (m_mode < 1 || m_mode>3) m_mode = 1; 174 if (m_mode < 1 || m_mode>3) m_mode = 1;
175 175
176 m_view->setItemTextPos( QIconView::Right ); 176 m_view->setItemTextPos( QIconView::Right );
177 177
178 calculateGrid(); 178 calculateGrid();
179 179
180 initKeys(); 180 initKeys();
181 181
182 loadViews(); 182 loadViews();
183 int cc=0; 183 int cc=0;
184 for (; cc<m_views->count();++cc) { 184 for (; cc<m_views->count();++cc) {
185 if (m_views->text(cc)==lastView) { 185 if (m_views->text(cc)==lastView) {
186 break; 186 break;
187 } 187 }
188 } 188 }
189 if (cc<m_views->count()) { 189 if (cc<m_views->count()) {
190 m_views->setCurrentItem(cc); 190 m_views->setCurrentItem(cc);
191 slotViewChanged(cc); 191 slotViewChanged(cc);
192 } else { 192 } else {
193 slotViewChanged(m_views->currentItem()); 193 slotViewChanged(m_views->currentItem());
194 } 194 }
195 connect( m_views, SIGNAL(activated(int)), 195 connect( m_views, SIGNAL(activated(int)),
196 this, SLOT(slotViewChanged(int)) ); 196 this, SLOT(slotViewChanged(int)) );
197} 197}
198 198
199/* 199/*
200 * Unref the slave and save the keyboard manager 200 * Unref the slave and save the keyboard manager
201 */ 201 */
202PIconView::~PIconView() { 202PIconView::~PIconView() {
203 { 203 {
204 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 204 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
205 } 205 }
206 m_viewManager->save(); 206 m_viewManager->save();
207 delete m_viewManager; 207 delete m_viewManager;
208} 208}
209 209
210Opie::Core::OKeyConfigManager* PIconView::manager() { 210Opie::Core::OKeyConfigManager* PIconView::manager() {
211 return m_viewManager; 211 return m_viewManager;
212} 212}
213 213
214 214
215/* 215/*
216 * init the KeyBoard Shortcuts 216 * init the KeyBoard Shortcuts
217 * called from the c'tor 217 * called from the c'tor
218 */ 218 */
219void PIconView::initKeys() { 219void PIconView::initKeys() {
220 Opie::Core::OKeyPair::List lst; 220 Opie::Core::OKeyPair::List lst;
221 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 221 lst.append( Opie::Core::OKeyPair::upArrowKey() );
222 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 222 lst.append( Opie::Core::OKeyPair::downArrowKey() );
223 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 223 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
224 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 224 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
225 lst.append( Opie::Core::OKeyPair::returnKey() ); 225 lst.append( Opie::Core::OKeyPair::returnKey() );
226 226
227 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", 227 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
228 lst, false,this, "keyconfig name" ); 228 lst, false,this, "keyconfig name" );
229 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", 229 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
230 Resource::loadPixmap("beam"), BeamItem, 230 Resource::loadPixmap("beam"), BeamItem,
231 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), 231 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
232 this, SLOT(slotBeam())) ); 232 this, SLOT(slotBeam())) );
233 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", 233 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
234 Resource::loadPixmap("trash"), DeleteItem, 234 Resource::loadPixmap("trash"), DeleteItem,
235 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), 235 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
236 this, SLOT(slotTrash())) ); 236 this, SLOT(slotTrash())) );
237 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", 237 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
238 Resource::loadPixmap("1to1"), ViewItem, 238 Resource::loadPixmap("1to1"), ViewItem,
239 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 239 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
240 this, SLOT(slotShowImage()))); 240 this, SLOT(slotShowImage())));
241 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", 241 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
242 Resource::loadPixmap("DocumentTypeWord"), InfoItem, 242 Resource::loadPixmap("DocumentTypeWord"), InfoItem,
243 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), 243 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
244 this, SLOT(slotImageInfo()) ) ); 244 this, SLOT(slotImageInfo()) ) );
245 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
246 Resource::loadPixmap("1to1"), SlideItem,
247 Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
248 this, SLOT(slotStartSlide())));
245 m_viewManager->load(); 249 m_viewManager->load();
246 m_viewManager->handleWidget( m_view ); 250 m_viewManager->handleWidget( m_view );
247} 251}
248 252
249 253
250/* 254/*
251 * change one dir up 255 * change one dir up
252 */ 256 */
253void PIconView::slotDirUp() 257void PIconView::slotDirUp()
254{ 258{
255 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); 259 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
256} 260}
257 261
258/* 262/*
259 * change the dir 263 * change the dir
260 */ 264 */
261void PIconView::slotChangeDir(const QString& path) { 265void PIconView::slotChangeDir(const QString& path) {
262 if ( !currentView() ) 266 if ( !currentView() )
263 return; 267 return;
264 268
265 PDirLister *lister = currentView()->dirLister(); 269 PDirLister *lister = currentView()->dirLister();
266 if (!lister ) 270 if (!lister )
267 return; 271 return;
268 272
269 /* 273 /*
270 * Say what we want and take what we get 274 * Say what we want and take what we get
271 */ 275 */
272 lister->setStartPath( path ); 276 lister->setStartPath( path );
273 m_path = lister->currentPath(); 277 m_path = lister->currentPath();
274 278
275 m_view->viewport()->setUpdatesEnabled( false ); 279 m_view->viewport()->setUpdatesEnabled( false );
276 m_view->clear(); 280 m_view->clear();
277 281
278 /* 282 /*
279 * add files and folders 283 * add files and folders
280 */ 284 */
281 addFolders( lister->folders() ); 285 addFolders( lister->folders() );
282 addFiles( lister->files() ); 286 addFiles( lister->files() );
283 m_view->viewport()->setUpdatesEnabled( true ); 287 m_view->viewport()->setUpdatesEnabled( true );
284 288
285 // Also invalidate the cache. We can't cancel the operations anyway 289 // Also invalidate the cache. We can't cancel the operations anyway
286 g_stringPix.clear(); 290 g_stringPix.clear();
287 g_stringInf.clear(); 291 g_stringInf.clear();
288 292
289 // looks ugly 293 // looks ugly
290 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); 294 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) );
291} 295}
292 296
293/** 297/**
294 * get the current file name 298 * get the current file name
295 * @param isDir see if this is a dir or real file 299 * @param isDir see if this is a dir or real file
296 */ 300 */
297QString PIconView::currentFileName(bool &isDir)const { 301QString PIconView::currentFileName(bool &isDir)const {
298 isDir = false; 302 isDir = false;
299 QIconViewItem* _it = m_view->currentItem(); 303 QIconViewItem* _it = m_view->currentItem();
300 if ( !_it ) 304 if ( !_it )
301 return QString::null; 305 return QString::null;
302 306
303 IconViewItem* it = static_cast<IconViewItem*>( _it ); 307 IconViewItem* it = static_cast<IconViewItem*>( _it );
304 isDir = it->isDir(); 308 isDir = it->isDir();
305 return it->path(); 309 return it->path();
306} 310}
307 311
308QString PIconView::nextFileName(bool &isDir)const 312QString PIconView::nextFileName(bool &isDir)const
309{ 313{
310 isDir = false; 314 isDir = false;
311 QIconViewItem* _it1 = m_view->currentItem(); 315 QIconViewItem* _it1 = m_view->currentItem();
312 if ( !_it1 ) 316 if ( !_it1 )
313 return QString::null; 317 return QString::null;
314 QIconViewItem* _it = _it1->nextItem(); 318 QIconViewItem* _it = _it1->nextItem();
315 if ( !_it ) 319 if ( !_it )
316 return QString::null; 320 return QString::null;
317 IconViewItem* it = static_cast<IconViewItem*>( _it ); 321 IconViewItem* it = static_cast<IconViewItem*>( _it );
318 isDir = it->isDir(); 322 isDir = it->isDir();
319 return it->path(); 323 return it->path();
320} 324}
321 325
322QString PIconView::prevFileName(bool &isDir)const{ 326QString PIconView::prevFileName(bool &isDir)const{
323 isDir = false; 327 isDir = false;
324 QIconViewItem* _it = m_view->currentItem(); 328 QIconViewItem* _it = m_view->currentItem();
325 if ( !_it ) 329 if ( !_it )
326 return QString::null; 330 return QString::null;
327 _it = _it->prevItem(); 331 _it = _it->prevItem();
328 if ( !_it ) 332 if ( !_it )
329 return QString::null; 333 return QString::null;
330 IconViewItem* it = static_cast<IconViewItem*>( _it ); 334 IconViewItem* it = static_cast<IconViewItem*>( _it );
331 isDir = it->isDir(); 335 isDir = it->isDir();
332 return it->path(); 336 return it->path();
333} 337}
334 338
335void PIconView::slotTrash() { 339void PIconView::slotTrash() {
336 bool isDir; 340 bool isDir;
337 QString pa = currentFileName( isDir ); 341 QString pa = currentFileName( isDir );
338 if ( isDir && pa.isEmpty() ) 342 if ( isDir && pa.isEmpty() )
339 return; 343 return;
340 344
@@ -471,198 +475,284 @@ void PIconView::slotClicked(QIconViewItem* _it) {
471 * by the ImageDisplayer and goes to the next image 475 * by the ImageDisplayer and goes to the next image
472 */ 476 */
473void PIconView::slotRetrun( QIconViewItem *_it ) { 477void PIconView::slotRetrun( QIconViewItem *_it ) {
474 if(!_it ) 478 if(!_it )
475 return; 479 return;
476 480
477 IconViewItem* it = static_cast<IconViewItem*>(_it); 481 IconViewItem* it = static_cast<IconViewItem*>(_it);
478 if( it->isDir() ) 482 if( it->isDir() )
479 slotChangeDir( it->path() ); 483 slotChangeDir( it->path() );
480 else 484 else
481 QTimer::singleShot(0, this, SLOT(slotShowImage()) ); 485 QTimer::singleShot(0, this, SLOT(slotShowImage()) );
482} 486}
483 487
484/* 488/*
485 * got thumb info add to the cache if items is visible 489 * got thumb info add to the cache if items is visible
486 * we later need update after processing of slave is done 490 * we later need update after processing of slave is done
487 */ 491 */
488void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 492void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
489 IconViewItem* item = g_stringInf[_path]; 493 IconViewItem* item = g_stringInf[_path];
490 if (!item ) 494 if (!item )
491 return; 495 return;
492 496
493 if (m_mode == 2) { 497 if (m_mode == 2) {
494 return; 498 return;
495 } 499 }
496 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 500 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
497 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 501 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
498 m_updatet = true; 502 m_updatet = true;
499 503
500 item->setText( str ); 504 item->setText( str );
501 g_stringInf.remove( _path ); 505 g_stringInf.remove( _path );
502} 506}
503 507
504/* 508/*
505 * got thumbnail and see if it is visible so we need to update later 509 * got thumbnail and see if it is visible so we need to update later
506 */ 510 */
507void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 511void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
508 IconViewItem* item = g_stringPix[_path]; 512 IconViewItem* item = g_stringPix[_path];
509 if (!item ) 513 if (!item )
510 return; 514 return;
511 515
512 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 516 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
513 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 517 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
514 m_updatet = true; 518 m_updatet = true;
515 519
516 if (pix.width()>0) { 520 if (pix.width()>0) {
517 PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); 521 PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
518 item->setPixmap(pix,true); 522 item->setPixmap(pix,true);
519 } else { 523 } else {
520 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 ); 524 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), 64, 64 );
521 } 525 }
522 g_stringPix.remove( _path ); 526 g_stringPix.remove( _path );
523} 527}
524 528
525 529
526/* 530/*
527 * FIXME rename 531 * FIXME rename
528 */ 532 */
529void PIconView::slotRename() { 533void PIconView::slotRename() {
530 534
531} 535}
532 536
533 537
534/* 538/*
535 * BEAM the current file 539 * BEAM the current file
536 */ 540 */
537void PIconView::slotBeam() { 541void PIconView::slotBeam() {
538 bool isDir; 542 bool isDir;
539 QString pa = currentFileName( isDir ); 543 QString pa = currentFileName( isDir );
540 if ( isDir && pa.isEmpty() ) 544 if ( isDir && pa.isEmpty() )
541 return; 545 return;
542 546
543 Ir* ir = new Ir( this ); 547 Ir* ir = new Ir( this );
544 connect( ir, SIGNAL(done(Ir*)), 548 connect( ir, SIGNAL(done(Ir*)),
545 this, SLOT(slotBeamDone(Ir*))); 549 this, SLOT(slotBeamDone(Ir*)));
546 ir->send(pa, tr( "Image" ) ); 550 ir->send(pa, tr( "Image" ) );
547} 551}
548 552
549/* 553/*
550 * BEAM done clean up 554 * BEAM done clean up
551 */ 555 */
552void PIconView::slotBeamDone( Ir* ir) { 556void PIconView::slotBeamDone( Ir* ir) {
553 delete ir; 557 delete ir;
554} 558}
555 559
556void PIconView::slotStart() { 560void PIconView::slotStart() {
557 m_view->viewport()->setUpdatesEnabled( false ); 561 m_view->viewport()->setUpdatesEnabled( false );
558} 562}
559 563
560void PIconView::slotEnd() { 564void PIconView::slotEnd() {
561 if ( m_updatet ) 565 if ( m_updatet )
562 m_view->arrangeItemsInGrid( ); 566 m_view->arrangeItemsInGrid( );
563 m_view->viewport()->setUpdatesEnabled( true ); 567 m_view->viewport()->setUpdatesEnabled( true );
564 m_updatet = false; 568 m_updatet = false;
565} 569}
566 570
571void PIconView::slotShowLast()
572{
573 QIconViewItem* last_it = m_view->lastItem();
574 if (!last_it) return;
575 m_view->setCurrentItem(last_it);
576 IconViewItem* it = static_cast<IconViewItem*>( last_it );
577 bool isDir = it->isDir();
578 QString name = it->path();
579 if (!isDir && !name.isEmpty()) {
580 slotShowImage(name);
581 return;
582 }
583 bool first_loop = true;
584 while(isDir==true) {
585 if (!first_loop) {
586 m_view->setCurrentItem(m_view->currentItem()->prevItem());
587 } else {
588 first_loop = false;
589 }
590 name = prevFileName(isDir);
591 }
592
593 if (name.isEmpty()) return;
594 /* if we got a name we have a prev item */
595 m_view->setCurrentItem(m_view->currentItem()->prevItem());
596 slotShowImage(name);
597}
598
599bool PIconView::slotShowFirst()
600{
601 /* stop when reached - otherwise we may get an endless loop */
602 QIconViewItem* first_it = m_view->firstItem();
603 if (!first_it) return false;
604 m_view->setCurrentItem(first_it);
605 IconViewItem* it = static_cast<IconViewItem*>( first_it );
606 bool isDir = it->isDir();
607 QString name = it->path();
608 if (!isDir && !name.isEmpty()) {
609 slotShowImage(name);
610 return false;
611 }
612 bool first_loop = true;
613 while(isDir==true) {
614 /* if name is empty isDir is false, too. */
615 if (!first_loop) {
616 m_view->setCurrentItem(m_view->currentItem()->nextItem());
617 } else {
618 first_loop = false;
619 }
620 name = nextFileName(isDir);
621 }
622 if (name.isEmpty()) return false;
623 /* if we got a name we have a next item */
624 m_view->setCurrentItem(m_view->currentItem()->nextItem());
625 slotShowImage(name);
626 return true;
627}
628
567void PIconView::slotShowNext() 629void PIconView::slotShowNext()
568{ 630{
569 bool isDir = false; 631 bool isDir = false;
570 QString name = nextFileName(isDir); 632 QString name = nextFileName(isDir);
571 if (name.isEmpty()) return; 633 while (isDir==true) {
634 m_view->setCurrentItem(m_view->currentItem()->nextItem());
635 name = nextFileName(isDir);
636 }
637 if (name.isEmpty()) {
638 slotShowFirst();
639 return;
640 }
572 if (isDir) return; 641 if (isDir) return;
573 /* if we got a name we have a next item */ 642 /* if we got a name we have a next item */
574 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 643 m_view->setCurrentItem(m_view->currentItem()->nextItem());
575 slotShowImage(name); 644 slotShowImage(name);
576} 645}
577 646
578void PIconView::slotShowPrev() 647void PIconView::slotShowPrev()
579{ 648{
580 bool isDir = false; 649 bool isDir = false;
581 QString name = prevFileName(isDir); 650 QString name = prevFileName(isDir);
582 if (name.isEmpty()) return; 651 while (isDir==true) {
652 /* if name is empty isDir is false, too. */
653 m_view->setCurrentItem(m_view->currentItem()->prevItem());
654 name = prevFileName(isDir);
655 }
656 if (name.isEmpty()) {
657 slotShowLast();
658 return;
659 }
583 if (isDir) return; 660 if (isDir) return;
584 /* if we got a name we have a prev item */ 661 /* if we got a name we have a prev item */
585 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 662 m_view->setCurrentItem(m_view->currentItem()->prevItem());
586 slotShowImage(name); 663 slotShowImage(name);
587} 664}
588 665
589void PIconView::slotShowImage() 666void PIconView::slotShowImage()
590{ 667{
591 bool isDir = false; 668 bool isDir = false;
592 QString name = currentFileName(isDir); 669 QString name = currentFileName(isDir);
593 if (isDir) return; 670 if (isDir) return;
594 slotShowImage( name ); 671 slotShowImage( name );
595} 672}
596void PIconView::slotShowImage( const QString& name) { 673void PIconView::slotShowImage( const QString& name) {
597 PDirLister *lister = currentView()->dirLister(); 674 PDirLister *lister = currentView()->dirLister();
598 QString r_name = lister->nameToFname(name); 675 QString r_name = lister->nameToFname(name);
599 emit sig_display( r_name ); 676 emit sig_display( r_name );
600} 677}
678
679void PIconView::slotStartSlide() {
680 bool isDir = false;
681 QString name = currentFileName(isDir);
682 if (isDir) {
683 if (!slotShowFirst())
684 return;
685 } else {
686 slotShowImage( name );
687 }
688 emit sig_startslide(2);
689}
690
601void PIconView::slotImageInfo() { 691void PIconView::slotImageInfo() {
602 bool isDir = false; 692 bool isDir = false;
603 QString name = currentFileName(isDir); 693 QString name = currentFileName(isDir);
604 if (isDir) return; 694 if (isDir) return;
605 695
606 slotImageInfo( name ); 696 slotImageInfo( name );
607} 697}
608 698
609void PIconView::slotImageInfo( const QString& name) { 699void PIconView::slotImageInfo( const QString& name) {
610 PDirLister *lister = currentView()->dirLister(); 700 PDirLister *lister = currentView()->dirLister();
611 QString r_name = lister->nameToFname(name); 701 QString r_name = lister->nameToFname(name);
612 emit sig_showInfo(r_name ); 702 emit sig_showInfo(r_name );
613} 703}
614 704
615 705
616void PIconView::slotChangeMode( int mode ) { 706void PIconView::slotChangeMode( int mode ) {
617 if ( mode >= 1 && mode <= 3 ) 707 if ( mode >= 1 && mode <= 3 )
618 m_mode = mode; 708 m_mode = mode;
619 709
620 m_cfg->writeEntry("ListViewMode", m_mode); 710 m_cfg->writeEntry("ListViewMode", m_mode);
621 /* performance! */ 711 /* performance! */
622 m_view->clear(); 712 m_view->clear();
623 calculateGrid(); 713 calculateGrid();
624 slotReloadDir(); 714 slotReloadDir();
625} 715}
626 716
627 717
628void PIconView::resizeEvent( QResizeEvent* re ) { 718void PIconView::resizeEvent( QResizeEvent* re ) {
629 QVBox::resizeEvent( re ); 719 QVBox::resizeEvent( re );
630 calculateGrid(); 720 calculateGrid();
631} 721}
632 722
633 723
634void PIconView::calculateGrid() { 724void PIconView::calculateGrid() {
635 int dw = QApplication::desktop()->width(); 725 int dw = QApplication::desktop()->width();
636 int viewerWidth = dw-style().scrollBarExtent().width(); 726 int viewerWidth = dw-style().scrollBarExtent().width();
637 727
638 QIconView::ItemTextPos pos; 728 QIconView::ItemTextPos pos;
639 switch( m_mode ) { 729 switch( m_mode ) {
640 case 2: 730 case 2:
641 pos = QIconView::Bottom; 731 pos = QIconView::Bottom;
642 break; 732 break;
643 case 3: 733 case 3:
644 case 1: 734 case 1:
645 default: 735 default:
646 pos = QIconView::Right; 736 pos = QIconView::Right;
647 break; 737 break;
648 } 738 }
649 m_view->setItemTextPos( pos ); 739 m_view->setItemTextPos( pos );
650 switch (m_mode) { 740 switch (m_mode) {
651 case 2: 741 case 2:
652 m_view->setGridX(50); 742 m_view->setGridX(50);
653 m_view->setGridY(20); 743 m_view->setGridY(20);
654 PPixmapCache::self()->setMaxImages(40); 744 PPixmapCache::self()->setMaxImages(40);
655 break; 745 break;
656 case 3: 746 case 3:
657 m_view->setGridX( fontMetrics().width("testimage.jpg")+20); 747 m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
658 m_view->setGridY(8); 748 m_view->setGridY(8);
659 PPixmapCache::self()->setMaxImages(2); 749 PPixmapCache::self()->setMaxImages(2);
660 break; 750 break;
661 case 1: 751 case 1:
662 default: 752 default:
663 m_view->setGridX( viewerWidth-3*m_view->spacing()); 753 m_view->setGridX( viewerWidth-3*m_view->spacing());
664 m_view->setGridY( fontMetrics().height()*2+40 ); 754 m_view->setGridY( fontMetrics().height()*2+40 );
665 PPixmapCache::self()->setMaxImages(20); 755 PPixmapCache::self()->setMaxImages(20);
666 break; 756 break;
667 } 757 }
668} 758}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index a424c5c..bccbb0e 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -1,96 +1,100 @@
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,SlideItem
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 void sig_startslide(int timeout);
41 42
42public slots: 43public slots:
43 virtual void slotShowNext(); 44 virtual void slotShowNext();
44 virtual void slotShowPrev(); 45 virtual void slotShowPrev();
46 virtual void slotShowLast();
47 virtual bool slotShowFirst();
45 48
46protected: 49protected:
47 void resizeEvent( QResizeEvent* ); 50 void resizeEvent( QResizeEvent* );
48 51
49private: 52private:
50 void initKeys(); 53 void initKeys();
51 QString currentFileName(bool &isDir)const; 54 QString currentFileName(bool &isDir)const;
52 QString nextFileName(bool &isDir)const; 55 QString nextFileName(bool &isDir)const;
53 QString prevFileName(bool &isDir)const; 56 QString prevFileName(bool &isDir)const;
54 void loadViews(); 57 void loadViews();
55 void calculateGrid(); 58 void calculateGrid();
56 59
57private slots: 60private slots:
58 void slotDirUp(); 61 void slotDirUp();
59 void slotChangeDir(const QString&); 62 void slotChangeDir(const QString&);
60 void slotTrash(); 63 void slotTrash();
61 void slotViewChanged( int ); 64 void slotViewChanged( int );
62 void slotReloadDir(); 65 void slotReloadDir();
63 void slotRename(); 66 void slotRename();
64 void slotBeam(); 67 void slotBeam();
65 void slotBeamDone( Ir* ); 68 void slotBeamDone( Ir* );
66 69
67 void slotShowImage(); 70 void slotShowImage();
68 void slotShowImage( const QString& ); 71 void slotShowImage( const QString& );
69 void slotImageInfo(); 72 void slotImageInfo();
70 void slotImageInfo( const QString& ); 73 void slotImageInfo( const QString& );
74 void slotStartSlide();
71 75
72 void slotStart(); 76 void slotStart();
73 void slotEnd(); 77 void slotEnd();
74 78
75/* for performance reasons make it inline in the future */ 79/* for performance reasons make it inline in the future */
76 void addFolders( const QStringList& ); 80 void addFolders( const QStringList& );
77 void addFiles( const QStringList& ); 81 void addFiles( const QStringList& );
78 void slotClicked(QIconViewItem* ); 82 void slotClicked(QIconViewItem* );
79 void slotRetrun(QIconViewItem* ); 83 void slotRetrun(QIconViewItem* );
80 84
81/**/ 85/**/
82 void slotThumbInfo(const QString&, const QString&); 86 void slotThumbInfo(const QString&, const QString&);
83 void slotThumbNail(const QString&, const QPixmap&); 87 void slotThumbNail(const QString&, const QPixmap&);
84 88
85 void slotChangeMode( int ); 89 void slotChangeMode( int );
86private: 90private:
87 Opie::Core::OKeyConfigManager *m_viewManager; 91 Opie::Core::OKeyConfigManager *m_viewManager;
88 Opie::Core::OConfig *m_cfg; 92 Opie::Core::OConfig *m_cfg;
89 QComboBox* m_views; 93 QComboBox* m_views;
90 QIconView* m_view; 94 QIconView* m_view;
91 QString m_path; 95 QString m_path;
92 bool m_updatet : 1; 96 bool m_updatet : 1;
93 int m_mode; 97 int m_mode;
94}; 98};
95 99
96#endif 100#endif
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 5522131..b699aa1 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,180 +1,206 @@
1#include "imageview.h" 1#include "imageview.h"
2 2
3#include <opie2/odebug.h> 3#include <opie2/odebug.h>
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5#include <opie2/okeyconfigwidget.h> 5#include <opie2/okeyconfigwidget.h>
6 6
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qtimer.h>
10 11
11using namespace Opie::Core; 12using namespace Opie::Core;
12 13
13ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) 14ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
14 : Opie::MM::OImageScrollView(parent,name,fl) 15 : Opie::MM::OImageScrollView(parent,name,fl)
15{ 16{
16 m_viewManager = 0; 17 m_viewManager = 0;
17 focus_in_count = 0; 18 focus_in_count = 0;
18 m_cfg = cfg; 19 m_cfg = cfg;
19 m_isFullScreen = false; 20 m_isFullScreen = false;
20 m_ignore_next_in = false; 21 m_ignore_next_in = false;
22 m_slideTimer = 0;
21 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); 23 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
22 initKeys(); 24 initKeys();
25 m_slideValue = 5;
23} 26}
24 27
25ImageView::~ImageView() 28ImageView::~ImageView()
26{ 29{
27 odebug << "Delete Imageview" << oendl; 30 odebug << "Delete Imageview" << oendl;
28 delete m_viewManager; 31 delete m_viewManager;
29} 32}
30 33
31Opie::Core::OKeyConfigManager* ImageView::manager() 34Opie::Core::OKeyConfigManager* ImageView::manager()
32{ 35{
33 if (!m_viewManager) { 36 if (!m_viewManager) {
34 initKeys(); 37 initKeys();
35 } 38 }
36 return m_viewManager; 39 return m_viewManager;
37} 40}
38 41
42void ImageView::startSlide(int value)
43{
44 if (!m_slideTimer) {
45 m_slideTimer = new QTimer(this);
46 }
47 m_slideValue=value;
48 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
49 m_slideTimer->start(m_slideValue*1000,true);
50}
51
52void ImageView::nextSlide()
53{
54 if (!m_slideTimer) {
55 return;
56 }
57 if (isHidden()) {
58 delete m_slideTimer;
59 m_slideTimer = 0;
60 return;
61 }
62 emit dispNext();
63 m_slideTimer->start(m_slideValue*1000,true);
64}
39void ImageView::initKeys() 65void ImageView::initKeys()
40{ 66{
41 odebug << "init imageview keys" << oendl; 67 odebug << "init imageview keys" << oendl;
42 if (!m_cfg) { 68 if (!m_cfg) {
43 m_cfg = new Opie::Core::OConfig("phunkview"); 69 m_cfg = new Opie::Core::OConfig("phunkview");
44 m_cfg->setGroup("image_view_keys" ); 70 m_cfg->setGroup("image_view_keys" );
45 } 71 }
46 Opie::Core::OKeyPair::List lst; 72 Opie::Core::OKeyPair::List lst;
47 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 73 lst.append( Opie::Core::OKeyPair::upArrowKey() );
48 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 74 lst.append( Opie::Core::OKeyPair::downArrowKey() );
49 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 75 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
50 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 76 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
51 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); 77 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
52 78
53 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 79 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
54 lst, false,this, "image_view_keys" ); 80 lst, false,this, "image_view_keys" );
55 81
56 /** 82 /**
57 * Handle KeyEvents when they're pressed. This avoids problems 83 * Handle KeyEvents when they're pressed. This avoids problems
58 * with 'double next' on Return. 84 * with 'double next' on Return.
59 * The Return press would switch to this view and the return 85 * The Return press would switch to this view and the return
60 * release would emit the dispNext Signal. 86 * release would emit the dispNext Signal.
61 */ 87 */
62 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); 88 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed );
63 89
64 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 90 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
65 Resource::loadPixmap("1to1"), ViewInfo, 91 Resource::loadPixmap("1to1"), ViewInfo,
66 Opie::Core::OKeyPair(Qt::Key_I,0), 92 Opie::Core::OKeyPair(Qt::Key_I,0),
67 this, SLOT(slotShowImageInfo()))); 93 this, SLOT(slotShowImageInfo())));
68 94
69 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", 95 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
70 Resource::loadPixmap("rotate"), Autorotate, 96 Resource::loadPixmap("rotate"), Autorotate,
71 Opie::Core::OKeyPair(Qt::Key_R,0), 97 Opie::Core::OKeyPair(Qt::Key_R,0),
72 this, SIGNAL(toggleAutorotate()))); 98 this, SIGNAL(toggleAutorotate())));
73 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", 99 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
74 Resource::loadPixmap("1to1"), Autoscale, 100 Resource::loadPixmap("1to1"), Autoscale,
75 Opie::Core::OKeyPair(Qt::Key_S,0), 101 Opie::Core::OKeyPair(Qt::Key_S,0),
76 this, SIGNAL(toggleAutoscale()))); 102 this, SIGNAL(toggleAutoscale())));
77 103
78 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", 104 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
79 Resource::loadPixmap("forward"), ShowNext, 105 Resource::loadPixmap("forward"), ShowNext,
80 Opie::Core::OKeyPair(Qt::Key_Return,0), 106 Opie::Core::OKeyPair(Qt::Key_Return,0),
81 this, SIGNAL(dispNext()))); 107 this, SIGNAL(dispNext())));
82 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", 108 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
83 Resource::loadPixmap("back"), ShowPrevious, 109 Resource::loadPixmap("back"), ShowPrevious,
84 Opie::Core::OKeyPair(Qt::Key_P,0), 110 Opie::Core::OKeyPair(Qt::Key_P,0),
85 this, SIGNAL(dispPrev()))); 111 this, SIGNAL(dispPrev())));
86 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", 112 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
87 Resource::loadPixmap("fullscreen"), FullScreen, 113 Resource::loadPixmap("fullscreen"), FullScreen,
88 Opie::Core::OKeyPair(Qt::Key_F,0), 114 Opie::Core::OKeyPair(Qt::Key_F,0),
89 this, SIGNAL(toggleFullScreen()))); 115 this, SIGNAL(toggleFullScreen())));
90 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", 116 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
91 Resource::loadPixmap("mag"), Zoomer, 117 Resource::loadPixmap("mag"), Zoomer,
92 Opie::Core::OKeyPair(Qt::Key_T,0), 118 Opie::Core::OKeyPair(Qt::Key_T,0),
93 this, SIGNAL(toggleZoomer()))); 119 this, SIGNAL(toggleZoomer())));
94 m_viewManager->handleWidget( this ); 120 m_viewManager->handleWidget( this );
95 m_viewManager->load(); 121 m_viewManager->load();
96} 122}
97 123
98void ImageView::keyReleaseEvent(QKeyEvent * e) 124void ImageView::keyReleaseEvent(QKeyEvent * e)
99{ 125{
100 if (!e || e->state()!=0) { 126 if (!e || e->state()!=0) {
101 return; 127 return;
102 } 128 }
103 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); 129 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe();
104} 130}
105 131
106void ImageView::slotShowImageInfo() 132void ImageView::slotShowImageInfo()
107{ 133{
108 emit dispImageInfo(m_lastName); 134 emit dispImageInfo(m_lastName);
109} 135}
110 136
111void ImageView::contentsMousePressEvent ( QMouseEvent * e) 137void ImageView::contentsMousePressEvent ( QMouseEvent * e)
112{ 138{
113 if (e->button()==1) { 139 if (e->button()==1) {
114 return OImageScrollView::contentsMousePressEvent(e); 140 return OImageScrollView::contentsMousePressEvent(e);
115 } 141 }
116 odebug << "Popup " << oendl; 142 odebug << "Popup " << oendl;
117 QPopupMenu *m = new QPopupMenu(0); 143 QPopupMenu *m = new QPopupMenu(0);
118 if (!m) return; 144 if (!m) return;
119 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); 145 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
120 if (fullScreen()) { 146 if (fullScreen()) {
121 m->insertSeparator(); 147 m->insertSeparator();
122 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); 148 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev()));
123 m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); 149 m->insertItem(tr("Next image"),this,SIGNAL(dispNext()));
124 m->insertSeparator(); 150 m->insertSeparator();
125 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); 151 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale()));
126 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); 152 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate()));
127 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); 153 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer()));
128 } 154 }
129 m->setFocus(); 155 m->setFocus();
130 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 156 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
131 delete m; 157 delete m;
132} 158}
133 159
134void ImageView::setFullScreen(bool how) 160void ImageView::setFullScreen(bool how)
135{ 161{
136 m_isFullScreen = how; 162 m_isFullScreen = how;
137 if (how) { 163 if (how) {
138 m_ignore_next_in = true; 164 m_ignore_next_in = true;
139 setFixedSize(qApp->desktop()->size()); 165 setFixedSize(qApp->desktop()->size());
140 showFullScreen(); 166 showFullScreen();
141 } else { 167 } else {
142 setMinimumSize(10,10); 168 setMinimumSize(10,10);
143 } 169 }
144} 170}
145 171
146void ImageView::focusInEvent(QFocusEvent *) 172void ImageView::focusInEvent(QFocusEvent *)
147{ 173{
148 // Always do it here, no matter the size. 174 // Always do it here, no matter the size.
149 odebug << "Focus in (view)" << oendl; 175 odebug << "Focus in (view)" << oendl;
150 //if (fullScreen()) parentWidget()->showNormal(); 176 //if (fullScreen()) parentWidget()->showNormal();
151 if (m_ignore_next_in){m_ignore_next_in=false;return;} 177 if (m_ignore_next_in){m_ignore_next_in=false;return;}
152 if (fullScreen()) enableFullscreen(); 178 if (fullScreen()) enableFullscreen();
153} 179}
154 180
155void ImageView::hide() 181void ImageView::hide()
156{ 182{
157 if (fullScreen()) { 183 if (fullScreen()) {
158 m_ignore_next_in = true; 184 m_ignore_next_in = true;
159 showNormal(); 185 showNormal();
160 } 186 }
161 QWidget::hide(); 187 QWidget::hide();
162} 188}
163void ImageView::enableFullscreen() 189void ImageView::enableFullscreen()
164{ 190{
165 if (!fullScreen()) return; 191 if (!fullScreen()) return;
166 if (m_ignore_next_in) {m_ignore_next_in = false;return;} 192 if (m_ignore_next_in) {m_ignore_next_in = false;return;}
167 193
168 setUpdatesEnabled(false); 194 setUpdatesEnabled(false);
169 // This is needed because showNormal() forcefully changes the window 195 // This is needed because showNormal() forcefully changes the window
170 // style to WSTyle_TopLevel. 196 // style to WSTyle_TopLevel.
171 reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 197 reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
172 // Enable fullscreen. 198 // Enable fullscreen.
173 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus 199 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
174 * so we must block it here! */ 200 * so we must block it here! */
175 m_ignore_next_in = true; 201 m_ignore_next_in = true;
176 showFullScreen(); 202 showFullScreen();
177 setUpdatesEnabled(true); 203 setUpdatesEnabled(true);
178 204
179} 205}
180 206
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 18697e0..f0e6541 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -1,65 +1,71 @@
1#ifndef _IMAGE_VIEW_H 1#ifndef _IMAGE_VIEW_H
2#define _IMAGE_VIEW_H 2#define _IMAGE_VIEW_H
3 3
4#include <opie2/oimagescrollview.h> 4#include <opie2/oimagescrollview.h>
5 5
6#include <qwidget.h> 6#include <qwidget.h>
7 7
8class QTimer;
9
8namespace Opie { 10namespace Opie {
9 namespace Core { 11 namespace Core {
10 class OConfig; 12 class OConfig;
11 class OKeyConfigManager; 13 class OKeyConfigManager;
12 } 14 }
13} 15}
14 16
15class ImageView:public Opie::MM::OImageScrollView 17class ImageView:public Opie::MM::OImageScrollView
16{ 18{
17 Q_OBJECT 19 Q_OBJECT
18 20
19 enum ActionIds { 21 enum ActionIds {
20 ViewInfo, 22 ViewInfo,
21 FullScreen, 23 FullScreen,
22 ShowNext, 24 ShowNext,
23 ShowPrevious, 25 ShowPrevious,
24 Zoomer, 26 Zoomer,
25 Autorotate, 27 Autorotate,
26 Autoscale 28 Autoscale
27 }; 29 };
28 30
29public: 31public:
30 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); 32 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 );
31 virtual ~ImageView(); 33 virtual ~ImageView();
32 Opie::Core::OKeyConfigManager* manager(); 34 Opie::Core::OKeyConfigManager* manager();
33 void setFullScreen(bool how); 35 void setFullScreen(bool how);
34 bool fullScreen(){return m_isFullScreen;} 36 bool fullScreen(){return m_isFullScreen;}
35 virtual void enableFullscreen(); 37 virtual void enableFullscreen();
36 38
37signals: 39signals:
38 void dispImageInfo(const QString&); 40 void dispImageInfo(const QString&);
39 void dispNext(); 41 void dispNext();
40 void dispPrev(); 42 void dispPrev();
41 void toggleFullScreen(); 43 void toggleFullScreen();
42 void hideMe(); 44 void hideMe();
43 void toggleZoomer(); 45 void toggleZoomer();
44 void toggleAutoscale(); 46 void toggleAutoscale();
45 void toggleAutorotate(); 47 void toggleAutorotate();
46 48
47protected: 49protected:
48 Opie::Core::OConfig * m_cfg; 50 Opie::Core::OConfig * m_cfg;
49 Opie::Core::OKeyConfigManager*m_viewManager; 51 Opie::Core::OKeyConfigManager*m_viewManager;
50 void initKeys(); 52 void initKeys();
51 bool m_isFullScreen:1; 53 bool m_isFullScreen:1;
52 bool m_ignore_next_in:1; 54 bool m_ignore_next_in:1;
53 int focus_in_count; 55 int focus_in_count;
56 QTimer*m_slideTimer;
57 int m_slideValue;
54 virtual void focusInEvent ( QFocusEvent * ); 58 virtual void focusInEvent ( QFocusEvent * );
55 59
56public slots: 60public slots:
57 virtual void hide(); 61 virtual void hide();
62 virtual void startSlide(int);
63 virtual void nextSlide();
58 64
59protected slots: 65protected slots:
60 virtual void slotShowImageInfo(); 66 virtual void slotShowImageInfo();
61 virtual void keyReleaseEvent(QKeyEvent * e); 67 virtual void keyReleaseEvent(QKeyEvent * e);
62 virtual void contentsMousePressEvent ( QMouseEvent * e); 68 virtual void contentsMousePressEvent ( QMouseEvent * e);
63}; 69};
64 70
65#endif 71#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 438fbf2..3c946b6 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -218,192 +218,193 @@ void PMainWindow::slotConfig() {
218 PDirView *view = (_it.data())(*m_cfg); 218 PDirView *view = (_it.data())(*m_cfg);
219 PInterfaceInfo *inf = view->interfaceInfo(); 219 PInterfaceInfo *inf = view->interfaceInfo();
220 QWidget *_wid = inf->configWidget( *m_cfg ); 220 QWidget *_wid = inf->configWidget( *m_cfg );
221 if (!_wid) continue; 221 if (!_wid) continue;
222 _wid->reparent(wid, QPoint() ); 222 _wid->reparent(wid, QPoint() );
223 lst.insert( view, _wid ); 223 lst.insert( view, _wid );
224 wid->addTab( _wid, "fileopen", inf->name() ); 224 wid->addTab( _wid, "fileopen", inf->name() );
225 } 225 }
226 226
227/* 227/*
228 * Add the KeyConfigWidget 228 * Add the KeyConfigWidget
229 */ 229 */
230 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 230 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
231 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 231 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
232 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 232 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
233 233
234 if ( !m_info ) { 234 if ( !m_info ) {
235 initInfo(); 235 initInfo();
236 } 236 }
237 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 237 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
238 238
239 if ( !m_disp ) { 239 if ( !m_disp ) {
240 initDisp(); 240 initDisp();
241 } 241 }
242 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 242 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
243 243
244 keyWid->load(); 244 keyWid->load();
245 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 245 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
246 246
247 247
248 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 248 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
249 249
250/* 250/*
251 * clean up 251 * clean up
252 *apply changes 252 *apply changes
253 */ 253 */
254 254
255 QMap<PDirView*, QWidget*>::Iterator it; 255 QMap<PDirView*, QWidget*>::Iterator it;
256 for ( it = lst.begin(); it != lst.end(); ++it ) { 256 for ( it = lst.begin(); it != lst.end(); ++it ) {
257 if ( act ) 257 if ( act )
258 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 258 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
259 delete it.key(); 259 delete it.key();
260 } 260 }
261 261
262 262
263 if ( act ) { 263 if ( act ) {
264 m_view->resetView(); 264 m_view->resetView();
265 keyWid->save(); 265 keyWid->save();
266 m_disp->manager()->save(); 266 m_disp->manager()->save();
267 m_info->manager()->save(); 267 m_info->manager()->save();
268 m_view->manager()->save(); 268 m_view->manager()->save();
269 } 269 }
270 delete keyWid; 270 delete keyWid;
271} 271}
272 272
273/* 273/*
274 * create a new image info component 274 * create a new image info component
275 * and detach the current one 275 * and detach the current one
276 * we will make the other delete on exit 276 * we will make the other delete on exit
277 */ 277 */
278template<class T> 278template<class T>
279void PMainWindow::initT( const char* name, T** ptr, int id) { 279void PMainWindow::initT( const char* name, T** ptr, int id) {
280 if ( *ptr ) { 280 if ( *ptr ) {
281 (*ptr)->disconnect(this, SLOT(slotReturn())); 281 (*ptr)->disconnect(this, SLOT(slotReturn()));
282 (*ptr)->setDestructiveClose(); 282 (*ptr)->setDestructiveClose();
283 m_stack->removeWidget( *ptr ); 283 m_stack->removeWidget( *ptr );
284 } 284 }
285 *ptr = new T(m_cfg, m_stack, name ); 285 *ptr = new T(m_cfg, m_stack, name );
286 m_stack->addWidget( *ptr, id ); 286 m_stack->addWidget( *ptr, id );
287 287
288 connect(*ptr, SIGNAL(sig_return()), 288 connect(*ptr, SIGNAL(sig_return()),
289 this,SLOT(slotReturn())); 289 this,SLOT(slotReturn()));
290 290
291} 291}
292void PMainWindow::initInfo() { 292void PMainWindow::initInfo() {
293 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 293 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
294 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 294 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
295} 295}
296void PMainWindow::initDisp() { 296void PMainWindow::initDisp() {
297 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 297 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
298 if (m_disp) { 298 if (m_disp) {
299 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 299 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
300 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 300 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
301 } 301 }
302 m_disp->setAutoScale(autoScale); 302 m_disp->setAutoScale(autoScale);
303 m_disp->setAutoRotate(autoRotate); 303 m_disp->setAutoRotate(autoRotate);
304 m_disp->setShowZoomer(zoomerOn); 304 m_disp->setShowZoomer(zoomerOn);
305 m_disp->setBackgroundColor(white); 305 m_disp->setBackgroundColor(white);
306 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 306 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
307 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 307 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
308 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 308 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
309 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 309 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
310 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 310 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
311 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 311 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
312 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 312 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
313 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 313 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
314 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
314 } 315 }
315} 316}
316 317
317void PMainWindow::slotToggleFullScreen() 318void PMainWindow::slotToggleFullScreen()
318{ 319{
319 odebug << "Toggle full " << oendl; 320 odebug << "Toggle full " << oendl;
320 if (!m_disp) return; 321 if (!m_disp) return;
321 bool current = !m_disp->fullScreen(); 322 bool current = !m_disp->fullScreen();
322 odebug << "Current = " << current << oendl; 323 odebug << "Current = " << current << oendl;
323 if (current) { 324 if (current) {
324 odebug << "full" << oendl; 325 odebug << "full" << oendl;
325 m_disp->setBackgroundColor(black); 326 m_disp->setBackgroundColor(black);
326 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 327 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
327 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 328 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
328 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 329 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
329 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 330 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
330 //m_disp->showFullScreen(); 331 //m_disp->showFullScreen();
331 //qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 332 //qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
332 } else { 333 } else {
333 setUpdatesEnabled(false); 334 setUpdatesEnabled(false);
334 odebug << "window" << oendl; 335 odebug << "window" << oendl;
335 m_disp->reparent(0,QPoint(0,0)); 336 m_disp->reparent(0,QPoint(0,0));
336 m_disp->showNormal(); 337 m_disp->showNormal();
337 m_disp->setBackgroundColor(white); 338 m_disp->setBackgroundColor(white);
338 m_stack->addWidget(m_disp,ImageDisplay); 339 m_stack->addWidget(m_disp,ImageDisplay);
339 m_disp->setVScrollBarMode(QScrollView::Auto); 340 m_disp->setVScrollBarMode(QScrollView::Auto);
340 m_disp->setHScrollBarMode(QScrollView::Auto); 341 m_disp->setHScrollBarMode(QScrollView::Auto);
341 m_stack->raiseWidget(m_disp); 342 m_stack->raiseWidget(m_disp);
342 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 343 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
343 m_disp->resize(m_disp->minimumSize()); 344 m_disp->resize(m_disp->minimumSize());
344 } 345 }
345 setUpdatesEnabled(true); 346 setUpdatesEnabled(true);
346 } 347 }
347 m_disp->setFullScreen(current); 348 m_disp->setFullScreen(current);
348} 349}
349 350
350/** 351/**
351 * With big Screen the plan could be to 'detach' the image 352 * With big Screen the plan could be to 'detach' the image
352 * window if visible and to create a ne wone 353 * window if visible and to create a ne wone
353 * init* already supports it but I make no use of it for 354 * init* already supports it but I make no use of it for
354 * now. We set filename and raise 355 * now. We set filename and raise
355 * 356 *
356 * ### FIXME and talk to alwin 357 * ### FIXME and talk to alwin
357 */ 358 */
358void PMainWindow::slotShowInfo( const QString& inf ) { 359void PMainWindow::slotShowInfo( const QString& inf ) {
359 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 360 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
360 return; 361 return;
361 } 362 }
362 if ( !m_info ) { 363 if ( !m_info ) {
363 initInfo(); 364 initInfo();
364 } 365 }
365 m_info->setPath( inf ); 366 m_info->setPath( inf );
366 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 367 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
367 prevButton->hide(); 368 prevButton->hide();
368 nextButton->hide(); 369 nextButton->hide();
369 upButton->hide(); 370 upButton->hide();
370 fsButton->hide(); 371 fsButton->hide();
371 viewModeButton->hide(); 372 viewModeButton->hide();
372 } 373 }
373 m_stack->raiseWidget( ImageInfo ); 374 m_stack->raiseWidget( ImageInfo );
374} 375}
375 376
376void PMainWindow::slotDisplay( const QString& inf ) { 377void PMainWindow::slotDisplay( const QString& inf ) {
377 if ( !m_disp ) { 378 if ( !m_disp ) {
378 initDisp(); 379 initDisp();
379 } 380 }
380 m_disp->setImage( inf ); 381 m_disp->setImage( inf );
381 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 382 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
382 prevButton->show(); 383 prevButton->show();
383 nextButton->show(); 384 nextButton->show();
384 upButton->hide(); 385 upButton->hide();
385 fsButton->hide(); 386 fsButton->hide();
386 viewModeButton->hide(); 387 viewModeButton->hide();
387 } 388 }
388 if (m_disp->fullScreen()) { 389 if (m_disp->fullScreen()) {
389 //m_disp->showFullScreen(); 390 //m_disp->showFullScreen();
390 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 391 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
391 } else { 392 } else {
392 m_stack->raiseWidget( ImageDisplay ); 393 m_stack->raiseWidget( ImageDisplay );
393 } 394 }
394} 395}
395 396
396void PMainWindow::slotReturn() { 397void PMainWindow::slotReturn() {
397 raiseIconView(); 398 raiseIconView();
398} 399}
399 400
400 401
401void PMainWindow::closeEvent( QCloseEvent* ev ) { 402void PMainWindow::closeEvent( QCloseEvent* ev ) {
402 /* 403 /*
403 * return from view 404 * return from view
404 * or properly quit 405 * or properly quit
405 */ 406 */
406 if ( m_stack->visibleWidget() == m_info || 407 if ( m_stack->visibleWidget() == m_info ||
407 m_stack->visibleWidget() == m_disp ) { 408 m_stack->visibleWidget() == m_disp ) {
408 ev->ignore(); 409 ev->ignore();
409 raiseIconView(); 410 raiseIconView();