-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 85 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 6 |
2 files changed, 61 insertions, 30 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 90e2e99..a96bfbd 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -39,24 +39,25 @@ | |||
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" ) ); | 45 | setCaption( QObject::tr("Opie Eye" ) ); |
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 | m_setDocCalled = false; | 49 | m_setDocCalled = false; |
50 | m_polishDone = false; | 50 | m_polishDone = false; |
51 | m_SmallWindow = QApplication::desktop()->size().width()<330; | ||
51 | 52 | ||
52 | m_storage = new StorageInfo(); | 53 | m_storage = new StorageInfo(); |
53 | connect(m_storage, SIGNAL(disksChanged() ), | 54 | connect(m_storage, SIGNAL(disksChanged() ), |
54 | this, SLOT( dirChanged() ) ); | 55 | this, SLOT( dirChanged() ) ); |
55 | 56 | ||
56 | m_stack = new Opie::Ui::OWidgetStack( this ); | 57 | m_stack = new Opie::Ui::OWidgetStack( this ); |
57 | setCentralWidget( m_stack ); | 58 | setCentralWidget( m_stack ); |
58 | 59 | ||
59 | m_view = new PIconView( m_stack, m_cfg ); | 60 | m_view = new PIconView( m_stack, m_cfg ); |
60 | m_stack->addWidget( m_view, IconView ); | 61 | m_stack->addWidget( m_view, IconView ); |
61 | m_stack->raiseWidget( IconView ); | 62 | m_stack->raiseWidget( IconView ); |
62 | 63 | ||
@@ -66,24 +67,27 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
66 | this, SLOT(slotShowInfo(const QString&)) ); | 67 | this, SLOT(slotShowInfo(const QString&)) ); |
67 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); | 68 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); |
68 | 69 | ||
69 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 70 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
70 | 71 | ||
71 | listviewMenu = 0; | 72 | listviewMenu = 0; |
72 | /* setup menu and toolbar */ | 73 | /* setup menu and toolbar */ |
73 | setupActions(); | 74 | setupActions(); |
74 | setupToolbar(); | 75 | setupToolbar(); |
75 | setupMenu(); | 76 | setupMenu(); |
76 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); | 77 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); |
77 | m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); | 78 | m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); |
79 | if (m_aForceSmall) { | ||
80 | m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); | ||
81 | } | ||
78 | odebug << "mainwindow constructor done" << oendl; | 82 | odebug << "mainwindow constructor done" << oendl; |
79 | } | 83 | } |
80 | 84 | ||
81 | PMainWindow::~PMainWindow() { | 85 | PMainWindow::~PMainWindow() { |
82 | } | 86 | } |
83 | 87 | ||
84 | void PMainWindow::slotToggleZoomer() | 88 | void PMainWindow::slotToggleZoomer() |
85 | { | 89 | { |
86 | m_aZoomer->setOn(!m_aZoomer->isOn()); | 90 | m_aZoomer->setOn(!m_aZoomer->isOn()); |
87 | } | 91 | } |
88 | 92 | ||
89 | void PMainWindow::slotZoomerToggled(bool how) | 93 | void PMainWindow::slotZoomerToggled(bool how) |
@@ -245,27 +249,27 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { | |||
245 | this,SLOT(slotReturn())); | 249 | this,SLOT(slotReturn())); |
246 | 250 | ||
247 | } | 251 | } |
248 | 252 | ||
249 | void PMainWindow::initInfo() { | 253 | void PMainWindow::initInfo() { |
250 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 254 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
251 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 255 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
252 | } | 256 | } |
253 | 257 | ||
254 | void PMainWindow::initDisp() { | 258 | void PMainWindow::initDisp() { |
255 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 259 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
256 | if (m_disp) { | 260 | if (m_disp) { |
257 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 261 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
258 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 262 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
259 | } | 263 | // } |
260 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 264 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
261 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 265 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
262 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 266 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
263 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 267 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
264 | m_disp->setBackgroundColor(white); | 268 | m_disp->setBackgroundColor(white); |
265 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 269 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
266 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 270 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
267 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 271 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
268 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 272 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
269 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 273 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
270 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 274 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
271 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 275 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
@@ -297,35 +301,32 @@ void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | |||
297 | if (!m_disp) { | 301 | if (!m_disp) { |
298 | return; | 302 | return; |
299 | } | 303 | } |
300 | if (current) { | 304 | if (current) { |
301 | m_disp->setBackgroundColor(black); | 305 | m_disp->setBackgroundColor(black); |
302 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 306 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
303 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 307 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
304 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 308 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
305 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 309 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
306 | m_disp->setFullScreen(current,forceDisplay); | 310 | m_disp->setFullScreen(current,forceDisplay); |
307 | } else { | 311 | } else { |
308 | setUpdatesEnabled(false); | 312 | setUpdatesEnabled(false); |
313 | #if 0 | ||
309 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 314 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
310 | 315 | ||
311 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 316 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
312 | } else { | 317 | } else { |
313 | //m_disp->setMinimumSize(10,10); | 318 | //m_disp->setMinimumSize(10,10); |
314 | } | 319 | } |
315 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 320 | #endif |
316 | m_disp->reparent(0,QPoint(10,10)); | ||
317 | } else { | ||
318 | m_disp->reparent(0,QPoint(0,0)); | ||
319 | } | ||
320 | m_disp->setBackgroundColor(white); | 321 | m_disp->setBackgroundColor(white); |
321 | m_stack->addWidget(m_disp,ImageDisplay); | 322 | m_stack->addWidget(m_disp,ImageDisplay); |
322 | m_disp->setVScrollBarMode(QScrollView::Auto); | 323 | m_disp->setVScrollBarMode(QScrollView::Auto); |
323 | m_disp->setHScrollBarMode(QScrollView::Auto); | 324 | m_disp->setHScrollBarMode(QScrollView::Auto); |
324 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 325 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
325 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); | 326 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); |
326 | } | 327 | } |
327 | if (forceDisplay || m_disp->isVisible()) { | 328 | if (forceDisplay || m_disp->isVisible()) { |
328 | m_stack->raiseWidget(m_disp); | 329 | m_stack->raiseWidget(m_disp); |
329 | m_disp->setFocus(); | 330 | m_disp->setFocus(); |
330 | } | 331 | } |
331 | setUpdatesEnabled(true); | 332 | setUpdatesEnabled(true); |
@@ -345,78 +346,79 @@ void PMainWindow::slotFullScreenToggled(bool current) | |||
345 | * now. We set filename and raise | 346 | * now. We set filename and raise |
346 | * | 347 | * |
347 | * ### FIXME and talk to alwin | 348 | * ### FIXME and talk to alwin |
348 | */ | 349 | */ |
349 | void PMainWindow::slotShowInfo( const QString& inf ) { | 350 | void PMainWindow::slotShowInfo( const QString& inf ) { |
350 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 351 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
351 | return; | 352 | return; |
352 | } | 353 | } |
353 | if ( !m_info ) { | 354 | if ( !m_info ) { |
354 | initInfo(); | 355 | initInfo(); |
355 | } | 356 | } |
356 | m_info->setPath( inf ); | 357 | m_info->setPath( inf ); |
357 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 358 | if (m_SmallWindow) { |
358 | m_aNext->removeFrom(toolBar); | 359 | m_aNext->removeFrom(toolBar); |
359 | m_aPrevious->removeFrom(toolBar); | 360 | m_aPrevious->removeFrom(toolBar); |
360 | m_aNext->setEnabled(false); | ||
361 | m_aPrevious->setEnabled(false); | ||
362 | m_aDirUp->setEnabled(false); | ||
363 | m_aShowInfo->setEnabled(false); | ||
364 | m_aViewfile->setEnabled(true); | ||
365 | m_aStartSlide->setEnabled(false); | ||
366 | fsButton->hide(); | 361 | fsButton->hide(); |
367 | } | 362 | } |
363 | m_aNext->setEnabled(false); | ||
364 | m_aPrevious->setEnabled(false); | ||
365 | m_aDirUp->setEnabled(false); | ||
366 | m_aShowInfo->setEnabled(false); | ||
367 | m_aViewfile->setEnabled(true); | ||
368 | m_aStartSlide->setEnabled(false); | ||
368 | m_stack->raiseWidget( ImageInfo ); | 369 | m_stack->raiseWidget( ImageInfo ); |
369 | } | 370 | } |
370 | 371 | ||
371 | void PMainWindow::slotDisplay( const QString& inf ) { | 372 | void PMainWindow::slotDisplay( const QString& inf ) { |
372 | bool nwindow = false; | 373 | bool nwindow = false; |
373 | if ( !m_disp ) { | 374 | if ( !m_disp ) { |
374 | nwindow = true; | 375 | nwindow = true; |
375 | initDisp(); | 376 | initDisp(); |
376 | } | 377 | } |
377 | m_disp->setImage( inf ); | 378 | m_disp->setImage( inf ); |
378 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 379 | if (m_SmallWindow) { |
379 | if (m_gPrevNext->isEnabled()==false) { | 380 | if (m_gPrevNext->isEnabled()==false) { |
380 | m_gPrevNext->addTo(toolBar); | 381 | m_gPrevNext->addTo(toolBar); |
381 | m_gPrevNext->setEnabled(true); | ||
382 | |||
383 | m_aDirUp->setEnabled(false); | ||
384 | m_aShowInfo->setEnabled(true); | ||
385 | m_aViewfile->setEnabled(false); | ||
386 | m_aStartSlide->setEnabled(false); | ||
387 | fsButton->hide(); | 382 | fsButton->hide(); |
388 | } | 383 | } |
389 | } | 384 | } |
385 | m_gPrevNext->setEnabled(true); | ||
386 | m_aDirUp->setEnabled(false); | ||
387 | m_aShowInfo->setEnabled(true); | ||
388 | m_aViewfile->setEnabled(false); | ||
389 | m_aStartSlide->setEnabled(false); | ||
390 | |||
390 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 391 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
391 | slotFullScreenToggled(m_aFullScreen->isOn()); | 392 | slotFullScreenToggled(m_aFullScreen->isOn()); |
392 | } | 393 | } |
393 | if (m_disp->fullScreen()) { | 394 | if (m_disp->fullScreen()) { |
394 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 395 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
395 | } else { | 396 | } else { |
396 | m_stack->raiseWidget( ImageDisplay ); | 397 | m_stack->raiseWidget( ImageDisplay ); |
397 | } | 398 | } |
398 | } | 399 | } |
399 | 400 | ||
400 | void PMainWindow::raiseIconView() { | 401 | void PMainWindow::raiseIconView() { |
401 | setUpdatesEnabled(false); | 402 | setUpdatesEnabled(false); |
402 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 403 | if (m_SmallWindow) { |
403 | m_gPrevNext->removeFrom(toolBar); | 404 | m_gPrevNext->removeFrom(toolBar); |
404 | m_gPrevNext->setEnabled(false); | ||
405 | m_aDirUp->setEnabled(true); | ||
406 | m_aShowInfo->setEnabled(true); | ||
407 | m_aViewfile->setEnabled(true); | ||
408 | m_aStartSlide->setEnabled(true); | ||
409 | fsButton->show(); | 405 | fsButton->show(); |
410 | } | 406 | } |
407 | m_gPrevNext->setEnabled(false); | ||
408 | m_aDirUp->setEnabled(true); | ||
409 | m_aShowInfo->setEnabled(true); | ||
410 | m_aViewfile->setEnabled(true); | ||
411 | m_aStartSlide->setEnabled(true); | ||
412 | |||
411 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 413 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
412 | m_disp->stopSlide(); | 414 | m_disp->stopSlide(); |
413 | m_disp->hide(); | 415 | m_disp->hide(); |
414 | } | 416 | } |
415 | m_stack->raiseWidget( IconView ); | 417 | m_stack->raiseWidget( IconView ); |
416 | setUpdatesEnabled(true); | 418 | setUpdatesEnabled(true); |
417 | repaint(); | 419 | repaint(); |
418 | } | 420 | } |
419 | 421 | ||
420 | void PMainWindow::slotReturn() { | 422 | void PMainWindow::slotReturn() { |
421 | raiseIconView(); | 423 | raiseIconView(); |
422 | } | 424 | } |
@@ -613,24 +615,32 @@ void PMainWindow::setupActions() | |||
613 | if (autoSave) { | 615 | if (autoSave) { |
614 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); | 616 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); |
615 | } else { | 617 | } else { |
616 | m_aZoomer->setOn (true); | 618 | m_aZoomer->setOn (true); |
617 | } | 619 | } |
618 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 620 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
619 | m_gDisplayType->insert(m_aAutoRotate); | 621 | m_gDisplayType->insert(m_aAutoRotate); |
620 | m_gDisplayType->insert(m_aUnscaled); | 622 | m_gDisplayType->insert(m_aUnscaled); |
621 | m_gDisplayType->insert(m_aZoomer); | 623 | m_gDisplayType->insert(m_aZoomer); |
622 | 624 | ||
623 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 625 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
624 | m_hGroup->insert(m_aFullScreen); | 626 | m_hGroup->insert(m_aFullScreen); |
627 | |||
628 | if (!m_SmallWindow) { | ||
629 | m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); | ||
630 | m_aForceSmall->setToggleAction(true); | ||
631 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); | ||
632 | } else { | ||
633 | m_aForceSmall = 0; | ||
634 | } | ||
625 | } | 635 | } |
626 | 636 | ||
627 | void PMainWindow::setupToolbar() | 637 | void PMainWindow::setupToolbar() |
628 | { | 638 | { |
629 | toolBar = new QToolBar( this ); | 639 | toolBar = new QToolBar( this ); |
630 | addToolBar(toolBar); | 640 | addToolBar(toolBar); |
631 | toolBar->setHorizontalStretchable( true ); | 641 | toolBar->setHorizontalStretchable( true ); |
632 | setToolBarsMovable( false ); | 642 | setToolBarsMovable( false ); |
633 | m_aDirUp->addTo( toolBar ); | 643 | m_aDirUp->addTo( toolBar ); |
634 | 644 | ||
635 | fsButton = new PFileSystem( toolBar ); | 645 | fsButton = new PFileSystem( toolBar ); |
636 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 646 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
@@ -638,25 +648,25 @@ void PMainWindow::setupToolbar() | |||
638 | connect( this, SIGNAL( changeDir( const QString& ) ), | 648 | connect( this, SIGNAL( changeDir( const QString& ) ), |
639 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 649 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
640 | 650 | ||
641 | if (m_aBeam) { | 651 | if (m_aBeam) { |
642 | m_aBeam->addTo( toolBar ); | 652 | m_aBeam->addTo( toolBar ); |
643 | } | 653 | } |
644 | m_aShowInfo->addTo(toolBar); | 654 | m_aShowInfo->addTo(toolBar); |
645 | m_aTrash->addTo(toolBar); | 655 | m_aTrash->addTo(toolBar); |
646 | // m_aSetup->addTo(toolBar); | 656 | // m_aSetup->addTo(toolBar); |
647 | 657 | ||
648 | m_gDisplayType->addTo(toolBar); | 658 | m_gDisplayType->addTo(toolBar); |
649 | 659 | ||
650 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 660 | if (!m_SmallWindow) { |
651 | m_gPrevNext->addTo(toolBar); | 661 | m_gPrevNext->addTo(toolBar); |
652 | } else { | 662 | } else { |
653 | m_gPrevNext->setEnabled(false); | 663 | m_gPrevNext->setEnabled(false); |
654 | } | 664 | } |
655 | } | 665 | } |
656 | 666 | ||
657 | void PMainWindow::setupMenu() | 667 | void PMainWindow::setupMenu() |
658 | { | 668 | { |
659 | fileMenu = new QPopupMenu( menuBar() ); | 669 | fileMenu = new QPopupMenu( menuBar() ); |
660 | menuBar()->insertItem( tr( "File" ), fileMenu ); | 670 | menuBar()->insertItem( tr( "File" ), fileMenu ); |
661 | dispMenu = new QPopupMenu( menuBar() ); | 671 | dispMenu = new QPopupMenu( menuBar() ); |
662 | menuBar()->insertItem( tr( "Show" ), dispMenu ); | 672 | menuBar()->insertItem( tr( "Show" ), dispMenu ); |
@@ -681,24 +691,28 @@ void PMainWindow::setupMenu() | |||
681 | } | 691 | } |
682 | fileMenu->insertSeparator(); | 692 | fileMenu->insertSeparator(); |
683 | m_aTrash->addTo(fileMenu); | 693 | m_aTrash->addTo(fileMenu); |
684 | 694 | ||
685 | listviewMenu = new QPopupMenu(dispMenu); | 695 | listviewMenu = new QPopupMenu(dispMenu); |
686 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); | 696 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); |
687 | m_gListViewMode->addTo(listviewMenu); | 697 | m_gListViewMode->addTo(listviewMenu); |
688 | dispMenu->insertSeparator(); | 698 | dispMenu->insertSeparator(); |
689 | m_aFullScreen->addTo(dispMenu); | 699 | m_aFullScreen->addTo(dispMenu); |
690 | m_gDisplayType->addTo(dispMenu); | 700 | m_gDisplayType->addTo(dispMenu); |
691 | dispMenu->insertSeparator(); | 701 | dispMenu->insertSeparator(); |
692 | m_gPrevNext->addTo(dispMenu); | 702 | m_gPrevNext->addTo(dispMenu); |
703 | if (m_aForceSmall) { | ||
704 | dispMenu->insertSeparator(); | ||
705 | m_aForceSmall->addTo(dispMenu); | ||
706 | } | ||
693 | 707 | ||
694 | m_aSetup->addTo(settingsMenu); | 708 | m_aSetup->addTo(settingsMenu); |
695 | m_aHideToolbar->addTo(settingsMenu); | 709 | m_aHideToolbar->addTo(settingsMenu); |
696 | } | 710 | } |
697 | 711 | ||
698 | void PMainWindow::listviewselected(QAction*which) | 712 | void PMainWindow::listviewselected(QAction*which) |
699 | { | 713 | { |
700 | if (!which || which->isOn()==false) return; | 714 | if (!which || which->isOn()==false) return; |
701 | int val = 1; | 715 | int val = 1; |
702 | 716 | ||
703 | if (which==m_aDirName) { | 717 | if (which==m_aDirName) { |
704 | val = 3; | 718 | val = 3; |
@@ -728,12 +742,27 @@ void PMainWindow::polish() | |||
728 | m_setDocCalled = false; | 742 | m_setDocCalled = false; |
729 | m_view->setDoccalled(false); | 743 | m_view->setDoccalled(false); |
730 | } | 744 | } |
731 | m_polishDone = true; | 745 | m_polishDone = true; |
732 | QMainWindow::polish(); | 746 | QMainWindow::polish(); |
733 | if (m_setDocCalled) { | 747 | if (m_setDocCalled) { |
734 | if (m_aFullScreen->isOn()) { | 748 | if (m_aFullScreen->isOn()) { |
735 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); | 749 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); |
736 | } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 750 | } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
737 | } | 751 | } |
738 | } | 752 | } |
739 | } | 753 | } |
754 | |||
755 | void PMainWindow::slotForceSmall(bool how) | ||
756 | { | ||
757 | odebug << "Disable separate windows: " << how << oendl; | ||
758 | if (m_stack) { | ||
759 | if (how) { | ||
760 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | ||
761 | } else { | ||
762 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | ||
763 | } | ||
764 | } | ||
765 | if (autoSave) { | ||
766 | m_cfg->writeEntry("dontshowseperate",how); | ||
767 | } | ||
768 | } | ||
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 2f54090..a49a9d3 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h | |||
@@ -71,40 +71,42 @@ protected slots: | |||
71 | private: | 71 | private: |
72 | template<class T> void initT( const char* name, T**, int ); | 72 | template<class T> void initT( const char* name, T**, int ); |
73 | void initInfo(); | 73 | void initInfo(); |
74 | void initDisp(); | 74 | void initDisp(); |
75 | void setupViewWindow(bool full, bool forceDisplay); | 75 | void setupViewWindow(bool full, bool forceDisplay); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | Opie::Core::OConfig *m_cfg; | 78 | Opie::Core::OConfig *m_cfg; |
79 | Opie::Ui::OWidgetStack *m_stack; | 79 | Opie::Ui::OWidgetStack *m_stack; |
80 | PIconView* m_view; | 80 | PIconView* m_view; |
81 | imageinfo *m_info; | 81 | imageinfo *m_info; |
82 | ImageView *m_disp; | 82 | ImageView *m_disp; |
83 | bool autoSave; | 83 | bool autoSave:1; |
84 | bool m_setDocCalled:1; | 84 | bool m_setDocCalled:1; |
85 | bool m_polishDone:1; | 85 | bool m_polishDone:1; |
86 | bool m_SmallWindow:1; | ||
86 | QToolButton*fsButton; | 87 | QToolButton*fsButton; |
87 | QToolBar *toolBar; | 88 | QToolBar *toolBar; |
88 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; | 89 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; |
89 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; | 90 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; |
90 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; | 91 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; |
91 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; | 92 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; |
92 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; | 93 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; |
93 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer; | 94 | QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall; |
94 | 95 | ||
95 | /* init funs */ | 96 | /* init funs */ |
96 | void readConfig(); | 97 | void readConfig(); |
97 | void setupActions(); | 98 | void setupActions(); |
98 | void setupToolbar(); | 99 | void setupToolbar(); |
99 | void setupMenu(); | 100 | void setupMenu(); |
100 | /* for the device submenu - ToDo: Merge with the special button */ | 101 | /* for the device submenu - ToDo: Merge with the special button */ |
101 | StorageInfo *m_storage; | 102 | StorageInfo *m_storage; |
102 | QMap<QString, QString> m_dev; | 103 | QMap<QString, QString> m_dev; |
103 | 104 | ||
104 | private slots: | 105 | private slots: |
105 | void slotConfig(); | 106 | void slotConfig(); |
106 | void slotSelectDir(int); | 107 | void slotSelectDir(int); |
107 | void dirChanged(); | 108 | void dirChanged(); |
109 | void slotForceSmall(bool); | ||
108 | }; | 110 | }; |
109 | 111 | ||
110 | #endif | 112 | #endif |