mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp
author hgs
Fri, 06 Aug 2010 16:51:36 -0500
changeset 47 4cc1412daed0
parent 45 612c4815aebe
child 51 560ce2306a17
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
36
hgs
parents: 35
diff changeset
     4
* This component and the accompanying materials are made available
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description: Music Player details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
35
hgs
parents: 34
diff changeset
    17
#include <QWebSettings>
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <QGraphicsWidget>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <QGraphicsLayoutItem>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <QUrl>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <QDomElement>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <QList>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <QFile>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <QGraphicsLinearLayout>
35
hgs
parents: 34
diff changeset
    25
#include <QSizeF>
47
hgs
parents: 45
diff changeset
    26
#include <QDesktopServices>
36
hgs
parents: 35
diff changeset
    27
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <hbinstance.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include <hbmainwindow.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include <hbaction.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include <hblabel.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include <hbgroupbox.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include <hbdocumentloader.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <hbwidget.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <hbpushbutton.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include <hbpopup.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include <hbdialog.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include <hblistwidget.h>
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include <hblistwidgetitem.h>
35
hgs
parents: 34
diff changeset
    41
#include <hblistviewitem.h>
hgs
parents: 34
diff changeset
    42
#include <hbprogressbar.h>
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "mpdetailsview.h"
35
hgs
parents: 34
diff changeset
    45
#include "mpenginefactory.h"
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
#include "mpcommondefs.h"
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
#include "mpsongdata.h"
35
hgs
parents: 34
diff changeset
    48
#include "mpsettingsmanager.h"
hgs
parents: 34
diff changeset
    49
#include "mpquerymanager.h"
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#include "mptrace.h"
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
35
hgs
parents: 34
diff changeset
    52
45
hgs
parents: 43
diff changeset
    53
const int KOneKiloByteInBytes = 1024;
hgs
parents: 43
diff changeset
    54
const int KOneMegabyteInBytes = 1048576;        
hgs
parents: 43
diff changeset
    55
const int KOneGigaByteInBytes = 134217728;        
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
 Constructor
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
MpDetailsView::MpDetailsView()
35
hgs
parents: 34
diff changeset
    61
    : mMpEngine( 0 ),
hgs
parents: 34
diff changeset
    62
      mSongData( 0 ),
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
      mActivated( false ),
35
hgs
parents: 34
diff changeset
    64
      mSoftKeyBack( 0 ),
36
hgs
parents: 35
diff changeset
    65
      mSongText( 0 ),
hgs
parents: 35
diff changeset
    66
      mAlbumText( 0 ),
hgs
parents: 35
diff changeset
    67
      mArtistText( 0 ),
hgs
parents: 35
diff changeset
    68
      mAlbumArt( 0 ),
hgs
parents: 35
diff changeset
    69
      mSongDetailsGroupBox(0),
hgs
parents: 35
diff changeset
    70
      mInspireMeGroupBox(0),
hgs
parents: 35
diff changeset
    71
      mDocumentLoader( 0 ),
hgs
parents: 35
diff changeset
    72
      mDetailList(0),
hgs
parents: 35
diff changeset
    73
      mInspireList(0),
hgs
parents: 35
diff changeset
    74
      mInspireMeProgressBar(0),
35
hgs
parents: 34
diff changeset
    75
      mMpQueryManager( 0 ),
hgs
parents: 34
diff changeset
    76
      mInspireMeQueryOngoing( false ),
47
hgs
parents: 45
diff changeset
    77
      mInspireMeQueryRendered( false )
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    bool widgetsOk = false;
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    mDocumentLoader = new HbDocumentLoader();
36
hgs
parents: 35
diff changeset
    83
35
hgs
parents: 34
diff changeset
    84
    TX_LOG_ARGS("Document loader created")
hgs
parents: 34
diff changeset
    85
    if(!mDocumentLoader) {
hgs
parents: 34
diff changeset
    86
        TX_LOG_ARGS( "MpDetailsView() Error: HbDocumentLoader not constructed" );
36
hgs
parents: 35
diff changeset
    87
        return;
35
hgs
parents: 34
diff changeset
    88
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
35
hgs
parents: 34
diff changeset
    90
    TX_LOG_ARGS("Loading :/mpdetailsviewdocml/mpdetailsview.docml")
hgs
parents: 34
diff changeset
    91
    mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), &widgetsOk );
hgs
parents: 34
diff changeset
    92
    if(!widgetsOk) {
hgs
parents: 34
diff changeset
    93
        TX_LOG_ARGS( "MpDetailsView() Error: invalid mpdetailsview.docml" );
36
hgs
parents: 35
diff changeset
    94
        return;
35
hgs
parents: 34
diff changeset
    95
    }
36
hgs
parents: 35
diff changeset
    96
35
hgs
parents: 34
diff changeset
    97
    TX_LOG_ARGS("Loaded :/mpdetailsviewdocml/mpdetailsview.docml")
36
hgs
parents: 35
diff changeset
    98
    QGraphicsWidget *widget = 0;
hgs
parents: 35
diff changeset
    99
35
hgs
parents: 34
diff changeset
   100
    widget = mDocumentLoader->findWidget( QString("content") );
hgs
parents: 34
diff changeset
   101
    TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) );
