Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6c805f37 authored by Scott Wheeler's avatar Scott Wheeler

Make the "Now Playing" label use the right size font on the first song played.

BUG:98197

svn path=/trunk/kdemultimedia/juk/; revision=390664
parent c90ba2fe
......@@ -24,6 +24,7 @@
#include <qevent.h>
#include <qdragobject.h>
#include <qimage.h>
#include <qtimer.h>
#include "nowplaying.h"
#include "playlistcollection.h"
......@@ -192,10 +193,28 @@ TrackItem::TrackItem(NowPlaying *parent) :
void TrackItem::update(const FileHandle &file)
{
m_file = file;
QTimer::singleShot(0, this, SLOT(slotUpdate()));
}
void TrackItem::slotOpenLink(const QString &link)
{
PlaylistCollection *collection = NowPlayingItem::parent()->collection();
if(link == "artist")
collection->showMore(m_file.tag()->artist());
else if(link == "album")
collection->showMore(m_file.tag()->artist(), m_file.tag()->album());
else if(link == "clear")
collection->clearShowMore();
update(m_file);
}
QString title = QStyleSheet::escape(file.tag()->title());
QString artist = QStyleSheet::escape(file.tag()->artist());
QString album = QStyleSheet::escape(file.tag()->album());
void TrackItem::slotUpdate()
{
QString title = QStyleSheet::escape(m_file.tag()->title());
QString artist = QStyleSheet::escape(m_file.tag()->artist());
QString album = QStyleSheet::escape(m_file.tag()->album());
QString separator = (artist.isNull() || album.isNull()) ? QString::null : QString(" - ");
// This block-o-nastiness makes the font smaller and smaller until it actually fits.
......@@ -220,20 +239,6 @@ void TrackItem::update(const FileHandle &file)
m_label->setFixedHeight(QMIN(imageSize, m_label->heightForWidth(m_label->width())));
}
void TrackItem::slotOpenLink(const QString &link)
{
PlaylistCollection *collection = NowPlayingItem::parent()->collection();
if(link == "artist")
collection->showMore(m_file.tag()->artist());
else if(link == "album")
collection->showMore(m_file.tag()->artist(), m_file.tag()->album());
else if(link == "clear")
collection->clearShowMore();
update(m_file);
}
////////////////////////////////////////////////////////////////////////////////
// HistoryItem
////////////////////////////////////////////////////////////////////////////////
......
......@@ -124,6 +124,7 @@ public:
private slots:
void slotOpenLink(const QString &link);
void slotUpdate();
private:
FileHandle m_file;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment