-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 18 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 67eb277..f443ccb 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -12,128 +12,129 @@ | |||
12 | #include "basesetup.h" | 12 | #include "basesetup.h" |
13 | 13 | ||
14 | #include <iface/ifaceinfo.h> | 14 | #include <iface/ifaceinfo.h> |
15 | #include <iface/dirview.h> | 15 | #include <iface/dirview.h> |
16 | 16 | ||
17 | #include <opie2/odebug.h> | 17 | #include <opie2/odebug.h> |
18 | #include <opie2/owidgetstack.h> | 18 | #include <opie2/owidgetstack.h> |
19 | #include <opie2/oapplicationfactory.h> | 19 | #include <opie2/oapplicationfactory.h> |
20 | #include <opie2/otabwidget.h> | 20 | #include <opie2/otabwidget.h> |
21 | #include <opie2/okeyconfigwidget.h> | 21 | #include <opie2/okeyconfigwidget.h> |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/ir.h> | 25 | #include <qpe/ir.h> |
26 | #include <qpe/storage.h> | 26 | #include <qpe/storage.h> |
27 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
28 | 28 | ||
29 | #include <qtoolbar.h> | 29 | #include <qtoolbar.h> |
30 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qtimer.h> | 34 | #include <qtimer.h> |
35 | #include <qframe.h> | 35 | #include <qframe.h> |
36 | #include <qmenubar.h> | 36 | #include <qmenubar.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | 38 | ||
39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
41 | 41 | ||
42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
43 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 43 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
44 | { | 44 | { |
45 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 45 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
46 | m_cfg = new Opie::Core::OConfig("opie-eye"); | 46 | m_cfg = new Opie::Core::OConfig("opie-eye"); |
47 | m_cfg->setGroup("main" ); | 47 | m_cfg->setGroup("main" ); |
48 | readConfig(); | 48 | readConfig(); |
49 | 49 | ||
50 | m_storage = new StorageInfo(); | 50 | m_storage = new StorageInfo(); |
51 | connect(m_storage, SIGNAL(disksChanged() ), | 51 | connect(m_storage, SIGNAL(disksChanged() ), |
52 | this, SLOT( dirChanged() ) ); | 52 | this, SLOT( dirChanged() ) ); |
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 | 60 | ||
61 | connect(m_view, SIGNAL(sig_display(const QString&)), | 61 | connect(m_view, SIGNAL(sig_display(const QString&)), |
62 | this, SLOT(slotDisplay(const QString&))); | 62 | this, SLOT(slotDisplay(const QString&))); |
63 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 63 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
64 | this, SLOT(slotShowInfo(const QString&)) ); | 64 | this, SLOT(slotShowInfo(const QString&)) ); |
65 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); | 65 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); |
66 | 66 | ||
67 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 67 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
68 | 68 | ||
69 | listviewMenu = 0; | 69 | listviewMenu = 0; |
70 | /* setup menu and toolbar */ | 70 | /* setup menu and toolbar */ |
71 | setupActions(); | 71 | setupActions(); |
72 | setupToolbar(); | 72 | setupToolbar(); |
73 | setupMenu(); | 73 | setupMenu(); |
74 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); | 74 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); |
75 | m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); | 75 | m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); |
76 | odebug << "mainwindow constructor done" << oendl; | ||
76 | } | 77 | } |
77 | 78 | ||
78 | PMainWindow::~PMainWindow() { | 79 | PMainWindow::~PMainWindow() { |
79 | } | 80 | } |
80 | 81 | ||
81 | void PMainWindow::slotToggleZoomer() | 82 | void PMainWindow::slotToggleZoomer() |
82 | { | 83 | { |
83 | m_aZoomer->setOn(!m_aZoomer->isOn()); | 84 | m_aZoomer->setOn(!m_aZoomer->isOn()); |
84 | } | 85 | } |
85 | 86 | ||
86 | void PMainWindow::slotZoomerToggled(bool how) | 87 | void PMainWindow::slotZoomerToggled(bool how) |
87 | { | 88 | { |
88 | if (m_disp) { | 89 | if (m_disp) { |
89 | m_disp->setShowZoomer(how); | 90 | m_disp->setShowZoomer(how); |
90 | } | 91 | } |
91 | if (autoSave) { | 92 | if (autoSave) { |
92 | m_cfg->writeEntry("zoomeron",how); | 93 | m_cfg->writeEntry("zoomeron",how); |
93 | } | 94 | } |
94 | } | 95 | } |
95 | 96 | ||
96 | void PMainWindow::slotToggleAutorotate() | 97 | void PMainWindow::slotToggleAutorotate() |
97 | { | 98 | { |
98 | if (!m_aAutoRotate->isEnabled()) return; | 99 | if (!m_aAutoRotate->isEnabled()) return; |
99 | m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); | 100 | m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); |
100 | } | 101 | } |
101 | 102 | ||
102 | void PMainWindow::slotToggleAutoscale() | 103 | void PMainWindow::slotToggleAutoscale() |
103 | { | 104 | { |
104 | m_aUnscaled->setOn(!m_aUnscaled->isOn()); | 105 | m_aUnscaled->setOn(!m_aUnscaled->isOn()); |
105 | } | 106 | } |
106 | 107 | ||
107 | void PMainWindow::slotRotateToggled(bool how) | 108 | void PMainWindow::slotRotateToggled(bool how) |
108 | { | 109 | { |
109 | if (autoSave) { | 110 | if (autoSave) { |
110 | m_cfg->writeEntry("autorotate",how); | 111 | m_cfg->writeEntry("autorotate",how); |
111 | } | 112 | } |
112 | if (m_disp) { | 113 | if (m_disp) { |
113 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); | 114 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); |
114 | } | 115 | } |
115 | } | 116 | } |
116 | 117 | ||
117 | void PMainWindow::slotScaleToggled(bool how) | 118 | void PMainWindow::slotScaleToggled(bool how) |
118 | { | 119 | { |
119 | if (autoSave) { | 120 | if (autoSave) { |
120 | m_cfg->writeEntry("unscaled",how); | 121 | m_cfg->writeEntry("unscaled",how); |
121 | } | 122 | } |
122 | odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; | 123 | odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; |
123 | odebug << "How: " << how << oendl; | 124 | odebug << "How: " << how << oendl; |
124 | if (how) { | 125 | if (how) { |
125 | m_aAutoRotate->setOn(false); | 126 | m_aAutoRotate->setOn(false); |
126 | } | 127 | } |
127 | if (m_disp) { | 128 | if (m_disp) { |
128 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); | 129 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); |
129 | } | 130 | } |
130 | m_aAutoRotate->setEnabled(!how); | 131 | m_aAutoRotate->setEnabled(!how); |
131 | odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; | 132 | odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; |
132 | } | 133 | } |
133 | 134 | ||
134 | void PMainWindow::slotConfig() { | 135 | void PMainWindow::slotConfig() { |
135 | /* | 136 | /* |
136 | * have a tab with the possible views | 137 | * have a tab with the possible views |
137 | * a tab for globals image cache size.. scaled loading | 138 | * a tab for globals image cache size.. scaled loading |
138 | * and one tab for the KeyConfigs | 139 | * and one tab for the KeyConfigs |
139 | */ | 140 | */ |
@@ -372,135 +373,148 @@ void PMainWindow::slotDisplay( const QString& inf ) { | |||
372 | m_gPrevNext->setEnabled(true); | 373 | m_gPrevNext->setEnabled(true); |
373 | 374 | ||
374 | m_aDirUp->setEnabled(false); | 375 | m_aDirUp->setEnabled(false); |
375 | m_aShowInfo->setEnabled(true); | 376 | m_aShowInfo->setEnabled(true); |
376 | m_aViewfile->setEnabled(false); | 377 | m_aViewfile->setEnabled(false); |
377 | m_aStartSlide->setEnabled(false); | 378 | m_aStartSlide->setEnabled(false); |
378 | fsButton->hide(); | 379 | fsButton->hide(); |
379 | } | 380 | } |
380 | } | 381 | } |
381 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 382 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
382 | slotFullScreenToggled(m_aFullScreen->isOn()); | 383 | slotFullScreenToggled(m_aFullScreen->isOn()); |
383 | } | 384 | } |
384 | if (m_disp->fullScreen()) { | 385 | if (m_disp->fullScreen()) { |
385 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 386 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
386 | } else { | 387 | } else { |
387 | m_stack->raiseWidget( ImageDisplay ); | 388 | m_stack->raiseWidget( ImageDisplay ); |
388 | } | 389 | } |
389 | } | 390 | } |
390 | 391 | ||
391 | void PMainWindow::raiseIconView() { | 392 | void PMainWindow::raiseIconView() { |
392 | setUpdatesEnabled(false); | 393 | setUpdatesEnabled(false); |
393 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 394 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
394 | m_gPrevNext->removeFrom(toolBar); | 395 | m_gPrevNext->removeFrom(toolBar); |
395 | m_gPrevNext->setEnabled(false); | 396 | m_gPrevNext->setEnabled(false); |
396 | m_aDirUp->setEnabled(true); | 397 | m_aDirUp->setEnabled(true); |
397 | m_aShowInfo->setEnabled(true); | 398 | m_aShowInfo->setEnabled(true); |
398 | m_aViewfile->setEnabled(true); | 399 | m_aViewfile->setEnabled(true); |
399 | m_aStartSlide->setEnabled(true); | 400 | m_aStartSlide->setEnabled(true); |
400 | fsButton->show(); | 401 | fsButton->show(); |
401 | } | 402 | } |
402 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 403 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
403 | m_disp->stopSlide(); | 404 | m_disp->stopSlide(); |
404 | m_disp->hide(); | 405 | m_disp->hide(); |
405 | } | 406 | } |
406 | m_stack->raiseWidget( IconView ); | 407 | m_stack->raiseWidget( IconView ); |
407 | setUpdatesEnabled(true); | 408 | setUpdatesEnabled(true); |
408 | repaint(); | 409 | repaint(); |
409 | } | 410 | } |
410 | 411 | ||
411 | void PMainWindow::slotReturn() { | 412 | void PMainWindow::slotReturn() { |
412 | raiseIconView(); | 413 | raiseIconView(); |
413 | } | 414 | } |
414 | 415 | ||
415 | 416 | ||
416 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 417 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
417 | /* | 418 | /* |
418 | * return from view | 419 | * return from view |
419 | * or properly quit | 420 | * or properly quit |
420 | */ | 421 | */ |
421 | if ( m_stack->visibleWidget() == m_info || | 422 | if ( m_stack->visibleWidget() == m_info || |
422 | m_stack->visibleWidget() == m_disp ) { | 423 | m_stack->visibleWidget() == m_disp ) { |
423 | ev->ignore(); | 424 | ev->ignore(); |
424 | raiseIconView(); | 425 | raiseIconView(); |
425 | return; | 426 | return; |
426 | } | 427 | } |
427 | if (m_disp && m_disp->fullScreen()) { | 428 | if (m_disp && m_disp->fullScreen()) { |
428 | /* otherwise opie-eye crashes in bigscreen mode! */ | 429 | /* otherwise opie-eye crashes in bigscreen mode! */ |
429 | m_disp->reparent(0,QPoint(0,0)); | 430 | m_disp->reparent(0,QPoint(0,0)); |
430 | m_stack->addWidget(m_disp,ImageDisplay); | 431 | m_stack->addWidget(m_disp,ImageDisplay); |
431 | } | 432 | } |
432 | ev->accept(); | 433 | ev->accept(); |
433 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 434 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
434 | } | 435 | } |
435 | 436 | ||
436 | void PMainWindow::setDocument( const QString& showImg ) { | 437 | void PMainWindow::setDocument( const QString& showImg ) |
438 | { | ||
439 | bool first_start = m_disp==0; | ||
440 | |||
437 | QString file = showImg; | 441 | QString file = showImg; |
438 | DocLnk lnk(showImg); | 442 | DocLnk lnk(showImg); |
439 | if (lnk.isValid() ) | 443 | if (lnk.isValid() ) |
440 | file = lnk.file(); | 444 | file = lnk.file(); |
441 | |||
442 | slotDisplay( file ); | 445 | slotDisplay( file ); |
446 | if (first_start && m_aFullScreen->isOn()) { | ||
447 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | void PMainWindow::check_view_fullscreen() | ||
452 | { | ||
453 | if (!m_view) return; | ||
454 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { | ||
455 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | ||
456 | } | ||
443 | } | 457 | } |
444 | 458 | ||
445 | void PMainWindow::slotSelectDir(int id) | 459 | void PMainWindow::slotSelectDir(int id) |
446 | { | 460 | { |
447 | emit changeDir( m_dev[fsMenu->text(id )] ); | 461 | emit changeDir( m_dev[fsMenu->text(id )] ); |
448 | } | 462 | } |
449 | 463 | ||
450 | void PMainWindow::dirChanged() | 464 | void PMainWindow::dirChanged() |
451 | { | 465 | { |
452 | fsMenu->clear(); | 466 | fsMenu->clear(); |
453 | m_dev.clear(); | 467 | m_dev.clear(); |
454 | 468 | ||
455 | /* home dir, too */ | 469 | /* home dir, too */ |
456 | QString f = getenv( "HOME" ); | 470 | QString f = getenv( "HOME" ); |
457 | if (!f.isEmpty()) { | 471 | if (!f.isEmpty()) { |
458 | m_dev.insert("Home directory",f); | 472 | m_dev.insert("Home directory",f); |
459 | fsMenu->insertItem("Home directory"); | 473 | fsMenu->insertItem("Home directory"); |
460 | } | 474 | } |
461 | const QList<FileSystem> &fs = m_storage->fileSystems(); | 475 | const QList<FileSystem> &fs = m_storage->fileSystems(); |
462 | QListIterator<FileSystem> it(fs ); | 476 | QListIterator<FileSystem> it(fs ); |
463 | for ( ; it.current(); ++it ) { | 477 | for ( ; it.current(); ++it ) { |
464 | const QString disk = (*it)->name(); | 478 | const QString disk = (*it)->name(); |
465 | const QString path = (*it)->path(); | 479 | const QString path = (*it)->path(); |
466 | m_dev.insert( disk, path ); | 480 | m_dev.insert( disk, path ); |
467 | fsMenu->insertItem( disk ); | 481 | fsMenu->insertItem( disk ); |
468 | } | 482 | } |
469 | } | 483 | } |
470 | 484 | ||
471 | void PMainWindow::showToolbar(bool how) | 485 | void PMainWindow::showToolbar(bool how) |
472 | { | 486 | { |
473 | if (!how) toolBar->hide(); | 487 | if (!how) toolBar->hide(); |
474 | else toolBar->show(); | 488 | else toolBar->show(); |
475 | if (autoSave) { | 489 | if (autoSave) { |
476 | m_cfg->writeEntry("showtoolbar",how); | 490 | m_cfg->writeEntry("showtoolbar",how); |
477 | } | 491 | } |
478 | } | 492 | } |
479 | 493 | ||
480 | void PMainWindow::setupActions() | 494 | void PMainWindow::setupActions() |
481 | { | 495 | { |
482 | m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); | 496 | m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); |
483 | m_aDirUp->setToggleAction(false); | 497 | m_aDirUp->setToggleAction(false); |
484 | connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); | 498 | connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); |
485 | 499 | ||
486 | if ( Ir::supported() ) { | 500 | if ( Ir::supported() ) { |
487 | m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); | 501 | m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); |
488 | m_aBeam->setToggleAction(false); | 502 | m_aBeam->setToggleAction(false); |
489 | connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); | 503 | connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); |
490 | } else { | 504 | } else { |
491 | m_aBeam = 0; | 505 | m_aBeam = 0; |
492 | } | 506 | } |
493 | 507 | ||
494 | m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); | 508 | m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); |
495 | m_aShowInfo->setToggleAction(false); | 509 | m_aShowInfo->setToggleAction(false); |
496 | connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); | 510 | connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); |
497 | 511 | ||
498 | m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); | 512 | m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); |
499 | m_aTrash->setToggleAction(false); | 513 | m_aTrash->setToggleAction(false); |
500 | connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); | 514 | connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); |
501 | 515 | ||
502 | m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); | 516 | m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); |
503 | m_aViewfile->setToggleAction(false); | 517 | m_aViewfile->setToggleAction(false); |
504 | connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); | 518 | connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); |
505 | 519 | ||
506 | m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); | 520 | m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 5707568..465e352 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h | |||
@@ -4,103 +4,104 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef PHUNK_MAIN_WINDOW_H | 6 | #ifndef PHUNK_MAIN_WINDOW_H |
7 | #define PHUNK_MAIN_WINDOW_H | 7 | #define PHUNK_MAIN_WINDOW_H |
8 | 8 | ||
9 | #include <opie2/oconfig.h> | 9 | #include <opie2/oconfig.h> |
10 | 10 | ||
11 | #include <qmainwindow.h> | 11 | #include <qmainwindow.h> |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | namespace Opie { | 15 | namespace Opie { |
16 | namespace Ui{ | 16 | namespace Ui{ |
17 | class OWidgetStack; | 17 | class OWidgetStack; |
18 | } | 18 | } |
19 | namespace Core{ | 19 | namespace Core{ |
20 | class OKeyConfigManager; | 20 | class OKeyConfigManager; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | class ImageView; | 24 | class ImageView; |
25 | class ImageWidget; | 25 | class ImageWidget; |
26 | class PIconView; | 26 | class PIconView; |
27 | class imageinfo; | 27 | class imageinfo; |
28 | class QMenuBar; | 28 | class QMenuBar; |
29 | class QToolBar; | 29 | class QToolBar; |
30 | class QPopupMenu; | 30 | class QPopupMenu; |
31 | class QAction; | 31 | class QAction; |
32 | class QActionGroup; | 32 | class QActionGroup; |
33 | class StorageInfo; | 33 | class StorageInfo; |
34 | 34 | ||
35 | class PMainWindow : public QMainWindow { | 35 | class PMainWindow : public QMainWindow { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | enum Views { IconView, ImageInfo, ImageDisplay }; | 37 | enum Views { IconView, ImageInfo, ImageDisplay }; |
38 | public: | 38 | public: |
39 | static QString appName() { return QString::fromLatin1("opie-eye" ); } | 39 | static QString appName() { return QString::fromLatin1("opie-eye" ); } |
40 | PMainWindow(QWidget*, const char*, WFlags ); | 40 | PMainWindow(QWidget*, const char*, WFlags ); |
41 | ~PMainWindow(); | 41 | ~PMainWindow(); |
42 | 42 | ||
43 | signals: | 43 | signals: |
44 | void configChanged(); | 44 | void configChanged(); |
45 | void changeDir( const QString& ); | 45 | void changeDir( const QString& ); |
46 | void changeListMode(int); | 46 | void changeListMode(int); |
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | void slotShowInfo( const QString& inf ); | 49 | void slotShowInfo( const QString& inf ); |
50 | void slotDisplay( const QString& inf ); | 50 | void slotDisplay( const QString& inf ); |
51 | void slotReturn(); | 51 | void slotReturn(); |
52 | void slotRotateToggled(bool); | 52 | void slotRotateToggled(bool); |
53 | void slotScaleToggled(bool); | 53 | void slotScaleToggled(bool); |
54 | void slotZoomerToggled(bool); | 54 | void slotZoomerToggled(bool); |
55 | void slotToggleZoomer(); | 55 | void slotToggleZoomer(); |
56 | void slotToggleAutorotate(); | 56 | void slotToggleAutorotate(); |
57 | void slotToggleAutoscale(); | 57 | void slotToggleAutoscale(); |
58 | void setDocument( const QString& ); | 58 | void setDocument( const QString& ); |
59 | virtual void slotToggleFullScreen(); | 59 | virtual void slotToggleFullScreen(); |
60 | virtual void slotFullScreenToggled(bool); | 60 | virtual void slotFullScreenToggled(bool); |
61 | 61 | ||
62 | protected slots: | 62 | protected slots: |
63 | void raiseIconView(); | 63 | void raiseIconView(); |
64 | void closeEvent( QCloseEvent* ); | 64 | void closeEvent( QCloseEvent* ); |
65 | void showToolbar(bool); | 65 | void showToolbar(bool); |
66 | void listviewselected(QAction*); | 66 | void listviewselected(QAction*); |
67 | void slotFullScreenButton(bool); | 67 | void slotFullScreenButton(bool); |
68 | void check_view_fullscreen(); | ||
68 | 69 | ||
69 | private: | 70 | private: |
70 | template<class T> void initT( const char* name, T**, int ); | 71 | template<class T> void initT( const char* name, T**, int ); |
71 | void initInfo(); | 72 | void initInfo(); |
72 | void initDisp(); | 73 | void initDisp(); |
73 | void setupViewWindow(bool full, bool forceDisplay); | 74 | void setupViewWindow(bool full, bool forceDisplay); |
74 | 75 | ||
75 | private: | 76 | private: |
76 | Opie::Core::OConfig *m_cfg; | 77 | Opie::Core::OConfig *m_cfg; |
77 | Opie::Ui::OWidgetStack *m_stack; | 78 | Opie::Ui::OWidgetStack *m_stack; |
78 | PIconView* m_view; | 79 | PIconView* m_view; |
79 | imageinfo *m_info; | 80 | imageinfo *m_info; |
80 | ImageView *m_disp; | 81 | ImageView *m_disp; |
81 | bool autoSave; | 82 | bool autoSave; |
82 | QToolButton*fsButton; | 83 | QToolButton*fsButton; |
83 | QToolBar *toolBar; | 84 | QToolBar *toolBar; |
84 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; | 85 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; |
85 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; | 86 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; |
86 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; | 87 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; |
87 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; | 88 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; |
88 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; | 89 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; |
89 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; | 90 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; |
90 | 91 | ||
91 | /* init funs */ | 92 | /* init funs */ |
92 | void readConfig(); | 93 | void readConfig(); |
93 | void setupActions(); | 94 | void setupActions(); |
94 | void setupToolbar(); | 95 | void setupToolbar(); |
95 | void setupMenu(); | 96 | void setupMenu(); |
96 | /* for the device submenu - ToDo: Merge with the special button */ | 97 | /* for the device submenu - ToDo: Merge with the special button */ |
97 | StorageInfo *m_storage; | 98 | StorageInfo *m_storage; |
98 | QMap<QString, QString> m_dev; | 99 | QMap<QString, QString> m_dev; |
99 | 100 | ||
100 | private slots: | 101 | private slots: |
101 | void slotConfig(); | 102 | void slotConfig(); |
102 | void slotSelectDir(int); | 103 | void slotSelectDir(int); |
103 | void dirChanged(); | 104 | void dirChanged(); |
104 | }; | 105 | }; |
105 | 106 | ||
106 | #endif | 107 | #endif |