36
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
35
|
18 |
#ifdef SHARE_FUNC_ENABLED
|
|
19 |
|
|
20 |
#include "mpsharedata.h"
|
|
21 |
#include "mpsongdata.h"
|
|
22 |
|
36
|
23 |
|
35
|
24 |
// TODO OVI_URL needs to come from cenrep
|
|
25 |
const QString OVI_URL = "http://music.ovi.com";
|
|
26 |
|
|
27 |
// The music note symbol that we post if we do not have music store URL.
|
36
|
28 |
const QString MUSIC_NOTE_SYMBOL = "♫";
|
|
29 |
|
35
|
30 |
|
|
31 |
MpShareData::MpShareData()
|
|
32 |
: mOwner( 0 ),
|
|
33 |
mSongData( 0 )
|
|
34 |
{
|
|
35 |
}
|
|
36 |
|
|
37 |
MpShareData::~MpShareData()
|
|
38 |
{
|
36
|
39 |
// Intentionally empty.
|
35
|
40 |
}
|
|
41 |
|
|
42 |
void MpShareData::setOwner( QObject* aOwner )
|
|
43 |
{
|
|
44 |
mOwner = aOwner;
|
|
45 |
}
|
|
46 |
|
|
47 |
QObject* MpShareData::owner() const
|
|
48 |
{
|
|
49 |
return mOwner;
|
|
50 |
}
|
|
51 |
|
|
52 |
void MpShareData::setSongData( MpSongData* aSongData )
|
|
53 |
{
|
|
54 |
mSongData = aSongData;
|
|
55 |
}
|
|
56 |
|
|
57 |
MpSongData* MpShareData::songData() const
|
|
58 |
{
|
|
59 |
return mSongData;
|
|
60 |
}
|
|
61 |
|
|
62 |
void MpShareData::setErrorMessage( const QString& s )
|
|
63 |
{
|
|
64 |
mErrorMessage = s;
|
|
65 |
}
|
|
66 |
|
|
67 |
QString MpShareData::errorMessage() const
|
|
68 |
{
|
|
69 |
return mErrorMessage;
|
|
70 |
}
|
|
71 |
|
|
72 |
void MpShareData::setUsername( const QString& s )
|
|
73 |
{
|
|
74 |
mUsername = s;
|
|
75 |
}
|
|
76 |
|
|
77 |
QString MpShareData::username() const
|
|
78 |
{
|
|
79 |
return mUsername;
|
|
80 |
}
|
|
81 |
|
|
82 |
void MpShareData::setPassword( const QString& s )
|
|
83 |
{
|
|
84 |
mPassword = s;
|
|
85 |
}
|
|
86 |
|
|
87 |
QString MpShareData::password() const
|
|
88 |
{
|
|
89 |
return mPassword;
|
|
90 |
}
|
|
91 |
|
|
92 |
void MpShareData::setLanguage( const QString& s )
|
|
93 |
{
|
|
94 |
mLanguage = s;
|
|
95 |
}
|
|
96 |
|
|
97 |
QString MpShareData::language() const
|
|
98 |
{
|
|
99 |
return mLanguage;
|
|
100 |
}
|
|
101 |
|
36
|
102 |
void MpShareData::setUnknownTr( const QString& s )
|
|
103 |
{
|
|
104 |
mUnknownTr = s;
|
|
105 |
}
|
|
106 |
|
35
|
107 |
QString MpShareData::objectType() const
|
|
108 |
{
|
|
109 |
if ( !mSongData || mSongData->link().isEmpty() )
|
|
110 |
{
|
|
111 |
return "NOTE-APPEND";
|
|
112 |
}
|
36
|
113 |
// No link, append artist-song
|
|
114 |
return "URI";
|
35
|
115 |
}
|
|
116 |
|
|
117 |
int MpShareData::objectReservedLength() const
|
|
118 |
{
|
|
119 |
return objectContent().length();
|
|
120 |
}
|
|
121 |
|
|
122 |
QString MpShareData::objectContent() const
|
|
123 |
{
|
36
|
124 |
if ( mSongData && !mSongData->link().isEmpty() )
|
35
|
125 |
{
|
36
|
126 |
return mSongData->link();
|
35
|
127 |
}
|
36
|
128 |
// TODO: do we need to have right-to-left text direction here,
|
|
129 |
// i.e. putting the title before the artist in such a case?
|
|
130 |
return MUSIC_NOTE_SYMBOL + " " + artist() + ": " + title() + " " + OVI_URL;
|
35
|
131 |
}
|
|
132 |
|
|
133 |
QString MpShareData::title() const
|
|
134 |
{
|
36
|
135 |
if ( mSongData && !mSongData->title().isEmpty() )
|
|
136 |
{
|
|
137 |
return mSongData->title();
|
|
138 |
}
|
|
139 |
return mUnknownTr;
|
35
|
140 |
}
|
|
141 |
|
|
142 |
QString MpShareData::artist() const
|
|
143 |
{
|
36
|
144 |
if ( mSongData && !mSongData->artist().isEmpty() )
|
|
145 |
{
|
|
146 |
return mSongData->artist();
|
|
147 |
}
|
|
148 |
return mUnknownTr;
|
35
|
149 |
}
|
|
150 |
|
|
151 |
QString MpShareData::albumArtBase64() const
|
|
152 |
{
|
|
153 |
return mSongData ? mSongData->albumArtBase64() : "";
|
|
154 |
}
|
|
155 |
|
|
156 |
#endif // SHARE_FUNC_ENABLED
|