Commit f63cf17e authored by Scott Wheeler's avatar Scott Wheeler

Added a StatusLabel class and ported over the current functionality to that

class.  This will allow for the status label to be expanded, idealy this
weekend.  :-)

svn path=/trunk/kdemultimedia/juk/; revision=184415
parent 9a2305ea
......@@ -3,12 +3,12 @@ bin_PROGRAMS = juk
## INCLUDES were found outside kdevelop specific part
juk_SOURCES = cachedtag.cpp oggtag.cpp id3tag.cpp collectionlist.cpp playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp playlistbox.cpp tageditor.cpp cache.cpp audiodata.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp slideraction.cpp juk.cpp main.cpp
juk_SOURCES = statuslabel.cpp cachedtag.cpp oggtag.cpp id3tag.cpp collectionlist.cpp playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp playlistbox.cpp tageditor.cpp cache.cpp audiodata.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp slideraction.cpp juk.cpp main.cpp
juk_LDADD = -lid3 -lsoundserver_idl $(LIB_KFILE) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET)
SUBDIRS = pics data
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc slideraction.cpp slideraction.h customaction.h customaction.cpp tag.cpp tag.h player.cpp player.h genre.h genre.cpp hi16-app-juk.png hi32-app-juk.png hi48-app-juk.png genrelist.cpp genrelist.h genrelistlist.cpp genrelistlist.h genrelistreader.cpp genrelistreader.h audiodata.cpp audiodata.h cache.cpp cache.h tageditor.cpp tageditor.h playlistbox.cpp playlistbox.h listboxpixmap.cpp listboxpixmap.h playlistsplitter.cpp playlistsplitter.h playlist.cpp playlist.h playlistitem.cpp playlistitem.h collectionlist.cpp collectionlist.h id3tag.cpp id3tag.h oggtag.cpp oggtag.h cachedtag.cpp cachedtag.h
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc slideraction.cpp slideraction.h customaction.h customaction.cpp tag.cpp tag.h player.cpp player.h genre.h genre.cpp hi16-app-juk.png hi32-app-juk.png hi48-app-juk.png genrelist.cpp genrelist.h genrelistlist.cpp genrelistlist.h genrelistreader.cpp genrelistreader.h audiodata.cpp audiodata.h cache.cpp cache.h tageditor.cpp tageditor.h playlistbox.cpp playlistbox.h listboxpixmap.cpp listboxpixmap.h playlistsplitter.cpp playlistsplitter.h playlist.cpp playlist.h playlistitem.cpp playlistitem.h collectionlist.cpp collectionlist.h id3tag.cpp id3tag.h oggtag.cpp oggtag.h cachedtag.cpp cachedtag.h statuslabel.cpp statuslabel.h
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Multimedia/
......
......@@ -29,6 +29,7 @@
#include "collectionlist.h"
#include "slideraction.h"
#include "cache.h"
#include "statuslabel.h"
////////////////////////////////////////////////////////////////////////////////
// public members
......@@ -63,7 +64,7 @@ void JuK::setupLayout()
connect(splitter, SIGNAL(playlistDoubleClicked(QListViewItem *)), this, SLOT(playItem(QListViewItem *)));
// create status bar
statusLabel = new QLabel(statusBar());
statusLabel = new StatusLabel(statusBar());
statusBar()->addWidget(statusLabel, 1);
splitter->setFocus();
......@@ -309,24 +310,7 @@ void JuK::stopFile()
playingItem->setPixmap(0, 0);
playingItem = 0;
updateStatusLabel();
}
void JuK::updateStatusLabel()
{
if(playingItem) {
Playlist *p = static_cast<Playlist *>(playingItem->listView());
if(p && p->playlistBoxItem()) {
QString label = p->playlistBoxItem()->text()
+ " / " + playingItem->text(PlaylistItem::ArtistColumn)
+ " - " + playingItem->text(PlaylistItem::TrackColumn);
statusLabel->setText(label);
}
else
statusLabel->clear();
}
else
statusLabel->clear();
statusLabel->clear();
}
////////////////////////////////////////////////////////////////////////////////
......@@ -373,7 +357,7 @@ void JuK::pollPlay()
playingItem->setPixmap(0, QPixmap(UserIcon("playing")));
}
}
updateStatusLabel();
statusLabel->setPlayingItem(playingItem);
}
else
stopFile();
......@@ -421,7 +405,7 @@ void JuK::playItem(PlaylistItem *item)
playingItem->setPixmap(0, QPixmap(UserIcon("playing")));
playTimer->start(pollInterval);
updateStatusLabel();
statusLabel->setPlayingItem(playingItem);
}
}
}
......
......@@ -37,6 +37,7 @@ class Playlist;
class PlaylistSplitter;
class PlaylistItem;
class SliderAction;
class StatusLabel;
class JuK : public KMainWindow
{
......@@ -57,11 +58,9 @@ private:
virtual bool queryClose();
void updateStatusLabel();
// layout objects
PlaylistSplitter *splitter;
QLabel *statusLabel;
StatusLabel *statusLabel;
// actions
KToggleAction *showEditorAction;
......
/***************************************************************************
statuslabel.cpp - description
-------------------
begin : Fri Oct 18 2002
copyright : (C) 2002 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "statuslabel.h"
#include "playlistitem.h"
#include "playlist.h"
#include "playlistbox.h"
StatusLabel::StatusLabel(QWidget *parent, const char *name) : QHBox(parent, name)
{
trackLabel = new QLabel(this, "trackLabel");
}
StatusLabel::~StatusLabel()
{
}
void StatusLabel::setPlayingItem(PlaylistItem *item)
{
playingItem = item;
if(item) {
Playlist *p = static_cast<Playlist *>(item->listView());
if(p && p->playlistBoxItem()) {
QString label = p->playlistBoxItem()->text()
+ " / " + item->text(PlaylistItem::ArtistColumn)
+ " - " + item->text(PlaylistItem::TrackColumn);
trackLabel->setText(label);
}
else
trackLabel->clear();
}
else
trackLabel->clear();
}
void StatusLabel::clear()
{
trackLabel->clear();
}
#include "statuslabel.moc"
/***************************************************************************
statuslabel.h - description
-------------------
begin : Fri Oct 18 2002
copyright : (C) 2002 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef STATUSLABEL_H
#define STATUSLABEL_H
#include <qwidget.h>
#include <qhbox.h>
#include <qlabel.h>
class PlaylistItem;
class StatusLabel : public QHBox
{
Q_OBJECT
public:
StatusLabel(QWidget *parent = 0, const char *name = 0);
virtual ~StatusLabel();
void setPlayingItem(PlaylistItem *item);
void clear();
private:
QLabel *trackLabel;
PlaylistItem *playingItem;
};
#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