mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp
author hgs
Fri, 09 Jul 2010 16:27:03 -0500
changeset 43 0f32e550d9d8
parent 37 eb79a7c355bf
child 45 612c4815aebe
permissions -rw-r--r--
201027
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>
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
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
#ifdef SHARE_FUNC_ENABLED
hgs
parents: 34
diff changeset
    53
#include "mpdetailssharedialog.h"
hgs
parents: 34
diff changeset
    54
#endif
hgs
parents: 34
diff changeset
    55
36
hgs
parents: 35
diff changeset
    56
35
hgs
parents: 34
diff changeset
    57
const int KRecommendationCount = 2;
hgs
parents: 34
diff changeset
    58
20
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
 Constructor
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
MpDetailsView::MpDetailsView()
35
hgs
parents: 34
diff changeset
    64
    : mMpEngine( 0 ),
hgs
parents: 34
diff changeset
    65
      mSongData( 0 ),
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
      mActivated( false ),
35
hgs
parents: 34
diff changeset
    67
      mSoftKeyBack( 0 ),
36
hgs
parents: 35
diff changeset
    68
      mSongText( 0 ),
hgs
parents: 35
diff changeset
    69
      mAlbumText( 0 ),
hgs
parents: 35
diff changeset
    70
      mArtistText( 0 ),
hgs
parents: 35
diff changeset
    71
      mAlbumArt( 0 ),
hgs
parents: 35
diff changeset
    72
      mSongDetailsGroupBox(0),
hgs
parents: 35
diff changeset
    73
      mInspireMeGroupBox(0),
hgs
parents: 35
diff changeset
    74
      mShareButton(0),
hgs
parents: 35
diff changeset
    75
      mDocumentLoader( 0 ),
hgs
parents: 35
diff changeset
    76
      mDetailList(0),
hgs
parents: 35
diff changeset
    77
      mInspireList(0),
hgs
parents: 35
diff changeset
    78
      mInspireMeProgressBar(0),
35
hgs
parents: 34
diff changeset
    79
      mMpQueryManager( 0 ),
hgs
parents: 34
diff changeset
    80
      mInspireMeQueryOngoing( false ),
hgs
parents: 34
diff changeset
    81
      mInspireMeQueryRendered( false ),
hgs
parents: 34
diff changeset
    82
      mInspireMeOpen(true),
hgs
parents: 34
diff changeset
    83
      mSongDetailsGbOpen(false)
hgs
parents: 34
diff changeset
    84
#ifdef SHARE_FUNC_ENABLED
hgs
parents: 34
diff changeset
    85
      , mSharePopup( 0 )
hgs
parents: 34
diff changeset
    86
#endif
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    bool widgetsOk = false;
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
    HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    mDocumentLoader = new HbDocumentLoader();
36
hgs
parents: 35
diff changeset
    92
35
hgs
parents: 34
diff changeset
    93
    TX_LOG_ARGS("Document loader created")
hgs
parents: 34
diff changeset
    94
    if(!mDocumentLoader) {
hgs
parents: 34
diff changeset
    95
        TX_LOG_ARGS( "MpDetailsView() Error: HbDocumentLoader not constructed" );
36
hgs
parents: 35
diff changeset
    96
        return;
35
hgs
parents: 34
diff changeset
    97
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
35
hgs
parents: 34
diff changeset
    99
    TX_LOG_ARGS("Loading :/mpdetailsviewdocml/mpdetailsview.docml")
hgs
parents: 34
diff changeset
   100
    mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), &widgetsOk );
hgs
parents: 34
diff changeset
   101
    if(!widgetsOk) {
hgs
parents: 34
diff changeset
   102
        TX_LOG_ARGS( "MpDetailsView() Error: invalid mpdetailsview.docml" );
36
hgs
parents: 35
diff changeset
   103
        return;
35
hgs
parents: 34
diff changeset
   104
    }
36
hgs
parents: 35
diff changeset
   105
35
hgs
parents: 34
diff changeset
   106
    TX_LOG_ARGS("Loaded :/mpdetailsviewdocml/mpdetailsview.docml")
36
hgs
parents: 35
diff changeset
   107
    QGraphicsWidget *widget = 0;
hgs
parents: 35
diff changeset
   108
35
hgs
parents: 34
diff changeset
   109
    widget = mDocumentLoader->findWidget( QString("content") );
hgs
parents: 34
diff changeset
   110
    TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) );
36
hgs
parents: 35
diff changeset
   111
    setWidget(  qobject_cast<HbWidget *>(widget) );
35
hgs
parents: 34
diff changeset
   112
hgs
parents: 34
diff changeset
   113
    widget = mDocumentLoader->findWidget( QString("shareButton") );
