30 #include <qabstractitemmodel.h> |
30 #include <qabstractitemmodel.h> |
31 #include <hbmessagebox.h> |
31 #include <hbmessagebox.h> |
32 #include <hblistwidget.h> |
32 #include <hblistwidget.h> |
33 #include <hblistwidgetitem.h> |
33 #include <hblistwidgetitem.h> |
34 #include <hblistviewitem.h> |
34 #include <hblistviewitem.h> |
|
35 #include <hbparameterlengthlimiter.h> |
35 #include <cmath> |
36 #include <cmath> |
36 #include <thumbnailmanager_qt.h> |
37 #include <thumbnailmanager_qt.h> |
37 #include <shareui.h> |
38 #include <shareui.h> |
38 |
39 |
39 #include "videocollectionclient.h" |
40 #include "videocollectionclient.h" |
111 mLoader.reset(); |
112 mLoader.reset(); |
112 |
113 |
113 mActivated = false; |
114 mActivated = false; |
114 |
115 |
115 bool ok = false; |
116 bool ok = false; |
116 |
117 |
117 //Load the details view docml first |
118 //Load the details view docml first |
118 mLoader.load(VIDEO_DETAILS_DOCML, &ok); |
119 mLoader.load(VIDEO_DETAILS_DOCML, &ok); |
119 |
120 |
120 if(!ok) |
121 if(!ok) |
121 { |
122 { |
122 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load docml."); |
123 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load docml."); |
123 return; |
124 return; |
124 } |
125 } |
125 |
126 |
126 //Load portrait section by default as only vertical orientation is currently supported by videoplayer |
127 //Load portrait section by default as only vertical orientation is currently supported by videoplayer |
127 mLoader.load(VIDEO_DETAILS_DOCML, VIDEO_DETAILS_PORTRAIT, &ok); |
128 mLoader.load(VIDEO_DETAILS_DOCML, VIDEO_DETAILS_PORTRAIT, &ok); |
128 |
129 |
129 if(!ok) |
130 if(!ok) |
130 { |
131 { |
131 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load portrait view."); |
132 ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load portrait view."); |
132 return; |
133 return; |
133 } |
134 } |
174 // no deallocation needed for this since |
175 // no deallocation needed for this since |
175 // stackedwidget takes ownership |
176 // stackedwidget takes ownership |
176 mThumbLabel = new VideoDetailsLabel; |
177 mThumbLabel = new VideoDetailsLabel; |
177 mThumbLabel->setAlignment(Qt::AlignCenter); |
178 mThumbLabel->setAlignment(Qt::AlignCenter); |
178 mThumbLabel->setObjectName(VIDEO_DETAILS_OBJECT_NAME_THUMBLABEL); |
179 mThumbLabel->setObjectName(VIDEO_DETAILS_OBJECT_NAME_THUMBLABEL); |
179 |
180 |
180 connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot())); |
181 connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot())); |
181 |
182 |
182 thumbWidget->addWidget(mThumbLabel); |
183 thumbWidget->addWidget(mThumbLabel); |
183 |
184 |
184 // Load details title. |
185 // Load details title. |
209 } |
210 } |
210 |
211 |
211 // Create navigation keys. |
212 // Create navigation keys. |
212 mNavKeyBackAction = new HbAction(Hb::BackNaviAction); |
213 mNavKeyBackAction = new HbAction(Hb::BackNaviAction); |
213 mNavKeyBackAction->setObjectName(VIDEO_DETAILS_OBJECT_NAME_NAVKEY_BACK); |
214 mNavKeyBackAction->setObjectName(VIDEO_DETAILS_OBJECT_NAME_NAVKEY_BACK); |
214 |
215 |
215 if (!mThumbnailManager) |
216 if (!mThumbnailManager) |
216 { |
217 { |
217 mThumbnailManager = new ThumbnailManager(); |
218 mThumbnailManager = new ThumbnailManager(); |
218 } |
219 } |
219 |
220 |
220 connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)), |
221 connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)), |
221 this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int))); |
222 this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int))); |
222 |
223 |
223 HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET); |
224 HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET); |
224 if(!list) |
225 if(!list) |
225 { |
226 { |
226 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget."); |
227 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget."); |
227 return; |
228 return; |
228 } |
229 } |
229 |
230 |
230 list->setEnabledAnimations(HbAbstractItemView::None); |
231 list->setEnabledAnimations(HbAbstractItemView::None); |
231 } |
232 } |
232 |
233 |
233 // --------------------------------------------------------------------------- |
234 // --------------------------------------------------------------------------- |
234 // Destroy view |
235 // Destroy view |
312 |
313 |
313 VideoServices::TVideoService service = VideoServices::ENoService; |
314 VideoServices::TVideoService service = VideoServices::ENoService; |
314 if (mIsService && mVideoServices) |
315 if (mIsService && mVideoServices) |
315 { |
316 { |
316 service = mVideoServices->currentService(); |
317 service = mVideoServices->currentService(); |
317 |
318 |
318 HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0); |
319 HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0); |
319 mainWnd->currentView()->setTitle(mVideoServices->contextTitle()); |
320 mainWnd->currentView()->setTitle(mVideoServices->contextTitle()); |
320 } |
321 } |
321 |
322 |
322 HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON); |
323 HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON); |
323 if(!button) |
324 if(!button) |
324 { |
325 { |
325 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details button."); |
326 ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details button."); |
326 return; |
327 return; |
327 } |
328 } |
328 |
329 |
329 // Fix the size of the thumbnail, as that needs to be in 16:9 |
330 // Fix the size of the thumbnail, as that needs to be in 16:9 |
330 qreal width = button->size().width(); |
331 qreal width = button->size().width(); |
331 qreal height = width * 9 / 16; |
332 qreal height = width * 9 / 16; |
332 |
333 |
333 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
334 HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL); |
334 thumbWidget->setPreferredWidth(width); |
335 thumbWidget->setPreferredWidth(width); |
335 thumbWidget->setPreferredHeight(height); |
336 thumbWidget->setPreferredHeight(height); |
336 |
337 |
337 if (service == VideoServices::EUriFetcher) |
338 if (service == VideoServices::EUriFetcher) |
338 { |
339 { |
339 button->setText(hbTrId("txt_videos_button_attach")); |
340 HbIcon icon = HbIcon("qtg_mono_attach"); |
|
341 button->setIcon(icon); |
340 |
342 |
341 connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri())); |
343 connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri())); |
342 connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&))); |
344 connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&))); |
343 } |
345 } |
344 else |
346 else |
345 { |
347 { |
346 connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot())); |
348 connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot())); |
347 button->setText(hbTrId("txt_videos_opt_share")); |
349 |
|
350 HbIcon icon = HbIcon("qtg_mono_share"); |
|
351 button->setIcon(icon); |
348 } |
352 } |
349 |
353 |
350 connect(mainWnd, |
354 connect(mainWnd, |
351 SIGNAL(orientationChanged(Qt::Orientation)), |
355 SIGNAL(orientationChanged(Qt::Orientation)), |
352 this, SLOT(orientationChange(Qt::Orientation))); |
356 this, SLOT(orientationChange(Qt::Orientation))); |
592 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
596 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
593 QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyTitle); |
597 QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyTitle); |
594 |
598 |
595 if (variant.isValid()) |
599 if (variant.isValid()) |
596 { |
600 { |
597 QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg( |
601 QString text = HbParameterLengthLimiter(hbTrId("txt_videos_info_do_you_want_to_delete_1")). |
598 variant.toString()); |
602 arg(variant.toString()); |
599 |
603 |
600 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
604 HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); |
601 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
605 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
606 messageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); |
602 messageBox->setObjectName(VIDEO_DETAILS_OBJECT_NAME_DELETE_VIDEO); |
607 messageBox->setObjectName(VIDEO_DETAILS_OBJECT_NAME_DELETE_VIDEO); |
603 messageBox->open(this, SLOT(deleteVideoDialogFinished(HbAction *))); |
608 messageBox->open(this, SLOT(deleteVideoDialogFinished(int))); |
604 } |
609 } |
605 } |
610 } |
606 } |
611 } |
607 |
612 |
608 // --------------------------------------------------------------------------- |
613 // --------------------------------------------------------------------------- |
609 // deleteVideoDialogFinished |
614 // deleteVideoDialogFinished |
610 // --------------------------------------------------------------------------- |
615 // --------------------------------------------------------------------------- |
611 // |
616 // |
612 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(HbAction *action) |
617 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(int action) |
613 { |
618 { |
614 FUNC_LOG; |
619 FUNC_LOG; |
615 HbMessageBox *dlg = static_cast<HbMessageBox*>(sender()); |
|
616 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
620 QModelIndex modelIndex = mModel->indexOfId(mVideoId); |
617 if(action == dlg->actions().at(0) && modelIndex.isValid()) |
621 if(action == HbMessageBox::Yes && modelIndex.isValid()) |
618 { |
622 { |
619 deleteItem(modelIndex); |
623 deleteItem(modelIndex); |
620 } |
624 } |
621 } |
625 } |
622 |
626 |
800 HbIcon bottom = HbIcon("qtg_fr_popup_trans_b"); |
811 HbIcon bottom = HbIcon("qtg_fr_popup_trans_b"); |
801 HbIcon bottomRight = HbIcon("qtg_fr_popup_trans_br"); |
812 HbIcon bottomRight = HbIcon("qtg_fr_popup_trans_br"); |
802 |
813 |
803 int width = topLeft.width() + top.width() + topRight.width(); |
814 int width = topLeft.width() + top.width() + topRight.width(); |
804 int height = topLeft.height() + center.height() + bottomLeft.height(); |
815 int height = topLeft.height() + center.height() + bottomLeft.height(); |
805 |
816 |
806 mPlayIcon = QPixmap(width, height); |
817 mPlayIcon = QPixmap(width, height); |
807 |
818 |
808 QPainter painter(&mPlayIcon); |
819 QPainter painter(&mPlayIcon); |
809 painter.fillRect(mPlayIcon.rect(), Qt::white); |
820 painter.fillRect(mPlayIcon.rect(), Qt::white); |
810 |
821 |
811 painter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
822 painter.setCompositionMode(QPainter::CompositionMode_SourceOver); |
812 |
823 |
813 int x = 0; |
824 int x = 0; |
814 int y = 0; |
825 int y = 0; |
815 |
826 |
816 // Draw top |
827 // Draw top |
817 painter.drawPixmap(QPoint(x, y), topLeft.pixmap()); |
828 painter.drawPixmap(QPoint(x, y), topLeft.pixmap()); |
818 x += left.width(); |
829 x += left.width(); |
819 |
830 |
820 painter.drawPixmap(QPoint(x, y), top.pixmap()); |
831 painter.drawPixmap(QPoint(x, y), top.pixmap()); |
821 x += top.width(); |
832 x += top.width(); |
822 |
833 |
823 painter.drawPixmap(QPoint(x, y), topRight.pixmap()); |
834 painter.drawPixmap(QPoint(x, y), topRight.pixmap()); |
824 y += top.height(); |
835 y += top.height(); |
825 |
836 |
826 // Draw center |
837 // Draw center |
827 x = 0; |
838 x = 0; |
828 painter.drawPixmap(QPoint(x, y), left.pixmap()); |
839 painter.drawPixmap(QPoint(x, y), left.pixmap()); |
829 x += left.width(); |
840 x += left.width(); |
830 |
841 |
831 painter.drawPixmap(QPoint(x, y), center.pixmap()); |
842 painter.drawPixmap(QPoint(x, y), center.pixmap()); |
832 x += center.width(); |
843 x += center.width(); |
833 |
844 |
834 painter.drawPixmap(QPoint(x, y), right.pixmap()); |
845 painter.drawPixmap(QPoint(x, y), right.pixmap()); |
835 y += center.height(); |
846 y += center.height(); |
836 |
847 |
837 // Draw bottom |
848 // Draw bottom |
838 x = 0; |
849 x = 0; |
839 painter.drawPixmap(QPoint(x, y), bottomLeft.pixmap()); |
850 painter.drawPixmap(QPoint(x, y), bottomLeft.pixmap()); |
840 x += left.width(); |
851 x += left.width(); |
841 |
852 |
842 painter.drawPixmap(QPoint(x, y), bottom.pixmap()); |
853 painter.drawPixmap(QPoint(x, y), bottom.pixmap()); |
843 x += top.width(); |
854 x += top.width(); |
844 |
855 |
845 painter.drawPixmap(QPoint(x, y), bottomRight.pixmap()); |
856 painter.drawPixmap(QPoint(x, y), bottomRight.pixmap()); |
846 |
857 |
847 // Draw play icon |
858 // Draw play icon |
848 play.setSize(mPlayIcon.size()); |
859 play.setSize(mPlayIcon.size()); |
849 play.setColor(Qt::white); |
860 play.setColor(Qt::white); |
850 painter.drawPixmap(mPlayIcon.rect(), play.pixmap()); |
861 painter.drawPixmap(mPlayIcon.rect(), play.pixmap()); |
851 painter.end(); |
862 painter.end(); |
852 |
863 |
853 return mPlayIcon; |
864 return mPlayIcon; |
854 } |
865 } |
855 |
866 |
856 // --------------------------------------------------------------------------- |
867 // --------------------------------------------------------------------------- |
857 // findWidget |
868 // findWidget |