--- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Fri Apr 16 14:51:30 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu May 13 21:30:19 2010 +0300
@@ -32,7 +32,7 @@
#include <hbmessagebox.h>
#include <hbnotificationdialog.h>
-#include <shareuidialog.h>
+#include <shareui.h>
#include "cxeviewfindercontrol.h"
#include "cxuienums.h"
@@ -136,14 +136,20 @@
// get toolbar pointers from the documentloader
widget = mDocumentLoader->findWidget(STILL_POST_CAPTURE_TOOLBAR);
+ // This resize is a workaround to get toolbar shown correctly.
+ widget->resize(60, 300);
mStillToolbar = qobject_cast<HbToolBar *> (widget);
CX_DEBUG_ASSERT(mStillToolbar);
widget = mDocumentLoader->findWidget(VIDEO_POST_CAPTURE_TOOLBAR);
+ // This resize is a workaround to get toolbar shown correctly.
+ widget->resize(60, 300);
mVideoToolbar = qobject_cast<HbToolBar *> (widget);
CX_DEBUG_ASSERT(mVideoToolbar);
widget = mDocumentLoader->findWidget(EMBEDDED_POST_CAPTURE_TOOLBAR);
+ // This resize is a workaround to get toolbar shown correctly.
+ widget->resize(60, 300);
mEmbeddedToolbar = qobject_cast<HbToolBar *> (widget);
CX_DEBUG_ASSERT(mEmbeddedToolbar);
@@ -204,9 +210,11 @@
*/
void CxuiPostcaptureView::playVideo()
{
+
launchNotSupportedNotification();
//! @todo needs an implementation
CX_DEBUG_IN_FUNCTION();
+
}
// ---------------------------------------------------------------------------
@@ -218,18 +226,38 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QString filename = getCurrentFilename();
- bool ret = false;
-
hideControls();
if (mEngine->mode() == Cxe::VideoMode) {
- ret = HbMessageBox::question(hbTrId("txt_cam_other_delete_video_clip"));
+ HbMessageBox::question(hbTrId("txt_cam_other_delete_video_clip"),
+ this,
+ SLOT(handleDeleteDialogClosed(HbAction*)));
} else {
- ret = HbMessageBox::question(hbTrId("txt_cam_other_delete_image"));
+ HbMessageBox::question(hbTrId("txt_cam_other_delete_image"),
+ this,
+ SLOT(handleDeleteDialogClosed(HbAction*)));
}
- if (ret) {
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// ---------------------------------------------------------------------------
+// CxuiPostcaptureView::handleDeleteDialogClosed
+//
+// ---------------------------------------------------------------------------
+//
+void CxuiPostcaptureView::handleDeleteDialogClosed(HbAction *action)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ hideControls();
+
+ HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
+
+ // check that it was "primary action" that closed the dialog
+ if (dlg && dlg->actions().at(0) == action) {
+ // User confirmed delete
+ QString filename = getCurrentFilename();
QFileInfo fileInfo(filename);
if (fileInfo.exists()) {
//! @todo
@@ -246,32 +274,30 @@
}
}
- CX_DEBUG_EXIT_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
Slot for handling image/video sharing.
*/
void CxuiPostcaptureView::launchShare()
{
CX_DEBUG_ENTER_FUNCTION();
-
+
stopTimers();
- stopViewfinder();
releaseCamera();
-
+
QString filename = getCurrentFilename();
-
- QVariantList filelist;
- filelist.append(QVariant(filename));
-
+
+ QStringList filelist;
+ filelist.append(filename);
+
ShareUi dialog;
- dialog.init(filelist, true);
-
+ dialog.send(filelist, true);
+
showControls();
-
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -284,16 +310,16 @@
{
CX_DEBUG_ENTER_FUNCTION();
- // Cannot return to post-capture while stopping in video mode
+ // Cannot return to pre-capture while stopping in video mode
if (mEngine->mode() != Cxe::VideoMode ||
mEngine->videoCaptureControl().state() != CxeVideoCaptureControl::Stopping) {
stopTimers();
+ // Re-enabling starting timers the next time we enter post capture view.
+ mTimersStarted = false;
+
// Make sure engine prepares for new image/video if necessary
mEngine->initMode(mEngine->mode());
- // enables starting of timers in postcaptureview
- mTimersStarted = false;
-
// Switch to pre-capture view
emit changeToPrecaptureView();
}
@@ -414,7 +440,6 @@
bool CxuiPostcaptureView::eventFilter(QObject *object, QEvent *event)
{
Q_UNUSED(object)
-
bool eventWasConsumed = false;
switch (event->type())
@@ -435,16 +460,13 @@
}
/*!
-* Paint event.
-* Used for performance tracing (snapshot latency).
+* Paint method.
+* Used for performance tracing purposes.
*/
-bool CxuiPostcaptureView::event(QEvent *event)
+void CxuiPostcaptureView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- bool processed(HbView::event(event));
- if (event && event->type() == QEvent::Paint) {
OstTrace0(camerax_performance, CXUIPOSTCAPTUREVIEW_SNAPSHOT_DRAW, "msg: e_CX_SHOT_TO_SNAPSHOT 0");
- }
- return processed;
+ QGraphicsWidget::paint(painter, option, widget);
}
// ---------------------------------------------------------------------------
@@ -454,8 +476,8 @@
//
void CxuiPostcaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
-
- if (event->type() == QEvent::GraphicsSceneMousePress) {
+ //! @todo temporary workaround for title bar mouse event handling bug
+ if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) {
mPostcaptureTimer.stop();
toggleControls();
event->accept();
@@ -501,6 +523,9 @@
// remove event filter to disable unnecessary actions
QCoreApplication::instance()->removeEventFilter(this);
+ // Clear the snapshot.
+ mImageLabel->setIcon(HbIcon());
+
stopTimers();
// Hide controls to make sure title bar reacts to show()
// when this view is reactivated.
@@ -590,13 +615,7 @@
void CxuiPostcaptureView::launchNotSupportedNotification()
{
CX_DEBUG_ENTER_FUNCTION();
-
- // Instantiate a popup
- HbNotificationDialog note;
- note.setTitle("Notification");
- note.setText("Not supported yet");
- note.exec();
-
+ HbNotificationDialog::launchDialog("Notification", "Not supported yet");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -727,7 +746,13 @@
mPostcaptureTimer.stop();
mStopViewfinderTimer.stop();
- mTimersStarted = false;
+ // Note: mTimersStarted is intentionally not reset here.
+ // Once the timers are stopped, they are not to be started again until
+ // we come from precapture view again.
+ // E.g. returning from background could otherwise restart the timers and
+ // if post-capture timer would be on, user could be confused: camera
+ // shows up with post-capture view, after couple seconds it disappears
+ // and we return to pre-capture view. That's not what we want.
CX_DEBUG_EXIT_FUNCTION();
}