36
hgs
parents: 35
diff changeset
   102
    setWidget(  qobject_cast<HbWidget *>(widget) );
35
hgs
parents: 34
diff changeset
   103
hgs
parents: 34
diff changeset
   104
    widget = mDocumentLoader->findWidget( QString("trackTitle") );
hgs
parents: 34
diff changeset
   105
    mSongText = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   106
    TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) );
36
hgs
parents: 35
diff changeset
   107
35
hgs
parents: 34
diff changeset
   108
    widget = mDocumentLoader->findWidget( QString("artist") );
hgs
parents: 34
diff changeset
   109
    mArtistText = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   110
    TX_LOG_ARGS("MpDetailsView() <artist> widget found mArtistText: " << (int)(mArtistText) );
36
hgs
parents: 35
diff changeset
   111
35
hgs
parents: 34
diff changeset
   112
    widget = mDocumentLoader->findWidget( QString("albumName") );
hgs
parents: 34
diff changeset
   113
    mAlbumText = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   114
    TX_LOG_ARGS("MpDetailsView() <albumName> widget found mAlbumText: " << (int)(mAlbumText) );
hgs
parents: 34
diff changeset
   115
hgs
parents: 34
diff changeset
   116
    widget = mDocumentLoader->findWidget( QString("albumArt") );
hgs
parents: 34
diff changeset
   117
    mAlbumArt = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   118
    TX_LOG_ARGS("MpDetailsView() <albumArt> widget found mAlbumArt: " << (int)(mAlbumArt) );
36
hgs
parents: 35
diff changeset
   119
35
hgs
parents: 34
diff changeset
   120
    widget = mDocumentLoader->findWidget( QString("songDetails") );
hgs
parents: 34
diff changeset
   121
    mSongDetailsGroupBox = qobject_cast<HbGroupBox *>(widget);
hgs
parents: 34
diff changeset
   122
    TX_LOG_ARGS("MpDetailsView() <songDetails> widget found mSongDetailsGroupBox: " << (int)(mSongDetailsGroupBox) );
36
hgs
parents: 35
diff changeset
   123
35
hgs
parents: 34
diff changeset
   124
    widget = mDocumentLoader->findWidget( QString("songDetailsListWidget") );
hgs
parents: 34
diff changeset
   125
    mDetailList = qobject_cast<HbListWidget *>(widget);
hgs
parents: 34
diff changeset
   126
    TX_LOG_ARGS("MpDetailsView() <songDetailsListWidget> widget found mDetailList: " << (int)(mDetailList) );
36
hgs
parents: 35
diff changeset
   127
35
hgs
parents: 34
diff changeset
   128
    widget = mDocumentLoader->findWidget( QString("inspireMeGroupBox") );
hgs
parents: 34
diff changeset
   129
    mInspireMeGroupBox = qobject_cast<HbGroupBox *>(widget);
hgs
parents: 34
diff changeset
   130
    TX_LOG_ARGS("MpDetailsView() <inspireMeGroupBox> widget found mInspireMeGroupBox: " << (int)(mInspireMeGroupBox) );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
35
hgs
parents: 34
diff changeset
   132
    widget = mDocumentLoader->findWidget( QString("inspireListWidget") );
hgs
parents: 34
diff changeset
   133
    mInspireList = qobject_cast<HbListWidget *>(widget);
hgs
parents: 34
diff changeset
   134
    TX_LOG_ARGS("MpDetailsView() <inspireListWidget> widget found mInspireList: " << (int)(mInspireList) );
36
hgs
parents: 35
diff changeset
   135
35
hgs
parents: 34
diff changeset
   136
    widget = mDocumentLoader->findWidget( QString("inspireMeProgressBar") );
hgs
parents: 34
diff changeset
   137
    mInspireMeProgressBar = qobject_cast<HbProgressBar *>(widget);
hgs
parents: 34
diff changeset
   138
    TX_LOG_ARGS("MpDetailsView() <inspireMeProgressBar> widget found mInspireMeProgressBar: " << (int)(mInspireMeProgressBar) );
36
hgs
parents: 35
diff changeset
   139
    
hgs
parents: 35
diff changeset
   140
    // load section HideInspireMe if no ovi store suport
hgs
parents: 35
diff changeset
   141
    bool loadingSectionOk = false;
hgs
parents: 35
diff changeset
   142
    mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), QString( "ShowInspireMe" ), &loadingSectionOk );    
hgs
parents: 35
diff changeset
   143
    if( loadingSectionOk ) {
hgs
parents: 35
diff changeset
   144
        TX_LOG_ARGS( "Loading ShowInspireMe section is successful." );
47
hgs
parents: 45
diff changeset
   145
    }
hgs
parents: 45
diff changeset
   146
    else {
36
hgs
parents: 35
diff changeset
   147
        TX_LOG_ARGS( "Loading ShowInspireMe section fails." );
hgs
parents: 35
diff changeset
   148
    }
hgs
parents: 35
diff changeset
   149
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
 Destructs the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
