Commit 71d5d71d authored by Scott Wheeler's avatar Scott Wheeler

Added the beginnings of a status bar. As always, more to come with this.

svn path=/trunk/kdemultimedia/juk/; revision=183776
parent 3a5a63d6
......@@ -36,32 +36,6 @@ Cache *Cache::instance()
return(cache);
}
void Cache::load()
{
QString cacheFileName = KGlobal::dirs()->saveLocation("appdata") + "cache";
QFile f(cacheFileName);
if(!f.open(IO_ReadOnly))
return;
QDataStream s(&f);
while(!s.atEnd()) {
QString fileName;
s >> fileName;
CachedTag *t = new CachedTag(fileName);
s >> *t;
if(!t->current())
delete(t);
}
f.close();
}
void Cache::save()
{
QString cacheFileName = KGlobal::dirs()->saveLocation("appdata") + "cache";
......@@ -94,3 +68,29 @@ Cache::~Cache()
{
delete(cache);
}
void Cache::load()
{
QString cacheFileName = KGlobal::dirs()->saveLocation("appdata") + "cache";
QFile f(cacheFileName);
if(!f.open(IO_ReadOnly))
return;
QDataStream s(&f);
while(!s.atEnd()) {
QString fileName;
s >> fileName;
CachedTag *t = new CachedTag(fileName);
s >> *t;
if(!t->current())
delete(t);
}
f.close();
}
......@@ -18,6 +18,7 @@
#include <klocale.h>
#include <kiconloader.h>
#include <kcmdlineargs.h>
#include <kstatusbar.h>
#include <kdebug.h>
#include <qinputdialog.h>
......@@ -61,6 +62,10 @@ void JuK::setupLayout()
// playlist item activation connection
connect(splitter, SIGNAL(playlistDoubleClicked(QListViewItem *)), this, SLOT(playItem(QListViewItem *)));
// create status bar
statusLabel = new QLabel(statusBar());
statusBar()->addWidget(statusLabel, 1);
splitter->setFocus();
}
......@@ -302,6 +307,8 @@ void JuK::stopFile()
sliderAction->getTrackPositionSlider()->setEnabled(false);
if(playingItem)
playingItem->setPixmap(0, 0);
statusLabel->clear();
}
////////////////////////////////////////////////////////////////////////////////
......@@ -394,6 +401,14 @@ void JuK::playItem(PlaylistItem *item)
sliderAction->getTrackPositionSlider()->setEnabled(true);
playingItem->setPixmap(0, QPixmap(UserIcon("playing")));
playTimer->start(pollInterval);
Playlist * p = static_cast<Playlist *>(item->listView());
if(p && p->playlistBoxItem()) {
QString label = p->playlistBoxItem()->text()
+ " / " + item->text(PlaylistItem::ArtistColumn)
+ " - " + item->text(PlaylistItem::TrackColumn);
statusLabel->setText(label);
}
}
}
}
......
......@@ -29,6 +29,7 @@
#include <qtimer.h>
#include <qlistview.h>
#include <qlabel.h>
#include "player.h"
......@@ -45,6 +46,7 @@ public:
virtual ~JuK();
private:
// private methods
void setupLayout();
void setupActions();
......@@ -57,6 +59,7 @@ private:
// layout objects
PlaylistSplitter *splitter;
QLabel *statusLabel;
// actions
KToggleAction *showEditorAction;
......
......@@ -35,6 +35,7 @@
#include "playlist.h"
#include "collectionlist.h"
#include "playlistsplitter.h"
#include "playlistbox.h"
////////////////////////////////////////////////////////////////////////////////
// public members
......@@ -42,6 +43,7 @@
Playlist::Playlist(PlaylistSplitter *s, QWidget *parent, const QString &name) : KListView(parent, name.latin1())
{
boxItem = 0;
playlistName = name;
internalFile = true;
playlistFileName = QString::null;
......@@ -296,6 +298,16 @@ void Playlist::setName(const QString &n)
emit(nameChanged(playlistName));
}
PlaylistBoxItem *Playlist::playlistBoxItem() const
{
return(boxItem);
}
void Playlist::setPlaylistBoxItem(PlaylistBoxItem *item)
{
boxItem = item;
}
////////////////////////////////////////////////////////////////////////////////
// protected members
////////////////////////////////////////////////////////////////////////////////
......
......@@ -25,6 +25,7 @@
#include "playlistitem.h"
class PlaylistSplitter;
class PlaylistBoxItem;
class Playlist : public KListView
{
......@@ -90,6 +91,9 @@ public:
QString name() const;
void setName(const QString &n);
PlaylistBoxItem *playlistBoxItem() const;
void setPlaylistBoxItem(PlaylistBoxItem *item);
// static methods
/**
......@@ -120,6 +124,7 @@ private:
QString playlistFileName;
QString playlistName;
PlaylistSplitter *splitter;
PlaylistBoxItem *boxItem;
private slots:
void emitSelected();
......
......@@ -213,7 +213,8 @@ Playlist *PlaylistSplitter::createPlaylist()
Playlist *PlaylistSplitter::createPlaylist(const QString &name)
{
Playlist *p = new Playlist(this, playlistStack, name.latin1());
new PlaylistBoxItem(playlistBox, SmallIcon("midi", 32), name, p);
PlaylistBoxItem *i = new PlaylistBoxItem(playlistBox, SmallIcon("midi", 32), name, p);
p->setPlaylistBoxItem(i);
connect(p, SIGNAL(selectionChanged(const PlaylistItemList &)), editor, SLOT(setItems(const PlaylistItemList &)));
connect(p, SIGNAL(doubleClicked(QListViewItem *)), this, SIGNAL(playlistDoubleClicked(QListViewItem *)));
......@@ -242,7 +243,8 @@ Playlist *PlaylistSplitter::openPlaylist(const QString &playlistFile)
connect(p, SIGNAL(selectionChanged(const PlaylistItemList &)), editor, SLOT(setItems(const PlaylistItemList &)));
connect(p, SIGNAL(doubleClicked(QListViewItem *)), this, SIGNAL(playlistDoubleClicked(QListViewItem *)));
connect(p, SIGNAL(collectionChanged()), editor, SLOT(updateCollection()));
new PlaylistBoxItem(playlistBox, SmallIcon("midi", 32), p->name(), p);
PlaylistBoxItem *i = new PlaylistBoxItem(playlistBox, SmallIcon("midi", 32), p->name(), p);
p->setPlaylistBoxItem(i);
playlistBox->sort();
return(p);
}
......@@ -308,6 +310,7 @@ void PlaylistSplitter::setupLayout()
PlaylistBoxItem *collectionBoxItem = new PlaylistBoxItem(playlistBox, SmallIcon("folder_sound", 32),
i18n("Music Collection"), collection);
collection->setPlaylistBoxItem(collectionBoxItem);
connect(collection, SIGNAL(selectionChanged(const PlaylistItemList &)),
editor, SLOT(setItems(const PlaylistItemList &)));
......
......@@ -113,8 +113,6 @@ public slots:
void duplicatePlaylist() { playlistBox->duplicate(); }
void deleteItemPlaylist() { playlistBox->deleteItem(); }
protected:
private:
void setupLayout();
void readConfig();
......
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