hgs
parents: 34
diff changeset
   114
    mShareButton = qobject_cast<HbPushButton *>(widget);
hgs
parents: 34
diff changeset
   115
    TX_LOG_ARGS("MpDetailsView() <shareButton> widget found mShareButton: " << (int)(mShareButton) );
hgs
parents: 34
diff changeset
   116
hgs
parents: 34
diff changeset
   117
    widget = mDocumentLoader->findWidget( QString("trackTitle") );
hgs
parents: 34
diff changeset
   118
    mSongText = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   119
    TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) );
36
hgs
parents: 35
diff changeset
   120
35
hgs
parents: 34
diff changeset
   121
    widget = mDocumentLoader->findWidget( QString("artist") );
hgs
parents: 34
diff changeset
   122
    mArtistText = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   123
    TX_LOG_ARGS("MpDetailsView() <artist> widget found mArtistText: " << (int)(mArtistText) );
36
hgs
parents: 35
diff changeset
   124
35
hgs
parents: 34
diff changeset
   125
    widget = mDocumentLoader->findWidget( QString("albumName") );
hgs
parents: 34
diff changeset
   126
    mAlbumText = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   127
    TX_LOG_ARGS("MpDetailsView() <albumName> widget found mAlbumText: " << (int)(mAlbumText) );
hgs
parents: 34
diff changeset
   128
hgs
parents: 34
diff changeset
   129
    widget = mDocumentLoader->findWidget( QString("albumArt") );
hgs
parents: 34
diff changeset
   130
    mAlbumArt = qobject_cast<HbLabel *>(widget);
hgs
parents: 34
diff changeset
   131
    TX_LOG_ARGS("MpDetailsView() <albumArt> widget found mAlbumArt: " << (int)(mAlbumArt) );
36
hgs
parents: 35
diff changeset
   132
35
hgs
parents: 34
diff changeset
   133
    widget = mDocumentLoader->findWidget( QString("songDetails") );
hgs
parents: 34
diff changeset
   134
    mSongDetailsGroupBox = qobject_cast<HbGroupBox *>(widget);
hgs
parents: 34
diff changeset
   135
    TX_LOG_ARGS("MpDetailsView() <songDetails> widget found mSongDetailsGroupBox: " << (int)(mSongDetailsGroupBox) );
36
hgs
parents: 35
diff changeset
   136
35
hgs
parents: 34
diff changeset
   137
    widget = mDocumentLoader->findWidget( QString("songDetailsListWidget") );
hgs
parents: 34
diff changeset
   138
    mDetailList = qobject_cast<HbListWidget *>(widget);
hgs
parents: 34
diff changeset
   139
    TX_LOG_ARGS("MpDetailsView() <songDetailsListWidget> widget found mDetailList: " << (int)(mDetailList) );
36
hgs
parents: 35
diff changeset
   140
35
hgs
parents: 34
diff changeset
   141
    widget = mDocumentLoader->findWidget( QString("inspireMeGroupBox") );
hgs
parents: 34
diff changeset
   142
    mInspireMeGroupBox = qobject_cast<HbGroupBox *>(widget);
hgs
parents: 34
diff changeset
   143
    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
   144
35
hgs
parents: 34
diff changeset
   145
    widget = mDocumentLoader->findWidget( QString("inspireListWidget") );
hgs
parents: 34
diff changeset
   146
    mInspireList = qobject_cast<HbListWidget *>(widget);
hgs
parents: 34
diff changeset
   147
    TX_LOG_ARGS("MpDetailsView() <inspireListWidget> widget found mInspireList: " << (int)(mInspireList) );
36
hgs
parents: 35
diff changeset
   148
35
hgs
parents: 34
diff changeset
   149
    widget = mDocumentLoader->findWidget( QString("inspireMeProgressBar") );
hgs
parents: 34
diff changeset
   150
    mInspireMeProgressBar = qobject_cast<HbProgressBar *>(widget);
hgs
parents: 34
diff changeset
   151
    TX_LOG_ARGS("MpDetailsView() <inspireMeProgressBar> widget found mInspireMeProgressBar: " << (int)(mInspireMeProgressBar) );
36
hgs
parents: 35
diff changeset
   152
    
hgs
parents: 35
diff changeset
   153
    // load section HideInspireMe if no ovi store suport
hgs
parents: 35
diff changeset
   154
    bool loadingSectionOk = false;
hgs
parents: 35
diff changeset
   155
    mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), QString( "ShowInspireMe" ), &loadingSectionOk );    