MpDetailsView::~MpDetailsView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
{
36
hgs
parents: 35
diff changeset
   158
    TX_ENTRY
47
hgs
parents: 45
diff changeset
   159
    saveGroupBoxStates();
36
hgs
parents: 35
diff changeset
   160
    delete mSoftKeyBack;
hgs
parents: 35
diff changeset
   161
    delete mDocumentLoader;
35
hgs
parents: 34
diff changeset
   162
    delete mMpQueryManager;
hgs
parents: 34
diff changeset
   163
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
35
hgs
parents: 34
diff changeset
   167
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
 Initializes the details view. Allocates all resources needed by the view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
void MpDetailsView::initializeView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
{
36
hgs
parents: 35
diff changeset
   173
    TX_ENTRY
hgs
parents: 35
diff changeset
   174
hgs
parents: 35
diff changeset
   175
    mSoftKeyBack = new HbAction( Hb::BackNaviAction, this );
hgs
parents: 35
diff changeset
   176
35
hgs
parents: 34
diff changeset
   177
    mMpEngine = MpEngineFactory::sharedEngine();
hgs
parents: 34
diff changeset
   178
    mSongData = mMpEngine->songData();
36
hgs
parents: 35
diff changeset
   179
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
    // TODO: might need later
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
    setupMenu();
36
hgs
parents: 35
diff changeset
   182
    mMpQueryManager = new MpQueryManager();
hgs
parents: 35
diff changeset
   183
35
hgs
parents: 34
diff changeset
   184
    connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) );
36
hgs
parents: 35
diff changeset
   185
    connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) );
35
hgs
parents: 34
diff changeset
   186
    connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) );
36
hgs
parents: 35
diff changeset
   187
    connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) );
47
hgs
parents: 45
diff changeset
   188
    connect( mDetailList, SIGNAL( pressed( HbListWidgetItem  * ) ), this, SLOT( handleListItemSelected( HbListWidgetItem  * ) ) );
36
hgs
parents: 35
diff changeset
   189
    connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) );
hgs
parents: 35
diff changeset
   190
    connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) );
47
hgs
parents: 45
diff changeset
   191
    connect( mMpQueryManager, SIGNAL(inspireMeItemsMetadataRetrieved()), this, SLOT(renderInspireMeMetadata()));
hgs
parents: 45
diff changeset
   192
    connect( mMpQueryManager, SIGNAL(inspireMeItemAlbumArtReady()), this, SLOT(renderInspireMeAlbumArts()));    
hgs
parents: 45
diff changeset
   193
    connect( mMpQueryManager, SIGNAL(localMusicStoreRetrieved(bool)), this, SLOT(queryInspireMe(bool)), Qt::QueuedConnection);
hgs
parents: 45
diff changeset
   194
    connect( mMpQueryManager, SIGNAL(localMusicStoreRetrievalError()), this, SLOT(abortInspireMeProcess()));
hgs
parents: 45
diff changeset
   195
    connect( mMpQueryManager, SIGNAL(inspireMeItemsRetrievalError()), this, SLOT(queryLocalMusicStore()), Qt::QueuedConnection);
35
hgs
parents: 34
diff changeset
   196
47
hgs
parents: 45
diff changeset
   197
    TX_EXIT
hgs
parents: 45
diff changeset
   198
}
36
hgs
parents: 35
diff changeset
   199
47
hgs
parents: 45
diff changeset
   200
