Commit 477de11a authored by François Cartegnie's avatar François Cartegnie 🤞

Qt: PLItem: constness and override

parent 3a3af320
...@@ -85,12 +85,12 @@ PLItem::~PLItem() ...@@ -85,12 +85,12 @@ PLItem::~PLItem()
children.clear(); children.clear();
} }
int PLItem::id( int type ) int PLItem::id( int type ) const
{ {
switch( type ) switch( type )
{ {
case INPUTITEM_ID: case INPUTITEM_ID:
return inputItem()->i_id; return p_input->i_id;
case PLAYLIST_ID: case PLAYLIST_ID:
return i_playlist_id; return i_playlist_id;
default: default:
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include "qt.hpp"
#include <QList> #include <QList>
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
...@@ -51,7 +53,7 @@ public: ...@@ -51,7 +53,7 @@ public:
virtual ~AbstractPLItem() {} virtual ~AbstractPLItem() {}
protected: protected:
virtual int id( int type ) = 0; virtual int id( int type ) const = 0;
int childCount() const { return children.count(); } int childCount() const { return children.count(); }
int indexOf( AbstractPLItem *item ) const { return children.indexOf( item ); }; int indexOf( AbstractPLItem *item ) const { return children.indexOf( item ); };
int lastIndexOf( AbstractPLItem *item ) const { return children.lastIndexOf( item ); }; int lastIndexOf( AbstractPLItem *item ) const { return children.lastIndexOf( item ); };
...@@ -81,12 +83,12 @@ public: ...@@ -81,12 +83,12 @@ public:
private: private:
/* AbstractPLItem */ /* AbstractPLItem */
int id( int type ); int id( int type ) const Q_DECL_OVERRIDE;
input_item_t *inputItem() { return p_input; } input_item_t *inputItem() Q_DECL_OVERRIDE { return p_input; }
AbstractPLItem *child( int id ) const { return children.value( id ); }; AbstractPLItem *child( int id ) const Q_DECL_OVERRIDE { return children.value( id ); };
virtual QUrl getURI() const; virtual QUrl getURI() const Q_DECL_OVERRIDE;
virtual QString getTitle() const; virtual QString getTitle() const Q_DECL_OVERRIDE;
virtual bool readOnly() const; virtual bool readOnly() const Q_DECL_OVERRIDE;
/* Local */ /* Local */
PLItem( playlist_item_t *, PLItem *parent ); PLItem( playlist_item_t *, PLItem *parent );
......
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