|
@@ -25,6 +25,7 @@
|
|
|
|
|
|
#include <tdefilemetainfo.h>
|
|
|
#include <tdelocale.h>
|
|
|
+#include <tdemenubar.h>
|
|
|
|
|
|
class PlaylistTable : public TQTable
|
|
|
{
|
|
@@ -70,6 +71,11 @@ PlaylistWindow::PlaylistWindow(Playlist *playlist, TQWidget *parent, const char
|
|
|
|
|
|
auto layout = new TQVBoxLayout(this);
|
|
|
|
|
|
+ m_menuBar = new KMenuBar(this, "playlist_window_menubar");
|
|
|
+ m_menuBar->insertItem("Open File...", 0); // TODO: Should this just emit a signal?
|
|
|
+ m_menuBar->insertItem("Remove Item", this, TQ_SLOT(slotRemoveCurrent()), Key_Delete, 1);
|
|
|
+ m_menuBar->setItemEnabled(1, m_playlist->count() > 1);
|
|
|
+
|
|
|
m_table = new PlaylistTable(this, "playlist_window_table");
|
|
|
m_table->setFocusStyle(TQTable::FollowStyle);
|
|
|
m_table->setLeftMargin(0);
|
|
@@ -83,10 +89,12 @@ PlaylistWindow::PlaylistWindow(Playlist *playlist, TQWidget *parent, const char
|
|
|
|
|
|
connect(m_playlist, TQ_SIGNAL(currentIndexChanged(int)), TQ_SLOT(slotIndexChanged(int)));
|
|
|
connect(m_playlist, TQ_SIGNAL(itemsInserted(int, int)), TQ_SLOT(slotItemsInserted(int, int)));
|
|
|
+ connect(m_playlist, TQ_SIGNAL(itemsRemoved(int, int)), TQ_SLOT(slotItemsRemoved(int, int)));
|
|
|
|
|
|
connect(m_table, TQ_SIGNAL(doubleClicked(int, int, int, const TQPoint&)),
|
|
|
TQ_SLOT(slotTableDoubleClicked(int, int, int, const TQPoint&)));
|
|
|
|
|
|
+ layout->add(m_menuBar);
|
|
|
layout->add(m_table);
|
|
|
|
|
|
/* FIXME: No way to iterate playlist */
|
|
@@ -110,7 +118,7 @@ PlaylistWindow::PlaylistWindow(Playlist *playlist, TQWidget *parent, const char
|
|
|
|
|
|
resize(500, 200);
|
|
|
move(parent->x() + (parent->width() / 2) - (width() / 2),
|
|
|
- parent->y() + (parent->height() / 2) - (height() / 2));
|
|
|
+ parent->y() + (parent->height() / 2) - (height() / 2));
|
|
|
}
|
|
|
|
|
|
void PlaylistWindow::keyReleaseEvent(TQKeyEvent *event)
|
|
@@ -155,6 +163,22 @@ void PlaylistWindow::slotItemsInserted(int start, int end)
|
|
|
m_table->setText(start + i, 1, TQString::fromLatin1("00:00:00"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // Ensure the 'remove item' is active.
|
|
|
+ m_menuBar->setItemEnabled(1, true);
|
|
|
+}
|
|
|
+
|
|
|
+void PlaylistWindow::slotItemsRemoved(int start, int end)
|
|
|
+{
|
|
|
+ m_table->removeRow(start);
|
|
|
+ if (m_playlist->count() == 0)
|
|
|
+ m_menuBar->setItemEnabled(1, false);
|
|
|
+ tqWarning("PlaylistWindow::slotItemsRemoved: implementation isn't finished as multiple selections are not supported.");
|
|
|
+}
|
|
|
+
|
|
|
+void PlaylistWindow::slotRemoveCurrent()
|
|
|
+{
|
|
|
+ m_playlist->remove(m_table->currentRow());
|
|
|
}
|
|
|
|
|
|
void PlaylistWindow::slotTableDoubleClicked(int row, int, int button, const TQPoint&)
|