void MpDetailsView::queryLocalMusicStore()
hgs
parents: 45
diff changeset
   201
{
hgs
parents: 45
diff changeset
   202
    TX_ENTRY
hgs
parents: 45
diff changeset
   203
    mMpQueryManager->reset();
hgs
parents: 45
diff changeset
   204
    mMpQueryManager->queryLocalMusicStore(); 
hgs
parents: 45
diff changeset
   205
    TX_EXIT        
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
 Activates the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
void MpDetailsView::activateView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
{
36
hgs
parents: 35
diff changeset
   213
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   214
    setNavigationAction( mSoftKeyBack );
36
hgs
parents: 35
diff changeset
   215
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
    mActivated = true;
47
hgs
parents: 45
diff changeset
   217
    TX_LOG_ARGS( "InspireMeVal: " << MpSettingsManager::inspireMe() );
hgs
parents: 45
diff changeset
   218
    TX_LOG_ARGS( "SongDetailsGbVal: " << MpSettingsManager::songDetailsGb() );
hgs
parents: 45
diff changeset
   219
    mInspireMeGroupBox->setCollapsed(!MpSettingsManager::inspireMe());
hgs
parents: 45
diff changeset
   220
    mSongDetailsGroupBox->setCollapsed(!MpSettingsManager::songDetailsGb());
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
 Deactivates the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
void MpDetailsView::deactivateView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
{
36
hgs
parents: 35
diff changeset
   229
    TX_ENTRY
47
hgs
parents: 45
diff changeset
   230
    saveGroupBoxStates();
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    setNavigationAction( 0 );
36
hgs
parents: 35
diff changeset
   232
    mActivated = false;
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
47
hgs
parents: 45
diff changeset
   236
void MpDetailsView::saveGroupBoxStates()
hgs
parents: 45
diff changeset
   237
{
hgs
parents: 45
diff changeset
   238
    TX_ENTRY
hgs
parents: 45
diff changeset
   239
    if (mInspireMeGroupBox->isCollapsed() ) {
hgs
parents: 45
diff changeset
   240
        MpSettingsManager::setInspireMe(false);
hgs
parents: 45
diff changeset
   241
    }
hgs
parents: 45
diff changeset
   242
    else {
hgs
parents: 45
diff changeset
   243
        MpSettingsManager::setInspireMe(true);
hgs
parents: 45
diff changeset
   244
    }
hgs
parents: 45
diff changeset
   245
hgs
parents: 45
diff changeset
   246
    if (mSongDetailsGroupBox->isCollapsed() ) {
hgs
parents: 45
diff changeset
   247
        MpSettingsManager::setSongDetailsGb(false);
hgs
parents: 45
diff changeset
   248
    }
hgs
parents: 45
diff changeset
   249
    else {
hgs
parents: 45
diff changeset
   250
        MpSettingsManager::setSongDetailsGb(true);
hgs
parents: 45
diff changeset
   251
    }
hgs
parents: 45
diff changeset
   252
    TX_EXIT      
hgs
parents: 45
diff changeset
   253
}
hgs
parents: 45
diff changeset
   254
 
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
 Setup the menu.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
void MpDetailsView::setupMenu()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
 Slot to handle back command from softkey.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
void MpDetailsView::back()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
{
36
hgs
parents: 35
diff changeset
   270
    TX_ENTRY
43
hgs
parents: 37
diff changeset
   271
    emit command( MpCommon::ActivatePreviousView );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
 Slot to handle Album art changed.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
void MpDetailsView::albumArtChanged( )
36
hgs
parents: 35
diff changeset
   279
{
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   281
    HbIcon icon;
hgs
parents: 34
diff changeset
   282
    mSongData->albumArt( icon );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
    mAlbumArt->setIcon( icon );
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
/*!
35
hgs
parents: 34
diff changeset
   288
 Slot to handle network error.
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
 */
47
hgs
parents: 45
diff changeset
   290
void MpDetailsView::abortInspireMeProcess()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
    TX_ENTRY
47
hgs
parents: 45
diff changeset
   293
    mInspireMeProgressBar->hide();    
hgs
parents: 45
diff changeset
   294
    mInspireMeGroupBox->setCollapsed( true );    
35
hgs
parents: 34
diff changeset
   295
    mInspireMeQueryOngoing = false;
hgs
parents: 34
diff changeset
   296
    mInspireMeQueryRendered = false;
47
hgs
parents: 45
diff changeset
   297
    // ensure that we dont get callbacks from previous queries. Especially true,
hgs
parents: 45
diff changeset
   298
    // if details view is actived with a quick song change again
hgs
parents: 45
diff changeset
   299
    mMpQueryManager->reset();
hgs
parents: 45
diff changeset
   300
    mInspireList->clear();
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
 Render inspireme groupbox after album arts downloaded
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
 */
47
hgs
parents: 45
diff changeset
   307
void MpDetailsView::renderInspireMeMetadata()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   310
    mInspireMeQueryOngoing = false;
hgs
parents: 34
diff changeset
   311
    mInspireMeQueryRendered = true;
hgs
parents: 34
diff changeset
   312
    mInspireMeProgressBar->hide();
47
hgs
parents: 45
diff changeset
   313
    if( mMpQueryManager->recommendationsCount() ) {
35
hgs
parents: 34
diff changeset
   314
        TX_LOG_ARGS( "There are recommendations." )
hgs
parents: 34
diff changeset
   315
        // we have recommendations
47
hgs
parents: 45
diff changeset
   316
        for ( int i = 0; i < mMpQueryManager->recommendationsCount(); ++i ) {
35
hgs
parents: 34
diff changeset
   317
            // configure the layout properties
hgs
parents: 34
diff changeset
   318
            if(!mInspireList->count()) {
36
hgs
parents: 35
diff changeset
   319
                // we havent configured the prototype before
35
hgs
parents: 34
diff changeset
   320
                HbListViewItem *prototype = mInspireList->listItemPrototype();
hgs
parents: 34
diff changeset
   321
                prototype->setGraphicsSize( HbListViewItem::LargeIcon );
hgs
parents: 34
diff changeset
   322
            }
hgs
parents: 34
diff changeset
   323
            // create the item
hgs
parents: 34
diff changeset
   324
            HbListWidgetItem  *inspireMeItem = new HbListWidgetItem();
47
hgs
parents: 45
diff changeset
   325
            inspireMeItem->setIcon( mMpQueryManager->recommendedAlbumArt( i ));
hgs
parents: 45
diff changeset
   326
            inspireMeItem->setText( mMpQueryManager->recommendedSong( i ) );
hgs
parents: 45
diff changeset
   327
            inspireMeItem->setSecondaryText( mMpQueryManager->recommendedArtist( i ) );
35
hgs
parents: 34
diff changeset
   328
            mInspireList->addItem( inspireMeItem );
hgs
parents: 34
diff changeset
   329
        }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
    }
35
hgs
parents: 34
diff changeset
   331
    else {
47
hgs
parents: 45
diff changeset
   332
        TX_LOG_ARGS( "There are NO recommendations" )
35
hgs
parents: 34
diff changeset
   333
        // we dont have recommendations
36
hgs
parents: 35
diff changeset
   334
        // we havent configured the prototype before
35
hgs
parents: 34
diff changeset
   335
        HbListViewItem *prototype = mInspireList->listItemPrototype();
hgs
parents: 34
diff changeset
   336
        const int maxTextRowCount = 20;
hgs
parents: 34
diff changeset
   337
        const int minTextRowCount = 1;
hgs
parents: 34
diff changeset
   338
        prototype->setSecondaryTextRowCount(minTextRowCount,maxTextRowCount);
36
hgs
parents: 35
diff changeset
   339
35
hgs
parents: 34
diff changeset
   340
        HbListWidgetItem  *inspireMeItem = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   341
        inspireMeItem->setSecondaryText( hbTrId( "txt_mus_dblist_val_there_are_no_recommendations" ) );
35
hgs
parents: 34
diff changeset
   342
        mInspireList->addItem( inspireMeItem );
hgs
parents: 34
diff changeset
   343
    }
36
hgs
parents: 35
diff changeset
   344
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
47
hgs
parents: 45
diff changeset
   348
void MpDetailsView::renderInspireMeAlbumArts()
hgs
parents: 45
diff changeset
   349
{
hgs
parents: 45
diff changeset
   350
    TX_ENTRY    
hgs
parents: 45
diff changeset
   351
    for( int i = 0; i < mInspireList->count(); ++i) {
hgs
parents: 45
diff changeset
   352
        mInspireList->item(i)->setIcon( mMpQueryManager->recommendedAlbumArt( i ) );
hgs
parents: 45
diff changeset
   353
    }
hgs
parents: 45
diff changeset
   354
    TX_EXIT    
hgs
parents: 45
diff changeset
   355
}
hgs
parents: 45
diff changeset
   356
   
hgs
parents: 45
diff changeset
   357
bool MpDetailsView::isMetadata() const
35
hgs
parents: 34
diff changeset
   358
{
hgs
parents: 34
diff changeset
   359
    bool result = ( ( !mSongData->album().isEmpty() ) ||
47
hgs
parents: 45
diff changeset
   360
                    ( !mSongData->artist().isEmpty() ) );
hgs
parents: 45
diff changeset
   361
    TX_LOG_ARGS( "Inspire Me Query metadata available:" << result );
35
hgs
parents: 34
diff changeset
   362
    return result;
hgs
parents: 34
diff changeset
   363
}
hgs
parents: 34
diff changeset
   364
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
 Slot to handle basic song information
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
 */
35
hgs
parents: 34
diff changeset
   368
void MpDetailsView::handlePlaybackInfoChanged()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
    TX_ENTRY
47
hgs
parents: 45
diff changeset
   371
    // ensure that we dont get callbacks from previous queries. Especially true,
hgs
parents: 45
diff changeset
   372
    // if details view is actived with a quick song change again
hgs
parents: 45
diff changeset
   373
    mMpQueryManager->reset();
hgs
parents: 45
diff changeset
   374
    mInspireList->clear();
35
hgs
parents: 34
diff changeset
   375
    mInspireMeQueryRendered = false;
36
hgs
parents: 35
diff changeset
   376
hgs
parents: 35
diff changeset
   377
    // Clear the song data link until new query has been made.
hgs
parents: 35
diff changeset
   378
    mSongData->setLink( "" );
hgs
parents: 35
diff changeset
   379
35
hgs
parents: 34
diff changeset
   380
    if ( !mSongData->title().isEmpty () ) {
hgs
parents: 34
diff changeset
   381
        mSongText->setPlainText( mSongData->title() );
47
hgs
parents: 45
diff changeset
   382
    }
hgs
parents: 45
diff changeset
   383
    else {
35
hgs
parents: 34
diff changeset
   384
        mSongText->setPlainText( mSongData->fileName() );
hgs
parents: 34
diff changeset
   385
    }
36
hgs
parents: 35
diff changeset
   386
35
hgs
parents: 34
diff changeset
   387
    if ( !mSongData->album().isEmpty () ) {
hgs
parents: 34
diff changeset
   388
        mAlbumText->setPlainText( mSongData->album() );
47
hgs
parents: 45
diff changeset
   389
    }
hgs
parents: 45
diff changeset
   390
    else {
45
hgs
parents: 43
diff changeset
   391
        mAlbumText->setPlainText( hbTrId( "txt_mus_other_unknown7") );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
    }
36
hgs
parents: 35
diff changeset
   393
35
hgs
parents: 34
diff changeset
   394
    if ( !mSongData->artist().isEmpty() ) {
hgs
parents: 34
diff changeset
   395
        mArtistText->setPlainText( mSongData->artist() );
47
hgs
parents: 45
diff changeset
   396
    }
hgs
parents: 45
diff changeset
   397
    else {
45
hgs
parents: 43
diff changeset
   398
        mArtistText->setPlainText( hbTrId( "txt_mus_other_unknown6") );
35
hgs
parents: 34
diff changeset
   399
    }
36
hgs
parents: 35
diff changeset
   400
47
hgs
parents: 45
diff changeset
   401
    if(!mInspireMeGroupBox->isCollapsed()) {
hgs
parents: 45
diff changeset
   402
        startInspireMe();
35
hgs
parents: 34
diff changeset
   403
    }
36
hgs
parents: 35
diff changeset
   404
    TX_EXIT
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
47
hgs
parents: 45
diff changeset
   407
void MpDetailsView::startInspireMe()
35
hgs
parents: 34
diff changeset
   408
{
47
hgs
parents: 45
diff changeset
   409
    TX_ENTRY    
hgs
parents: 45
diff changeset
   410
    if(isMetadata()) {
hgs
parents: 45
diff changeset
   411
        // show progress bar, start store query or inspire me query process
hgs
parents: 45
diff changeset
   412
        mInspireMeProgressBar->show();
hgs
parents: 45
diff changeset
   413
        mInspireMeQueryOngoing = true;
hgs
parents: 45
diff changeset
   414
        if( mMpQueryManager->isLocalMusicStore() ) {
hgs
parents: 45
diff changeset
   415
            mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 45
diff changeset
   416
        }
hgs
parents: 45
diff changeset
   417
        else {
hgs
parents: 45
diff changeset
   418
            // no local store information present
hgs
parents: 45
diff changeset
   419
            mMpQueryManager->queryLocalMusicStore();
hgs
parents: 45
diff changeset
   420
        }
hgs
parents: 45
diff changeset
   421
    }
hgs
parents: 45
diff changeset
   422
    else {
hgs
parents: 45
diff changeset
   423
        // no metadata. show no recommendations
hgs
parents: 45
diff changeset
   424
        renderInspireMeMetadata();
hgs
parents: 45
diff changeset
   425
    }
hgs
parents: 45
diff changeset
   426
    TX_EXIT    
35
hgs
parents: 34
diff changeset
   427
}
47
hgs
parents: 45
diff changeset
   428
    
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
 Slot to handle detail song information
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
void MpDetailsView::songDetailInfoChanged()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
    mDetailList->clear();
36
hgs
parents: 35
diff changeset
   436
35
hgs
parents: 34
diff changeset
   437
    if ( !mSongData->albumTrack().isNull() ) {
36
hgs
parents: 35
diff changeset
   438
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   439
        item->setText( hbTrId( "txt_mus_dblist_song_number" ) );
35
hgs
parents: 34
diff changeset
   440
        item->setSecondaryText( mSongData->albumTrack() );
hgs
parents: 34
diff changeset
   441
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   442
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   443
    }
36
hgs
parents: 35
diff changeset
   444
35
hgs
parents: 34
diff changeset
   445
    if ( !mSongData->year().isNull() ) {
hgs
parents: 34
diff changeset
   446
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   447
        item->setText( hbTrId( "txt_mus_dblist_year" ) );
35
hgs
parents: 34
diff changeset
   448
        item->setSecondaryText( mSongData->year() );
hgs
parents: 34
diff changeset
   449
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   450
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   451
    }
36
hgs
parents: 35
diff changeset
   452
35
hgs
parents: 34
diff changeset
   453
    if ( !mSongData->genre().isNull() ) {
hgs
parents: 34
diff changeset
   454
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   455
        item->setText( hbTrId( "txt_mus_dblist_genre" ) );
35
hgs
parents: 34
diff changeset
   456
        item->setSecondaryText( mSongData->genre() );
hgs
parents: 34
diff changeset
   457
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   458
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   459
    }
36
hgs
parents: 35
diff changeset
   460
35
hgs
parents: 34
diff changeset
   461
    if ( !mSongData->composer().isNull() ) {
hgs
parents: 34
diff changeset
   462
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   463
        item->setText( hbTrId( "txt_mus_dblist_composer" ) );
35
hgs
parents: 34
diff changeset
   464
        item->setSecondaryText( mSongData->composer() );
hgs
parents: 34
diff changeset
   465
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   466
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   467
    }
hgs
parents: 34
diff changeset
   468
hgs
parents: 34
diff changeset
   469
    if ( !mSongData->fileName().isNull() ) {
hgs
parents: 34
diff changeset
   470
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   471
        item->setText( hbTrId( "txt_mus_dblist_file_name" ) );
35
hgs
parents: 34
diff changeset
   472
        item->setSecondaryText( mSongData->fileName() );
hgs
parents: 34
diff changeset
   473
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   474
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   475
    }
36
hgs
parents: 35
diff changeset
   476
35
hgs
parents: 34
diff changeset
   477
    if ( !mSongData->mimeType().isNull() ) {
hgs
parents: 34
diff changeset
   478
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   479
        item->setText( hbTrId( "txt_mus_dblist_format" ) );
35
hgs
parents: 34
diff changeset
   480
        item->setSecondaryText( mSongData->mimeType() );
hgs
parents: 34
diff changeset
   481
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   482
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   483
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
35
hgs
parents: 34
diff changeset
   485
    if ( !mSongData->duration().isNull() ) {
hgs
parents: 34
diff changeset
   486
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   487
        item->setText( hbTrId( "txt_mus_dblist_duration" ) );
35
hgs
parents: 34
diff changeset
   488
        item->setSecondaryText( mSongData->duration() );
hgs
parents: 34
diff changeset
   489
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   490
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   491
    }
36
hgs
parents: 35
diff changeset
   492
35
hgs
parents: 34
diff changeset
   493
    if ( !mSongData->bitRate().isNull() ) {
hgs
parents: 34
diff changeset
   494
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   495
        item->setText( hbTrId( "txt_mus_dblist_bitrate" ) );
hgs
parents: 43
diff changeset
   496
        bool ok = false;
hgs
parents: 43
diff changeset
   497
        int bitRate = mSongData->bitRate().toInt(&ok);
hgs
parents: 43
diff changeset
   498
        TX_LOG_ARGS("Warning: If zero, bitrate is not read correctly. It wont show up in details" << ok);
hgs
parents: 43
diff changeset
   499
        if(ok) {
hgs
parents: 43
diff changeset
   500
            item->setSecondaryText( hbTrId("txt_mus_dblist_bitrate_val_ln_kbps", bitRate) );
47
hgs
parents: 45
diff changeset
   501
        }
35
hgs
parents: 34
diff changeset
   502
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   503
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   504
    }
36
hgs
parents: 35
diff changeset
   505
35
hgs
parents: 34
diff changeset
   506
    if ( !mSongData->sampleRate().isNull() ) {
hgs
parents: 34
diff changeset
   507
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   508
        item->setText( hbTrId( "txt_mus_dblist_sampling_rate" ) );
hgs
parents: 43
diff changeset
   509
        bool ok = false;
hgs
parents: 43
diff changeset
   510
        int samplingRate = mSongData->sampleRate().toInt(&ok);
hgs
parents: 43
diff changeset
   511
        TX_LOG_ARGS("Warning: If zero, sampling rate is not read correctly. It wont show up in details" << ok);
hgs
parents: 43
diff changeset
   512
        if(ok) {
hgs
parents: 43
diff changeset
   513
            item->setSecondaryText(	hbTrId("txt_mus_dblist_sampling_rate_val_ln_hz", samplingRate) );
47
hgs
parents: 45
diff changeset
   514
        }
35
hgs
parents: 34
diff changeset
   515
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   516
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   517
    }
36
hgs
parents: 35
diff changeset
   518
35
hgs
parents: 34
diff changeset
   519
    if ( !mSongData->size().isNull() ) {
hgs
parents: 34
diff changeset
   520
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   521
        item->setText( hbTrId( "txt_mus_dblist_size" ) );
hgs
parents: 43
diff changeset
   522
        bool ok = false;
hgs
parents: 43
diff changeset
   523
        long size = mSongData->size().toLong(&ok); // in bytes
hgs
parents: 43
diff changeset
   524
        TX_LOG_ARGS("WARNING: If zero, Cant get song data size right. You wont see the size in details groupbox correctly" << ok );
hgs
parents: 43
diff changeset
   525
        if( size < KOneKiloByteInBytes) {
hgs
parents: 43
diff changeset
   526
            // under 1 KB
hgs
parents: 43
diff changeset
   527
            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_b", size) );
47
hgs
parents: 45
diff changeset
   528
        }
hgs
parents: 45
diff changeset
   529
        else if( size < KOneMegabyteInBytes ) {
45
hgs
parents: 43
diff changeset
   530
            // under 1 MB
hgs
parents: 43
diff changeset
   531
            size /= KOneKiloByteInBytes; // turn size into KB
hgs
parents: 43
diff changeset
   532
            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_kb", size) );
47
hgs
parents: 45
diff changeset
   533
        }
hgs
parents: 45
diff changeset
   534
        else if( size < KOneGigaByteInBytes ) {
45
hgs
parents: 43
diff changeset
   535
            // under 1 GB
hgs
parents: 43
diff changeset
   536
            size /= KOneMegabyteInBytes; // turn size to MB
hgs
parents: 43
diff changeset
   537
            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_mb", size) );
47
hgs
parents: 45
diff changeset
   538
        }
hgs
parents: 45
diff changeset
   539
        else {
45
hgs
parents: 43
diff changeset
   540
            // 1 GB or higher
hgs
parents: 43
diff changeset
   541
            size /= KOneGigaByteInBytes; // turn size to GB
hgs
parents: 43
diff changeset
   542
            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_gb", size) );            
hgs
parents: 43
diff changeset
   543
        }
35
hgs
parents: 34
diff changeset
   544
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   545
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   546
    }
36
hgs
parents: 35
diff changeset
   547
35
hgs
parents: 34
diff changeset
   548
    if ( !mSongData->modified().isNull() ) {
hgs
parents: 34
diff changeset
   549
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   550
        item->setText( hbTrId( "txt_mus_dblist_modified" ) );
35
hgs
parents: 34
diff changeset
   551
        item->setSecondaryText( mSongData->modified() );
hgs
parents: 34
diff changeset
   552
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   553
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   554
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
35
hgs
parents: 34
diff changeset
   556
    if ( !mSongData->copyright().isNull() ) {
hgs
parents: 34
diff changeset
   557
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   558
        item->setText( hbTrId( "txt_mus_dblist_copyright" ) );
35
hgs
parents: 34
diff changeset
   559
        item->setSecondaryText( mSongData->copyright() );
hgs
parents: 34
diff changeset
   560
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   561
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   562
    }
36
hgs
parents: 35
diff changeset
   563
35
hgs
parents: 34
diff changeset
   564
    if ( !mSongData->musicURL().isNull() ) {
hgs
parents: 34
diff changeset
   565
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   566
        item->setText( hbTrId( "txt_mus_dblist_web_site" ) );
35
hgs
parents: 34
diff changeset
   567
        item->setSecondaryText( mSongData->musicURL() );
hgs
parents: 34
diff changeset
   568
        item->setEnabled( true );
hgs
parents: 34
diff changeset
   569
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   570
    }
36
hgs
parents: 35
diff changeset
   571
35
hgs
parents: 34
diff changeset
   572
    if ( mSongData->isDrmProtected() ) {
hgs
parents: 34
diff changeset
   573
        HbListWidgetItem *item = new HbListWidgetItem();
45
hgs
parents: 43
diff changeset
   574
        item->setText( hbTrId( "txt_mus_dblist_licences" ) );
hgs
parents: 43
diff changeset
   575
        item->setSecondaryText( hbTrId( "txt_mus_dblist_licences_val_click_for_details" ) );
35
hgs
parents: 34
diff changeset
   576
        item->setEnabled( true );
hgs
parents: 34
diff changeset
   577
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   578
    }
hgs
parents: 34
diff changeset
   579
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
36
hgs
parents: 35
diff changeset
   583
void MpDetailsView::handleDetailsGroupBoxToggled(bool /*state*/)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   586
    if ( !mSongDetailsGroupBox->isCollapsed() ) {
35
hgs
parents: 34
diff changeset
   587
            mInspireMeGroupBox->setCollapsed( true );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
    }
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
35
hgs
parents: 34
diff changeset
   592
void MpDetailsView::handleInspireMeGroupBoxToggled(bool /*state*/)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   595
    if ( !mInspireMeGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   596
        TX_LOG_ARGS( "InspireMe is expanded." )
36
hgs
parents: 35
diff changeset
   597
        mSongDetailsGroupBox->setCollapsed( true );
35
hgs
parents: 34
diff changeset
   598
        if ( mInspireMeQueryOngoing ) {
hgs
parents: 34
diff changeset
   599
            TX_LOG_ARGS( "Query is ongoing " )
hgs
parents: 34
diff changeset
   600
            mInspireMeProgressBar->show();
47
hgs
parents: 45
diff changeset
   601
        }
hgs
parents: 45
diff changeset
   602
        else {
35
hgs
parents: 34
diff changeset
   603
            TX_LOG_ARGS( "Query is NOT ongoing " )
hgs
parents: 34
diff changeset
   604
            if ( mInspireMeQueryRendered ) {
hgs
parents: 34
diff changeset
   605
                TX_LOG_ARGS( "InspireMe is rendered already. " )
hgs
parents: 34
diff changeset
   606
                mInspireMeProgressBar->hide();
47
hgs
parents: 45
diff changeset
   607
            }
hgs
parents: 45
diff changeset
   608
            else {
hgs
parents: 45
diff changeset
   609
                startInspireMe();
36
hgs
parents: 35
diff changeset
   610
            }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
        }
47
hgs
parents: 45
diff changeset
   612
    }
hgs
parents: 45
diff changeset
   613
    else {
35
hgs
parents: 34
diff changeset
   614
        TX_LOG_ARGS( "InspireMe is collapsed." )
hgs
parents: 34
diff changeset
   615
        mInspireMeProgressBar->hide();
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
    }
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
/*!
47
hgs
parents: 45
diff changeset
   621
 Slot to call when URL item in song details is pressed
hgs
parents: 45
diff changeset
   622
*/
hgs
parents: 45
diff changeset
   623
void MpDetailsView::handleListItemSelected( HbListWidgetItem  *item)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
{
47
hgs
parents: 45
diff changeset
   625
    TX_ENTRY_ARGS( "URL: " << item->secondaryText() );
hgs
parents: 45
diff changeset
   626
    QDesktopServices::openUrl( item->secondaryText() );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
35
hgs
parents: 34
diff changeset
   630
/*!
47
hgs
parents: 45
diff changeset
   631
 Slot to call when MusicStore Info is Received
hgs
parents: 45
diff changeset
   632
*/
hgs
parents: 45
diff changeset
   633
void MpDetailsView::queryInspireMe(bool storeUpdated)
36
hgs
parents: 35
diff changeset
   634
{
hgs
parents: 35
diff changeset
   635
    TX_ENTRY
47
hgs
parents: 45
diff changeset
   636
    // we asked query manager to update its local store information
hgs
parents: 45
diff changeset
   637
    // if that store info didnt change (i.e. from empty string to "fi" or
hgs
parents: 45
diff changeset
   638
    // from "bad old store" to "good new store") then we dont need to pursue a query    
hgs
parents: 45
diff changeset
   639
    if( storeUpdated ) {
hgs
parents: 45
diff changeset
   640
        mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 45
diff changeset
   641
        mInspireMeQueryOngoing = true;
36
hgs
parents: 35
diff changeset
   642
    }
47
hgs
parents: 45
diff changeset
   643
    else {
hgs
parents: 45
diff changeset
   644
        mInspireMeQueryOngoing = false;
hgs
parents: 45
diff changeset
   645
        mInspireMeProgressBar->hide();
hgs
parents: 45
diff changeset
   646
    }
36
hgs
parents: 35
diff changeset
   647
    TX_EXIT
hgs
parents: 35
diff changeset
   648
}
hgs
parents: 35
diff changeset
   649