mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp
author hgs
Fri, 11 Jun 2010 19:36:32 -0500
changeset 37 eb79a7c355bf
parent 36 a0afa279b8fe
child 43 0f32e550d9d8
child 48 af3740e3753f
permissions -rw-r--r--
201023
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 );
hgs
parents: 34
diff changeset
   224
    mMpEngine->retrieveSong();
36
hgs
parents: 35
diff changeset
   225
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
    mActivated = true;
35
hgs
parents: 34
diff changeset
   227
    mInspireMeOpen = MpSettingsManager::inspireMe();
hgs
parents: 34
diff changeset
   228
    mSongDetailsGbOpen = MpSettingsManager::songDetailsGb();
hgs
parents: 34
diff changeset
   229
    TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen );
hgs
parents: 34
diff changeset
   230
    TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen );
hgs
parents: 34
diff changeset
   231
    mInspireMeGroupBox->setCollapsed(!mInspireMeOpen);
hgs
parents: 34
diff changeset
   232
    mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen);
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
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
 Deactivates the details view.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
void MpDetailsView::deactivateView()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
{
36
hgs
parents: 35
diff changeset
   241
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   242
    if (mInspireMeGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   243
      MpSettingsManager::setInspireMe(false);
hgs
parents: 34
diff changeset
   244
      } else {
hgs
parents: 34
diff changeset
   245
      MpSettingsManager::setInspireMe(true);
hgs
parents: 34
diff changeset
   246
      }
36
hgs
parents: 35
diff changeset
   247
35
hgs
parents: 34
diff changeset
   248
    if (mSongDetailsGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   249
      MpSettingsManager::setSongDetailsGb(false);
hgs
parents: 34
diff changeset
   250
      } else {
hgs
parents: 34
diff changeset
   251
      MpSettingsManager::setSongDetailsGb(true);
hgs
parents: 34
diff changeset
   252
      }
36
hgs
parents: 35
diff changeset
   253
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    setNavigationAction( 0 );
36
hgs
parents: 35
diff changeset
   255
    mActivated = false;
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    TX_EXIT
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
 Setup the menu.
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
void MpDetailsView::setupMenu()
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
    TX_ENTRY
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
    TX_EXIT
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
 Slot to handle back command from softkey.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
void MpDetailsView::back()
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
{
36
hgs
parents: 35
diff changeset
   274
    TX_ENTRY
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    emit command( MpCommon::ActivatePlaybackView );
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
    TX_EXIT
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
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
 Slot to handle Album art changed.
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
 */
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
void MpDetailsView::albumArtChanged( )
36
hgs
parents: 35
diff changeset
   283
{
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   285
    HbIcon icon;
hgs
parents: 34
diff changeset
   286
    mSongData->albumArt( icon );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
    mAlbumArt->setIcon( icon );
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
    TX_EXIT
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
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
/*!
35
hgs
parents: 34
diff changeset
   292
 Slot to handle network error.
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
 */
35
hgs
parents: 34
diff changeset
   294
void MpDetailsView::handleNetworkError()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   297
    mInspireMeQueryOngoing = false;
hgs
parents: 34
diff changeset
   298
    mInspireMeQueryRendered = false;
36
hgs
parents: 35
diff changeset
   299
    clearInspireMe();
35
hgs
parents: 34
diff changeset
   300
    mInspireMeGroupBox->setCollapsed( true );
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
 */
36
hgs
parents: 35
diff changeset
   307
void MpDetailsView::RenderInspireMeGroupBox()
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();
hgs
parents: 34
diff changeset
   313
    if( mMpQueryManager->recommendationAlbumArtsMap().count() ) {
hgs
parents: 34
diff changeset
   314
        TX_LOG_ARGS( "There are recommendations." )
hgs
parents: 34
diff changeset
   315
        // we have recommendations
hgs
parents: 34
diff changeset
   316
        for ( int i = 0; i < KRecommendationCount; i++ ) {
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();
36
hgs
parents: 35
diff changeset
   325
            HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) );
35
hgs
parents: 34
diff changeset
   326
            inspireMeItem->setIcon( icon );
hgs
parents: 34
diff changeset
   327
            inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) );
hgs
parents: 34
diff changeset
   328
            inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) );
