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

Added a method to determine the currently playing playlist and made some

member variables static.

svn path=/trunk/kdemultimedia/juk/; revision=229109
parent 1ae86779
......@@ -182,17 +182,18 @@ void Playlist::SharedSettings::writeConfig()
// public members
////////////////////////////////////////////////////////////////////////////////
PlaylistItem *Playlist::m_playingItem = 0;
int Playlist::m_leftColumn = 0;
Playlist::Playlist(QWidget *parent, const QString &name) : KListView(parent, name.latin1()),
m_playlistName(name), m_playingItem(0),
m_leftColumn(0)
m_playlistName(name)
{
setup();
}
Playlist::Playlist(const QFileInfo &playlistFile, QWidget *parent, const char *name) : KListView(parent, name),
m_fileName(playlistFile.absFilePath()),
m_playingItem(0), m_leftColumn(0)
m_fileName(playlistFile.absFilePath())
{
setup();
loadFile(m_fileName, playlistFile);
......@@ -417,7 +418,7 @@ void Playlist::updateLeftColumn()
}
}
void Playlist::setItemsVisible(const PlaylistItemList &items, bool visible)
void Playlist::setItemsVisible(const PlaylistItemList &items, bool visible) // static
{
m_visibleChanged = true;
for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it)
......@@ -717,7 +718,7 @@ bool Playlist::isColumnVisible(int c) const
// Though it's somewhat obvious, this function will stat the file, so only use it when
// you're out of a performance critical loop.
QString Playlist::resolveSymLinks(const QFileInfo &file)
QString Playlist::resolveSymLinks(const QFileInfo &file) // static
{
char real[PATH_MAX];
if(file.exists() && realpath(QFile::encodeName(file.absFilePath()).data(), real))
......@@ -858,9 +859,9 @@ void Playlist::loadFile(const QString &fileName, const QFileInfo &fileInfo)
file.close();
}
void Playlist::setPlaying(PlaylistItem *item, bool playing)
void Playlist::setPlaying(PlaylistItem *item, bool p)
{
if(playing) {
if(p) {
m_playingItem = item;
item->setPixmap(m_leftColumn, QPixmap(UserIcon("playing")));
}
......@@ -869,7 +870,7 @@ void Playlist::setPlaying(PlaylistItem *item, bool playing)
item->setPixmap(m_leftColumn, QPixmap(0, 0));
}
item->setPlaying(playing);
item->setPlaying(p);
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -136,7 +136,15 @@ public:
KActionMenu *columnVisibleAction() const { return m_columnVisibleAction; }
void setPlaying(PlaylistItem *item, bool playing = true);
/**
* Set item to be the playing item; also set this list to be the playing list.
*/
static void setPlaying(PlaylistItem *item, bool p = true);
/**
* Returns true if this playlist is currently playing.
*/
bool playing() const { return m_playingItem && this == static_cast<Playlist *>(m_playingItem->listView()); }
/**
* This forces an update of the left most visible column, but does not save
......@@ -251,8 +259,8 @@ private slots:
void slotToggleColumnVisible(int column);
private:
int m_currentColumn;
SortedStringList m_members;
int m_currentColumn;
int m_processed;
bool m_allowDuplicates;
/**
......@@ -284,8 +292,8 @@ private:
int m_rmbPasteID;
int m_rmbEditID;
PlaylistItem *m_playingItem;
int m_leftColumn;
static PlaylistItem *m_playingItem;
static int m_leftColumn;
PlaylistItemList m_randomList;
};
......
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