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 f58b5fb5 authored by Scott Wheeler's avatar Scott Wheeler

Use the same delay in the "Now Playing" history as we do in the HistoryPlaylist.

BUG:93259

svn path=/trunk/kdemultimedia/juk/; revision=390968
parent ed382c10
......@@ -73,7 +73,7 @@ void HistoryPlaylist::slotAddPlaying()
{
m_file = PlayerManager::instance()->playingFile();
m_timer->stop();
m_timer->start(5000, true);
m_timer->start(delay(), true);
}
void HistoryPlaylist::slotCreateNewItem()
......
......@@ -47,6 +47,9 @@ public:
virtual void createItems(const PlaylistItemList &siblings);
virtual int columnOffset() const { return 1; }
virtual bool readOnly() const { return true; }
static int delay() { return 5000; }
public slots:
void cut() {}
void clear() {}
......
......@@ -33,6 +33,7 @@
#include "tag.h"
#include "playlistitem.h"
#include "collectionlist.h"
#include "historyplaylist.h"
static const int imageSize = 64;
......@@ -251,6 +252,9 @@ HistoryItem::HistoryItem(NowPlaying *parent) :
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
setLinkUnderline(false);
setText(QString("<b>%1</b>").arg(i18n("History")));
m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotAddPlaying()));
}
void HistoryItem::update(const FileHandle &file)
......@@ -277,8 +281,9 @@ void HistoryItem::update(const FileHandle &file)
}
}
m_history.prepend(Item(KApplication::randomString(20),
file, Playlist::playingItem()->playlist()));
m_file = file;
m_timer->stop();
m_timer->start(HistoryPlaylist::delay(), true);
}
void HistoryItem::openLink(const QString &link)
......@@ -301,6 +306,20 @@ void HistoryItem::openLink(const QString &link)
}
}
void HistoryItem::slotAddPlaying()
{
// More or less copied from the HistoryPlaylist
PlayerManager *manager = PlayerManager::instance();
if(manager->playing() && manager->playingFile() == m_file) {
m_history.prepend(Item(KApplication::randomString(20),
m_file, Playlist::playingItem()->playlist()));
}
m_file = FileHandle::null();
}
#include "nowplaying.moc"
// vim: set et sw=4 ts=8:
......@@ -25,6 +25,8 @@
#include "filehandle.h"
#include "playlist.h"
class QTimer;
class NowPlayingItem;
class PlaylistCollection;
class Playlist;
......@@ -137,11 +139,16 @@ private:
class HistoryItem : public LinkLabel, public NowPlayingItem
{
Q_OBJECT
public:
HistoryItem(NowPlaying *parent);
virtual void update(const FileHandle &file);
virtual void openLink(const QString &link);
private slots:
void slotAddPlaying();
private:
struct Item
{
......@@ -156,6 +163,8 @@ private:
QValueList<Item> m_history;
LinkLabel *m_label;
QTimer *m_timer;
FileHandle m_file;
};
#endif
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