hgs
parents: 34
diff changeset
   329
            mInspireList->addItem( inspireMeItem );
hgs
parents: 34
diff changeset
   330
        }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
    }
35
hgs
parents: 34
diff changeset
   332
    else {
hgs
parents: 34
diff changeset
   333
        TX_LOG_ARGS( "There is NO recommendation." )
hgs
parents: 34
diff changeset
   334
        // we dont have recommendations
36
hgs
parents: 35
diff changeset
   335
        // we havent configured the prototype before
35
hgs
parents: 34
diff changeset
   336
        HbListViewItem *prototype = mInspireList->listItemPrototype();
hgs
parents: 34
diff changeset
   337
        const int maxTextRowCount = 20;
hgs
parents: 34
diff changeset
   338
        const int minTextRowCount = 1;
hgs
parents: 34
diff changeset
   339
        prototype->setSecondaryTextRowCount(minTextRowCount,maxTextRowCount);
36
hgs
parents: 35
diff changeset
   340
35
hgs
parents: 34
diff changeset
   341
        HbListWidgetItem  *inspireMeItem = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   342
        QString info(tr("There are no recommendations for this track, but you can always discover new music on Ovi"));
hgs
parents: 34
diff changeset
   343
        inspireMeItem->setText( QString( " " ) );
hgs
parents: 34
diff changeset
   344
        inspireMeItem->setSecondaryText( info );
hgs
parents: 34
diff changeset
   345
        mInspireList->addItem( inspireMeItem );
hgs
parents: 34
diff changeset
   346
    }
36
hgs
parents: 35
diff changeset
   347
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
35
hgs
parents: 34
diff changeset
   351
bool MpDetailsView::canQueryRecommendations() const
hgs
parents: 34
diff changeset
   352
{
hgs
parents: 34
diff changeset
   353
    bool result = ( ( !mSongData->album().isEmpty() ) ||
36
hgs
parents: 35
diff changeset
   354
                    ( !mSongData->artist().isEmpty() ) ) &&
35
hgs
parents: 34
diff changeset
   355
                  !( mInspireMeGroupBox->isCollapsed() );
hgs
parents: 34
diff changeset
   356
    TX_LOG_ARGS( "Can query recommendations:" << result );
hgs
parents: 34
diff changeset
   357
    return result;
hgs
parents: 34
diff changeset
   358
}
hgs
parents: 34
diff changeset
   359
hgs
parents: 34
diff changeset
   360
bool MpDetailsView::canQuerySharePlayerLink() const
hgs
parents: 34
diff changeset
   361
{
hgs
parents: 34
diff changeset
   362
  bool result = ( !mSongData->title().isEmpty() ) &&
hgs
parents: 34
diff changeset
   363
                ( !mSongData->artist().isEmpty() ) ;
hgs
parents: 34
diff changeset
   364
  TX_LOG_ARGS( "Can query share player link:" << result );
hgs
parents: 34
diff changeset
   365
  return result;
hgs
parents: 34
diff changeset
   366
}
hgs
parents: 34
diff changeset
   367
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
 Slot to handle basic song information
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
 */
35
hgs
parents: 34
diff changeset
   371
void MpDetailsView::handlePlaybackInfoChanged()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   374
    mMpQueryManager->clearNetworkReplies();
hgs
parents: 34
diff changeset
   375
    clearInspireMe();
hgs
parents: 34
diff changeset
   376
    mInspireMeQueryRendered = false;
36
hgs
parents: 35
diff changeset
   377
hgs
parents: 35
diff changeset
   378
    // Clear the song data link until new query has been made.
hgs
parents: 35
diff changeset
   379
    mSongData->setLink( "" );
hgs
parents: 35
diff changeset
   380
35
hgs
parents: 34
diff changeset
   381
    if ( !mSongData->title().isEmpty () ) {
hgs
parents: 34
diff changeset
   382
        mSongText->setPlainText( mSongData->title() );
hgs
parents: 34
diff changeset
   383
    } else {
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() );
hgs
parents: 34
diff changeset
   389
    } else {
36
hgs
parents: 35
diff changeset
   390
        mAlbumText->setPlainText( tr( "Unknown") );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
    }
36
hgs
parents: 35
diff changeset
   392