hgs
parents: 35
diff changeset
   156
    if( loadingSectionOk ) {
hgs
parents: 35
diff changeset
   157
        TX_LOG_ARGS( "Loading ShowInspireMe section is successful." );
hgs
parents: 35
diff changeset
   158
    } else {
hgs
parents: 35
diff changeset
   159
        TX_LOG_ARGS( "Loading ShowInspireMe section fails." );
hgs
parents: 35
diff changeset
   160
    }
hgs
parents: 35
diff changeset
   161
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
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
 Destructs the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
MpDetailsView::~MpDetailsView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
{
36
hgs
parents: 35
diff changeset
   170
    TX_ENTRY
hgs
parents: 35
diff changeset
   171
    delete mSoftKeyBack;
hgs
parents: 35
diff changeset
   172
    delete mDocumentLoader;
35
hgs
parents: 34
diff changeset
   173
    delete mMpQueryManager;
hgs
parents: 34
diff changeset
   174
hgs
parents: 34
diff changeset
   175
#ifdef SHARE_FUNC_ENABLED
hgs
parents: 34
diff changeset
   176
    closeShareDialog();
hgs
parents: 34
diff changeset
   177
#endif
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
35
hgs
parents: 34
diff changeset
   181
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
 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
   184
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
void MpDetailsView::initializeView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
{
36
hgs
parents: 35
diff changeset
   187
    TX_ENTRY
hgs
parents: 35
diff changeset
   188
hgs
parents: 35
diff changeset
   189
    mSoftKeyBack = new HbAction( Hb::BackNaviAction, this );
hgs
parents: 35
diff changeset
   190
35
hgs
parents: 34
diff changeset
   191
    mMpEngine = MpEngineFactory::sharedEngine();
hgs
parents: 34
diff changeset
   192
    mSongData = mMpEngine->songData();
36
hgs
parents: 35
diff changeset
   193
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
    // TODO: might need later
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
    setupMenu();
36
hgs
parents: 35
diff changeset
   196
    mMpQueryManager = new MpQueryManager();
hgs
parents: 35
diff changeset
   197
35
hgs
parents: 34
diff changeset
   198
    connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) );
36
hgs
parents: 35
diff changeset
   199
    connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) );
35
hgs
parents: 34
diff changeset
   200
    connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) );
36
hgs
parents: 35
diff changeset
   201
    connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) );
hgs
parents: 35
diff changeset
   202
    connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) );
hgs
parents: 35
diff changeset
   203
    connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) );
35
hgs
parents: 34
diff changeset
   204
    connect( mMpQueryManager, SIGNAL( networkError() ), this ,SLOT( handleNetworkError() ) );
hgs
parents: 34
diff changeset
   205
    connect( mMpQueryManager, SIGNAL(searchUrlRetrieved(const QString&)), this, SLOT(updateSharedData(const QString&)));
36
hgs
parents: 35
diff changeset
   206
    connect( mMpQueryManager, SIGNAL(recommendationAlbumArtsReady()), this, SLOT(RenderInspireMeGroupBox()));
35
hgs
parents: 34
diff changeset
   207
36
hgs
parents: 35
diff changeset
   208
#ifdef SHARE_FUNC_ENABLED
35
hgs
parents: 34
diff changeset
   209
    connect( mShareButton, SIGNAL( clicked() ), this, SLOT( share() ) );
36
hgs
parents: 35
diff changeset
   210
35
hgs
parents: 34
diff changeset
   211
    // Preload the share popup
36
hgs
parents: 35
diff changeset
   212
    preloadShareDialog();
35
hgs
parents: 34
diff changeset
   213
#endif
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
 Activates the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
void MpDetailsView::activateView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
{
36
hgs
parents: 35
diff changeset
   222
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   223
    setNavigationAction( mSoftKeyBack );
36
hgs
parents: 35
diff changeset
   224
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
    mActivated = true;
35
hgs
parents: 34
diff changeset
   226
    mInspireMeOpen = MpSettingsManager::inspireMe();
hgs
parents: 34
diff changeset
   227
    mSongDetailsGbOpen = MpSettingsManager::songDetailsGb();
hgs
parents: 34
diff changeset
   228
    TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen );
hgs
parents: 34
diff changeset
   229
    TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen );
hgs
parents: 34
diff changeset
   230
    mInspireMeGroupBox->setCollapsed(!mInspireMeOpen);
hgs
parents: 34
diff changeset
   231
    mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen);
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
}
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
 Deactivates the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
void MpDetailsView::deactivateView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
{
36
hgs
parents: 35
diff changeset
   240
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   241
    if (mInspireMeGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   242
      MpSettingsManager::setInspireMe(false);
hgs
parents: 34
diff changeset
   243
      } else {
hgs
parents: 34
diff changeset
   244
      MpSettingsManager::setInspireMe(true);
hgs
parents: 34
diff changeset
   245
      }
36
hgs
parents: 35
diff changeset
   246
35
hgs
parents: 34
diff changeset
   247
    if (mSongDetailsGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   248
      MpSettingsManager::setSongDetailsGb(false);
hgs
parents: 34
diff changeset
   249
      } else {
hgs
parents: 34
diff changeset
   250
      MpSettingsManager::setSongDetailsGb(true);
hgs
parents: 34
diff changeset
   251
      }
36
hgs
parents: 35
diff changeset
   252
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    setNavigationAction( 0 );
36
hgs
parents: 35
diff changeset
   254
    mActivated = false;
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
}
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
 Setup the menu.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
void MpDetailsView::setupMenu()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
    TX_ENTRY
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
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
}
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
 Slot to handle back command from softkey.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
void MpDetailsView::back()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
{
36
hgs
parents: 35
diff changeset
   273
    TX_ENTRY
43
hgs
parents: 37
diff changeset
   274
    emit command( MpCommon::ActivatePreviousView );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
}
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
 Slot to handle Album art changed.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
void MpDetailsView::albumArtChanged( )
36
hgs
parents: 35
diff changeset
   282
{
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   284
    HbIcon icon;
hgs
parents: 34
diff changeset
   285
    mSongData->albumArt( icon );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
    mAlbumArt->setIcon( icon );
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
/*!
35
hgs
parents: 34
diff changeset
   291
 Slot to handle network error.
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
 */
35
hgs
parents: 34
diff changeset
   293
void MpDetailsView::handleNetworkError()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   296
    mInspireMeQueryOngoing = false;
hgs
parents: 34
diff changeset
   297
    mInspireMeQueryRendered = false;
36
hgs
parents: 35
diff changeset
   298
    clearInspireMe();
35
hgs
parents: 34
diff changeset
   299
    mInspireMeGroupBox->setCollapsed( true );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
}
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
 Render inspireme groupbox after album arts downloaded
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
 */
36
hgs
parents: 35
diff changeset
   306
void MpDetailsView::RenderInspireMeGroupBox()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   309
    mInspireMeQueryOngoing = false;
hgs
parents: 34
diff changeset
   310
    mInspireMeQueryRendered = true;
hgs
parents: 34
diff changeset
   311
    mInspireMeProgressBar->hide();
hgs
parents: 34
diff changeset
   312
    if( mMpQueryManager->recommendationAlbumArtsMap().count() ) {
hgs
parents: 34
diff changeset
   313
        TX_LOG_ARGS( "There are recommendations." )
hgs
parents: 34
diff changeset
   314
        // we have recommendations
hgs
parents: 34
diff changeset
   315
        for ( int i = 0; i < KRecommendationCount; i++ ) {
hgs
parents: 34
diff changeset
   316
            // configure the layout properties
hgs
parents: 34
diff changeset
   317
            if(!mInspireList->count()) {
36
hgs
parents: 35
diff changeset
   318
                // we havent configured the prototype before
35
hgs
parents: 34
diff changeset
   319
                HbListViewItem *prototype = mInspireList->listItemPrototype();
hgs
parents: 34
diff changeset
   320
                prototype->setGraphicsSize( HbListViewItem::LargeIcon );
hgs
parents: 34
diff changeset
   321
            }
hgs
parents: 34
diff changeset
   322
            // create the item
hgs
parents: 34
diff changeset
   323
            HbListWidgetItem  *inspireMeItem = new HbListWidgetItem();
36
hgs
parents: 35
diff changeset
   324
            HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) );
35
hgs
parents: 34
diff changeset
   325
            inspireMeItem->setIcon( icon );
hgs
parents: 34
diff changeset
   326
            inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) );
hgs
parents: 34
diff changeset
   327
            inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) );
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 {
hgs
parents: 34
diff changeset
   332
        TX_LOG_ARGS( "There is NO recommendation." )
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();
hgs
parents: 34
diff changeset
   341
        QString info(tr("There are no recommendations for this track, but you can always discover new music on Ovi"));
hgs
parents: 34
diff changeset
   342
        inspireMeItem->setText( QString( " " ) );
hgs
parents: 34
diff changeset
   343
        inspireMeItem->setSecondaryText( info );
hgs
parents: 34
diff changeset
   344
        mInspireList->addItem( inspireMeItem );
hgs
parents: 34
diff changeset
   345
    }
36
hgs
parents: 35
diff changeset
   346
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
35
hgs
parents: 34
diff changeset
   350
