]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/selector.hpp
Qt4: remove proto combo from open net tab
[vlc] / modules / gui / qt4 / components / playlist / selector.hpp
index 785bd31e5c4cb2651415e2771159b7aa190d0c8d..3682b27769d1408b4b3a4662d2383c62ce61e83c 100644 (file)
@@ -1,10 +1,11 @@
 /*****************************************************************************
  * selector.hpp : Playlist source selector
  ****************************************************************************
- * Copyright (C) 2000-2005 the VideoLAN team
- * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
+ * Copyright (C) 2000-2009 the VideoLAN team
+ * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf
  *
  * 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
 #ifndef _PLSEL_H_
 #define _PLSEL_H_
 
-#include <vlc/vlc.h>
-#include <QWidget>
-#include <QString>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QStyledItemDelegate>
+#include <QPainter>
+#include <QPushButton>
+#include <QLabel>
+#include <QHBoxLayout>
+
+#include <vlc_playlist.h>
+
+#include "qt4.hpp"
+
+class PlaylistWidget;
+class QVLCIconLabel;
+
+enum SelectorItemType {
+    CATEGORY_TYPE,
+    SD_TYPE,
+    PL_ITEM_TYPE
+};
+
+enum SpecialData {
+    IS_PODCAST = 1,
+    IS_PL,
+    IS_ML
+};
+
+enum {
+    TYPE_ROLE = Qt::UserRole,
+    NAME_ROLE, //QString
+    LONGNAME_ROLE, //QString
+    PL_ITEM_ROLE, //playlist_item_t*
+    PL_ITEM_ID_ROLE, //playlist_item_t->i_id
+    IN_ITEM_ROLE, //input_item_t->i_id
+    SPECIAL_ROLE //SpecialData
+};
+
+enum ItemAction {
+    ADD_ACTION,
+    RM_ACTION
+};
+
+class PLSelItem : public QWidget
+{
+    Q_OBJECT;
+public:
+    PLSelItem( QTreeWidgetItem*, const QString& );
+    void setText( const QString& );
+    void addAction( ItemAction, const QString& toolTip = 0 );
+    QTreeWidgetItem *treeItem() { return qitem; }
+    QString text() { return lbl->text(); }
+public slots:
+    void showAction();
+    void hideAction();
+private slots:
+    void triggerAction() { emit action( this ); }
+signals:
+    void action( PLSelItem* );
+private:
+    void enterEvent( QEvent* );
+    void leaveEvent( QEvent* );
+    QTreeWidgetItem* qitem;
+    QVLCIconLabel *lblAction;
+    QLabel *lbl;
+    QHBoxLayout *layout;
+};
 
-class PLSelector: public QWidget
+Q_DECLARE_METATYPE( playlist_item_t *);
+Q_DECLARE_METATYPE( input_item_t *);
+class PLSelector: public QTreeWidget
 {
     Q_OBJECT;
 public:
-    PLSelector( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
-    {
-        p_intf = _p_intf;
-    }
+    PLSelector( QWidget *p, intf_thread_t *_p_intf );
     virtual ~PLSelector();
+protected:
+    friend class PlaylistWidget;
 private:
+    QStringList mimeTypes () const;
+    bool dropMimeData ( QTreeWidgetItem * parent, int index, const QMimeData * data, Qt::DropAction action );
+    void createItems();
+    PLSelItem * addItem (
+        SelectorItemType type, const QString& str, bool drop,
+        QTreeWidgetItem* parentItem = 0 );
+    PLSelItem * addPodcastItem( playlist_item_t *p_item );
+    inline PLSelItem * itemWidget( QTreeWidgetItem * );
     intf_thread_t *p_intf;
+    QTreeWidgetItem *podcastsParent;
+    int podcastsParentId;
+private slots:
+    void setSource( QTreeWidgetItem *item );
+    void plItemAdded( int, int );
+    void plItemRemoved( int );
+    void inputItemUpdate( input_item_t * );
+    void podcastAdd( PLSelItem* );
+    void podcastRemove( PLSelItem* );
+
+signals:
+    void activated( playlist_item_t * );
 };
 
 #endif