messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h
branchRCL_3
changeset 26 ebe688cedc25
equal deleted inserted replaced
25:fa1df4b99609 26: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 in univiewer.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef UNI_VIEWER_AUDIO_WIDGET_H
       
    19 #define UNI_VIEWER_AUDIO_WIDGET_H
       
    20 
       
    21 // FORWARD DECLARATIONS
       
    22 class UniViewerUtils;
       
    23 class UniMessageInfo;
       
    24 
       
    25 #include <HbPushButton>
       
    26 
       
    27 /**
       
    28  * @class UniViewerAudioWidget
       
    29  * @brief This widget is used to display audio content in univiewer.
       
    30  */
       
    31 class UniViewerAudioWidget: public HbPushButton
       
    32 {
       
    33 Q_OBJECT
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Constructor
       
    39      */
       
    40     explicit UniViewerAudioWidget(QGraphicsItem *parent = 0);
       
    41 
       
    42     /**
       
    43      * Destructor
       
    44      */
       
    45     ~UniViewerAudioWidget();
       
    46 
       
    47     /**
       
    48      * Populates the widget contents.
       
    49      * @param info Object information.
       
    50      */
       
    51     void populate(UniMessageInfo *info);
       
    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 private slots:
       
    74 
       
    75     /**
       
    76      * Handles short tap event.
       
    77      */
       
    78     void handleShortTap();
       
    79 
       
    80     /**
       
    81      * Handles long tap event.
       
    82      * @param position Scene coordinates of tap.
       
    83      */
       
    84     void handleLongTap(const QPointF &position);
       
    85 
       
    86     /**
       
    87      * Handles opening of media.
       
    88      */
       
    89     void handleOpen();
       
    90 
       
    91     /**
       
    92      * Handles saving of media.
       
    93      */
       
    94     void handleSave();
       
    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      * UniViewerUtils object.
       
   106      * Own
       
   107      */
       
   108     UniViewerUtils *mViewerUtils;
       
   109 
       
   110     /**
       
   111      * Media file path.
       
   112      */
       
   113     QString mMediaPath;
       
   114 
       
   115     /**
       
   116      * Mime type of media.
       
   117      */
       
   118     QString mMimeType;
       
   119 
       
   120     /**
       
   121      * True if valid media duration else false.
       
   122      */
       
   123     bool mValidMediaDuration;
       
   124 };
       
   125 
       
   126 #endif //UNI_VIEWER_AUDIO_WIDGET_H
       
   127 // EOF