bool MpDetailsView::canQueryRecommendations() const
hgs
parents: 34
diff changeset
   351
{
hgs
parents: 34
diff changeset
   352
    bool result = ( ( !mSongData->album().isEmpty() ) ||
36
hgs
parents: 35
diff changeset
   353
                    ( !mSongData->artist().isEmpty() ) ) &&
35
hgs
parents: 34
diff changeset
   354
                  !( mInspireMeGroupBox->isCollapsed() );
hgs
parents: 34
diff changeset
   355
    TX_LOG_ARGS( "Can query recommendations:" << result );
hgs
parents: 34
diff changeset
   356
    return result;
hgs
parents: 34
diff changeset
   357
}
hgs
parents: 34
diff changeset
   358
hgs
parents: 34
diff changeset
   359
bool MpDetailsView::canQuerySharePlayerLink() const
hgs
parents: 34
diff changeset
   360
{
hgs
parents: 34
diff changeset
   361
  bool result = ( !mSongData->title().isEmpty() ) &&
hgs
parents: 34
diff changeset
   362
                ( !mSongData->artist().isEmpty() ) ;
hgs
parents: 34
diff changeset
   363
  TX_LOG_ARGS( "Can query share player link:" << result );
hgs
parents: 34
diff changeset
   364
  return result;
hgs
parents: 34
diff changeset
   365
}
hgs
parents: 34
diff changeset
   366
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
 Slot to handle basic song information
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
 */
35
hgs
parents: 34
diff changeset
   370
void MpDetailsView::handlePlaybackInfoChanged()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   373
    mMpQueryManager->clearNetworkReplies();
hgs
parents: 34
diff changeset
   374
    clearInspireMe();
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() );
hgs
parents: 34
diff changeset
   382
    } else {
hgs
parents: 34
diff changeset
   383
        mSongText->setPlainText( mSongData->fileName() );
hgs
parents: 34
diff changeset
   384
    }
36
hgs
parents: 35
diff changeset
   385
35
hgs
parents: 34
diff changeset
   386
    if ( !mSongData->album().isEmpty () ) {
hgs
parents: 34
diff changeset
   387
        mAlbumText->setPlainText( mSongData->album() );
hgs
parents: 34
diff changeset
   388
    } else {
36
hgs
parents: 35
diff changeset
   389
        mAlbumText->setPlainText( tr( "Unknown") );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
    }
36
hgs
parents: 35
diff changeset
   391
35
hgs
parents: 34
diff changeset
   392
    if ( !mSongData->artist().isEmpty() ) {
hgs
parents: 34
diff changeset
   393
        mArtistText->setPlainText( mSongData->artist() );
hgs
parents: 34
diff changeset
   394
    } else {
36
hgs
parents: 35
diff changeset
   395
        mArtistText->setPlainText( tr( "Unknown") );
35
hgs
parents: 34
diff changeset
   396
    }
36
hgs
parents: 35
diff changeset
   397
hgs
parents: 35
diff changeset
   398
    if (canQuerySharePlayerLink() ) {
hgs
parents: 35
diff changeset
   399
        mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 35
diff changeset
   400
    }
hgs
parents: 35
diff changeset
   401
35
hgs
parents: 34
diff changeset
   402
    if (canQueryRecommendations()) {
hgs
parents: 34
diff changeset
   403
        // start inspire me area progress bar
hgs
parents: 34
diff changeset
   404
        // TODO: currently, till we get to this callback from MPX the bar not shown
hgs
parents: 34
diff changeset
   405
        // TODO: check if inspireMe is ON, if not, dont show
hgs
parents: 34
diff changeset
   406
        mInspireMeProgressBar->show();
hgs
parents: 34
diff changeset
   407
        mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 34
diff changeset
   408
        mInspireMeQueryOngoing = true;
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
    }
35
hgs
parents: 34
diff changeset
   410
    else {
hgs
parents: 34
diff changeset
   411
        // metadata to query for inspire me items not available
hgs
parents: 34
diff changeset
   412
        // show information note
hgs
parents: 34
diff changeset
   413
      if (!mInspireMeGroupBox->isCollapsed())
hgs
parents: 34
diff changeset
   414
        RenderInspireMeGroupBox();
hgs
parents: 34
diff changeset
   415
    }
36
hgs
parents: 35
diff changeset
   416
    TX_EXIT
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
35
hgs
parents: 34
diff changeset
   419
void MpDetailsView::clearInspireMe()
hgs
parents: 34
diff changeset
   420
{
36
hgs
parents: 35
diff changeset
   421
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   422
    mInspireList->clear();
36
hgs
parents: 35
diff changeset
   423
    mMpQueryManager->clearRecommendations();
hgs
parents: 35
diff changeset
   424
    TX_EXIT
35
hgs
parents: 34
diff changeset
   425
}
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
 Slot to handle detail song information
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
void MpDetailsView::songDetailInfoChanged()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
    mDetailList->clear();
