Lines 212-218
Link Here
|
212 |
|
212 |
|
213 |
m_contextTab = new QVBox(this, "context_tab"); |
213 |
m_contextTab = new QVBox(this, "context_tab"); |
214 |
|
214 |
|
215 |
m_currentTrackPage = new HTMLView( m_contextTab, "current_track_page", true /* DNDEnabled */ ); |
215 |
m_currentTrackPage = new HTMLView( m_contextTab, "current_track_page", true /* DNDEnabled */, |
|
|
216 |
true /*JScriptEnabled*/ ); |
216 |
|
217 |
|
217 |
m_lyricsTab = new QVBox(this, "lyrics_tab"); |
218 |
m_lyricsTab = new QVBox(this, "lyrics_tab"); |
218 |
|
219 |
|
Lines 264-270
Link Here
|
264 |
|
265 |
|
265 |
|
266 |
|
266 |
|
267 |
|
267 |
m_lyricsPage = new HTMLView( m_lyricsTab, "lyrics_page", true /* DNDEnabled */ ); |
268 |
m_lyricsPage = new HTMLView( m_lyricsTab, "lyrics_page", true /* DNDEnabled */, false /* JScriptEnabled*/ ); |
268 |
m_lyricsTextEdit = new KTextEdit ( m_lyricsTab, "lyrics_text_edit"); |
269 |
m_lyricsTextEdit = new KTextEdit ( m_lyricsTab, "lyrics_text_edit"); |
269 |
m_lyricsTextEdit->setTextFormat( Qt::PlainText ); |
270 |
m_lyricsTextEdit->setTextFormat( Qt::PlainText ); |
270 |
m_lyricsTextEdit->hide(); |
271 |
m_lyricsTextEdit->hide(); |
Lines 285-291
Link Here
|
285 |
m_wikiToolBar->setDelayedPopup( WIKI_BACK, m_wikiBackPopup ); |
286 |
m_wikiToolBar->setDelayedPopup( WIKI_BACK, m_wikiBackPopup ); |
286 |
m_wikiToolBar->setDelayedPopup( WIKI_FORWARD, m_wikiForwardPopup ); |
287 |
m_wikiToolBar->setDelayedPopup( WIKI_FORWARD, m_wikiForwardPopup ); |
287 |
|
288 |
|
288 |
m_wikiPage = new HTMLView( m_wikiTab, "wiki_page", true /* DNDEnabled */ ); |
289 |
m_wikiPage = new HTMLView( m_wikiTab, "wiki_page", true /* DNDEnabled */, false /* JScriptEnabled */ ); |
289 |
|
290 |
|
290 |
m_cuefile = CueFile::instance(); |
291 |
m_cuefile = CueFile::instance(); |
291 |
connect( m_cuefile, SIGNAL(metaData( const MetaBundle& )), |
292 |
connect( m_cuefile, SIGNAL(metaData( const MetaBundle& )), |
Lines 1104-1109
Link Here
|
1104 |
{ |
1105 |
{ |
1105 |
m_metadataHistory += QDeepCopy<QString>( *it ); |
1106 |
m_metadataHistory += QDeepCopy<QString>( *it ); |
1106 |
} |
1107 |
} |
|
|
1108 |
|
1109 |
|
1110 |
m_amarokIconPath = QDeepCopy<QString>(KGlobal::iconLoader()->iconPath( "amarok", |
1111 |
-KIcon::SizeEnormous ) ); |
1112 |
m_musicBrainIconPath = QDeepCopy<QString>(locate( "data", "amarok/images/musicbrainz.png" ) |
1113 |
); |
1114 |
m_lastfmIcon = "file://" + locate( "data","amarok/images/lastfm.png" ); |
1107 |
} |
1115 |
} |
1108 |
|
1116 |
|
1109 |
private: |
1117 |
private: |
Lines 1145-1150
Link Here
|
1145 |
b->saveHtmlData(); // Send html code to file |
1153 |
b->saveHtmlData(); // Send html code to file |
1146 |
} |
1154 |
} |
1147 |
QString m_HTMLSource; |
1155 |
QString m_HTMLSource; |
|
|
1156 |
QString m_amarokIconPath; |
1157 |
QString m_musicBrainIconPath; |
1158 |
QString m_lastfmIcon; |
1148 |
|
1159 |
|
1149 |
ContextBrowser *b; |
1160 |
ContextBrowser *b; |
1150 |
MetaBundle m_currentTrack; |
1161 |
MetaBundle m_currentTrack; |
Lines 1329-1335
Link Here
|
1329 |
"</div>\n" ) |
1340 |
"</div>\n" ) |
1330 |
.args( QStringList() |
1341 |
.args( QStringList() |
1331 |
<< escapeHTMLAttr( "externalurl://amarok.kde.org" ) |
1342 |
<< escapeHTMLAttr( "externalurl://amarok.kde.org" ) |
1332 |
<< escapeHTMLAttr( KGlobal::iconLoader()->iconPath( "amarok", -KIcon::SizeEnormous ) ) |
1343 |
<< escapeHTMLAttr( m_amarokIconPath ) |
1333 |
<< i18n( "1 Track", "%n Tracks", songCount.toInt() ) |
1344 |
<< i18n( "1 Track", "%n Tracks", songCount.toInt() ) |
1334 |
<< i18n( "1 Artist", "%n Artists", artistCount.toInt() ) |
1345 |
<< i18n( "1 Artist", "%n Artists", artistCount.toInt() ) |
1335 |
<< i18n( "1 Album", "%n Albums", albumCount.toInt() ) |
1346 |
<< i18n( "1 Album", "%n Albums", albumCount.toInt() ) |
Lines 1743-1749
Link Here
|
1743 |
const QString albumUrl = lastFmInfo->albumUrl(); |
1754 |
const QString albumUrl = lastFmInfo->albumUrl(); |
1744 |
const QString artistUrl = lastFmInfo->artistUrl(); |
1755 |
const QString artistUrl = lastFmInfo->artistUrl(); |
1745 |
const QString titleUrl = lastFmInfo->titleUrl(); |
1756 |
const QString titleUrl = lastFmInfo->titleUrl(); |
1746 |
const QString lastfmIcon = "file://" + locate( "data","amarok/images/lastfm.png" ); |
|
|
1747 |
|
1757 |
|
1748 |
const QString coverImage = ContextBrowser::getEncodedImage( lastFmInfo->imageUrl() ); |
1758 |
const QString coverImage = ContextBrowser::getEncodedImage( lastFmInfo->imageUrl() ); |
1749 |
|
1759 |
|
Lines 1818-1824
Link Here
|
1818 |
<< escapeHTMLAttr( currentTrack.album() )//10 |
1828 |
<< escapeHTMLAttr( currentTrack.album() )//10 |
1819 |
<< escapeHTMLAttr( userpage ) //11 |
1829 |
<< escapeHTMLAttr( userpage ) //11 |
1820 |
<< escapeHTMLAttr( userpage ) //12 |
1830 |
<< escapeHTMLAttr( userpage ) //12 |
1821 |
<< escapeHTMLAttr( lastfmIcon ) //13 |
1831 |
<< escapeHTMLAttr( m_lastfmIcon ) //13 |
1822 |
<< escapeHTML( i18n( "Skip" ) ) //14 |
1832 |
<< escapeHTML( i18n( "Skip" ) ) //14 |
1823 |
<< escapeHTMLAttr( skipIcon ) //15 |
1833 |
<< escapeHTMLAttr( skipIcon ) //15 |
1824 |
<< escapeHTML( i18n( "Love" ) ) //16 |
1834 |
<< escapeHTML( i18n( "Love" ) ) //16 |
Lines 2249-2255
Link Here
|
2249 |
<< escapeHTMLAttr( currentTrack.artist() ) |
2259 |
<< escapeHTMLAttr( currentTrack.artist() ) |
2250 |
<< escapeHTMLAttr( currentTrack.album() ) |
2260 |
<< escapeHTMLAttr( currentTrack.album() ) |
2251 |
<< escapeHTMLAttr( currentTrack.title() ) |
2261 |
<< escapeHTMLAttr( currentTrack.title() ) |
2252 |
<< escapeHTML( locate( "data", "amarok/images/musicbrainz.png" ) ) ) |
2262 |
<< escapeHTML( m_musicBrainIconPath ) ) |
2253 |
: QString ( //no title |
2263 |
: QString ( //no title |
2254 |
"<span id='current_box-header-prettytitle' class='box-header-prettytitle'>%1</span> " |
2264 |
"<span id='current_box-header-prettytitle' class='box-header-prettytitle'>%1</span> " |
2255 |
"</div>\n" |
2265 |
"</div>\n" |
Lines 2612-2618
Link Here
|
2612 |
qb.groupBy( QueryBuilder::tabAlbum, QueryBuilder::valName ); |
2622 |
qb.groupBy( QueryBuilder::tabAlbum, QueryBuilder::valName ); |
2613 |
qb.groupBy( QueryBuilder::tabAlbum, QueryBuilder::valID ); |
2623 |
qb.groupBy( QueryBuilder::tabAlbum, QueryBuilder::valID ); |
2614 |
qb.sortByFunction( QueryBuilder::funcMax, QueryBuilder::tabYear, QueryBuilder::valName, true ); |
2624 |
qb.sortByFunction( QueryBuilder::funcMax, QueryBuilder::tabYear, QueryBuilder::valName, true ); |
2615 |
qb.sortBy( QueryBuilder::tabAlbum, QueryBuilder::valName ); |
2625 |
qb.sortBy( QueryBuilder::tabAlbum, QueryBuilder::valName, true ); |
2616 |
qb.setOptions( QueryBuilder::optNoCompilations ); |
2626 |
qb.setOptions( QueryBuilder::optNoCompilations ); |
2617 |
values = qb.run(); |
2627 |
values = qb.run(); |
2618 |
|
2628 |
|
Lines 2775-2781
Link Here
|
2775 |
qb.addReturnValue( QueryBuilder::tabAlbum, QueryBuilder::valID ); |
2785 |
qb.addReturnValue( QueryBuilder::tabAlbum, QueryBuilder::valID ); |
2776 |
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valArtistID, QString::number( artist_id ) ); |
2786 |
qb.addMatch( QueryBuilder::tabSong, QueryBuilder::valArtistID, QString::number( artist_id ) ); |
2777 |
qb.sortBy( QueryBuilder::tabYear, QueryBuilder::valName, true ); |
2787 |
qb.sortBy( QueryBuilder::tabYear, QueryBuilder::valName, true ); |
2778 |
qb.sortBy( QueryBuilder::tabAlbum, QueryBuilder::valName ); |
2788 |
qb.sortBy( QueryBuilder::tabAlbum, QueryBuilder::valName, true ); |
2779 |
qb.setOptions( QueryBuilder::optRemoveDuplicates ); |
2789 |
qb.setOptions( QueryBuilder::optRemoveDuplicates ); |
2780 |
qb.setOptions( QueryBuilder::optOnlyCompilations ); |
2790 |
qb.setOptions( QueryBuilder::optOnlyCompilations ); |
2781 |
values = qb.run(); |
2791 |
values = qb.run(); |
Lines 3192-3202
Link Here
|
3192 |
{ |
3202 |
{ |
3193 |
// Embed cover image in html (encoded string), to get around khtml's caching |
3203 |
// Embed cover image in html (encoded string), to get around khtml's caching |
3194 |
//debug() << "Encoding imageUrl: " << imageUrl << endl; |
3204 |
//debug() << "Encoding imageUrl: " << imageUrl << endl; |
3195 |
const QImage img( imageUrl ); |
3205 |
qApp->lock(); |
|
|
3206 |
const QImage img( imageUrl, "PNG" ); |
3207 |
qApp->unlock(); |
3196 |
QByteArray ba; |
3208 |
QByteArray ba; |
3197 |
QBuffer buffer( ba ); |
3209 |
QBuffer buffer( ba ); |
3198 |
buffer.open( IO_WriteOnly ); |
3210 |
buffer.open( IO_WriteOnly ); |
|
|
3211 |
qApp->lock(); |
3199 |
img.save( &buffer, "PNG" ); // writes image into ba in PNG format |
3212 |
img.save( &buffer, "PNG" ); // writes image into ba in PNG format |
|
|
3213 |
qApp->unlock(); |
3200 |
const QString coverImage = QString( "data:image/png;base64,%1" ).arg( KCodecs::base64Encode( ba ) ); |
3214 |
const QString coverImage = QString( "data:image/png;base64,%1" ).arg( KCodecs::base64Encode( ba ) ); |
3201 |
//debug() << "Encoded imageUrl: " << coverImage << endl; |
3215 |
//debug() << "Encoded imageUrl: " << coverImage << endl; |
3202 |
return coverImage; |
3216 |
return coverImage; |
Lines 3716-3723
Link Here
|
3716 |
QString |
3730 |
QString |
3717 |
ContextBrowser::wikiURL( const QString &item ) |
3731 |
ContextBrowser::wikiURL( const QString &item ) |
3718 |
{ |
3732 |
{ |
|
|
3733 |
// add any special characters to be replaced here |
3734 |
QString wStr = QString(item).replace( "/", " " ); |
3735 |
|
3719 |
return QString( "http://%1.wikipedia.org/wiki/" ).arg( wikiLocale() ) |
3736 |
return QString( "http://%1.wikipedia.org/wiki/" ).arg( wikiLocale() ) |
3720 |
+ KURL::encode_string_no_slash( item, 106 /*utf-8*/ ); |
3737 |
+ KURL::encode_string_no_slash( wStr, 106 /*utf-8*/ ); |
3721 |
} |
3738 |
} |
3722 |
|
3739 |
|
3723 |
void |
3740 |
void |
Lines 4326-4331
Link Here
|
4326 |
//which can be confusing, and looks less polished/professional |
4343 |
//which can be confusing, and looks less polished/professional |
4327 |
//This can be changed if it slows things down too much... |
4344 |
//This can be changed if it slows things down too much... |
4328 |
if( m_browseLabels || ( currentTrack.isFile() && ( currentTrack.url().path() == path || AmarokConfig::useRatings() ) ) ) |
4345 |
if( m_browseLabels || ( currentTrack.isFile() && ( currentTrack.url().path() == path || AmarokConfig::useRatings() ) ) ) |
|
|
4346 |
m_dirtyCurrentTrackPage = true; // will be reloaded when viewed (much faster) |
4347 |
|
4348 |
if( currentPage() == m_contextTab ) |
4329 |
refreshCurrentTrackPage(); |
4349 |
refreshCurrentTrackPage(); |
4330 |
} |
4350 |
} |
4331 |
|
4351 |
|