messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     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 is used to display audio content.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
       
    19 #define MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
       
    20 
       
    21 // FORWARD DECLARATIONS
       
    22 class MsgUnifiedEditorUtils;
       
    23 
       
    24 #include <HbPushButton>
       
    25 
       
    26 /**
       
    27  * @class MsgUniFiedEditorAudioWidget
       
    28  * @brief This widget is used to display audio content in univiewer.
       
    29  */
       
    30 class MsgUniFiedEditorAudioWidget: public HbPushButton
       
    31 {
       
    32 Q_OBJECT
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Constructor
       
    38      */
       
    39     explicit MsgUniFiedEditorAudioWidget(QGraphicsItem *parent = 0);
       
    40 
       
    41     /**
       
    42      * Destructor
       
    43      */
       
    44     ~MsgUniFiedEditorAudioWidget();
       
    45 
       
    46     /**
       
    47      * Populates the widget contents.
       
    48      * @param mimeType Mime type of media.
       
    49      * @param filePath File path of media.
       
    50      */
       
    51     void populate(const QString &filePath);
       
    52 
       
    53     /**
       
    54      * Overloaded from base class.
       
    55      * @see HbPushButton
       
    56      */
       
    57     void setStretched(bool stretched = true);
       
    58 
       
    59 signals:
       
    60 
       
    61     /**
       
    62      * Signal emitted when widget is clicked.
       
    63      * @param mediaPath File path of the media.
       
    64      */
       
    65     void shortTap(const QString &mediaPath);
       
    66 
       
    67     /**
       
    68      * Signal emitted when widget is long tapped.
       
    69      * @param position Scene coordinates of tap.
       
    70      */
       
    71     void longTap(const QPointF &position);
       
    72     
       
    73     /**
       
    74      * Emitted when remove action is triggered.
       
    75      */
       
    76     void remove();
       
    77 
       
    78 private slots:
       
    79 
       
    80     /**
       
    81      * Handles short tap event.
       
    82      */
       
    83     void handleShortTap();
       
    84 
       
    85     /**
       
    86      * Handles long tap event.
       
    87      * @param position Scene coordinates of tap.
       
    88      */
       
    89     void handleLongTap(const QPointF &position);
       
    90 
       
    91     /**
       
    92      * Handles opening of media.
       
    93      */
       
    94     void handleOpen();
       
    95 
       
    96     /**
       
    97      * Handles removing of media.
       
    98      */
       
    99     void handleRemove();
       
   100     
       
   101     /**
       
   102      * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
       
   103      * events back to back.  
       
   104      */
       
   105     void regrabGesture();
       
   106 
       
   107 private:
       
   108 
       
   109     /**
       
   110      * MsgUnifiedEditorUtils object.
       
   111      * Own
       
   112      */
       
   113     MsgUnifiedEditorUtils *mEditorUtils;
       
   114 
       
   115     /**
       
   116      * Media file path.
       
   117      */
       
   118     QString mMediaPath;
       
   119 
       
   120     /**
       
   121      * True if valid media duration else false.
       
   122      */
       
   123     bool mValidMediaDuration;
       
   124 };
       
   125 
       
   126 #endif //MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
       
   127 // EOF