Commit 42a9f409 authored by Scott Wheeler's avatar Scott Wheeler

Remove some unused methods, port a few more things over to FileHandle,

fix the status bar.

CCMAIL:78518-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=302103
parent 87ee0948
......@@ -514,20 +514,6 @@ bool JuK::queryClose()
return true;
}
QString JuK::playingString() const
{
QString s;
if(!m_player->playing() && !m_player->paused())
return i18n("No song playing");
if(!m_splitter->playingArtist().isEmpty())
s = m_splitter->playingArtist().simplifyWhiteSpace() + " - ";
s += m_splitter->playingTrack().simplifyWhiteSpace();
return s;
}
void JuK::updatePlaylistInfo()
{
m_statusLabel->setPlaylistInfo(m_splitter->visiblePlaylistName(),
......
......@@ -76,8 +76,6 @@ private:
virtual bool queryExit();
virtual bool queryClose();
QString playingString() const;
void updatePlaylistInfo();
void openFile(const QString &file);
......
......@@ -191,12 +191,16 @@ void PlayerManager::play(const FileHandle &file)
FileHandle currentFile = FileHandle(m_playlistInterface->currentFile());
if(!currentFile.isNull())
if(!currentFile.isNull()) {
player()->play(currentFile);
m_statusLabel->setPlayingItemInfo(currentFile, m_playlistInterface);
}
}
else
}
else {
player()->play(file);
m_statusLabel->setPlayingItemInfo(file, m_playlistInterface);
}
// Make sure that the player() actually starts before doing anything.
......
......@@ -80,7 +80,7 @@ private slots:
void slotPollPlay();
void slotUpdateTime(int position);
void slotSetOutput(int system);
void slotSetVolume(int volume); // TODO: make private
void slotSetVolume(int volume);
private:
static PlayerManager *m_instance;
......
......@@ -27,6 +27,7 @@
class PlaylistInterface
{
public:
virtual QString name() const = 0;
virtual QString nextFile() = 0;
virtual QString currentFile() = 0;
virtual QString previousFile() = 0;
......
......@@ -167,6 +167,11 @@ QString PlaylistSplitter::uniquePlaylistName(const QString &startingWith, bool u
}
}
QString PlaylistSplitter::name() const
{
return m_playingItem ? m_playingItem->playlist()->name() : QString::null;
}
QString PlaylistSplitter::nextFile()
{
PlaylistItem *i = 0;
......@@ -301,34 +306,6 @@ QString PlaylistSplitter::playRandomFile()
return play(p->nextItem(i, true));
}
QString PlaylistSplitter::playingArtist() const
{
if(m_playingItem) {
int offset = m_playingItem->playlist()->columnOffset();
return m_playingItem->text(PlaylistItem::ArtistColumn + offset);
}
else
return QString::null;
}
QString PlaylistSplitter::playingTrack() const
{
if(m_playingItem) {
int offset = m_playingItem->playlist()->columnOffset();
return m_playingItem->text(PlaylistItem::TrackColumn + offset);
}
else
return QString::null;
}
QString PlaylistSplitter::playingList() const
{
if(m_playingItem)
return m_playingItem->playlist()->name();
else
return QString::null;
}
void PlaylistSplitter::open(const QString &file)
{
if(file.isEmpty())
......
......@@ -68,6 +68,7 @@ public:
// Variations on the theme "play stuff"
////////////////////////////////////////////////////////////////////////////
virtual QString name() const;
virtual QString nextFile();
virtual QString currentFile();
virtual QString previousFile() { return playPreviousFile(); }
......@@ -109,10 +110,6 @@ public:
////////////////////////////////////////////////////////////////////////////
QString playingArtist() const;
QString playingTrack() const;
QString playingList() const;
/**
* Returns the name of the currently visible playlist.
*/
......
......@@ -25,6 +25,9 @@
#include <qlayout.h>
#include "statuslabel.h"
#include "filehandle.h"
#include "playlistinterface.h"
#include "tag.h"
////////////////////////////////////////////////////////////////////////////////
// public methods
......@@ -132,12 +135,14 @@ void StatusLabel::setPlaylistCount(int c)
setPlaylistInfo(m_playlistName, c, m_playlistTotalTime);
}
void StatusLabel::setPlayingItemInfo(const QString &track, const QString &playlist)
void StatusLabel::setPlayingItemInfo(const FileHandle &file, const PlaylistInterface *playlist)
{
mode = PlayingItemInfo;
m_trackLabel->setText(track);
m_playlistLabel->setText(playlist.simplifyWhiteSpace());
QString text = file.tag()->artist() + " - " + file.tag()->title();
m_trackLabel->setText(text);
m_playlistLabel->setText(playlist->name().simplifyWhiteSpace());
}
void StatusLabel::clear()
......
......@@ -22,7 +22,8 @@
class QLabel;
class PlaylistItem;
class FileHandle;
class PlaylistInterface;
class StatusLabel : public QHBox
{
......@@ -39,7 +40,7 @@ public slots:
* item playing.
*/
void setPlaylistCount(int c);
void setPlayingItemInfo(const QString &track, const QString &playlist);
void setPlayingItemInfo(const FileHandle &file, const PlaylistInterface *playlist);
void setPlaylistInfo(const QString &name, int count, int totalTime);
void setPlaylistTime(int totalTime);
......
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