Commit fa4716b1 authored by Scott Wheeler's avatar Scott Wheeler

finish the API cleanup for playlistbox

svn path=/trunk/kdemultimedia/juk/; revision=209671
parent 8d27910d
......@@ -41,14 +41,14 @@ PlaylistBox::PlaylistBox(PlaylistSplitter *parent, const char *name) : KListBox(
m_updatePlaylistStack(true)
{
m_collectionContextMenu = new KPopupMenu();
m_collectionContextMenu->insertItem(SmallIcon("editcopy"), i18n("Duplicate..."), this, SLOT(contextDuplicate()));
m_collectionContextMenu->insertItem(SmallIcon("editcopy"), i18n("Duplicate..."), this, SLOT(slotContextDuplicate()));
m_playlistContextMenu = new KPopupMenu();
m_playlistContextMenu->insertItem(SmallIcon("filesave"), i18n("Save"), this, SLOT(contextSave()));
m_playlistContextMenu->insertItem(SmallIcon("filesaveas"), i18n("Save As..."), this, SLOT(contextSaveAs()));
m_playlistContextMenu->insertItem(i18n("Rename..."), this, SLOT(contextRename()));
m_playlistContextMenu->insertItem(SmallIcon("editcopy"), i18n("Duplicate..."), this, SLOT(contextDuplicate()));
m_playlistContextMenu->insertItem(SmallIcon("edittrash"), i18n("Remove"), this, SLOT(contextDeleteItem()));
m_playlistContextMenu->insertItem(SmallIcon("filesave"), i18n("Save"), this, SLOT(slotContextSave()));
m_playlistContextMenu->insertItem(SmallIcon("filesaveas"), i18n("Save As..."), this, SLOT(slotContextSaveAs()));
m_playlistContextMenu->insertItem(i18n("Rename..."), this, SLOT(slotContextRename()));
m_playlistContextMenu->insertItem(SmallIcon("editcopy"), i18n("Duplicate..."), this, SLOT(slotContextDuplicate()));
m_playlistContextMenu->insertItem(SmallIcon("edittrash"), i18n("Remove"), this, SLOT(slotContextDeleteItem()));
setAcceptDrops(true);
......@@ -56,7 +56,7 @@ PlaylistBox::PlaylistBox(PlaylistSplitter *parent, const char *name) : KListBox(
this, SLOT(slotPlaylistChanged(QListBoxItem *)));
connect(this, SIGNAL(doubleClicked(QListBoxItem *)),
this, SLOT(slotPlaylistDoubleClicked(QListBoxItem *)));
this, SLOT(slotDoubleClicked(QListBoxItem *)));
}
PlaylistBox::~PlaylistBox()
......@@ -130,10 +130,6 @@ QPtrList<Playlist> PlaylistBox::playlists() const
return l;
}
////////////////////////////////////////////////////////////////////////////////
// PlaylistBox public slots
////////////////////////////////////////////////////////////////////////////////
void PlaylistBox::save()
{
save(static_cast<Item *>(selectedItem()));
......@@ -154,6 +150,10 @@ void PlaylistBox::duplicate()
duplicate(static_cast<Item *>(selectedItem()));
}
////////////////////////////////////////////////////////////////////////////////
// PlaylistBox public slots
////////////////////////////////////////////////////////////////////////////////
void PlaylistBox::deleteItem()
{
deleteItem(static_cast<Item *>(selectedItem()));
......@@ -333,12 +333,12 @@ void PlaylistBox::slotPlaylistChanged(QListBoxItem *item)
{
Item *i = dynamic_cast<Item *>(item);
if(m_updatePlaylistStack && i && i->playlist())
emit(currentChanged(i->playlist()));
emit signalCurrentChanged(i->playlist());
}
void PlaylistBox::slotPlaylistDoubleClicked(QListBoxItem *)
void PlaylistBox::slotDoubleClicked(QListBoxItem *)
{
emit(doubleClicked());
emit signalDoubleClicked();
}
void PlaylistBox::slotDrawContextMenu(QListBoxItem *item, const QPoint &point)
......@@ -354,27 +354,27 @@ void PlaylistBox::slotDrawContextMenu(QListBoxItem *item, const QPoint &point)
m_playlistContextMenu->popup(point);
}
void PlaylistBox::contextSave()
void PlaylistBox::slotContextSave()
{
save(m_contextMenuOn);
}
void PlaylistBox::contextSaveAs()
void PlaylistBox::slotContextSaveAs()
{
saveAs(m_contextMenuOn);
}
void PlaylistBox::contextRename()
void PlaylistBox::slotContextRename()
{
rename(m_contextMenuOn);
}
void PlaylistBox::contextDuplicate()
void PlaylistBox::slotContextDuplicate()
{
duplicate(m_contextMenuOn);
}
void PlaylistBox::contextDeleteItem()
void PlaylistBox::slotContextDeleteItem()
{
deleteItem(m_contextMenuOn);
m_contextMenuOn = 0;
......
......@@ -42,8 +42,6 @@ class PlaylistBox : public KListBox
Q_OBJECT
public:
enum ItemType { Collection, Plain };
PlaylistBox(PlaylistSplitter *parent = 0, const char *name = 0);
virtual ~PlaylistBox();
......@@ -54,30 +52,25 @@ public:
QStringList names() const { return m_names; }
QPtrList<Playlist> playlists() const;
public slots:
// All of the slots without parameters default to the selected item.
// All of the methods use the selected item.
void save();
void saveAs();
void rename();
void duplicate();
void deleteItem();
class Item;
friend class Item;
public slots:
void paste();
/**
* Override the default behavior of clear so that the clipboard code doesn't
* do bad things.
*/
void clear() {}
void clear() {} // override the (destructive) default
signals:
void currentChanged(Playlist *);
void doubleClicked();
void signalCurrentChanged(Playlist *);
void signalDoubleClicked();
public: // private: I hate you moc!
class Item;
private:
friend class Item;
void save(Item *item);
void saveAs(Item *item);
void rename(Item *item);
......@@ -101,15 +94,15 @@ private slots:
* the signal as currentChanged(Item *).
*/
void slotPlaylistChanged(QListBoxItem *item);
void slotPlaylistDoubleClicked(QListBoxItem *);
void slotDoubleClicked(QListBoxItem *);
void slotDrawContextMenu(QListBoxItem *item, const QPoint &point);
// context menu entries
void contextSave();
void contextSaveAs();
void contextRename();
void contextDuplicate();
void contextDeleteItem();
void slotContextSave();
void slotContextSaveAs();
void slotContextRename();
void slotContextDuplicate();
void slotContextDeleteItem();
private:
PlaylistSplitter *m_splitter;
......
......@@ -383,10 +383,10 @@ void PlaylistSplitter::setupLayout()
// Make the connection that will update the selected playlist when a
// selection is made in the playlist box.
connect(playlistBox, SIGNAL(currentChanged(Playlist *)),
connect(playlistBox, SIGNAL(signalCurrentChanged(Playlist *)),
this, SLOT(changePlaylist(Playlist *)));
connect(playlistBox, SIGNAL(doubleClicked()), this, SIGNAL(listBoxDoubleClicked()));
connect(playlistBox, SIGNAL(signalDoubleClicked()), this, SIGNAL(listBoxDoubleClicked()));
// Create the collection list; this should always exist. This has a
// slightly different creation process than normal playlists (since it in
......
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