169 QList<HbMainWindow *> mainWindows = hbInstance->allMainWindows(); |
171 QList<HbMainWindow *> mainWindows = hbInstance->allMainWindows(); |
170 if (mainWindows.count() > 0) { |
172 if (mainWindows.count() > 0) { |
171 HbMainWindow *primaryWindow = mainWindows[0]; |
173 HbMainWindow *primaryWindow = mainWindows[0]; |
172 connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), mWidget, SLOT(orientationChanged(Qt::Orientation))); |
174 connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), mWidget, SLOT(orientationChanged(Qt::Orientation))); |
173 connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); |
175 connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); |
|
176 primaryWindow->setAutomaticOrientationEffectEnabled(false); |
174 } |
177 } |
175 setupWidgetOptions(); |
178 setupWidgetOptions(); |
176 setupWidgetSize(); |
179 setupWidgetSize(); |
177 |
180 |
178 connect(mWidget, SIGNAL(scrollingStarted()), SLOT(onScrollingStarted())); |
181 connect(mWidget, SIGNAL(scrollingStarted()), SLOT(onScrollingStarted())); |
507 connect(view, SIGNAL(closeRequested()), SLOT(closeCurrentView())); |
510 connect(view, SIGNAL(closeRequested()), SLOT(closeCurrentView())); |
508 QList<HbMainWindow *> mainWindows = hbInstance->allMainWindows(); |
511 QList<HbMainWindow *> mainWindows = hbInstance->allMainWindows(); |
509 if (mainWindows.count() > 0) |
512 if (mainWindows.count() > 0) |
510 { |
513 { |
511 HbMainWindow *primaryWindow = mainWindows[0]; |
514 HbMainWindow *primaryWindow = mainWindows[0]; |
|
515 connect(primaryWindow, SIGNAL(orientationChanged(Qt::Orientation)), view, SLOT(orientationChanged(Qt::Orientation))); |
512 primaryWindow->addView(view); |
516 primaryWindow->addView(view); |
513 primaryWindow->setCurrentView(view); |
517 primaryWindow->setCurrentView(view); |
514 // For photos simulation |
518 // For photos simulation |
515 primaryWindow->setOrientation(Qt::Horizontal, false); |
519 // primaryWindow->setOrientation(Qt::Horizontal, false); |
516 } |
520 } |
517 } |
521 } |
518 } |
522 } |
519 } |
523 } |
520 |
524 |
527 HbMainWindow *primaryWindow = mainWindows[0]; |
531 HbMainWindow *primaryWindow = mainWindows[0]; |
528 HbView *currentView = primaryWindow->currentView(); |
532 HbView *currentView = primaryWindow->currentView(); |
529 primaryWindow->setCurrentView(this); |
533 primaryWindow->setCurrentView(this); |
530 primaryWindow->removeView(currentView); |
534 primaryWindow->removeView(currentView); |
531 // For photos simulation |
535 // For photos simulation |
532 primaryWindow->unsetOrientation(false); |
536 // primaryWindow->unsetOrientation(false); |
533 } |
537 } |
534 } |
538 } |
535 |
539 |
536 void HgWidgetTestView::openDeleteItemsDialog() |
540 void HgWidgetTestView::openDeleteItemsDialog() |
537 { |
541 { |
538 FUNC_LOG; |
542 FUNC_LOG; |
539 /* HANDLE_ERROR_NULL(mWidget); |
543 HANDLE_ERROR_NULL(mWidget); |
540 |
544 |
541 HgWidget *widget = copyWidget(); |
545 // HgWidget *widget = copyWidget(); |
542 HANDLE_ERROR_NULL(widget); |
546 // HANDLE_ERROR_NULL(widget); |
543 |
547 |
|
548 mLayout->removeItem(mWidget); |
|
549 |
544 HgSelectionDialog *dlg = |
550 HgSelectionDialog *dlg = |
545 new HgSelectionDialog("Remove items", "Remove", widget); // Takes ownership of widget |
551 new HgSelectionDialog("Remove items", "Remove", mWidget); // Takes ownership of widget |
546 HANDLE_ERROR_NULL(dlg); |
552 HANDLE_ERROR_NULL(dlg); |
547 |
553 |
548 mWidget->hide(); |
554 mWidget->setPreferredSize(mWidget->size()); |
549 widget->setSelectionMode(HgWidget::MultiSelection); |
555 connect(dlg, SIGNAL(finished(HbAction*)), |
550 bool removeItems = (dlg->exec() == dlg->primaryAction()); |
556 SLOT(dialogFinished(HbAction*))); |
|
557 |
|
558 // mWidget->hide(); |
|
559 mWidget->setSelectionMode(HgWidget::MultiSelection); |
|
560 dlg->open(); |
|
561 /* bool removeItems = (dlg->exec() == dlg->primaryAction()); |
551 QItemSelection selection = mSelectionModel->selection(); |
562 QItemSelection selection = mSelectionModel->selection(); |
552 widget->setSelectionMode(HgWidget::NoSelection); // Clears the selection |
563 widget->setSelectionMode(HgWidget::NoSelection); // Clears the selection |
553 delete dlg; |
564 delete dlg; |
554 |
565 |
555 if (removeItems) { |
566 if (removeItems) { |
556 mModel->remove(selection); |
567 mModel->remove(selection); |
557 } |
568 } |
558 |
569 */ |
559 mWidget->show(); |
570 // mWidget->show(); |
560 */ |
571 } |
|
572 |
|
573 void HgWidgetTestView::dialogFinished(HbAction* action) |
|
574 { |
|
575 mWidget->setSelectionMode(HgWidget::NoSelection); // Clears the selection |
|
576 if (action->text() == "Remove" ) { |
|
577 QItemSelection selection = mSelectionModel->selection(); |
|
578 mModel->remove(selection); |
|
579 } |
|
580 mLayout->addItem(mWidget); |
561 } |
581 } |
562 |
582 |
563 void HgWidgetTestView::openMoveItemsDialog() |
583 void HgWidgetTestView::openMoveItemsDialog() |
564 { |
584 { |
565 FUNC_LOG; |
585 FUNC_LOG; |
779 } |
799 } |
780 } |
800 } |
781 |
801 |
782 HgWidget* widget = 0; |
802 HgWidget* widget = 0; |
783 |
803 |
|
804 HbStyleLoader::unregisterFilePath(":/test/hgmediawall.css"); |
|
805 HbStyleLoader::unregisterFilePath(":/test/hgmediawall.widgetml"); |
|
806 |
784 switch (type) { |
807 switch (type) { |
785 case HgWidgetGrid: |
808 case HgWidgetGrid: |
786 mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); |
809 mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); |
787 mModel->setBuffer(GRIDBUFFERSIZE, GRIDBUFFERSIZE/3); |
810 mModel->setBuffer(GRIDBUFFERSIZE, GRIDBUFFERSIZE/3); |
788 widget = new HgGrid(scrollDirection); |
811 widget = new HgGrid(scrollDirection); |
790 case HgWidgetCoverflow: |
813 case HgWidgetCoverflow: |
791 { |
814 { |
792 mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); |
815 mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); |
793 mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3); |
816 mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3); |
794 HgMediawall *mediaWall = new HgMediawall; |
817 HgMediawall *mediaWall = new HgMediawall; |
795 // mediaWall->setItemSize(QSizeF(4, 3)); // Sets aspect ratio |
818 // mediaWall->setItemSize(QSizeF(4, 3)); // Sets aspect ratio |
796 // mediaWall->enableReflections(true); |
819 HbStyleLoader::registerFilePath(":/test/hgmediawall.css"); |
|
820 HbStyleLoader::registerFilePath(":/test/hgmediawall.widgetml"); |
797 widget = mediaWall; |
821 widget = mediaWall; |
798 } |
822 } |
799 break; |
823 break; |
800 case HgWidgetTBone: |
824 case HgWidgetTBone: |
801 mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); |
825 mModel->setThumbnailSize(ThumbnailManager::ThumbnailMedium); |
802 mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3); |
826 mModel->setBuffer(COVERFLOWBUFFERSIZE, COVERFLOWBUFFERSIZE/3); |
803 widget = new HgMediawall; |
827 widget = new HgMediawall; |
|
828 HbStyleLoader::registerFilePath(":/test/hgmediawall.css"); |
|
829 HbStyleLoader::registerFilePath(":/test/hgmediawall.widgetml"); |
804 break; |
830 break; |
805 default: |
831 default: |
806 break; |
832 break; |
807 } |
833 } |
808 |
834 |
809 HANDLE_ERROR_NULL(widget); |
835 HANDLE_ERROR_NULL(widget); |
810 |
836 |
811 widget->setModel(mModel); |
837 widget->setModel(mModel); |
812 widget->setSelectionModel(mSelectionModel); |
838 widget->setSelectionModel(mSelectionModel); |
813 widget->setLongPressEnabled(true); |
839 widget->setLongPressEnabled(true); |
814 |
840 |
815 QImage defaultImage(":/images/default.svg"); |
841 QImage defaultImage(":/images/default.svg"); |
850 |
876 |
851 void HgWidgetTestView::onScrollingStarted() |
877 void HgWidgetTestView::onScrollingStarted() |
852 { |
878 { |
853 FUNC_LOG; |
879 FUNC_LOG; |
854 |
880 |
|
881 qDebug() << "SCROLLING onScrollingStarted"; |
|
882 |
855 // scrolling started, need to hide |
883 // scrolling started, need to hide |
856 // label displaying full resolution image |
884 // label displaying full resolution image |
857 if (mFrontItem) |
885 if (mFrontItem) |
858 mFrontItem->setVisible(false); |
886 mFrontItem->setVisible(false); |
859 |
887 |
860 } |
888 } |
861 |
889 |
862 void HgWidgetTestView::onScrollingEnded() |
890 void HgWidgetTestView::onScrollingEnded() |
863 { |
891 { |
864 FUNC_LOG; |
892 FUNC_LOG; |
|
893 |
|
894 qDebug() << "SCROLLING onScrollingEnded"; |
865 |
895 |
866 if (mModel->lowResImagesEnabled()) { |
896 if (mModel->lowResImagesEnabled()) { |
867 |
897 |
868 if (!mWidget) |
898 if (!mWidget) |
869 return; |
899 return; |
912 delete mDialog; |
942 delete mDialog; |
913 mDialog = 0; |
943 mDialog = 0; |
914 delete mCoverItem; |
944 delete mCoverItem; |
915 mCoverItem = 0; |
945 mCoverItem = 0; |
916 mAnimationGroup->clear(); |
946 mAnimationGroup->clear(); |
917 |
947 |
918 |
948 if (orientation == Qt::Horizontal && mWidgetType == HgWidgetCoverflow) { |
919 if (orientation == Qt::Horizontal && (mWidgetType == HgWidgetCoverflow || mWidgetType == HgWidgetGrid )) { |
|
920 setItemVisible(Hb::AllItems, false); |
949 setItemVisible(Hb::AllItems, false); |
921 } |
950 } |
|
951 else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetGrid && mainWindow()->currentView() == this ) { |
|
952 setItemVisible(Hb::AllItems, false); |
|
953 } |
922 else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetTBone) { |
954 else if (orientation == Qt::Horizontal && mWidgetType == HgWidgetTBone) { |
923 initWidget(HgWidgetCoverflow); |
955 initWidget(HgWidgetCoverflow); |
924 setItemVisible(Hb::AllItems, false); |
956 setItemVisible(Hb::AllItems, false); |
925 } |
957 } |
926 else if (orientation == Qt::Vertical && mWidgetType == HgWidgetCoverflow) { |
958 else if (orientation == Qt::Vertical && mWidgetType == HgWidgetCoverflow) { |