Commit ba0abdcf authored by Scott Wheeler's avatar Scott Wheeler

Ok, this isn't really done yet, but this was what I'd been thinking of

for the "Now Playing" when I discovered the one that was part of Nathan's
patch.  This one does quite a bit more and makes it possible to easily add
or switch elements in the future.

Eventually the links for the artist and album will go to a filtered playlist
based on that and the history links will either jump to the item in the playlist
or start playing it.  We'll see.

Also clicking on the image should show the original -- but I'm not sure I want
that in a real window -- probably just a borderless thing that goes away when
you click it.

svn path=/trunk/kdemultimedia/juk/; revision=361877
parent 521bcbe1
......@@ -26,7 +26,6 @@
<Menu name="view" noMerge="1"><text>&amp;View</text>
<Action name="showSearch"/>
<Action name="showEditor"/>
<Action name="showNowPlaying"/>
<Action name="showHistory"/>
<Action name="showUpcoming"/>
<Action name="showColumns"/>
......
......@@ -28,7 +28,6 @@
<Menu name="view" noMerge="1"><text>&amp;View</text>
<Action name="showSearch"/>
<Action name="showEditor"/>
<Action name="showNowPlaying"/>
<Action name="showHistory"/>
<Action name="showUpcoming"/>
<Action name="showColumns"/>
......
This diff is collapsed.
/***************************************************************************
copyright : (C) 2004 Nathan Toone
email : nathan@toonetown.com
begin : Tue Nov 9 2004
copyright : (C) 2004 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
......@@ -15,38 +16,88 @@
#ifndef NOWPLAYING_H
#define NOWPLAYING_H
#include <qwidget.h>
#include <kactivelabel.h>
class QPushButton;
class QSplitter;
#include <qhbox.h>
#include <qlabel.h>
class NowPlaying : public QWidget
#include "filehandle.h"
class NowPlayingItem;
/**
* This is the widget that holds all of the other items and handles updating them
* when the playing item changes.
*/
class NowPlaying : public QHBox
{
Q_OBJECT
public:
NowPlaying(QSplitter *parent, const char *name = 0);
virtual ~NowPlaying();
NowPlaying(QWidget *parent, const char *name = 0);
void addItem(NowPlayingItem *item);
private slots:
void slotUpdate();
private:
void setupActions();
void setupLayout();
void readConfig();
void saveConfig();
QValueList<NowPlayingItem *> m_items;
};
public slots:
void slotRefresh();
void slotClear();
/**
* Abstract base for the other NowPlaying items.
*/
private slots:
void slotButtonPress();
class NowPlayingItem
{
public:
virtual void update(const FileHandle &file) = 0;
protected:
virtual void resizeEvent(QResizeEvent *ev);
virtual void mousePressEvent(QMouseEvent *e);
NowPlayingItem(NowPlaying *parent) { parent->addItem(this); }
};
/**
* Displays the cover of the currently playing file if available, or hides
* itself if not.
*/
class CoverItem : public QLabel, public NowPlayingItem
{
public:
CoverItem(NowPlaying *parent);
virtual void update(const FileHandle &file);
};
/**
* Show the text information on the current track and provides links to the
* album and artist of the currently playing item.
*/
class TrackItem : public QWidget, public NowPlayingItem
{
public:
TrackItem(NowPlaying *parent);
virtual void update(const FileHandle &file);
private:
KActiveLabel *m_label;
};
/**
* Shows up to 10 items of history and links to those items.
*/
class HistoryItem : public KActiveLabel, public NowPlayingItem
{
public:
HistoryItem(NowPlaying *parent);
virtual void update(const FileHandle &file);
private:
QPushButton *m_button;
FileHandleList m_history;
KActiveLabel *m_label;
};
#endif
......@@ -118,14 +118,7 @@ void PlaylistSplitter::setupLayout()
connect(CollectionList::instance(), SIGNAL(signalCollectionChanged()),
m_editor, SLOT(slotUpdateCollection()));
NowPlaying *nowPlaying = new NowPlaying(boxSplitter);
boxSplitter->moveToFirst(m_playlistBox);
connect(PlayerManager::instance(), SIGNAL(signalPlay()), nowPlaying, SLOT(slotRefresh()));
connect(PlayerManager::instance(), SIGNAL(signalStop()), nowPlaying, SLOT(slotClear()));
connect(PlayerManager::instance(), SIGNAL(signalCoverChanged()), nowPlaying, SLOT(slotRefresh()));
boxSplitter->setResizeMode(nowPlaying, QSplitter::KeepSize);
NowPlaying *nowPlaying = new NowPlaying(top);
// Create the search widget -- this must be done after the CollectionList is created.
......@@ -139,6 +132,7 @@ void PlaylistSplitter::setupLayout()
connect(action<KToggleAction>("showSearch"), SIGNAL(toggled(bool)),
m_searchWidget, SLOT(setEnabled(bool)));
topLayout->addWidget(nowPlaying);
topLayout->addWidget(m_searchWidget);
topLayout->addWidget(m_playlistStack);
......
......@@ -261,11 +261,15 @@ void SearchWidget::setupLayout()
connect(clearSearchButton, SIGNAL(pressed()), m_searchLine, SLOT(clear()));
setStretchableWidget(m_searchLine);
QToolButton *b = new QToolButton(this);
b->setTextLabel(i18n("Advanced Search"), true);
b->setIconSet(SmallIconSet("wizard"));
// I've decided that I think this is ugly, for now.
connect(b, SIGNAL(clicked()), this, SIGNAL(signalAdvancedSearchClicked()));
/*
QToolButton *b = new QToolButton(this);
b->setTextLabel(i18n("Advanced Search"), true);
b->setIconSet(SmallIconSet("wizard"));
connect(b, SIGNAL(clicked()), this, SIGNAL(signalAdvancedSearchClicked()));
*/
}
#include "searchwidget.moc"
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