summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp11
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp2
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp43
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h4
4 files changed, 45 insertions, 15 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index f6e1816..7231bfb 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -266,47 +266,45 @@ QString PIconView::currentFileName(bool &isDir)const {
266 IconViewItem* it = static_cast<IconViewItem*>( _it ); 266 IconViewItem* it = static_cast<IconViewItem*>( _it );
267 isDir = it->isDir(); 267 isDir = it->isDir();
268 return it->path(); 268 return it->path();
269} 269}
270 270
271QString PIconView::nextFileName(bool &isDir)const 271QString PIconView::nextFileName(bool &isDir)const
272{ 272{
273 isDir = false; 273 isDir = false;
274 QIconViewItem* _it1 = m_view->currentItem(); 274 QIconViewItem* _it1 = m_view->currentItem();
275 if ( !_it1 ) 275 if ( !_it1 )
276 return QString::null; 276 return QString::null;
277 QIconViewItem* _it = _it1->nextItem(); 277 QIconViewItem* _it = _it1->nextItem();
278 if ( !_it ) 278 if ( !_it )
279 return QString::null; 279 return QString::null;
280 IconViewItem* it = static_cast<IconViewItem*>( _it ); 280 IconViewItem* it = static_cast<IconViewItem*>( _it );
281 isDir = it->isDir(); 281 isDir = it->isDir();
282 m_view->setCurrentItem(_it);
283 return it->path(); 282 return it->path();
284} 283}
285 284
286QString PIconView::prevFileName(bool &isDir)const{ 285QString PIconView::prevFileName(bool &isDir)const{
287 isDir = false; 286 isDir = false;
288 QIconViewItem* _it = m_view->currentItem(); 287 QIconViewItem* _it = m_view->currentItem();
289 if ( !_it ) 288 if ( !_it )
290 return QString::null; 289 return QString::null;
291 _it = _it->prevItem(); 290 _it = _it->prevItem();
292 if ( !_it ) 291 if ( !_it )
293 return QString::null; 292 return QString::null;
294 IconViewItem* it = static_cast<IconViewItem*>( _it ); 293 IconViewItem* it = static_cast<IconViewItem*>( _it );
295 isDir = it->isDir(); 294 isDir = it->isDir();
296 m_view->setCurrentItem(_it);
297 return it->path(); 295 return it->path();
298} 296}
299 297
300void PIconView::slotTrash() { 298void PIconView::slotTrash() {
301 bool isDir; 299 bool isDir;
302 QString pa = currentFileName( isDir ); 300 QString pa = currentFileName( isDir );
303 if ( isDir && pa.isEmpty() ) 301 if ( isDir && pa.isEmpty() )
304 return; 302 return;
305 303
306 if (!QPEMessageBox::confirmDelete( this, 304 if (!QPEMessageBox::confirmDelete( this,
307 tr("Delete Image" ), 305 tr("Delete Image" ),
308 tr("the Image %1" ).arg(pa))) 306 tr("the Image %1" ).arg(pa)))
309 return 307 return
310 308
311 309
312 currentView()->dirLister()->deleteImage( pa ); 310 currentView()->dirLister()->deleteImage( pa );
@@ -466,44 +464,47 @@ void PIconView::slotBeamDone( Ir* ir) {
466 464
467void PIconView::slotStart() { 465void PIconView::slotStart() {
468 m_view->viewport()->setUpdatesEnabled( false ); 466 m_view->viewport()->setUpdatesEnabled( false );
469} 467}
470 468
471void PIconView::slotEnd() { 469void PIconView::slotEnd() {
472 if ( m_updatet ) 470 if ( m_updatet )
473 m_view->arrangeItemsInGrid( ); 471 m_view->arrangeItemsInGrid( );
474 m_view->viewport()->setUpdatesEnabled( true ); 472 m_view->viewport()->setUpdatesEnabled( true );
475 m_updatet = false; 473 m_updatet = false;
476} 474}
477 475
478void PIconView::slotShowNext() 476void PIconView::slotShowNext()
479{ 477{
480 bool isDir = false; 478 bool isDir = false;
481 QString name = nextFileName(isDir); 479 QString name = nextFileName(isDir);
482 if (isDir) return;
483 if (name.isEmpty()) return; 480 if (name.isEmpty()) return;
484 odebug << "Show next: " << name << oendl; 481 if (isDir) return;
482 /* if we got a name we have a next item */
483 m_view->setCurrentItem(m_view->currentItem()->nextItem());
485 slotShowImage(name); 484 slotShowImage(name);
486} 485}
487 486
488void PIconView::slotShowPrev() 487void PIconView::slotShowPrev()
489{ 488{
490 bool isDir = false; 489 bool isDir = false;
491 QString name = prevFileName(isDir); 490 QString name = prevFileName(isDir);
492 if (isDir) return;
493 if (name.isEmpty()) return; 491 if (name.isEmpty()) return;
492 if (isDir) return;
493 /* if we got a name we have a prev item */
494 m_view->setCurrentItem(m_view->currentItem()->prevItem());
494 slotShowImage(name); 495 slotShowImage(name);
495} 496}
496 497
497void PIconView::slotShowImage() 498void PIconView::slotShowImage()
498{ 499{
499 bool isDir = false; 500 bool isDir = false;
500 QString name = currentFileName(isDir); 501 QString name = currentFileName(isDir);
501 if (isDir) return; 502 if (isDir) return;
502 503
503 slotShowImage( name ); 504 slotShowImage( name );
504} 505}
505void PIconView::slotShowImage( const QString& name) { 506void PIconView::slotShowImage( const QString& name) {
506 emit sig_display( name ); 507 emit sig_display( name );
507} 508}
508void PIconView::slotImageInfo() { 509void PIconView::slotImageInfo() {
509 bool isDir = false; 510 bool isDir = false;
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index aa2b9bc..fbc4494 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -30,32 +30,34 @@ Opie::Core::OKeyConfigManager* ImageView::manager()
30 } 30 }
31 return m_viewManager; 31 return m_viewManager;
32} 32}
33 33
34void ImageView::initKeys() 34void ImageView::initKeys()
35{ 35{
36 odebug << "init imageview keys" << oendl; 36 odebug << "init imageview keys" << oendl;
37 if (!m_cfg) { 37 if (!m_cfg) {
38 m_cfg = new Opie::Core::OConfig("phunkview"); 38 m_cfg = new Opie::Core::OConfig("phunkview");
39 m_cfg->setGroup("image_view_keys" ); 39 m_cfg->setGroup("image_view_keys" );
40 } 40 }
41 Opie::Core::OKeyPair::List lst; 41 Opie::Core::OKeyPair::List lst;
42 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 42 lst.append( Opie::Core::OKeyPair::upArrowKey() );
43 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 43 lst.append( Opie::Core::OKeyPair::downArrowKey() );
44 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 44 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
45 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 45 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
46 lst.append( Opie::Core::OKeyPair(Qt::Key_N,0));
47 lst.append( Opie::Core::OKeyPair(Qt::Key_P,0));
46 48
47 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 49 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
48 lst, false,this, "image_view_keys" ); 50 lst, false,this, "image_view_keys" );
49 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 51 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
50 Resource::loadPixmap("1to1"), ViewInfo, 52 Resource::loadPixmap("1to1"), ViewInfo,
51 Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton), 53 Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton),
52 this, SLOT(slotShowImageInfo()))); 54 this, SLOT(slotShowImageInfo())));
53#if 0 55#if 0
54 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Next image"), "nextimage", 56 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Next image"), "nextimage",
55 Resource::loadPixmap("next"), ViewInfo, 57 Resource::loadPixmap("next"), ViewInfo,
56 Opie::Core::OKeyPair(Qt::Key_N,0), 58 Opie::Core::OKeyPair(Qt::Key_N,0),
57 this, SLOT(slotDispNext()))); 59 this, SLOT(slotDispNext())));
58#endif 60#endif
59 m_viewManager->handleWidget( this ); 61 m_viewManager->handleWidget( this );
60 m_viewManager->load(); 62 m_viewManager->load();
61} 63}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 57be247..6f3f255 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -51,68 +51,80 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
51 bar->setHorizontalStretchable( true ); 51 bar->setHorizontalStretchable( true );
52 setToolBarsMovable( false ); 52 setToolBarsMovable( false );
53 53
54 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
55 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
56 56
57 m_view = new PIconView( m_stack, m_cfg ); 57 m_view = new PIconView( m_stack, m_cfg );
58 m_stack->addWidget( m_view, IconView ); 58 m_stack->addWidget( m_view, IconView );
59 m_stack->raiseWidget( IconView ); 59 m_stack->raiseWidget( IconView );
60 connect(m_view, SIGNAL(sig_display(const QString&)), 60 connect(m_view, SIGNAL(sig_display(const QString&)),
61 this, SLOT(slotDisplay(const QString&))); 61 this, SLOT(slotDisplay(const QString&)));
62 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 62 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
63 this, SLOT(slotShowInfo(const QString&)) ); 63 this, SLOT(slotShowInfo(const QString&)) );
64 64
65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
66 66
67 QToolButton *btn = new QToolButton( bar ); 67 upButton = new QToolButton( bar );
68 btn->setIconSet( Resource::loadIconSet( "up" ) ); 68 upButton->setIconSet( Resource::loadIconSet( "up" ) );
69 connect( btn, SIGNAL(clicked()), 69 connect( upButton, SIGNAL(clicked()),
70 m_view, SLOT(slotDirUp()) ); 70 m_view, SLOT(slotDirUp()) );
71 71
72 btn = new PFileSystem( bar ); 72 fsButton = new PFileSystem( bar );
73 connect( btn, SIGNAL( changeDir( const QString& ) ), 73 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
74 m_view, SLOT(slotChangeDir( const QString& ) ) ); 74 m_view, SLOT(slotChangeDir( const QString& ) ) );
75 75
76 btn = new QToolButton( bar ); 76 QToolButton*btn = new QToolButton( bar );
77 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 77 btn->setIconSet( Resource::loadIconSet( "edit" ) );
78 connect( btn, SIGNAL(clicked()), 78 connect( btn, SIGNAL(clicked()),
79 m_view, SLOT(slotRename()) ); 79 m_view, SLOT(slotRename()) );
80 80
81 if ( Ir::supported() ) { 81 if ( Ir::supported() ) {
82 btn = new QToolButton( bar ); 82 btn = new QToolButton( bar );
83 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 83 btn->setIconSet( Resource::loadIconSet( "beam" ) );
84 connect( btn, SIGNAL(clicked()), 84 connect( btn, SIGNAL(clicked()),
85 m_view, SLOT(slotBeam()) ); 85 m_view, SLOT(slotBeam()) );
86 } 86 }
87 87
88 btn = new QToolButton( bar ); 88 btn = new QToolButton( bar );
89 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 89 btn->setIconSet( Resource::loadIconSet( "trash" ) );
90 connect( btn, SIGNAL(clicked() ), 90 connect( btn, SIGNAL(clicked() ),
91 m_view, SLOT(slotTrash() ) ); 91 m_view, SLOT(slotTrash() ) );
92 92
93 93
94 btn = new ViewModeButton( bar ); 94 viewModeButton = new ViewModeButton( bar );
95 connect( btn, SIGNAL(changeMode(int)), 95 connect( viewModeButton, SIGNAL(changeMode(int)),
96 m_view, SLOT(slotChangeMode(int))); 96 m_view, SLOT(slotChangeMode(int)));
97 97
98 btn = new QToolButton( bar ); 98 btn = new QToolButton( bar );
99 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 99 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
100 connect( btn, SIGNAL(clicked() ), 100 connect( btn, SIGNAL(clicked() ),
101 this, SLOT(slotConfig() ) ); 101 this, SLOT(slotConfig() ) );
102 102
103
104
105 prevButton = new QToolButton(bar);
106 prevButton->setIconSet( Resource::loadIconSet( "back" ) );
107 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
108 prevButton->hide();
109
110 nextButton = new QToolButton(bar);
111 nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
112 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
113 nextButton->hide();
114
103 rotateButton = new QToolButton(bar); 115 rotateButton = new QToolButton(bar);
104 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 116 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
105 rotateButton->setToggleButton(true); 117 rotateButton->setToggleButton(true);
106 118
107 odebug << "Mode = " << m_stack->mode() << oendl; 119 odebug << "Mode = " << m_stack->mode() << oendl;
108 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 120 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
109 rotateButton->setOn(true); 121 rotateButton->setOn(true);
110 autoRotate = true; 122 autoRotate = true;
111 } else { 123 } else {
112 rotateButton->setOn(false); 124 rotateButton->setOn(false);
113 autoRotate = false; 125 autoRotate = false;
114 } 126 }
115 127
116 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 128 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
117 129
118 btn = new QToolButton(bar); 130 btn = new QToolButton(bar);
@@ -271,59 +283,74 @@ void PMainWindow::initDisp() {
271 } 283 }
272} 284}
273 285
274/** 286/**
275 * With big Screen the plan could be to 'detach' the image 287 * With big Screen the plan could be to 'detach' the image
276 * window if visible and to create a ne wone 288 * window if visible and to create a ne wone
277 * init* already supports it but I make no use of it for 289 * init* already supports it but I make no use of it for
278 * now. We set filename and raise 290 * now. We set filename and raise
279 * 291 *
280 * ### FIXME and talk to alwin 292 * ### FIXME and talk to alwin
281 */ 293 */
282void PMainWindow::slotShowInfo( const QString& inf ) { 294void PMainWindow::slotShowInfo( const QString& inf ) {
283 if ( !m_info ) { 295 if ( !m_info ) {
284 initInfo(); 296 initInfo();
285 } 297 }
286 m_info->setPath( inf ); 298 m_info->setPath( inf );
299 prevButton->hide();
300 nextButton->hide();
301 upButton->hide();
302 fsButton->hide();
303 viewModeButton->hide();
287 m_stack->raiseWidget( ImageInfo ); 304 m_stack->raiseWidget( ImageInfo );
288} 305}
289 306
290void PMainWindow::slotDisplay( const QString& inf ) { 307void PMainWindow::slotDisplay( const QString& inf ) {
291 if ( !m_disp ) { 308 if ( !m_disp ) {
292 initDisp(); 309 initDisp();
293 } 310 }
294 m_disp->setImage( inf ); 311 m_disp->setImage( inf );
312 prevButton->show();
313 nextButton->show();
314 upButton->hide();
315 fsButton->hide();
316 viewModeButton->hide();
295 m_stack->raiseWidget( ImageDisplay ); 317 m_stack->raiseWidget( ImageDisplay );
296} 318}
297 319
298void PMainWindow::slotReturn() { 320void PMainWindow::slotReturn() {
299 raiseIconView(); 321 raiseIconView();
300} 322}
301 323
302 324
303void PMainWindow::closeEvent( QCloseEvent* ev ) { 325void PMainWindow::closeEvent( QCloseEvent* ev ) {
304 /* 326 /*
305 * return from view 327 * return from view
306 * or properly quit 328 * or properly quit
307 */ 329 */
308 if ( m_stack->visibleWidget() == m_info || 330 if ( m_stack->visibleWidget() == m_info ||
309 m_stack->visibleWidget() == m_disp ) { 331 m_stack->visibleWidget() == m_disp ) {
310 raiseIconView(); 332 raiseIconView();
311 ev->ignore(); 333 ev->ignore();
312 return; 334 return;
313 } 335 }
314 ev->accept(); 336 ev->accept();
315 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 337 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
316} 338}
317 339
318void PMainWindow::raiseIconView() { 340void PMainWindow::raiseIconView() {
341 prevButton->hide();
342 nextButton->hide();
343 upButton->show();
344 fsButton->show();
345 viewModeButton->show();
319 m_stack->raiseWidget( IconView ); 346 m_stack->raiseWidget( IconView );
320} 347}
321 348
322void PMainWindow::setDocument( const QString& showImg ) { 349void PMainWindow::setDocument( const QString& showImg ) {
323 QString file = showImg; 350 QString file = showImg;
324 DocLnk lnk(showImg); 351 DocLnk lnk(showImg);
325 if (lnk.isValid() ) 352 if (lnk.isValid() )
326 file = lnk.file(); 353 file = lnk.file();
327 354
328 slotDisplay( file ); 355 slotDisplay( file );
329} 356}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index adb5dc2..1967ef7 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -50,24 +50,24 @@ protected:
50 void closeEvent( QCloseEvent* ); 50 void closeEvent( QCloseEvent* );
51 51
52private: 52private:
53 template<class T> void initT( const char* name, T**, int ); 53 template<class T> void initT( const char* name, T**, int );
54 void initInfo(); 54 void initInfo();
55 void initDisp(); 55 void initDisp();
56 56
57private: 57private:
58 Opie::Core::OConfig *m_cfg; 58 Opie::Core::OConfig *m_cfg;
59 Opie::Ui::OWidgetStack *m_stack; 59 Opie::Ui::OWidgetStack *m_stack;
60 PIconView* m_view; 60 PIconView* m_view;
61 imageinfo *m_info; 61 imageinfo *m_info;
62 ImageView *m_disp; 62 ImageView *m_disp;
63 bool autoRotate; 63 bool autoRotate;
64 bool autoScale; 64 bool autoScale;
65 bool zoomerOn; 65 bool zoomerOn;
66 QToolButton*rotateButton; 66 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton;
67 67 QToolButton*nextButton,*prevButton;
68 68
69private slots: 69private slots:
70 void slotConfig(); 70 void slotConfig();
71}; 71};
72 72
73#endif 73#endif