Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index d11e4e1..4ee252f 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -244,62 +244,64 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { | |||
244 | if ( *ptr ) { | 244 | if ( *ptr ) { |
245 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 245 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
246 | (*ptr)->setDestructiveClose(); | 246 | (*ptr)->setDestructiveClose(); |
247 | m_stack->removeWidget( *ptr ); | 247 | m_stack->removeWidget( *ptr ); |
248 | } | 248 | } |
249 | *ptr = new T(m_cfg, m_stack, name ); | 249 | *ptr = new T(m_cfg, m_stack, name ); |
250 | m_stack->addWidget( *ptr, id ); | 250 | m_stack->addWidget( *ptr, id ); |
251 | 251 | ||
252 | connect(*ptr, SIGNAL(sig_return()), | 252 | connect(*ptr, SIGNAL(sig_return()), |
253 | this,SLOT(slotReturn())); | 253 | this,SLOT(slotReturn())); |
254 | 254 | ||
255 | } | 255 | } |
256 | 256 | ||
257 | void PMainWindow::initInfo() { | 257 | void PMainWindow::initInfo() { |
258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void PMainWindow::initDisp() { | 262 | void PMainWindow::initDisp() { |
263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
264 | if (m_disp) { | 264 | if (m_disp) { |
265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
267 | // } | 267 | // } |
268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType,m_hBright); |
269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
271 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 271 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
272 | m_disp->setBackgroundColor(white); | 272 | m_disp->setBackgroundColor(white); |
273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
282 | connect(m_IncBrightness,SIGNAL(activated()),m_disp,SLOT(slotIncBrightness())); | ||
283 | connect(m_DecBrightness,SIGNAL(activated()),m_disp,SLOT(slotDecBrightness())); | ||
282 | slotFullScreenToggled(m_aFullScreen->isOn()); | 284 | slotFullScreenToggled(m_aFullScreen->isOn()); |
283 | } | 285 | } |
284 | } | 286 | } |
285 | 287 | ||
286 | void PMainWindow::slotToggleFullScreen() | 288 | void PMainWindow::slotToggleFullScreen() |
287 | { | 289 | { |
288 | bool current = !m_aFullScreen->isOn(); | 290 | bool current = !m_aFullScreen->isOn(); |
289 | m_aFullScreen->setOn(current); | 291 | m_aFullScreen->setOn(current); |
290 | } | 292 | } |
291 | 293 | ||
292 | void PMainWindow::slotFullScreenButton(bool current) | 294 | void PMainWindow::slotFullScreenButton(bool current) |
293 | { | 295 | { |
294 | if (autoSave) { | 296 | if (autoSave) { |
295 | m_cfg->writeEntry("fullscreen",current); | 297 | m_cfg->writeEntry("fullscreen",current); |
296 | } | 298 | } |
297 | if (!m_disp) return; | 299 | if (!m_disp) return; |
298 | if (m_disp->isVisible()) { | 300 | if (m_disp->isVisible()) { |
299 | setupViewWindow(current, true); | 301 | setupViewWindow(current, true); |
300 | } | 302 | } |
301 | } | 303 | } |
302 | 304 | ||
303 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | 305 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) |
304 | { | 306 | { |
305 | if (!m_disp) { | 307 | if (!m_disp) { |
@@ -359,48 +361,49 @@ void PMainWindow::slotShowInfo( const QString& inf ) { | |||
359 | initInfo(); | 361 | initInfo(); |
360 | } | 362 | } |
361 | m_info->setPath( inf ); | 363 | m_info->setPath( inf ); |
362 | if (m_SmallWindow) { | 364 | if (m_SmallWindow) { |
363 | m_aNext->removeFrom(toolBar); | 365 | m_aNext->removeFrom(toolBar); |
364 | m_aPrevious->removeFrom(toolBar); | 366 | m_aPrevious->removeFrom(toolBar); |
365 | fsButton->hide(); | 367 | fsButton->hide(); |
366 | } | 368 | } |
367 | m_aNext->setEnabled(false); | 369 | m_aNext->setEnabled(false); |
368 | m_aPrevious->setEnabled(false); | 370 | m_aPrevious->setEnabled(false); |
369 | m_aDirUp->setEnabled(false); | 371 | m_aDirUp->setEnabled(false); |
370 | m_aShowInfo->setEnabled(false); | 372 | m_aShowInfo->setEnabled(false); |
371 | m_aViewfile->setEnabled(true); | 373 | m_aViewfile->setEnabled(true); |
372 | m_aStartSlide->setEnabled(false); | 374 | m_aStartSlide->setEnabled(false); |
373 | m_stack->raiseWidget( ImageInfo ); | 375 | m_stack->raiseWidget( ImageInfo ); |
374 | } | 376 | } |
375 | 377 | ||
376 | void PMainWindow::slotDisplay( const QString& inf ) { | 378 | void PMainWindow::slotDisplay( const QString& inf ) { |
377 | bool nwindow = false; | 379 | bool nwindow = false; |
378 | if ( !m_disp ) { | 380 | if ( !m_disp ) { |
379 | nwindow = true; | 381 | nwindow = true; |
380 | initDisp(); | 382 | initDisp(); |
381 | m_disp->setIntensity(m_Intensity); | 383 | m_disp->setIntensity(m_Intensity); |
382 | m_setCurrentBrightness->setEnabled(true); | 384 | m_setCurrentBrightness->setEnabled(true); |
385 | m_hBright->setEnabled(true); | ||
383 | } | 386 | } |
384 | m_disp->setImage( inf ); | 387 | m_disp->setImage( inf ); |
385 | if (m_SmallWindow) { | 388 | if (m_SmallWindow) { |
386 | if (m_gPrevNext->isEnabled()==false) { | 389 | if (m_gPrevNext->isEnabled()==false) { |
387 | m_gPrevNext->addTo(toolBar); | 390 | m_gPrevNext->addTo(toolBar); |
388 | fsButton->hide(); | 391 | fsButton->hide(); |
389 | } | 392 | } |
390 | } | 393 | } |
391 | m_gPrevNext->setEnabled(true); | 394 | m_gPrevNext->setEnabled(true); |
392 | m_aDirUp->setEnabled(false); | 395 | m_aDirUp->setEnabled(false); |
393 | m_aShowInfo->setEnabled(true); | 396 | m_aShowInfo->setEnabled(true); |
394 | m_aViewfile->setEnabled(false); | 397 | m_aViewfile->setEnabled(false); |
395 | m_aStartSlide->setEnabled(false); | 398 | m_aStartSlide->setEnabled(false); |
396 | 399 | ||
397 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 400 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
398 | slotFullScreenToggled(m_aFullScreen->isOn()); | 401 | slotFullScreenToggled(m_aFullScreen->isOn()); |
399 | } | 402 | } |
400 | if (m_disp->fullScreen()) { | 403 | if (m_disp->fullScreen()) { |
401 | if (!m_disp->isVisible()) { | 404 | if (!m_disp->isVisible()) { |
402 | m_disp->showFullScreen(); | 405 | m_disp->showFullScreen(); |
403 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 406 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
404 | } | 407 | } |
405 | } else { | 408 | } else { |
406 | m_stack->raiseWidget( ImageDisplay ); | 409 | m_stack->raiseWidget( ImageDisplay ); |
@@ -622,57 +625,62 @@ void PMainWindow::setupActions() | |||
622 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); | 625 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); |
623 | m_aZoomer->setToggleAction(true); | 626 | m_aZoomer->setToggleAction(true); |
624 | if (autoSave) { | 627 | if (autoSave) { |
625 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); | 628 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); |
626 | } else { | 629 | } else { |
627 | m_aZoomer->setOn (true); | 630 | m_aZoomer->setOn (true); |
628 | } | 631 | } |
629 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 632 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
630 | m_gDisplayType->insert(m_aAutoRotate); | 633 | m_gDisplayType->insert(m_aAutoRotate); |
631 | m_gDisplayType->insert(m_aUnscaled); | 634 | m_gDisplayType->insert(m_aUnscaled); |
632 | m_gDisplayType->insert(m_aZoomer); | 635 | m_gDisplayType->insert(m_aZoomer); |
633 | 636 | ||
634 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 637 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
635 | m_hGroup->insert(m_aFullScreen); | 638 | m_hGroup->insert(m_aFullScreen); |
636 | 639 | ||
637 | if (!m_SmallWindow) { | 640 | if (!m_SmallWindow) { |
638 | m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); | 641 | m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); |
639 | m_aForceSmall->setToggleAction(true); | 642 | m_aForceSmall->setToggleAction(true); |
640 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); | 643 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); |
641 | } else { | 644 | } else { |
642 | m_aForceSmall = 0; | 645 | m_aForceSmall = 0; |
643 | } | 646 | } |
644 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); | 647 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); |
645 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); | 648 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); |
649 | m_IncBrightness = new QAction(tr("Increase brightness by 5"),Resource::loadIconSet( "up" ),0, 0, this, 0, false); | ||
650 | m_DecBrightness = new QAction(tr("Decrease brightness by 5"),Resource::loadIconSet( "down" ),0, 0, this, 0, false); | ||
651 | m_hBright = new QActionGroup(this,"actioncollection",false), | ||
652 | m_hBright->insert(m_IncBrightness); | ||
653 | m_hBright->insert(m_DecBrightness); | ||
646 | } | 654 | } |
647 | 655 | ||
648 | void PMainWindow::setupBrightness() | 656 | void PMainWindow::setupBrightness() |
649 | { | 657 | { |
650 | if (!m_disp) { | 658 | if (!m_disp) { |
651 | return; | 659 | return; |
652 | } | 660 | } |
653 | int lb = m_disp->Intensity(); | 661 | int lb = m_disp->Intensity(); |
654 | if (Valuebox(0,-255,255,lb,lb)) { | 662 | if (Valuebox(0,-100,100,lb,lb)) { |
655 | m_disp->setIntensity(lb,true); | 663 | m_disp->setIntensity(lb,true); |
656 | } | 664 | } |
657 | } | 665 | } |
658 | 666 | ||
659 | void PMainWindow::setupToolbar() | 667 | void PMainWindow::setupToolbar() |
660 | { | 668 | { |
661 | toolBar = new QToolBar( this ); | 669 | toolBar = new QToolBar( this ); |
662 | addToolBar(toolBar); | 670 | addToolBar(toolBar); |
663 | toolBar->setHorizontalStretchable( true ); | 671 | toolBar->setHorizontalStretchable( true ); |
664 | setToolBarsMovable( false ); | 672 | setToolBarsMovable( false ); |
665 | m_aDirUp->addTo( toolBar ); | 673 | m_aDirUp->addTo( toolBar ); |
666 | 674 | ||
667 | fsButton = new PFileSystem( toolBar ); | 675 | fsButton = new PFileSystem( toolBar ); |
668 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 676 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
669 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 677 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
670 | connect( this, SIGNAL( changeDir( const QString& ) ), | 678 | connect( this, SIGNAL( changeDir( const QString& ) ), |
671 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 679 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
672 | 680 | ||
673 | if (m_aBeam) { | 681 | if (m_aBeam) { |
674 | m_aBeam->addTo( toolBar ); | 682 | m_aBeam->addTo( toolBar ); |
675 | } | 683 | } |
676 | m_aShowInfo->addTo(toolBar); | 684 | m_aShowInfo->addTo(toolBar); |
677 | m_aTrash->addTo(toolBar); | 685 | m_aTrash->addTo(toolBar); |
678 | // m_aSetup->addTo(toolBar); | 686 | // m_aSetup->addTo(toolBar); |
@@ -703,48 +711,52 @@ void PMainWindow::setupMenu() | |||
703 | m_aDirUp->addTo( fileMenu ); | 711 | m_aDirUp->addTo( fileMenu ); |
704 | 712 | ||
705 | fsMenu = new QPopupMenu(fileMenu); | 713 | fsMenu = new QPopupMenu(fileMenu); |
706 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); | 714 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); |
707 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); | 715 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); |
708 | dirChanged(); | 716 | dirChanged(); |
709 | 717 | ||
710 | if ( m_aBeam ) { | 718 | if ( m_aBeam ) { |
711 | fileMenu->insertSeparator(); | 719 | fileMenu->insertSeparator(); |
712 | m_aBeam->addTo( fileMenu ); | 720 | m_aBeam->addTo( fileMenu ); |
713 | } | 721 | } |
714 | fileMenu->insertSeparator(); | 722 | fileMenu->insertSeparator(); |
715 | m_aTrash->addTo(fileMenu); | 723 | m_aTrash->addTo(fileMenu); |
716 | 724 | ||
717 | listviewMenu = new QPopupMenu(dispMenu); | 725 | listviewMenu = new QPopupMenu(dispMenu); |
718 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); | 726 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); |
719 | m_gListViewMode->addTo(listviewMenu); | 727 | m_gListViewMode->addTo(listviewMenu); |
720 | dispMenu->insertSeparator(); | 728 | dispMenu->insertSeparator(); |
721 | m_aFullScreen->addTo(dispMenu); | 729 | m_aFullScreen->addTo(dispMenu); |
722 | m_gDisplayType->addTo(dispMenu); | 730 | m_gDisplayType->addTo(dispMenu); |
723 | dispMenu->insertSeparator(); | 731 | dispMenu->insertSeparator(); |
724 | m_gPrevNext->addTo(dispMenu); | 732 | m_gPrevNext->addTo(dispMenu); |
725 | m_setCurrentBrightness->addTo(dispMenu); | 733 | m_setCurrentBrightness->addTo(dispMenu); |
726 | m_setCurrentBrightness->setEnabled(false); | 734 | m_setCurrentBrightness->setEnabled(false); |
735 | dispMenu->insertSeparator(); | ||
736 | m_hBright->addTo(dispMenu); | ||
737 | m_hBright->setEnabled(false); | ||
738 | |||
727 | if (m_aForceSmall) { | 739 | if (m_aForceSmall) { |
728 | dispMenu->insertSeparator(); | 740 | dispMenu->insertSeparator(); |
729 | m_aForceSmall->addTo(dispMenu); | 741 | m_aForceSmall->addTo(dispMenu); |
730 | } | 742 | } |
731 | 743 | ||
732 | m_aSetup->addTo(settingsMenu); | 744 | m_aSetup->addTo(settingsMenu); |
733 | m_aHideToolbar->addTo(settingsMenu); | 745 | m_aHideToolbar->addTo(settingsMenu); |
734 | } | 746 | } |
735 | 747 | ||
736 | void PMainWindow::listviewselected(QAction*which) | 748 | void PMainWindow::listviewselected(QAction*which) |
737 | { | 749 | { |
738 | if (!which || which->isOn()==false) return; | 750 | if (!which || which->isOn()==false) return; |
739 | int val = 1; | 751 | int val = 1; |
740 | 752 | ||
741 | if (which==m_aDirName) { | 753 | if (which==m_aDirName) { |
742 | val = 3; | 754 | val = 3; |
743 | } else if (which==m_aDirShort) { | 755 | } else if (which==m_aDirShort) { |
744 | val = 2; | 756 | val = 2; |
745 | } else if (which==m_aDirLong) { | 757 | } else if (which==m_aDirLong) { |
746 | val = 1; | 758 | val = 1; |
747 | } | 759 | } |
748 | emit changeListMode(val); | 760 | emit changeListMode(val); |
749 | } | 761 | } |
750 | 762 | ||