-rw-r--r-- | noncore/multimedia/showimg/showimg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp index 0fbffe7..d6f0733 100644 --- a/noncore/multimedia/showimg/showimg.cpp +++ b/noncore/multimedia/showimg/showimg.cpp | |||
@@ -442,193 +442,193 @@ void ImageViewer::settings() | |||
442 | } | 442 | } |
443 | 443 | ||
444 | void ImageViewer::switchSizeToScreen() | 444 | void ImageViewer::switchSizeToScreen() |
445 | { | 445 | { |
446 | isSized=!isSized; | 446 | isSized=!isSized; |
447 | sss->setOn(isSized); | 447 | sss->setOn(isSized); |
448 | updateImage(); | 448 | updateImage(); |
449 | } | 449 | } |
450 | 450 | ||
451 | void ImageViewer::updateImage() | 451 | void ImageViewer::updateImage() |
452 | { | 452 | { |
453 | if ( isSized ) { | 453 | if ( isSized ) { |
454 | imagePanel->setPixmap(pmScaled); | 454 | imagePanel->setPixmap(pmScaled); |
455 | } else { | 455 | } else { |
456 | imagePanel->setPixmap(pm); | 456 | imagePanel->setPixmap(pm); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | 459 | ||
460 | void ImageViewer::switchThumbView() | 460 | void ImageViewer::switchThumbView() |
461 | { | 461 | { |
462 | 462 | ||
463 | showThumbView=!showThumbView; | 463 | showThumbView=!showThumbView; |
464 | viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView ); | 464 | viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView ); |
465 | fileSelector->switchView(); | 465 | fileSelector->switchView(); |
466 | 466 | ||
467 | } | 467 | } |
468 | 468 | ||
469 | void ImageViewer::switchToFileSelector() | 469 | void ImageViewer::switchToFileSelector() |
470 | { | 470 | { |
471 | stack->raiseWidget(fileSelector); | 471 | stack->raiseWidget(fileSelector); |
472 | menuBar->clear(); | 472 | menuBar->clear(); |
473 | menuBar->insertItem( tr("File"), fileMenuFile ); | 473 | menuBar->insertItem( tr("File"), fileMenuFile ); |
474 | menuBar->insertItem( tr("View"), viewMenuFile ); | 474 | menuBar->insertItem( tr("View"), viewMenuFile ); |
475 | menuBar->insertItem( tr("Options"), optionsMenuFile ); | 475 | menuBar->insertItem( tr("Options"), optionsMenuFile ); |
476 | iconToolBar->hide(); | 476 | iconToolBar->hide(); |
477 | imagePanel->disable(); | 477 | imagePanel->disable(); |
478 | slideShow(false); | 478 | slideShow(false); |
479 | 479 | ||
480 | } | 480 | } |
481 | 481 | ||
482 | void ImageViewer::switchToImageView() | 482 | void ImageViewer::switchToImageView() |
483 | { | 483 | { |
484 | stack->raiseWidget(imagePanel); | 484 | stack->raiseWidget(imagePanel); |
485 | 485 | ||
486 | menuBar->clear(); | 486 | menuBar->clear(); |
487 | menuBar->insertItem( tr("File"), fileMenuView ); | 487 | menuBar->insertItem( tr("File"), fileMenuView ); |
488 | menuBar->insertItem( tr("View"), viewMenuView ); | 488 | menuBar->insertItem( tr("View"), viewMenuView ); |
489 | viewMenuView->setItemEnabled(BLACKANDWHITE,true); | 489 | viewMenuView->setItemEnabled(BLACKANDWHITE,true); |
490 | iconToolBar->show(); | 490 | iconToolBar->show(); |
491 | 491 | ||
492 | imagePanel->setPosition(0,0); | 492 | imagePanel->setPosition(0,0); |
493 | 493 | ||
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | void ImageViewer::setDocument(const QString& fileref) | 497 | void ImageViewer::setDocument(const QString& fileref) |
498 | { | 498 | { |
499 | delayLoad = fileref; | 499 | delayLoad = fileref; |
500 | switchToImageView(); | 500 | switchToImageView(); |
501 | QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); | 501 | QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); |
502 | } | 502 | } |
503 | 503 | ||
504 | void ImageViewer::doDelayedLoad() | 504 | void ImageViewer::doDelayedLoad() |
505 | { | 505 | { |
506 | show(delayLoad); | 506 | show(delayLoad); |
507 | } | 507 | } |
508 | 508 | ||
509 | void ImageViewer::show() | 509 | void ImageViewer::show() |
510 | { | 510 | { |
511 | normalView(); | 511 | normalView(); |
512 | QMainWindow::show(); | 512 | QMainWindow::show(); |
513 | } | 513 | } |
514 | 514 | ||
515 | void ImageViewer::show(const QString& fileref) | 515 | void ImageViewer::show(const QString& fileref) |
516 | { | 516 | { |
517 | // qDebug("Show "+fileref); | 517 | // qDebug("Show "+fileref); |
518 | bFromDocView = TRUE; | 518 | bFromDocView = TRUE; |
519 | closeFileSelector(); | 519 | closeFileSelector(); |
520 | DocLnk link(fileref); | 520 | DocLnk link(fileref); |
521 | if ( link.isValid() ) { | 521 | if ( link.isValid() ) { |
522 | openFile(link); | 522 | openFile(link); |
523 | } else { | 523 | } else { |
524 | filename = fileref; | 524 | filename = fileref; |
525 | updateCaption( fileref ); | 525 | updateCaption( fileref ); |
526 | loadImage( fileref ); | 526 | loadImage( fileref ); |
527 | } | 527 | } |
528 | } | 528 | } |
529 | 529 | ||
530 | void ImageViewer::openFile() { | 530 | void ImageViewer::openFile() { |
531 | MimeTypes types; | 531 | MimeTypes types; |
532 | QStringList image; | 532 | QStringList image; |
533 | image << "image/*"; | 533 | image << "image/*"; |
534 | types.insert("Images", image); | 534 | types.insert("Images", image); |
535 | 535 | ||
536 | QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); | 536 | QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); |
537 | DocLnk link(str); | 537 | DocLnk link(str); |
538 | if ( link.isValid() ) | 538 | // if ( link.isValid() ) |
539 | openFile(link); | 539 | openFile(link); |
540 | 540 | ||
541 | } | 541 | } |
542 | 542 | ||
543 | void ImageViewer::openFile( const DocLnk &link ) | 543 | void ImageViewer::openFile( const DocLnk &link ) |
544 | { | 544 | { |
545 | closeFileSelector(); | 545 | closeFileSelector(); |
546 | // DocLnk link(file); | 546 | // DocLnk link(file); |
547 | qDebug("open "+link.name()); | 547 | qDebug("open "+link.name()); |
548 | updateCaption( link.name() ); | 548 | updateCaption( link.name() ); |
549 | loadImage( link.file() ); | 549 | loadImage( link.file() ); |
550 | if (slideTimer->isActive()) { | 550 | if (slideTimer->isActive()) { |
551 | slideTimer->start(slideDelay * 1000, FALSE); | 551 | slideTimer->start(slideDelay * 1000, FALSE); |
552 | } | 552 | } |
553 | 553 | ||
554 | } | 554 | } |
555 | 555 | ||
556 | void ImageViewer::open() | 556 | void ImageViewer::open() |
557 | { | 557 | { |
558 | switchToFileSelector(); | 558 | switchToFileSelector(); |
559 | } | 559 | } |
560 | 560 | ||
561 | void ImageViewer::closeFileSelector() | 561 | void ImageViewer::closeFileSelector() |
562 | { | 562 | { |
563 | switchToImageView(); | 563 | switchToImageView(); |
564 | } | 564 | } |
565 | 565 | ||
566 | void ImageViewer::updateCaption( QString name ) | 566 | void ImageViewer::updateCaption( QString name ) |
567 | { | 567 | { |
568 | int sep = name.findRev( '/' ); | 568 | int sep = name.findRev( '/' ); |
569 | if ( sep >= 0 ) | 569 | if ( sep >= 0 ) |
570 | name = name.mid( sep+1 ); | 570 | name = name.mid( sep+1 ); |
571 | setCaption( name + tr(" - Image Viewer") ); | 571 | setCaption( name + tr(" - Image Viewer") ); |
572 | } | 572 | } |
573 | 573 | ||
574 | /* | 574 | /* |
575 | This function loads an image from a file. | 575 | This function loads an image from a file. |
576 | */ | 576 | */ |
577 | 577 | ||
578 | void ImageViewer::loadImage( const char *fileName ) | 578 | void ImageViewer::loadImage( const char *fileName ) |
579 | { | 579 | { |
580 | filename = fileName; | 580 | filename = fileName; |
581 | if ( filename ) { | 581 | if ( filename ) { |
582 | QApplication::setOverrideCursor( waitCursor ); // this might take time | 582 | QApplication::setOverrideCursor( waitCursor ); // this might take time |
583 | //imagePanel->statusLabel()->setText( tr("Loading image...") ); | 583 | //imagePanel->statusLabel()->setText( tr("Loading image...") ); |
584 | qApp->processEvents(); | 584 | qApp->processEvents(); |
585 | bool ok = image.load(filename, 0); | 585 | bool ok = image.load(filename, 0); |
586 | if ( ok ) { | 586 | if ( ok ) { |
587 | ok = reconvertImage(); | 587 | ok = reconvertImage(); |
588 | updateImageInfo(filename); | 588 | updateImageInfo(filename); |
589 | } | 589 | } |
590 | if ( !ok ) { | 590 | if ( !ok ) { |
591 | pm.resize(0,0); // couldn't load image | 591 | pm.resize(0,0); // couldn't load image |
592 | update(); | 592 | update(); |
593 | } | 593 | } |
594 | QApplication::restoreOverrideCursor(); // restore original cursor | 594 | QApplication::restoreOverrideCursor(); // restore original cursor |
595 | } | 595 | } |
596 | 596 | ||
597 | // fastLoad ? ", Fast" : "", | 597 | // fastLoad ? ", Fast" : "", |
598 | // fastLoad ? QMAX(imagewidth/maxsize, imageheight/maxsize) : 1); | 598 | // fastLoad ? QMAX(imagewidth/maxsize, imageheight/maxsize) : 1); |
599 | 599 | ||
600 | 600 | ||
601 | // matrix.reset(); | 601 | // matrix.reset(); |
602 | rotated90 = FALSE; | 602 | rotated90 = FALSE; |
603 | 603 | ||
604 | if (rotateOnLoad) { | 604 | if (rotateOnLoad) { |
605 | rotated90 = TRUE; | 605 | rotated90 = TRUE; |
606 | rot90(); | 606 | rot90(); |
607 | // matrix.rotate( -90.0 ); | 607 | // matrix.rotate( -90.0 ); |
608 | } | 608 | } |
609 | 609 | ||
610 | switchToImageView(); | 610 | switchToImageView(); |
611 | updateImage(); | 611 | updateImage(); |
612 | 612 | ||
613 | } | 613 | } |
614 | 614 | ||
615 | bool ImageViewer::loadSelected() | 615 | bool ImageViewer::loadSelected() |
616 | { | 616 | { |
617 | bool ok = false; | 617 | bool ok = false; |
618 | if ( stack->visibleWidget() == fileSelector ) | 618 | if ( stack->visibleWidget() == fileSelector ) |
619 | { | 619 | { |
620 | const DocLnk *link = fileSelector->selected(); | 620 | const DocLnk *link = fileSelector->selected(); |
621 | if ( link ) | 621 | if ( link ) |
622 | { | 622 | { |
623 | if ( link->file() != filename ) | 623 | if ( link->file() != filename ) |
624 | { | 624 | { |
625 | updateCaption( link->name() ); | 625 | updateCaption( link->name() ); |
626 | filename = link->file(); | 626 | filename = link->file(); |
627 | qApp->processEvents(); | 627 | qApp->processEvents(); |
628 | ok = image.load(filename, 0); | 628 | ok = image.load(filename, 0); |
629 | if ( ok ) | 629 | if ( ok ) |
630 | { | 630 | { |
631 | updateImageInfo(filename); | 631 | updateImageInfo(filename); |
632 | ok = reconvertImage(); | 632 | ok = reconvertImage(); |
633 | } | 633 | } |
634 | if ( !ok ) | 634 | if ( !ok ) |