mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackwidget/stub/src/mpalbumcoverwidget.cpp
changeset 47 4cc1412daed0
equal deleted inserted replaced
45:612c4815aebe 47:4cc1412daed0
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Album Cover Widget.
       
    15 *
       
    16 */
       
    17 #include <QPainter>
       
    18 #include <QGraphicsSceneMouseEvent>
       
    19 
       
    20 
       
    21 #include "mpalbumcoverwidget.h"
       
    22 
       
    23 
       
    24 /*!
       
    25     Constructs the album cover widget
       
    26  */
       
    27 MpAlbumCoverWidget::MpAlbumCoverWidget( QGraphicsItem *parent ) : 
       
    28     HbWidget( parent )
       
    29 {
       
    30     setFlag( QGraphicsItem::ItemHasNoContents, false );
       
    31     grabGesture(Qt::TapGesture);
       
    32 }
       
    33 
       
    34 /*!
       
    35  Destructs the album cover widget.
       
    36  */
       
    37 MpAlbumCoverWidget::~MpAlbumCoverWidget()
       
    38 {
       
    39 }
       
    40 
       
    41 /*!
       
    42     Sets the \a icon as current album cover.
       
    43  */
       
    44 void MpAlbumCoverWidget::setIcon( const HbIcon &icon )
       
    45 {
       
    46     if (icon != mIcon) {
       
    47         mIcon = icon;
       
    48         mPixmap = QPixmap();
       
    49         update();
       
    50     }
       
    51 }
       
    52 
       
    53 /*!
       
    54     Sets the \a icon as default cover, to be used in case the album cover is null icon.
       
    55  */
       
    56 void MpAlbumCoverWidget::setDefaultIcon( const HbIcon &icon )
       
    57 {
       
    58     mDefaultIcon = icon;
       
    59     update();
       
    60 }
       
    61 
       
    62 //EOF