35
hgs
parents: 34
diff changeset
   393
    if ( !mSongData->artist().isEmpty() ) {
hgs
parents: 34
diff changeset
   394
        mArtistText->setPlainText( mSongData->artist() );
hgs
parents: 34
diff changeset
   395
    } else {
36
hgs
parents: 35
diff changeset
   396
        mArtistText->setPlainText( tr( "Unknown") );
35
hgs
parents: 34
diff changeset
   397
    }
36
hgs
parents: 35
diff changeset
   398
hgs
parents: 35
diff changeset
   399
    if (canQuerySharePlayerLink() ) {
hgs
parents: 35
diff changeset
   400
        mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 35
diff changeset
   401
    }
hgs
parents: 35
diff changeset
   402
35
hgs
parents: 34
diff changeset
   403
    if (canQueryRecommendations()) {
hgs
parents: 34
diff changeset
   404
        // start inspire me area progress bar
hgs
parents: 34
diff changeset
   405
        // TODO: currently, till we get to this callback from MPX the bar not shown
hgs
parents: 34
diff changeset
   406
        // TODO: check if inspireMe is ON, if not, dont show
hgs
parents: 34
diff changeset
   407
        mInspireMeProgressBar->show();
hgs
parents: 34
diff changeset
   408
        mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 34
diff changeset
   409
        mInspireMeQueryOngoing = true;
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
    }
35
hgs
parents: 34
diff changeset
   411
    else {
hgs
parents: 34
diff changeset
   412
        // metadata to query for inspire me items not available
hgs
parents: 34
diff changeset
   413
        // show information note
hgs
parents: 34
diff changeset
   414
      if (!mInspireMeGroupBox->isCollapsed())
hgs
parents: 34
diff changeset
   415
        RenderInspireMeGroupBox();
hgs
parents: 34
diff changeset
   416
    }
36
hgs
parents: 35
diff changeset
   417
    TX_EXIT
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
35
hgs
parents: 34
diff changeset
   420
