added a small fileinfo dialog to the playlistwidget
This commit is contained in:
parent
0369b3aa37
commit
8dc34b1759
9 changed files with 406 additions and 6 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "playlistmodel.h"
|
||||
#include "playlistwidget.h"
|
||||
#include "Skin.h"
|
||||
#include "entryinfo.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QMenu>
|
||||
|
@ -142,6 +143,9 @@ PlaylistView::PlaylistView (QWidget *parent) : QListView (parent)
|
|||
|
||||
connect (&xmmsh, SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
this, SLOT(handleStatus(Xmms::Playback::Status)));
|
||||
|
||||
connect (this, SIGNAL (clicked (QModelIndex)),
|
||||
this, SLOT (on_item_clicked (QModelIndex)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -182,7 +186,7 @@ PlaylistView::contextMenuEvent (QContextMenuEvent *e)
|
|||
|
||||
a = new QAction (tr ("Show file info"), this);
|
||||
a->setShortcut (tr ("Ctrl+Enter"));
|
||||
a->setEnabled(false); // FIXME: Disabled for now
|
||||
connect (a, SIGNAL (triggered ()), this, SLOT (showEntryInfo ()));
|
||||
qm.addAction (a);
|
||||
qm.addSeparator ();
|
||||
|
||||
|
@ -278,3 +282,33 @@ PlaylistView::mouseDoubleClickEvent (QMouseEvent *event)
|
|||
xmmsh.xplayback ()->play ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistView::showEntryInfo (void)
|
||||
{
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
QModelIndex current = selectionModel ()->currentIndex ();
|
||||
if (current.isValid ()) {
|
||||
uint32_t id = model ()->data (current, PlaylistModel::MedialibIdRole)
|
||||
.toUInt ();
|
||||
// If no infodialog exists, create one, else set the selected Item as
|
||||
// displayed item
|
||||
if (!m_entry_info) {
|
||||
m_entry_info = new EntryInfo (this, client.cache (), id);
|
||||
} else {
|
||||
m_entry_info->raise ();
|
||||
m_entry_info->setId (id);
|
||||
}
|
||||
m_entry_info->show ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistView::on_item_clicked (QModelIndex index)
|
||||
{
|
||||
if (m_entry_info) {
|
||||
uint32_t id = model ()->data (index, PlaylistModel::MedialibIdRole)
|
||||
.toUInt ();
|
||||
m_entry_info->setId (id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,15 @@
|
|||
|
||||
//include "Playlist.h"
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include <entryinfo.h>
|
||||
class Skin;
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractItemDelegate>
|
||||
#include <QListView>
|
||||
#include <QPointer>
|
||||
class QWidget;
|
||||
class QModelIndex;
|
||||
|
||||
class PlaylistDelegate : public QAbstractItemDelegate {
|
||||
Q_OBJECT
|
||||
|
@ -57,12 +60,16 @@ class PlaylistView : public QListView {
|
|||
void invertSelection (void);
|
||||
void cropSelected (void);
|
||||
void removeSelected (void);
|
||||
void showEntryInfo (void);
|
||||
void settingsSaved (void);
|
||||
void setPixmaps (Skin *skin);
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent (QMouseEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_item_clicked (QModelIndex index);
|
||||
|
||||
private:
|
||||
Xmms::Playback::Status m_status;
|
||||
QFont *m_font;
|
||||
|
@ -71,6 +78,7 @@ class PlaylistView : public QListView {
|
|||
QColor m_color_selected;
|
||||
QColor m_color_normal;
|
||||
QColor m_color_normal_bg;
|
||||
QPointer<EntryInfo> m_entry_info;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -273,6 +273,8 @@ PlaylistWidget::addButtons (void)
|
|||
Skin::PLS_MSC_SRT_1);
|
||||
b = new PlaylistMenuButton (m_msc, Skin::PLS_MSC_INF_0,
|
||||
Skin::PLS_MSC_INF_1);
|
||||
connect (b, SIGNAL (activated ()),
|
||||
m_view, SLOT (showEntryInfo ()));
|
||||
b = new PlaylistMenuButton (m_msc, Skin::PLS_MSC_OPT_0,
|
||||
Skin::PLS_MSC_OPT_1);
|
||||
/* playlist menu */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue