~neon/juk/master

1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
1
/***************************************************************************
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
2
    begin                : Tue Nov 9 2004
3
    copyright            : (C) 2004 by Scott Wheeler
4
    email                : wheeler@kde.org
5
 ***************************************************************************/
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
6
7
/***************************************************************************
8
 *                                                                         *
9
 *   This program is free software; you can redistribute it and/or modify  *
10
 *   it under the terms of the GNU General Public License as published by  *
11
 *   the Free Software Foundation; either version 2 of the License, or     *
12
 *   (at your option) any later version.                                   *
13
 *                                                                         *
14
 ***************************************************************************/
15
1787 by Michael Pyne
Reorganize headers to fix a ton of Krazy reports. At first I thought it was just
16
#include "nowplaying.h"
17
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
18
#include <kiconloader.h>
19
#include <klocale.h>
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
20
#include <kdebug.h>
1787 by Michael Pyne
Reorganize headers to fix a ton of Krazy reports. At first I thought it was just
21
#include <krandom.h>
1952 by Michael Pyne
More --qt3support:
22
#include <kglobalsettings.h>
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
23
#include <kio/netaccess.h>
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
24
1787 by Michael Pyne
Reorganize headers to fix a ton of Krazy reports. At first I thought it was just
25
#include <QImage>
1610 by Laurent Montel
Convert include from "#include <q...h>" to "#include <Q...>"
26
#include <QLayout>
1787 by Michael Pyne
Reorganize headers to fix a ton of Krazy reports. At first I thought it was just
27
#include <QEvent>
1952 by Michael Pyne
More --qt3support:
28
#include <QDrag>
1611 by Laurent Montel
#include <q...h> -> #include <Q...>
29
#include <QTimer>
1610 by Laurent Montel
Convert include from "#include <q...h>" to "#include <Q...>"
30
#include <QPoint>
1769 by Laurent Montel
Q3Frame--
31
#include <QFrame>
1530 by Laurent Montel
qt3to4 + my script
32
#include <QDropEvent>
33
#include <QLabel>
34
#include <QVBoxLayout>
35
#include <QDragEnterEvent>
36
#include <QMouseEvent>
1952 by Michael Pyne
More --qt3support:
37
#include <QUrl>
38
#include <QList>
1544 by Laurent Montel
Q3StyleSheet--
39
#include <QTextDocument>
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
40
1366 by Scott Wheeler
I have the "Show More" stuff mostly working here. It still needs a thing
41
#include "playlistcollection.h"
1791 by Michael Pyne
Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
42
#include "playlistitem.h"
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
43
#include "playermanager.h"
1310 by Michael Pyne
Remove the unnecessary dependency of filehandle.h on coveritem.h, and correct the files that broke because of this.
44
#include "coverinfo.h"
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
45
#include "covermanager.h"
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
46
#include "tag.h"
1413 by Scott Wheeler
Make the history playlist actually do something when the items are clicked on.
47
#include "playlistitem.h"
48
#include "collectionlist.h"
1442 by Scott Wheeler
Use the same delay in the "Now Playing" history as we do in the HistoryPlaylist.
49
#include "historyplaylist.h"
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
50
51
static const int imageSize = 64;
52
1769 by Laurent Montel
Q3Frame--
53
struct Line : public QFrame
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
54
{
1769 by Laurent Montel
Q3Frame--
55
    Line(QWidget *parent) : QFrame(parent) { setFrameShape(VLine); }
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
56
};
57
58
////////////////////////////////////////////////////////////////////////////////
59
// NowPlaying
60
////////////////////////////////////////////////////////////////////////////////
61
2007 by Michael Pyne
--qt3support (specifically Q3HBox)
62
NowPlaying::NowPlaying(QWidget *parent, PlaylistCollection *collection) :
63
    QWidget(parent),
1429 by Scott Wheeler
Clear the "now playing" text if we switch playlists.
64
    m_observer(this, collection),
1366 by Scott Wheeler
I have the "Show More" stuff mostly working here. It still needs a thing
65
    m_collection(collection)
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
66
{
2007 by Michael Pyne
--qt3support (specifically Q3HBox)
67
    setObjectName("NowPlaying");
68
1553 by Scott Wheeler
Since 3.5 devel seems to have mostly slowed down, I'm synching with the branch
69
    // m_observer is set to watch the PlaylistCollection, also watch for
70
    // changes that come from CollectionList.
71
72
    CollectionList::instance()->addObserver(&m_observer);
73
2007 by Michael Pyne
--qt3support (specifically Q3HBox)
74
    QHBoxLayout *layout = new QHBoxLayout(this);
75
    setLayout(layout);
76
77
    layout->setMargin(0);
78
    layout->setSpacing(3);
79
    setFixedHeight(imageSize + 2);
80
81
    layout->addWidget(new CoverItem(this), 0);
82
    layout->addWidget(new TrackItem(this), 2);
83
    layout->addWidget(new Line(this), 0);
84
    layout->addWidget(new HistoryItem(this), 1);
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
85
86
    connect(PlayerManager::instance(), SIGNAL(signalPlay()), this, SLOT(slotUpdate()));
87
    connect(PlayerManager::instance(), SIGNAL(signalStop()), this, SLOT(slotUpdate()));
88
89
    hide();
90
}
91
92
void NowPlaying::addItem(NowPlayingItem *item)
93
{
94
    m_items.append(item);
95
}
96
1366 by Scott Wheeler
I have the "Show More" stuff mostly working here. It still needs a thing
97
PlaylistCollection *NowPlaying::collection() const
98
{
99
    return m_collection;
100
}
101
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
102
void NowPlaying::slotUpdate()
103
{
104
    FileHandle file = PlayerManager::instance()->playingFile();
105
106
    if(file.isNull()) {
107
        hide();
108
        return;
109
    }
110
    else
111
        show();
112
1791 by Michael Pyne
Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
113
    foreach(NowPlayingItem *item, m_items)
114
        item->update(file);
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
115
}
116
117
////////////////////////////////////////////////////////////////////////////////
118
// CoverItem
119
////////////////////////////////////////////////////////////////////////////////
120
121
CoverItem::CoverItem(NowPlaying *parent) :
1696 by Tim Beaulen
Less use of deprecated functions.
122
    QLabel(parent),
1356 by Nathan Toone
Moved the large cover popup functionality that was found in NowPlaying to CoverInfo (so it is more central), and make all popups of the large cover use this method.
123
    NowPlayingItem(parent)
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
124
{
1696 by Tim Beaulen
Less use of deprecated functions.
125
    setObjectName("CoverItem");
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
126
    setFixedHeight(parent->height() - parent->layout()->margin() * 2);
127
    setMargin(1);
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
128
    setAcceptDrops(true);
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
129
}
130
131
void CoverItem::update(const FileHandle &file)
132
{
1335 by Scott Wheeler
Show the full image when we click on it.
133
    m_file = file;
134
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
135
    if(file.coverInfo()->hasCover()) {
136
        show();
1570 by Scott Wheeler
...a few more classes semi-ported.
137
        setPixmap(
138
	    file.coverInfo()->pixmap(CoverInfo::Thumbnail)
139
	    .scaled(imageSize, imageSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
140
    }
141
    else
142
        hide();
143
}
144
1370 by Scott Wheeler
Use mouse release rather than mouse press for showing and hiding the cover
145
void CoverItem::mouseReleaseEvent(QMouseEvent *event)
1335 by Scott Wheeler
Show the full image when we click on it.
146
{
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
147
    if(m_dragging) {
148
        m_dragging = false;
149
        return;
150
    }
151
1372 by Scott Wheeler
Don't show the popup if we release the mouse outside of the image widget.
152
    if(event->x() >= 0 && event->y() >= 0 &&
153
       event->x() < width() && event->y() < height() &&
1570 by Scott Wheeler
...a few more classes semi-ported.
154
       event->button() == Qt::LeftButton &&
1335 by Scott Wheeler
Show the full image when we click on it.
155
       m_file.coverInfo()->hasCover())
156
    {
1359 by Scott Wheeler
Remove the now uneeded CoverPopup class and simplify things a bit. This
157
        m_file.coverInfo()->popup();
1335 by Scott Wheeler
Show the full image when we click on it.
158
    }
1561 by Scott Wheeler
Since the annotate is going to be screwed anyway by the time this is ported,
159
1335 by Scott Wheeler
Show the full image when we click on it.
160
    QLabel::mousePressEvent(event);
161
}
162
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
163
void CoverItem::mousePressEvent(QMouseEvent *e)
164
{
165
    m_dragging = false;
166
    m_dragStart = e->globalPos();
167
}
168
169
void CoverItem::mouseMoveEvent(QMouseEvent *e)
170
{
171
    if(m_dragging)
172
        return;
173
174
    QPoint diff = m_dragStart - e->globalPos();
1952 by Michael Pyne
More --qt3support:
175
    if(diff.manhattanLength() > KGlobalSettings::dndEventDelay()) {
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
176
177
        // Start a drag.
178
179
        m_dragging = true;
180
1952 by Michael Pyne
More --qt3support:
181
        QDrag *drag = new QDrag(this);
182
        CoverDrag *data = new CoverDrag(m_file.coverInfo()->coverId());
183
184
        drag->setMimeData(data);
185
        drag->exec(Qt::CopyAction);
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
186
    }
187
}
188
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
189
void CoverItem::dragEnterEvent(QDragEnterEvent *e)
190
{
1952 by Michael Pyne
More --qt3support:
191
    e->setAccepted(CoverDrag::isCover(e->mimeData()) || e->mimeData()->hasUrls());
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
192
}
193
194
void CoverItem::dropEvent(QDropEvent *e)
195
{
196
    QImage image;
1952 by Michael Pyne
More --qt3support:
197
    QList<QUrl> urls;
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
198
    coverKey key;
199
200
    if(e->source() == this)
201
        return;
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
202
1952 by Michael Pyne
More --qt3support:
203
    key = CoverDrag::idFromData(e->mimeData());
204
    if(key != CoverManager::NoMatch) {
1512 by Michael Pyne
* Now you can drag covers to and from the little cover area on the "Now
205
        m_file.coverInfo()->setCoverId(key);
206
        update(m_file);
207
    }
1952 by Michael Pyne
More --qt3support:
208
    else if(e->mimeData()->hasImage()) {
209
        m_file.coverInfo()->setCover(qvariant_cast<QImage>(e->mimeData()->imageData()));
210
        update(m_file);
211
    }
212
    else {
213
        urls = e->mimeData()->urls();
214
        if(urls.isEmpty())
215
            return;
216
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
217
        QString fileName;
218
219
        if(KIO::NetAccess::download(urls.front(), fileName, this)) {
220
            if(image.load(fileName)) {
221
                m_file.coverInfo()->setCover(image);
222
                update(m_file);
223
            }
224
            else
1550 by Laurent Montel
deprecated--
225
                kError(65432) << "Unable to load image from " << urls.front() << endl;
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
226
227
            KIO::NetAccess::removeTempFile(fileName);
228
        }
229
        else
1550 by Laurent Montel
deprecated--
230
            kError(65432) << "Unable to download " << urls.front() << endl;
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
231
    }
232
}
233
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
234
////////////////////////////////////////////////////////////////////////////////
235
// TrackItem
236
////////////////////////////////////////////////////////////////////////////////
237
238
TrackItem::TrackItem(NowPlaying *parent) :
1673 by Dirk Mueller
qt3support--
239
    QWidget(parent),
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
240
    NowPlayingItem(parent)
241
{
1673 by Dirk Mueller
qt3support--
242
    setObjectName("TrackItem");
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
243
    setFixedHeight(parent->height() - parent->layout()->margin() * 2);
244
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
245
246
    QVBoxLayout *layout = new QVBoxLayout(this);
247
1984 by Sebastian Sauer
LinkLabel isn't needed && allow to wordwrap the title rather then to auto-grow the window
248
    m_label = new QLabel(this);
249
    m_label->setWordWrap(true);
1570 by Scott Wheeler
...a few more classes semi-ported.
250
1704 by Tim Beaulen
KActiveLabel -> QLabel
251
    m_label->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::LinksAccessibleByKeyboard);
252
1733 by David Faure
guard #warning
253
#ifdef __GNUC__
1570 by Scott Wheeler
...a few more classes semi-ported.
254
    #warning We should potentially check on URL underlining.
1733 by David Faure
guard #warning
255
#endif
1570 by Scott Wheeler
...a few more classes semi-ported.
256
    /* m_label->setLinkUnderline(false); */
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
257
258
    layout->addStretch();
259
    layout->addWidget(m_label);
260
    layout->addStretch();
1366 by Scott Wheeler
I have the "Show More" stuff mostly working here. It still needs a thing
261
1704 by Tim Beaulen
KActiveLabel -> QLabel
262
    connect(m_label, SIGNAL(linkActivated(const QString &)), this,
1366 by Scott Wheeler
I have the "Show More" stuff mostly working here. It still needs a thing
263
            SLOT(slotOpenLink(const QString &)));
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
264
}
265
266
void TrackItem::update(const FileHandle &file)
267
{
1366 by Scott Wheeler
I have the "Show More" stuff mostly working here. It still needs a thing
268
    m_file = file;
1432 by Scott Wheeler
Make the "Now Playing" label use the right size font on the first song played.
269
    QTimer::singleShot(0, this, SLOT(slotUpdate()));
270
}
271
272
void TrackItem::slotOpenLink(const QString &link)
273
{
274
    PlaylistCollection *collection = NowPlayingItem::parent()->collection();
275
276
    if(link == "artist")
277
        collection->showMore(m_file.tag()->artist());
278
    else if(link == "album")
279
        collection->showMore(m_file.tag()->artist(), m_file.tag()->album());
280
    else if(link == "clear")
281
        collection->clearShowMore();
282
283
    update(m_file);
284
}
285
286
void TrackItem::slotUpdate()
287
{
1544 by Laurent Montel
Q3StyleSheet--
288
    QString title  = Qt::escape(m_file.tag()->title());
289
    QString artist = Qt::escape(m_file.tag()->artist());
290
    QString album  = Qt::escape(m_file.tag()->album());
1823 by Arto Hytönen
the last of QString::null Krazy flagger commits, to kdemultimedia.
291
    QString separator = (artist.isNull() || album.isNull()) ? QString::null : QString(" - ");	//krazy:exclude=nullstrassign for old broken gcc
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
292
293
    // This block-o-nastiness makes the font smaller and smaller until it actually fits.
294
295
    int size = 4;
296
    QString format =
297
        "<font size=\"+%1\"><b>%2</b></font>"
298
        "<br />"
1414 by Scott Wheeler
Add a link to clear the selection from the "more playing" thinger.
299
        "<font size=\"+%3\"><b><a href=\"artist\">%4</a>%5<a href=\"album\">%6</a></b>";
300
301
    if(NowPlayingItem::parent()->collection()->showMoreActive())
302
        format.append(QString(" (<a href=\"clear\">%1</a>)").arg(i18n("back to playlist")));
303
304
    format.append("</font>");
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
305
306
    do {
307
        m_label->setText(format.arg(size).arg(title).arg(size - 2)
308
                         .arg(artist).arg(separator).arg(album));
309
        --size;
310
    } while(m_label->heightForWidth(m_label->width()) > imageSize && size >= 0);
311
1681 by Thomas Häber
changed depreciated QMIN and QMAX macros to qMin() and qMax() (with help of the English Breakfast Network)
312
    m_label->setFixedHeight(qMin(imageSize, m_label->heightForWidth(m_label->width())));
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
313
}
314
315
////////////////////////////////////////////////////////////////////////////////
316
// HistoryItem
317
////////////////////////////////////////////////////////////////////////////////
318
319
HistoryItem::HistoryItem(NowPlaying *parent) :
1984 by Sebastian Sauer
LinkLabel isn't needed && allow to wordwrap the title rather then to auto-grow the window
320
    QLabel(parent),
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
321
    NowPlayingItem(parent)
322
{
323
    setFixedHeight(parent->height() - parent->layout()->margin() * 2);
324
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
1570 by Scott Wheeler
...a few more classes semi-ported.
325
    /* setLinkUnderline(false); */
1340 by Scott Wheeler
Ugh, one more extra line in here.
326
    setText(QString("<b>%1</b>").arg(i18n("History")));
1442 by Scott Wheeler
Use the same delay in the "Now Playing" history as we do in the HistoryPlaylist.
327
328
    m_timer = new QTimer(this);
329
    connect(m_timer, SIGNAL(timeout()), this, SLOT(slotAddPlaying()));
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
330
}
331
332
void HistoryItem::update(const FileHandle &file)
333
{
1413 by Scott Wheeler
Make the history playlist actually do something when the items are clicked on.
334
    if(file.isNull() || (!m_history.isEmpty() && m_history.front().file == file))
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
335
        return;
336
337
    if(m_history.count() >= 10)
1791 by Michael Pyne
Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
338
        m_history.removeLast();
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
339
1457 by Scott Wheeler
Go one font size up until I get something more dynamic in place...
340
    QString format = "<br /><a href=\"%1\"><font size=\"-1\">%2</font></a>";
1339 by Scott Wheeler
Just a minor formatting thing -- don't put the <br /> at the end of the last line.
341
    QString current = QString("<b>%1</b>").arg(i18n("History"));
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
342
    QString previous;
343
1912 by Albert Astals Cid
const & in foreach
344
    foreach(const Item &historyItem, m_history) {
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
345
        previous = current;
1791 by Michael Pyne
Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
346
        current.append(format.arg(historyItem.anchor).arg(Qt::escape(historyItem.file.tag()->title())));
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
347
        setText(current);
1339 by Scott Wheeler
Just a minor formatting thing -- don't put the <br /> at the end of the last line.
348
        if(heightForWidth(width()) > imageSize) {
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
349
            setText(previous);
1337 by Scott Wheeler
Last one -- put the item in the history at the end of the method so that the
350
            break;
1334 by Scott Wheeler
Ok, this isn't really done yet, but this was what I'd been thinking of
351
        }
352
    }
1337 by Scott Wheeler
Last one -- put the item in the history at the end of the method so that the
353
1442 by Scott Wheeler
Use the same delay in the "Now Playing" history as we do in the HistoryPlaylist.
354
    m_file = file;
355
    m_timer->stop();
1696 by Tim Beaulen
Less use of deprecated functions.
356
    m_timer->setSingleShot(true);
357
    m_timer->start(HistoryPlaylist::delay());
1413 by Scott Wheeler
Make the history playlist actually do something when the items are clicked on.
358
}
359
360
void HistoryItem::openLink(const QString &link)
361
{
1912 by Albert Astals Cid
const & in foreach
362
    foreach(const Item &historyItem, m_history) {
1791 by Michael Pyne
Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
363
        if(historyItem.anchor == link) {
364
            if(historyItem.playlist) {
1561 by Scott Wheeler
Since the annotate is going to be screwed anyway by the time this is ported,
365
                CollectionListItem *collectionItem =
1791 by Michael Pyne
Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
366
                    CollectionList::instance()->lookup(historyItem.file.absFilePath());
367
                PlaylistItem *item = collectionItem->itemForPlaylist(historyItem.playlist);
368
                historyItem.playlist->clearSelection();
369
                historyItem.playlist->setSelected(item, true);
370
                historyItem.playlist->ensureItemVisible(item);
371
                NowPlayingItem::parent()->collection()->raise(historyItem.playlist);
1413 by Scott Wheeler
Make the history playlist actually do something when the items are clicked on.
372
            }
373
            break;
374
        }
375
    }
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
376
}
377
1442 by Scott Wheeler
Use the same delay in the "Now Playing" history as we do in the HistoryPlaylist.
378
void HistoryItem::slotAddPlaying()
379
{
380
    // More or less copied from the HistoryPlaylist
381
382
    PlayerManager *manager = PlayerManager::instance();
383
384
    if(manager->playing() && manager->playingFile() == m_file) {
1536 by Laurent Montel
adapt to new kde4 api
385
        m_history.prepend(Item(KRandom::randomString(20),
1442 by Scott Wheeler
Use the same delay in the "Now Playing" history as we do in the HistoryPlaylist.
386
                               m_file, Playlist::playingItem()->playlist()));
387
    }
388
389
    m_file = FileHandle::null();
390
}
391
1299 by Scott Wheeler
Ok, huge patch from Nathan Toone to add a cover manager and such. There
392
#include "nowplaying.moc"
1338 by Michael Pyne
Add drag-and-drop support to the cover image on the new Now Playing bar. You can drag images (or links to images) to set the cover.
393
1562 by Michael Pyne
Since we're standardizing the source style, figured I'd throw in the Big Huge Vim Modeline
394
// vim: set et sw=4 tw=0 sta: