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