Commit 240e4ec4 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: PLModel: rework menu signaling to get rid of popup data storage in model

parent d4a2b748
......@@ -47,7 +47,6 @@
class PLItem;
class PLSelector;
class PlMimeData;
class QSignalMapper;
class PLModel : public VLCModel
{
......@@ -128,6 +127,8 @@ public slots:
virtual void activateItem( const QModelIndex &index );
void clearPlaylist();
void ensureArtRequested( const QModelIndex &index );
virtual void actionSlot( QAction *action );
private:
/* General */
PLItem *rootItem;
......@@ -154,7 +155,7 @@ private:
return static_cast<PLItem*>( index.internalPointer() );
else return rootItem;
}
QStringList selectedURIs();
QStringList selectedURIs( QModelIndexList * );
QModelIndex index( PLItem *, const int c ) const;
bool isCurrent( const QModelIndex &index ) const;
bool isParent( const QModelIndex &index, const QModelIndex &current) const;
......@@ -175,13 +176,7 @@ private:
void dropMove( const PlMimeData * data, PLItem *target, int new_pos );
/* */
void sort( QModelIndex rootIndex, const int column, Qt::SortOrder order );
/* Popup */
QModelIndex popupLauncherIndex;
QModelIndexList current_selection;
QMenu *sortingMenu;
QSignalMapper *sortingMapper;
void sort( QModelIndex caller, QModelIndex rootIndex, const int column, Qt::SortOrder order );
/* Lookups */
PLItem *findById( PLItem *, int ) const;
......@@ -200,15 +195,6 @@ private:
QString latestSearch;
private slots:
void popupPlay();
void popupDel();
void popupInfo();
void popupStream();
void popupSave();
void popupExplore();
void popupAddNode();
void popupAddToPlaylist();
void popupSort( int column );
void processInputItemUpdate( input_item_t *);
void processInputItemUpdate( input_thread_t* p_input );
void processItemRemoval( int i_id );
......
......@@ -37,7 +37,7 @@
#include <QPixmapCache>
#include <QSize>
#include <QAbstractItemModel>
class QAction;
class VLCModel : public QAbstractItemModel
{
......@@ -60,6 +60,24 @@ public:
static QPixmap getArtPixmap( const QModelIndex & index, const QSize & size );
static QString getArtUrl( const QModelIndex & index );
struct actionsContainerType
{
enum
{
ACTION_PLAY = 1,
ACTION_INFO,
ACTION_STREAM,
ACTION_SAVE,
ACTION_EXPLORE,
ACTION_ADDTOPLAYLIST,
ACTION_ADDNODE,
ACTION_REMOVE,
ACTION_SORT
} action;
QModelIndexList indexes; /* for passing selection or caller index(es) */
int column; /* for sorting */
};
static int columnToMeta( int _column )
{
int meta = 1, column = 0;
......@@ -88,11 +106,13 @@ public:
public slots:
virtual void activateItem( const QModelIndex &index ) = 0;
virtual void actionSlot( QAction *action ) = 0;
protected:
intf_thread_t *p_intf;
};
Q_DECLARE_METATYPE(VLCModel::actionsContainerType)
#endif
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