36
hgs
parents: 35
diff changeset
   433
35
hgs
parents: 34
diff changeset
   434
    if ( !mSongData->albumTrack().isNull() ) {
36
hgs
parents: 35
diff changeset
   435
        HbListWidgetItem *item = new HbListWidgetItem();
35
hgs
parents: 34
diff changeset
   436
        item->setText( tr( "Song number" ) );
hgs
parents: 34
diff changeset
   437
        item->setSecondaryText( mSongData->albumTrack() );
hgs
parents: 34
diff changeset
   438
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   439
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   440
    }
36
hgs
parents: 35
diff changeset
   441
35
hgs
parents: 34
diff changeset
   442
    if ( !mSongData->year().isNull() ) {
hgs
parents: 34
diff changeset
   443
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   444
        item->setText( tr( "Year" ) );
hgs
parents: 34
diff changeset
   445
        item->setSecondaryText( mSongData->year() );
hgs
parents: 34
diff changeset
   446
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   447
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   448
    }
36
hgs
parents: 35
diff changeset
   449
35
hgs
parents: 34
diff changeset
   450
    if ( !mSongData->genre().isNull() ) {
hgs
parents: 34
diff changeset
   451
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   452
        item->setText( tr( "Genre" ) );
hgs
parents: 34
diff changeset
   453
        item->setSecondaryText( mSongData->genre() );
hgs
parents: 34
diff changeset
   454
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   455
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   456
    }
36
hgs
parents: 35
diff changeset
   457
35
hgs
parents: 34
diff changeset
   458
    if ( !mSongData->composer().isNull() ) {
hgs
parents: 34
diff changeset
   459
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   460
        item->setText( tr( "Composer" ) );
hgs
parents: 34
diff changeset
   461
        item->setSecondaryText( mSongData->composer() );
hgs
parents: 34
diff changeset
   462
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   463
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   464
    }
hgs
parents: 34
diff changeset
   465
hgs
parents: 34
diff changeset
   466
    if ( !mSongData->fileName().isNull() ) {
hgs
parents: 34
diff changeset
   467
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   468
        item->setText( tr( "File name" ) );
hgs
parents: 34
diff changeset
   469
        item->setSecondaryText( mSongData->fileName() );
hgs
parents: 34
diff changeset
   470
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   471
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   472
    }
36
hgs
parents: 35
diff changeset
   473