void MpDetailsView::clearInspireMe()
hgs
parents: 34
diff changeset
   421
{
36
hgs
parents: 35
diff changeset
   422
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   423
    mInspireList->clear();
36
hgs
parents: 35
diff changeset
   424
    mMpQueryManager->clearRecommendations();
hgs
parents: 35
diff changeset
   425
    TX_EXIT
35
hgs
parents: 34
diff changeset
   426
}
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
/*!
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
 Slot to handle detail song information
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
void MpDetailsView::songDetailInfoChanged()
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
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
    mDetailList->clear();
36
hgs
parents: 35
diff changeset
   434
35
hgs
parents: 34
diff changeset
   435
    if ( !mSongData->albumTrack().isNull() ) {
36
hgs
parents: 35
diff changeset
   436
        HbListWidgetItem *item = new HbListWidgetItem();
35
hgs
parents: 34
diff changeset
   437
        item->setText( tr( "Song number" ) );
hgs
parents: 34
diff changeset
   438
        item->setSecondaryText( mSongData->albumTrack() );
hgs
parents: 34
diff changeset
   439
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   440
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   441
    }
36
hgs
parents: 35
diff changeset
   442
35
hgs
parents: 34
diff changeset
   443
    if ( !mSongData->year().isNull() ) {
hgs
parents: 34
diff changeset
   444
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   445
        item->setText( tr( "Year" ) );
hgs
parents: 34
diff changeset
   446
        item->setSecondaryText( mSongData->year() );
hgs
parents: 34
diff changeset
   447
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   448
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   449
    }
36
hgs
parents: 35
diff changeset
   450
35
hgs
parents: 34
diff changeset
   451
    if ( !mSongData->genre().isNull() ) {
hgs
parents: 34
diff changeset
   452
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   453
        item->setText( tr( "Genre" ) );
hgs
parents: 34
diff changeset
   454
        item->setSecondaryText( mSongData->genre() );
hgs
parents: 34
diff changeset
   455
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   456
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   457
    }
36
hgs
parents: 35
diff changeset
   458
35
hgs
parents: 34
diff changeset
   459
    if ( !mSongData->composer().isNull() ) {
hgs
parents: 34
diff changeset
   460
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   461
        item->setText( tr( "Composer" ) );
hgs
parents: 34
diff changeset
   462
        item->setSecondaryText( mSongData->composer() );
hgs
parents: 34
diff changeset
   463
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   464
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   465
    }
hgs
parents: 34
diff changeset
   466
hgs
parents: 34
diff changeset
   467
    if ( !mSongData->fileName().isNull() ) {
hgs
parents: 34
diff changeset
   468
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   469
        item->setText( tr( "File name" ) );
hgs
parents: 34
diff changeset
   470
        item->setSecondaryText( mSongData->fileName() );
hgs
parents: 34
diff changeset
   471
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   472
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   473
    }
36
hgs
parents: 35
diff changeset
   474
35
hgs
parents: 34
diff changeset
   475
    if ( !mSongData->mimeType().isNull() ) {
hgs
parents: 34
diff changeset
   476
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   477
        item->setText( tr( "Format" ) );
hgs
parents: 34
diff changeset
   478
        item->setSecondaryText( mSongData->mimeType() );
hgs
parents: 34
diff changeset
   479
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   480
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   481
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
35
hgs
parents: 34
diff changeset
   483
    if ( !mSongData->duration().isNull() ) {
hgs
parents: 34
diff changeset
   484
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   485
        item->setText( tr( "Duration" ) );
hgs
parents: 34
diff changeset
   486
        item->setSecondaryText( mSongData->duration() );
hgs
parents: 34
diff changeset
   487
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   488
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   489
    }
36
hgs
parents: 35
diff changeset
   490
35
hgs
parents: 34
diff changeset
   491
    if ( !mSongData->bitRate().isNull() ) {
hgs
parents: 34
diff changeset
   492
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   493
        item->setText( tr( "Bitrate" ) );
hgs
parents: 34
diff changeset
   494
        item->setSecondaryText( mSongData->bitRate().append( " Kbps" ) );
hgs
parents: 34
diff changeset
   495
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   496
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   497
    }
36
hgs
parents: 35
diff changeset
   498
35
hgs
parents: 34
diff changeset
   499
    if ( !mSongData->sampleRate().isNull() ) {
hgs
parents: 34
diff changeset
   500
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   501
        item->setText( tr( "Sampling rate" ) );
hgs
parents: 34
diff changeset
   502
        item->setSecondaryText( mSongData->sampleRate().append( " hz" ) );
hgs
parents: 34
diff changeset
   503
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   504
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   505
    }
36
hgs
parents: 35
diff changeset
   506
35
hgs
parents: 34
diff changeset
   507
    if ( !mSongData->size().isNull() ) {
hgs
parents: 34
diff changeset
   508
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   509
        item->setText( tr( "Size" ) );
hgs
parents: 34
diff changeset
   510
        item->setSecondaryText( mSongData->size().append( " MB" ) );
hgs
parents: 34
diff changeset
   511
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   512
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   513
    }
36
hgs
parents: 35
diff changeset
   514
35
hgs
parents: 34
diff changeset
   515
    if ( !mSongData->modified().isNull() ) {
hgs
parents: 34
diff changeset
   516
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   517
        item->setText( tr( "Modified" ) );
hgs
parents: 34
diff changeset
   518
        item->setSecondaryText( mSongData->modified() );
hgs
parents: 34
diff changeset
   519
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   520
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   521
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
35
hgs
parents: 34
diff changeset
   523
    if ( !mSongData->copyright().isNull() ) {
hgs
parents: 34
diff changeset
   524
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   525
        item->setText( tr( "Copyright" ) );
hgs
parents: 34
diff changeset
   526
        item->setSecondaryText( mSongData->copyright() );
hgs
parents: 34
diff changeset
   527
        item->setEnabled( false );
hgs
parents: 34
diff changeset
   528
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   529
    }
36
hgs
parents: 35
diff changeset
   530
35
hgs
parents: 34
diff changeset
   531
    if ( !mSongData->musicURL().isNull() ) {
hgs
parents: 34
diff changeset
   532
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   533
        item->setText( tr( "Web site" ) );
hgs
parents: 34
diff changeset
   534
        item->setSecondaryText( mSongData->musicURL() );
hgs
parents: 34
diff changeset
   535
        item->setEnabled( true );
hgs
parents: 34
diff changeset
   536
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   537
    }
36
hgs
parents: 35
diff changeset
   538
35
hgs
parents: 34
diff changeset
   539
    if ( mSongData->isDrmProtected() ) {
hgs
parents: 34
diff changeset
   540
        HbListWidgetItem *item = new HbListWidgetItem();
hgs
parents: 34
diff changeset
   541
        item->setText( tr( "Licences" ) );
hgs
parents: 34
diff changeset
   542
        item->setSecondaryText( tr( "Click for details" ) );
hgs
parents: 34
diff changeset
   543
        item->setEnabled( true );
hgs
parents: 34
diff changeset
   544
        mDetailList->addItem( item );
hgs
parents: 34
diff changeset
   545
    }
hgs
parents: 34
diff changeset
   546
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
36
hgs
parents: 35
diff changeset
   550
void MpDetailsView::handleDetailsGroupBoxToggled(bool /*state*/)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
    TX_ENTRY
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
    if ( !mSongDetailsGroupBox->isCollapsed() ) {
35
hgs
parents: 34
diff changeset
   554
            mInspireMeGroupBox->setCollapsed( true );
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
    }
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
35
hgs
parents: 34
diff changeset
   559
