If we are only showing intro text, we can use smaller headers
This commit is contained in:
@@ -134,7 +134,7 @@ void AlbumView::getTrackListing()
|
||||
QList<Song> songs=MusicLibraryModel::self()->getAlbumTracks(currentSong);
|
||||
|
||||
if (!songs.isEmpty()) {
|
||||
trackList=QLatin1String("<h3>")+i18n("Tracks")+QLatin1String("</h3><p><table>");
|
||||
trackList=View::subHeader(i18n("Tracks"))+QLatin1String("<p><table>");
|
||||
foreach (const Song &s, songs) {
|
||||
trackList+=QLatin1String("<tr><td>")+QString::number(s.track)+
|
||||
QLatin1String("</td><td><a href=\"")+s.file+"\">"+
|
||||
|
||||
@@ -239,7 +239,7 @@ void ArtistView::setBio()
|
||||
}
|
||||
|
||||
if (!webLinks.isEmpty()) {
|
||||
html+="<h2>"+i18n("Web Links")+"</h2><ul>"+QString(webLinks).replace("${artist}", currentSong.artist)+"</ul>";
|
||||
html+=View::subHeader(i18n("Web Links"))+QLatin1String("<ul>")+QString(webLinks).replace("${artist}", currentSong.artist)+QLatin1String("</ul>");
|
||||
}
|
||||
#endif
|
||||
text->setText(html);
|
||||
@@ -327,7 +327,7 @@ void ArtistView::buildSimilar(const QStringList &artists)
|
||||
QSet<QString> mpdArtists=MusicLibraryModel::self()->getAlbumArtists();
|
||||
foreach (QString artist, artists) {
|
||||
if (similarArtists.isEmpty()) {
|
||||
similarArtists="<br/><h2>"+i18n("Similar Artists")+"</h2><ul>";
|
||||
similarArtists=QLatin1String("<br/>")+View::subHeader(i18n("Similar Artists"))+QLatin1String("<ul>");
|
||||
}
|
||||
if (mpdArtists.contains(artist)) {
|
||||
artist=QLatin1String("<a href=\"cantata://?artist=")+artist+"\">"+artist+"</a>";
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "view.h"
|
||||
#include "spinner.h"
|
||||
#include "networkaccessmanager.h"
|
||||
#include "settings.h"
|
||||
#include <QLabel>
|
||||
#include <QTextBrowser>
|
||||
#include <QImage>
|
||||
@@ -32,6 +33,16 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QLocale>
|
||||
|
||||
static QString headerTag;
|
||||
QString View::subTag;
|
||||
|
||||
void View::initHeaderTags()
|
||||
{
|
||||
bool small=Settings::self()->wikipediaIntroOnly() ;
|
||||
headerTag=small ? "h2" : "h1";
|
||||
subTag=small ? "h3" : "h2";
|
||||
}
|
||||
|
||||
View::View(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, needToUpdate(false)
|
||||
@@ -56,6 +67,9 @@ View::View(QWidget *parent)
|
||||
layout->addItem(new QSpacerItem(1, fontMetrics().height()/4, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
text->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setEditable(false);
|
||||
if (headerTag.isEmpty()) {
|
||||
initHeaderTags();
|
||||
}
|
||||
}
|
||||
|
||||
void View::clear()
|
||||
@@ -67,7 +81,7 @@ void View::clear()
|
||||
|
||||
void View::setHeader(const QString &str)
|
||||
{
|
||||
header->setText("<h1>"+str+"</h1>");
|
||||
header->setText("<"+headerTag+">"+str+"</"+headerTag+">");
|
||||
}
|
||||
|
||||
void View::setPicSize(const QSize &sz)
|
||||
|
||||
@@ -40,7 +40,10 @@ class View : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
View(QWidget *p);
|
||||
|
||||
|
||||
static QString subHeader(const QString &str) { return "<"+subTag+">"+str+"</"+subTag+">"; }
|
||||
static void initHeaderTags();
|
||||
|
||||
void clear();
|
||||
void setStandardHeader(const QString &h) { stdHeader=h; }
|
||||
void setHeader(const QString &str);
|
||||
@@ -56,6 +59,7 @@ protected Q_SLOTS:
|
||||
virtual void searchResponse(const QString &r, const QString &l);
|
||||
|
||||
protected:
|
||||
static QString subTag;
|
||||
Song currentSong;
|
||||
QString stdHeader;
|
||||
QLabel *header;
|
||||
|
||||
Reference in New Issue
Block a user