mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainergenres.cpp
changeset 19 4e84c994a771
child 20 82baf59ce8dd
equal deleted inserted replaced
5:2a40e88564c8 19:4e84c994a771
       
     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: Music Player collection container definition - Genres.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <QtCore>
       
    20 
       
    21 #include <hbdocumentloader.h>
       
    22 #include <hblistview.h>
       
    23 
       
    24 #include "mpcollectioncontainergenres.h"
       
    25 #include "mptrace.h"
       
    26 
       
    27 /*!
       
    28     \class MpCollectionContainerGenres
       
    29     \brief Music Player collection container definition - Genres.
       
    30 
       
    31     'Genres' collection container implements the interface specified
       
    32     by MpCollectionContainer. It provides a layout and widgets for the
       
    33     'Genres' view.
       
    34 
       
    35     This container handles the following contexts:
       
    36     \li ECollectionContextGenres
       
    37     \li ECollectionContextGenreSongs
       
    38 
       
    39     \sa MpCollectionContainer
       
    40 */
       
    41 
       
    42 /*!
       
    43  Constructs the collection container.
       
    44  */
       
    45 MpCollectionContainerGenres::MpCollectionContainerGenres( HbDocumentLoader *loader, QGraphicsItem *parent )
       
    46     : MpCollectionListContainer(loader, parent)
       
    47 {
       
    48     TX_LOG
       
    49 }
       
    50 
       
    51 /*!
       
    52  Destructs the collection container.
       
    53  */
       
    54 MpCollectionContainerGenres::~MpCollectionContainerGenres()
       
    55 {
       
    56     TX_ENTRY
       
    57     delete mList;
       
    58     TX_EXIT
       
    59 }
       
    60 
       
    61 /*!
       
    62  Sets up the container by organizing widgets according to its layout.
       
    63 
       
    64  \reimp
       
    65  */
       
    66 void MpCollectionContainerGenres::setupContainer()
       
    67 {
       
    68     TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext);
       
    69     if ( !mList ) {
       
    70         bool ok = false;
       
    71         mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "genre", &ok);
       
    72 
       
    73         if ( !ok ) {
       
    74             TX_LOG_ARGS("Error: invalid xml file.");
       
    75             Q_ASSERT_X(ok, "MpCollectionContainerGenres::setupContainer", "invalid xml file");
       
    76         }
       
    77 
       
    78         QGraphicsWidget *widget;
       
    79         widget = mDocumentLoader->findWidget(QString("genreList"));
       
    80         mList = qobject_cast<HbListView*>(widget);
       
    81         initializeList();
       
    82     }
       
    83     TX_EXIT
       
    84 }
       
    85