void MpDetailsView::handleInspireMeGroupBoxToggled(bool /*state*/)
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   562
    if ( !mInspireMeGroupBox->isCollapsed() ) {
hgs
parents: 34
diff changeset
   563
        TX_LOG_ARGS( "InspireMe is expanded." )
36
hgs
parents: 35
diff changeset
   564
        mSongDetailsGroupBox->setCollapsed( true );
35
hgs
parents: 34
diff changeset
   565
        if ( mInspireMeQueryOngoing ) {
hgs
parents: 34
diff changeset
   566
            TX_LOG_ARGS( "Query is ongoing " )
hgs
parents: 34
diff changeset
   567
            mInspireMeProgressBar->show();
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
        } else {
35
hgs
parents: 34
diff changeset
   569
            TX_LOG_ARGS( "Query is NOT ongoing " )
hgs
parents: 34
diff changeset
   570
            if ( mInspireMeQueryRendered ) {
hgs
parents: 34
diff changeset
   571
                TX_LOG_ARGS( "InspireMe is rendered already. " )
hgs
parents: 34
diff changeset
   572
                mInspireMeProgressBar->hide();
hgs
parents: 34
diff changeset
   573
            } else {
hgs
parents: 34
diff changeset
   574
                if ( canQueryRecommendations() ) {
hgs
parents: 34
diff changeset
   575
                    TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " )
hgs
parents: 34
diff changeset
   576
                    mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
hgs
parents: 34
diff changeset
   577
                    mInspireMeProgressBar->show();
hgs
parents: 34
diff changeset
   578
                    mInspireMeQueryOngoing = true;
hgs
parents: 34
diff changeset
   579
                } else {
hgs
parents: 34
diff changeset
   580
                    TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " )
hgs
parents: 34
diff changeset
   581
                    RenderInspireMeGroupBox();
hgs
parents: 34
diff changeset
   582
                }
36
hgs
parents: 35
diff changeset
   583
            }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
        }
35
hgs
parents: 34
diff changeset
   585
    } else {
hgs
parents: 34
diff changeset
   586
        TX_LOG_ARGS( "InspireMe is collapsed." )
hgs
parents: 34
diff changeset
   587
        mInspireMeProgressBar->hide();
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
#ifdef SHARE_FUNC_ENABLED
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
/*!
35
hgs
parents: 34
diff changeset
   594
 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
   595
 */
35
hgs
parents: 34
diff changeset
   596
void MpDetailsView::share()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   599
    createShareDialog();
hgs
parents: 34
diff changeset
   600
    if (canQuerySharePlayerLink() )
hgs
parents: 34
diff changeset
   601
    {
hgs
parents: 34
diff changeset
   602
        mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() );
hgs
parents: 34
diff changeset
   603
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   604
    TX_EXIT
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
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
/*!
35
hgs
parents: 34
diff changeset
   608
  Method to create the share dialog on demand.
36
hgs
parents: 35
diff changeset
   609
  This will cause the share web view to be created and start loading.
35
hgs
parents: 34
diff changeset
   610
  */
hgs
parents: 34
diff changeset
   611
void MpDetailsView::createShareDialog()
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
{
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
    TX_ENTRY
35
hgs
parents: 34
diff changeset
   614
    if ( !mSharePopup )
hgs
parents: 34
diff changeset
   615
    {
hgs
parents: 34
diff changeset
   616
        mSharePopup = new MpDetailsShareDialog();
36
hgs
parents: 35
diff changeset
   617
    }
hgs
parents: 35
diff changeset
   618
    if ( !mSharePopup->isInitialized() )
hgs
parents: 35
diff changeset
   619
    {
hgs
parents: 35
diff changeset
   620
        connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) );
hgs
parents: 35
diff changeset
   621
        mSharePopup->initialize( mSongData, tr( "Unknown" ) );
35
hgs
parents: 34
diff changeset
   622
    }
