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