messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h
changeset 34 84197e66a4bd
child 56 f42d9a78f435
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: This widget displays the pixmap content.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H
       
    19 #define MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H
       
    20 
       
    21 #include <HbIconItem>
       
    22 
       
    23 // FORWARD DECLARATIONS
       
    24 class MsgUnifiedEditorUtils;
       
    25 
       
    26 /**
       
    27  * This widget displays the pixmap content.
       
    28  */
       
    29 class MsgUnifiedEditorPixmapWidget: public HbIconItem
       
    30 {
       
    31 Q_OBJECT
       
    32 
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Constructor
       
    37      */
       
    38     MsgUnifiedEditorPixmapWidget(QGraphicsItem *parent = 0);
       
    39 
       
    40     /**
       
    41      * Destructor
       
    42      */
       
    43     ~MsgUnifiedEditorPixmapWidget();
       
    44 
       
    45     /**
       
    46      * Sets the pixmap content to be displayed.
       
    47      * @param imagePath File path of the image.
       
    48      */
       
    49     void populate(const QString &imagePath);
       
    50 
       
    51 signals:
       
    52 
       
    53     /**
       
    54      * Signal emitted when widget is clicked.
       
    55      * @param mediaPath File path of the media.
       
    56      */
       
    57     void shortTap(const QString &mediaPath);
       
    58 
       
    59     /**
       
    60      * Signal emitted when widget is long tapped.
       
    61      * @param position Scene coordinates of tap.
       
    62      */
       
    63     void longTap(const QPointF &position);
       
    64     
       
    65     /**
       
    66      * Emitted when remove action is triggered.
       
    67      */
       
    68     void remove();
       
    69 
       
    70 protected:
       
    71 
       
    72     /**
       
    73      * Event handler for gesture events.
       
    74      * Reimplemented from HbWidgetBase.
       
    75      * @see HbWidgetBase
       
    76      */
       
    77     virtual void gestureEvent(QGestureEvent *event);
       
    78 
       
    79 private slots:
       
    80 
       
    81     /**
       
    82      * Handles opening of media.
       
    83      */
       
    84     void handleOpen();
       
    85     
       
    86     /**
       
    87      * Handles removing of media.
       
    88      */
       
    89     void handleRemove(); 
       
    90     
       
    91     /**
       
    92      * Handles opening of details view.
       
    93      */
       
    94     void viewDetails();
       
    95     
       
    96     /**
       
    97      * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
       
    98      * events back to back.  
       
    99      */
       
   100     void regrabGesture();
       
   101 
       
   102 private:
       
   103 
       
   104     /**
       
   105      * Handles short tap event.
       
   106      */
       
   107     void handleShortTap();
       
   108 
       
   109     /**
       
   110      * Handles long tap event.
       
   111      * @param position Scene coordinates of tap.
       
   112      */
       
   113     void handleLongTap(const QPointF &position);
       
   114 
       
   115 private:
       
   116 
       
   117     /**
       
   118      * MsgUnifiedEditorUtils object.
       
   119      * Own
       
   120      */
       
   121     MsgUnifiedEditorUtils *mEditorUtils;
       
   122 
       
   123     /**
       
   124      * Pixmap file path being set.
       
   125      */
       
   126     QString mPixmapPath;
       
   127 };
       
   128 
       
   129 #endif /* MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H */
       
   130 
       
   131 // EOF