35
hgs
parents: 34
diff changeset
   474
    if ( !mSongData->mimeType().isNull() ) {
hgs
parents: 34
diff changeset
   475
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   476
        item->setText( tr( "Format" ) );
hgs
parents: 34
diff changeset
   477
        item->setSecondaryText( mSongData->mimeType() );
hgs
parents: 34
diff changeset
   478
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   479
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   480
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
35
hgs
parents: 34
diff changeset
   482
    if ( !mSongData->duration().isNull() ) {
hgs
parents: 34
diff changeset
   483
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   484
        item->setText( tr( "Duration" ) );
hgs
parents: 34
diff changeset
   485
        item->setSecondaryText( mSongData->duration() );
hgs
parents: 34
diff changeset
   486
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   487
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   488
    }
36
hgs
parents: 35
diff changeset
   489
35
hgs
parents: 34
diff changeset
   490
    if ( !mSongData->bitRate().isNull() ) {
hgs
parents: 34
diff changeset
   491
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   492
        item->setText( tr( "Bitrate" ) );
hgs
parents: 34
diff changeset
   493
        item->setSecondaryText( mSongData->bitRate().append( " Kbps" ) );
hgs
parents: 34
diff changeset
   494
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   495
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   496
    }
36
hgs
parents: 35
diff changeset
   497
35
hgs
parents: 34
diff changeset
   498
    if ( !mSongData->sampleRate().isNull() ) {
hgs
parents: 34
diff changeset
   499
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   500
        item->setText( tr( "Sampling rate" ) );
hgs
parents: 34
diff changeset
   501
        item->setSecondaryText( mSongData->sampleRate().append( " hz" ) );
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->size().isNull() ) {
hgs
parents: 34
diff changeset
   507
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   508
        item->setText( tr( "Size" ) );
hgs
parents: 34
diff changeset
   509
        item->setSecondaryText( mSongData->size().append( " MB" ) );
hgs
parents: 34
diff changeset
   510
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   511
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   512
    }
36
hgs
parents: 35
diff changeset
   513
35
hgs
parents: 34
diff changeset
   514
    if ( !mSongData->modified().isNull() ) {
hgs
parents: 34
diff changeset
   515
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   516
        item->setText( tr( "Modified" ) );
hgs
parents: 34
diff changeset
   517
        item->setSecondaryText( mSongData->modified() );
hgs
parents: 34
diff changeset
   518
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   519
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   520
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
35
hgs
parents: 34
diff changeset
   522
    if ( !mSongData->copyright().isNull() ) {
hgs
parents: 34
diff changeset
   523
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   524
        item->setText( tr( "Copyright" ) );
hgs
parents: 34
diff changeset
   525
        item->setSecondaryText( mSongData->copyright() );
hgs
parents: 34
diff changeset
   526
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   527
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   528
    }
36
hgs
parents: 35
diff changeset
   529
35
hgs
parents: 34
diff changeset
   530
    if ( !mSongData->musicURL().isNull() ) {
hgs
parents: 34
diff changeset
   531
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   532
        item->setText( tr( "Web site" ) );
hgs
parents: 34
diff changeset
   533
        item->setSecondaryText( mSongData->musicURL() );
hgs
parents: 34
diff changeset
   534
        item->setEnabled( true );
hgs
parents: 34
diff changeset
   535
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   536
    }
36
hgs
parents: 35
diff changeset
   537
35
hgs
parents: 34
diff changeset
   538
    if ( mSongData->isDrmProtected() ) {
hgs
parents: 34
diff changeset
   539
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   540
        item->setText( tr( "Licences" ) );
hgs
parents: 34
diff changeset
   541
        item->setSecondaryText( tr( "Click for details" ) );
hgs
parents: 34
diff changeset
   542
        item->setEnabled( true );
hgs
parents: 34
diff changeset
   543
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   544
    }
hgs
parents: 34
diff changeset
   545
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   546
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
36
hgs
parents: 35
diff changeset
   549
void MpDetailsView::handleDetailsGroupBoxToggled(bool /*state*/)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
    if ( !mSongDetailsGroupBox->isCollapsed() ) {
35
hgs
parents: 34
diff changeset
   553
            mInspireMeGroupBox->setCollapsed( true );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
    }
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
35
hgs
parents: 34
diff changeset
   558
void MpDetailsView::handleInspireMeGroupBoxToggled(bool /*state*/)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   561
    if ( !mInspireMeGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   562
        TX_LOG_ARGS( "InspireMe is expanded." )
36
hgs
parents: 35
diff changeset
   563
        mSongDetailsGroupBox->setCollapsed( true );
35
hgs
parents: 34
diff changeset
   564
        if ( mInspireMeQueryOngoing ) {
hgs
parents: 34
diff changeset
   565
            TX_LOG_ARGS( "Query is ongoing " )
hgs
parents: 34
diff changeset
   566
            mInspireMeProgressBar->show();
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
        } else {
35
hgs
parents: 34
diff changeset
   568
            TX_LOG_ARGS( "Query is NOT ongoing " )
hgs
parents: 34
diff changeset
   569
            if ( mInspireMeQueryRendered ) {
hgs
parents: 34
diff changeset
   570
                TX_LOG_ARGS( "InspireMe is rendered already. " )
hgs
parents: 34
diff changeset
   571
                mInspireMeProgressBar->hide();
hgs
parents: 34
diff changeset
   572
            } else {
hgs
parents: 34
diff changeset
   573
                if ( canQueryRecommendations() ) {
hgs
parents: 34
diff changeset
   574
                    TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " )
hgs
parents: 34
diff changeset
   575
                    mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 34
diff changeset
   576
                    mInspireMeProgressBar->show();
hgs
parents: 34
diff changeset
   577
                    mInspireMeQueryOngoing = true;
hgs
parents: 34
diff changeset
   578
                } else {
hgs
parents: 34
diff changeset
   579
                    TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " )
hgs
parents: 34
diff changeset
   580
                    RenderInspireMeGroupBox();
hgs
parents: 34
diff changeset
   581
                }
36
hgs
parents: 35
diff changeset
   582
            }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
        }
35
hgs
parents: 34
diff changeset
   584
    } else {
hgs
parents: 34
diff changeset
   585
        TX_LOG_ARGS( "InspireMe is collapsed." )
hgs
parents: 34
diff changeset
   586
        mInspireMeProgressBar->hide();
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
    }
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
35
hgs
parents: 34
diff changeset
   591
#ifdef SHARE_FUNC_ENABLED
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   592
/*!
35
hgs
parents: 34
diff changeset
   593
 Slot to be called when share button is clicked
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
 */
35
hgs
parents: 34
diff changeset
   595
void MpDetailsView::share()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   598
    createShareDialog();
hgs
parents: 34
diff changeset
   599
    if (canQuerySharePlayerLink() )
hgs
parents: 34
diff changeset
   600
    {
hgs
parents: 34
diff changeset
   601
        mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() );
hgs
parents: 34
diff changeset
   602
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   604
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
/*!
35
hgs
parents: 34
diff changeset
   607
  Method to create the share dialog on demand.
36
hgs
parents: 35
diff changeset
   608
  This will cause the share web view to be created and start loading.
35
hgs
parents: 34
diff changeset
   609
  */
hgs
parents: 34
diff changeset
   610
void MpDetailsView::createShareDialog()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   613
    if ( !mSharePopup )
hgs
parents: 34
diff changeset
   614
    {
hgs
parents: 34
diff changeset
   615
        mSharePopup = new MpDetailsShareDialog();
36
hgs
parents: 35
diff changeset
   616
    }
hgs
parents: 35
diff changeset
   617
    if ( !mSharePopup->isInitialized() )
hgs
parents: 35
diff changeset
   618
    {
hgs
parents: 35
diff changeset
   619
        connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) );
hgs
parents: 35
diff changeset
   620
        mSharePopup->initialize( mSongData, tr( "Unknown" ) );
35
hgs
parents: 34
diff changeset
   621
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
35
hgs
parents: 34
diff changeset
   625
/*!
36
hgs
parents: 35
diff changeset
   626
  Method to create the share dialog on demand and preload publishing player files.
hgs
parents: 35
diff changeset
   627
  This will construct the share dialog but it will still be in "uninitialized" state.
hgs
parents: 35
diff changeset
   628
  */
hgs
parents: 35
diff changeset
   629
void MpDetailsView::preloadShareDialog()
hgs
parents: 35
diff changeset
   630
{
hgs
parents: 35
diff changeset
   631
    TX_ENTRY
hgs
parents: 35
diff changeset
   632
    if ( !mSharePopup )
hgs
parents: 35
diff changeset
   633
    {
hgs
parents: 35
diff changeset
   634
        mSharePopup = new MpDetailsShareDialog();
hgs
parents: 35
diff changeset
   635
    }
hgs
parents: 35
diff changeset
   636
    mSharePopup->cachePublishingPlayerFiles();
hgs
parents: 35
diff changeset
   637
    TX_EXIT
hgs
parents: 35
diff changeset
   638
}
hgs
parents: 35
diff changeset
   639
hgs
parents: 35
diff changeset
   640
/*!
35
hgs
parents: 34
diff changeset
   641
 Slot to be called when ok/close button in share dialog is pressed.
hgs
parents: 34
diff changeset
   642
 */
hgs
parents: 34
diff changeset
   643
void MpDetailsView::closeShareDialog()
hgs
parents: 34
diff changeset
   644
{
hgs
parents: 34
diff changeset
   645
    TX_ENTRY
hgs
parents: 34
diff changeset
   646
    if ( mSharePopup )
hgs
parents: 34
diff changeset
   647
    {
36
hgs
parents: 35
diff changeset
   648
        // Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it.
35
hgs
parents: 34
diff changeset
   649
        mSharePopup->close();
hgs
parents: 34
diff changeset
   650
        mSharePopup = NULL;
hgs
parents: 34
diff changeset
   651
    }
hgs
parents: 34
diff changeset
   652
    TX_EXIT
hgs
parents: 34
diff changeset
   653
}
hgs
parents: 34
diff changeset
   654
#endif
hgs
parents: 34
diff changeset
   655
hgs
parents: 34
diff changeset
   656
/*!
hgs
parents: 34
diff changeset
   657
 Slot to handle the music store URL retrieval from the query manager.
hgs
parents: 34
diff changeset
   658
*/
hgs
parents: 34
diff changeset
   659
void MpDetailsView::updateSharedData(const QString& url)
hgs
parents: 34
diff changeset
   660
{
hgs
parents: 34
diff changeset
   661
    TX_ENTRY
hgs
parents: 34
diff changeset
   662
    mSongData->setLink( url );
hgs
parents: 34
diff changeset
   663
#ifdef SHARE_FUNC_ENABLED
hgs
parents: 34
diff changeset
   664
    if ( mSharePopup )
hgs
parents: 34
diff changeset
   665
	{
hgs
parents: 34
diff changeset
   666
		mSharePopup->updateSharedData();
hgs
parents: 34
diff changeset
   667
	}
hgs
parents: 34
diff changeset
   668
#endif
hgs
parents: 34
diff changeset
   669
    TX_EXIT
hgs
parents: 34
diff changeset
   670
}