20
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
    TX_EXIT
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
}
82baf59ce8dd Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
35
hgs
parents: 34
diff changeset
   626
/*!
36
hgs
parents: 35
diff changeset
   627
  Method to create the share dialog on demand and preload publishing player files.
hgs
parents: 35
diff changeset
   628
  This will construct the share dialog but it will still be in "uninitialized" state.
hgs
parents: 35
diff changeset
   629
  */
hgs
parents: 35
diff changeset
   630
void MpDetailsView::preloadShareDialog()
hgs
parents: 35
diff changeset
   631
{
hgs
parents: 35
diff changeset
   632
    TX_ENTRY
hgs
parents: 35
diff changeset
   633
    if ( !mSharePopup )
hgs
parents: 35
diff changeset
   634
    {
hgs
parents: 35
diff changeset
   635
        mSharePopup = new MpDetailsShareDialog();
hgs
parents: 35
diff changeset
   636
    }
hgs
parents: 35
diff changeset
   637
    mSharePopup->cachePublishingPlayerFiles();
hgs
parents: 35
diff changeset
   638
    TX_EXIT
hgs
parents: 35
diff changeset
   639
}
hgs
parents: 35
diff changeset
   640
hgs
parents: 35
diff changeset
   641
/*!
35
hgs
parents: 34
diff changeset
   642
 Slot to be called when ok/close button in share dialog is pressed.
hgs
parents: 34
diff changeset
   643
 */
hgs
parents: 34
diff changeset
   644
void MpDetailsView::closeShareDialog()
hgs
parents: 34
diff changeset
   645
{
hgs
parents: 34
diff changeset
   646
    TX_ENTRY
hgs
parents: 34
diff changeset
   647
    if ( mSharePopup )
hgs
parents: 34
diff changeset
   648
    {
36
hgs
parents: 35
diff changeset
   649
        // Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it.
35
hgs
parents: 34
diff changeset
   650
        mSharePopup->close();
hgs
parents: 34
diff changeset
   651
        mSharePopup = NULL;
hgs
parents: 34
diff changeset
   652
    }
hgs
parents: 34
diff changeset
   653
    TX_EXIT
hgs
parents: 34
diff changeset
   654
}
hgs
parents: 34
diff changeset
   655
#endif
hgs
parents: 34
diff changeset
   656
hgs
parents: 34
diff changeset
   657
/*!
hgs
parents: 34
diff changeset
   658
 Slot to handle the music store URL retrieval from the query manager.
hgs
parents: 34
diff changeset
   659
*/
hgs
parents: 34
diff changeset
   660
void MpDetailsView::updateSharedData(const QString& url)
hgs
parents: 34
diff changeset
   661
{
hgs
parents: 34
diff changeset
   662
    TX_ENTRY
hgs
parents: 34
diff changeset
   663
    mSongData->setLink( url );
hgs
parents: 34
diff changeset
   664
#ifdef SHARE_FUNC_ENABLED
hgs
parents: 34
diff changeset
   665
    if ( mSharePopup )
hgs
parents: 34
diff changeset
   666
	{
hgs
parents: 34
diff changeset
   667
		mSharePopup->updateSharedData();
hgs
parents: 34
diff changeset
   668
	}
hgs
parents: 34
diff changeset
   669
#endif
hgs
parents: 34
diff changeset
   670
    TX_EXIT
hgs
parents: 34
diff changeset
   671
}