111 mLoader.reset(); |
114 mLoader.reset(); |
112 |
115 |
113 mActivated = false; |
116 mActivated = false; |
114 |
117 |
115 bool ok = false; |
118 bool ok = false; |
116 |
119 |
117 //Load the details view docml first |
120 //Load the details view docml first |
118 mLoader.load(VIDEO_DETAILS_DOCML, &ok); |
121 mLoader.load(VIDEO_DETAILS_DOCML, &ok); |
119 |
122 |
120 if(!ok) |
123 if(!ok) |
121 { |
124 { |
122 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load docml."); |
125 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load docml."); |
123 return; |
126 return; |
124 } |
127 } |
125 |
128 |
126 //Load portrait section by default as only vertical orientation is currently supported by videoplayer |
129 //Load portrait section by default as only vertical orientation is currently supported by videoplayer |
127 mLoader.load(VIDEO_DETAILS_DOCML, VIDEO_DETAILS_PORTRAIT, &ok); |
130 mLoader.load(VIDEO_DETAILS_DOCML, VIDEO_DETAILS_PORTRAIT, &ok); |
128 |
131 |
129 if(!ok) |
132 if(!ok) |
130 { |
133 { |
131 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load portrait view."); |
134 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load portrait view."); |
132 return; |
135 return; |
133 } |
136 } |
174 // no deallocation needed for this since |
177 // no deallocation needed for this since |
175 // stackedwidget takes ownership |
178 // stackedwidget takes ownership |
176 mThumbLabel = new VideoDetailsLabel; |
179 mThumbLabel = new VideoDetailsLabel; |
177 mThumbLabel->setAlignment(Qt::AlignCenter); |
180 mThumbLabel->setAlignment(Qt::AlignCenter); |
178 mThumbLabel->setObjectName(VIDEO_DETAILS_OBJECT_NAME_THUMBLABEL); |
181 mThumbLabel->setObjectName(VIDEO_DETAILS_OBJECT_NAME_THUMBLABEL); |
179 |
182 |
180 connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot())); |
183 connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot())); |
181 |
184 |
182 thumbWidget->addWidget(mThumbLabel); |
185 thumbWidget->addWidget(mThumbLabel); |
183 |
186 |
184 // Load details title. |
187 // Load details title. |
209 } |
212 } |
210 |
213 |
211 // Create navigation keys. |
214 // Create navigation keys. |
212 mNavKeyBackAction = new HbAction(Hb::BackNaviAction); |
215 mNavKeyBackAction = new HbAction(Hb::BackNaviAction); |
213 mNavKeyBackAction->setObjectName(VIDEO_DETAILS_OBJECT_NAME_NAVKEY_BACK); |
216 mNavKeyBackAction->setObjectName(VIDEO_DETAILS_OBJECT_NAME_NAVKEY_BACK); |
214 |
217 |
215 if (!mThumbnailManager) |
218 if (!mThumbnailManager) |
216 { |
219 { |
217 mThumbnailManager = new ThumbnailManager(); |
220 mThumbnailManager = new ThumbnailManager(); |
218 } |
221 } |
219 |
222 |
220 connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)), |
223 connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)), |
221 this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int))); |
224 this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int))); |
222 |
225 |
223 HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET); |
226 HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET); |
224 if(!list) |
227 if(!list) |
225 { |
228 { |
226 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget."); |
229 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget."); |
227 return; |
230 return; |
228 } |
231 } |
229 |
232 |
230 list->setEnabledAnimations(HbAbstractItemView::None); |
233 list->setEnabledAnimations(HbAbstractItemView::None); |
231 } |
234 } |
232 |
235 |
233 // --------------------------------------------------------------------------- |
236 // --------------------------------------------------------------------------- |
234 // Destroy view |
237 // Destroy view |
312 |
315 |
313 VideoServices::TVideoService service = VideoServices::ENoService; |
316 VideoServices::TVideoService service = VideoServices::ENoService; |
314 if (mIsService && mVideoServices) |
317 if (mIsService && mVideoServices) |
315 { |
318 { |
316 service = mVideoServices->currentService(); |
319 service = mVideoServices->currentService(); |
317 |
320 |
318 HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0); |
321 HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0); |
319 mainWnd->currentView()->setTitle(mVideoServices->contextTitle()); |
322 mainWnd->currentView()->setTitle(mVideoServices->contextTitle()); |
320 } |
323 } |
321 |
324 |
322 HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON); |
325 HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON); |
323 if(!button) |
326 if(!button) |
324 { |
327 { |
325 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details button."); |
328 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details button."); |
326 return; |
329 return; |
327 } |
330 } |
328 |
331 |
329 // Fix the size of the thumbnail, as that needs to be in 16:9 |
332 // Fix the size of the thumbnail, as that needs to be in 16:9 |
330 qreal width = button->size().width(); |
333 qreal width = button->size().width(); |
331 qreal height = width * 9 / 16; |
334 qreal height = width * 9 / 16; |
332 |
335 |
333 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
336 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
334 thumbWidget->setPreferredWidth(width); |
337 thumbWidget->setPreferredWidth(width); |
335 thumbWidget->setPreferredHeight(height); |
338 thumbWidget->setPreferredHeight(height); |
336 |
339 |
337 if (service == VideoServices::EUriFetcher) |
340 if (service == VideoServices::EUriFetcher) |
338 { |
341 { |
339 button->setText(hbTrId("txt_videos_button_attach")); |
342 HbIcon icon = HbIcon("qtg_mono_attach"); |
340 |
343 button->setIcon(icon); |
341 connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri())); |
344 |
342 connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&))); |
345 connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri()), Qt::UniqueConnection); |
|
346 connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)), Qt::UniqueConnection); |
343 } |
347 } |
344 else |
348 else |
345 { |
349 { |
346 connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot())); |
350 connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()), Qt::UniqueConnection); |
347 button->setText(hbTrId("txt_videos_opt_share")); |
351 |
|
352 HbIcon icon = HbIcon("qtg_mono_share"); |
|
353 button->setIcon(icon); |
348 } |
354 } |
349 |
355 |
350 connect(mainWnd, |
356 connect(mainWnd, |
351 SIGNAL(orientationChanged(Qt::Orientation)), |
357 SIGNAL(orientationChanged(Qt::Orientation)), |
352 this, SLOT(orientationChange(Qt::Orientation))); |
358 this, SLOT(orientationChange(Qt::Orientation)), |
|
359 Qt::UniqueConnection); |
353 |
360 |
354 connect(&mCollectionWrapper, |
361 connect(&mCollectionWrapper, |
355 SIGNAL(asyncStatus(int, QVariant&)), |
362 SIGNAL(asyncStatus(int, QVariant&)), |
356 this, SLOT(handleErrorSlot(int, QVariant&))); |
363 this, SLOT(handleErrorSlot(int, QVariant&)), |
|
364 Qt::UniqueConnection); |
357 |
365 |
358 // setup title size in order for animation to be enabled if needed |
366 // setup title size in order for animation to be enabled if needed |
359 mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50); |
367 mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50); |
360 mTitleAnim->adjustSize(); |
368 mTitleAnim->adjustSize(); |
361 |
369 |
512 |
522 |
513 for(int i = 0; i< detailCount; i++) { |
523 for(int i = 0; i< detailCount; i++) { |
514 if (metadata.contains(VideoDetailLabelKeys[i])) |
524 if (metadata.contains(VideoDetailLabelKeys[i])) |
515 { |
525 { |
516 HbListWidgetItem* listWidgetItem = new HbListWidgetItem(); |
526 HbListWidgetItem* listWidgetItem = new HbListWidgetItem(); |
517 listWidgetItem->setEnabled(false); |
|
518 listWidgetItem->setText( hbTrId(VideoDetailLabels[i])); |
527 listWidgetItem->setText( hbTrId(VideoDetailLabels[i])); |
519 listWidgetItem->setSecondaryText(metadata[VideoDetailLabelKeys[i]].toString()); |
528 listWidgetItem->setSecondaryText(metadata[VideoDetailLabelKeys[i]].toString()); |
520 list->addItem(listWidgetItem); |
529 list->addItem(listWidgetItem); |
|
530 |
|
531 // following is required to change wrapping-mode for the second row |
|
532 HbListViewItem *viewItem = static_cast<HbListViewItem*>(list->viewItem(list->row(listWidgetItem))); |
|
533 if(viewItem) |
|
534 { |
|
535 HbTextItem *secondLine = static_cast<HbTextItem*>(viewItem->primitive("text-2")); |
|
536 if(secondLine) |
|
537 { |
|
538 secondLine->setTextWrapping(Hb::TextWrapAnywhere); |
|
539 } |
|
540 } |
521 } |
541 } |
522 } |
542 } |
523 |
543 |
524 // start title animation |
544 // start title animation |
525 mTitleAnim->startAnimation(); |
545 mTitleAnim->startAnimation(); |
562 // --------------------------------------------------------------------------- |
582 // --------------------------------------------------------------------------- |
563 // |
583 // |
564 void VideoFileDetailsViewPlugin::sendVideoSlot() |
584 void VideoFileDetailsViewPlugin::sendVideoSlot() |
565 { |
585 { |
566 FUNC_LOG; |
586 FUNC_LOG; |
567 // HbMessageBox::information(tr("Not implemented yet")); |
587 |
568 |
|
569 if(mVideoId != TMPXItemId::InvalidId()) |
588 if(mVideoId != TMPXItemId::InvalidId()) |
570 { |
589 { |
571 ShareUi dialog; |
590 if(!mShareUi) |
|
591 { |
|
592 mShareUi = new ShareUi(); |
|
593 } |
572 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
594 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
573 QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath); |
595 QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath); |
574 if(variant.isValid()) |
596 if(variant.isValid()) |
575 { |
597 { |
576 QStringList fileList; |
598 QStringList fileList; |
577 fileList.append(variant.toString()); |
599 fileList.append(variant.toString()); |
578 dialog.send(fileList, true); |
600 mShareUi->send(fileList, true); |
579 } |
601 } |
580 } |
602 } |
581 } |
603 } |
582 |
604 |
583 // --------------------------------------------------------------------------- |
605 // --------------------------------------------------------------------------- |
592 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
614 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
593 QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyTitle); |
615 QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyTitle); |
594 |
616 |
595 if (variant.isValid()) |
617 if (variant.isValid()) |
596 { |
618 { |
597 QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg( |
619 QString text = HbParameterLengthLimiter(hbTrId("txt_videos_info_do_you_want_to_delete_1")). |
598 variant.toString()); |
620 arg(variant.toString()); |
599 |
621 |
600 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
622 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
601 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
623 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
624 messageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); |
602 messageBox->setObjectName(VIDEO_DETAILS_OBJECT_NAME_DELETE_VIDEO); |
625 messageBox->setObjectName(VIDEO_DETAILS_OBJECT_NAME_DELETE_VIDEO); |
603 messageBox->open(this, SLOT(deleteVideoDialogFinished(HbAction *))); |
626 messageBox->open(this, SLOT(deleteVideoDialogFinished(int))); |
604 } |
627 } |
605 } |
628 } |
606 } |
629 } |
607 |
630 |
608 // --------------------------------------------------------------------------- |
631 // --------------------------------------------------------------------------- |
609 // deleteVideoDialogFinished |
632 // deleteVideoDialogFinished |
610 // --------------------------------------------------------------------------- |
633 // --------------------------------------------------------------------------- |
611 // |
634 // |
612 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(HbAction *action) |
635 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(int action) |
613 { |
636 { |
614 FUNC_LOG; |
637 FUNC_LOG; |
615 HbMessageBox *dlg = static_cast<HbMessageBox*>(sender()); |
|
616 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
638 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
617 if(action == dlg->actions().at(0) && modelIndex.isValid()) |
639 if(action == HbMessageBox::Yes && modelIndex.isValid()) |
618 { |
640 { |
619 deleteItem(modelIndex); |
641 deleteItem(modelIndex); |
620 } |
642 } |
621 } |
643 } |
622 |
644 |
800 HbIcon bottom = HbIcon("qtg_fr_popup_trans_b"); |
829 HbIcon bottom = HbIcon("qtg_fr_popup_trans_b"); |
801 HbIcon bottomRight = HbIcon("qtg_fr_popup_trans_br"); |
830 HbIcon bottomRight = HbIcon("qtg_fr_popup_trans_br"); |
802 |
831 |
803 int width = topLeft.width() + top.width() + topRight.width(); |
832 int width = topLeft.width() + top.width() + topRight.width(); |
804 int height = topLeft.height() + center.height() + bottomLeft.height(); |
833 int height = topLeft.height() + center.height() + bottomLeft.height(); |
805 |
834 |
806 mPlayIcon = QPixmap(width, height); |
835 mPlayIcon = QPixmap(width, height); |
807 |
836 |
808 QPainter painter(&mPlayIcon); |
837 QPainter painter(&mPlayIcon); |
809 painter.fillRect(mPlayIcon.rect(), Qt::white); |
838 painter.fillRect(mPlayIcon.rect(), Qt::white); |
810 |
839 |
811 painter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
840 painter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
812 |
841 |
813 int x = 0; |
842 int x = 0; |
814 int y = 0; |
843 int y = 0; |
815 |
844 |
816 // Draw top |
845 // Draw top |
817 painter.drawPixmap(QPoint(x, y), topLeft.pixmap()); |
846 painter.drawPixmap(QPoint(x, y), topLeft.pixmap()); |
818 x += left.width(); |
847 x += left.width(); |
819 |
848 |
820 painter.drawPixmap(QPoint(x, y), top.pixmap()); |
849 painter.drawPixmap(QPoint(x, y), top.pixmap()); |
821 x += top.width(); |
850 x += top.width(); |
822 |
851 |
823 painter.drawPixmap(QPoint(x, y), topRight.pixmap()); |
852 painter.drawPixmap(QPoint(x, y), topRight.pixmap()); |
824 y += top.height(); |
853 y += top.height(); |
825 |
854 |
826 // Draw center |
855 // Draw center |
827 x = 0; |
856 x = 0; |
828 painter.drawPixmap(QPoint(x, y), left.pixmap()); |
857 painter.drawPixmap(QPoint(x, y), left.pixmap()); |
829 x += left.width(); |
858 x += left.width(); |
830 |
859 |
831 painter.drawPixmap(QPoint(x, y), center.pixmap()); |
860 painter.drawPixmap(QPoint(x, y), center.pixmap()); |
832 x += center.width(); |
861 x += center.width(); |
833 |
862 |
834 painter.drawPixmap(QPoint(x, y), right.pixmap()); |
863 painter.drawPixmap(QPoint(x, y), right.pixmap()); |
835 y += center.height(); |
864 y += center.height(); |
836 |
865 |
837 // Draw bottom |
866 // Draw bottom |
838 x = 0; |
867 x = 0; |
839 painter.drawPixmap(QPoint(x, y), bottomLeft.pixmap()); |
868 painter.drawPixmap(QPoint(x, y), bottomLeft.pixmap()); |
840 x += left.width(); |
869 x += left.width(); |
841 |
870 |
842 painter.drawPixmap(QPoint(x, y), bottom.pixmap()); |
871 painter.drawPixmap(QPoint(x, y), bottom.pixmap()); |
843 x += top.width(); |
872 x += top.width(); |
844 |
873 |
845 painter.drawPixmap(QPoint(x, y), bottomRight.pixmap()); |
874 painter.drawPixmap(QPoint(x, y), bottomRight.pixmap()); |
846 |
875 |
847 // Draw play icon |
876 // Draw play icon |
848 play.setSize(mPlayIcon.size()); |
877 play.setSize(mPlayIcon.size()); |
849 play.setColor(Qt::white); |
878 play.setColor(Qt::white); |
850 painter.drawPixmap(mPlayIcon.rect(), play.pixmap()); |
879 painter.drawPixmap(mPlayIcon.rect(), play.pixmap()); |
851 painter.end(); |
880 painter.end(); |
852 |
881 |
853 return mPlayIcon; |
882 return mPlayIcon; |
854 } |
883 } |
855 |
884 |
856 // --------------------------------------------------------------------------- |
885 // --------------------------------------------------------------------------- |
857 // findWidget |
886 // findWidget |