[vlc-commits] commit: Qt4: constify (Ilkka Ollakka )
git at videolan.org
git at videolan.org
Thu Jun 24 23:18:28 CEST 2010
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu Jun 24 21:25:47 2010 +0300| [e7aff502e234f2ca64c0f25a85280c8f94942525] | committer: Ilkka Ollakka
Qt4: constify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e7aff502e234f2ca64c0f25a85280c8f94942525
---
.../gui/qt4/components/playlist/playlist_model.cpp | 22 ++++++++++----------
.../gui/qt4/components/playlist/playlist_model.hpp | 12 +++++-----
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 55c308c..0b4dfb8 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -115,7 +115,7 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
{
Qt::ItemFlags flags = QAbstractItemModel::flags( index );
- PLItem *item = index.isValid() ? getItem( index ) : rootItem;
+ const PLItem *item = index.isValid() ? getItem( index ) : rootItem;
if( canEdit() )
{
@@ -301,7 +301,7 @@ void PLModel::removeItem( int i_id )
void PLModel::activateItem( const QModelIndex &index )
{
assert( index.isValid() );
- PLItem *item = getItem( index );
+ const PLItem *item = getItem( index );
assert( item );
PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id );
@@ -325,10 +325,10 @@ void PLModel::activateItem( playlist_item_t *p_item )
}
/****************** Base model mandatory implementations *****************/
-QVariant PLModel::data( const QModelIndex &index, int role ) const
+QVariant PLModel::data( const QModelIndex &index, const int role ) const
{
if( !index.isValid() ) return QVariant();
- PLItem *item = getItem( index );
+ const PLItem *item = getItem( index );
if( role == Qt::DisplayRole )
{
int metadata = columnToMeta( index.column() );
@@ -420,7 +420,7 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
return QVariant( qfu( psz_column_title( meta_col ) ) );
}
-QModelIndex PLModel::index( int row, int column, const QModelIndex &parent )
+QModelIndex PLModel::index( const int row, const int column, const QModelIndex &parent )
const
{
PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
@@ -432,7 +432,7 @@ QModelIndex PLModel::index( int row, int column, const QModelIndex &parent )
return QModelIndex();
}
-QModelIndex PLModel::index( int i_id, int c )
+QModelIndex PLModel::index( const int i_id, const int c )
{
return index( findById( rootItem, i_id ), c );
}
@@ -485,7 +485,7 @@ int PLModel::columnCount( const QModelIndex &i) const
int PLModel::rowCount( const QModelIndex &parent ) const
{
- PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
+ const PLItem *parentItem = parent.isValid() ? getItem( parent ) : rootItem;
return parentItem->childCount();
}
@@ -494,7 +494,7 @@ QStringList PLModel::selectedURIs()
QStringList lst;
for( int i = 0; i < current_selection.size(); i++ )
{
- PLItem *item = getItem( current_selection[i] );
+ const PLItem *item = getItem( current_selection[i] );
if( item )
{
PL_LOCK;
@@ -637,7 +637,7 @@ void PLModel::processItemAppend( int i_item, int i_parent )
PLItem *nodeItem = findById( rootItem, i_parent );
if( !nodeItem ) return;
- foreach( PLItem *existing, nodeItem->children )
+ foreach( const PLItem *existing, nodeItem->children )
if( existing->i_id == i_item ) return;
PL_LOCK;
@@ -810,12 +810,12 @@ void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList
}
/******* Volume III: Sorting and searching ********/
-void PLModel::sort( int column, Qt::SortOrder order )
+void PLModel::sort( const int column, Qt::SortOrder order )
{
sort( rootItem->i_id, column, order );
}
-void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
+void PLModel::sort( const int i_root_id, const int column, Qt::SortOrder order )
{
msg_Dbg( p_intf, "Sorting by column %i, order %i", column, order );
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index ca18f0f..11a582e 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -70,13 +70,13 @@ public:
/*** QModel subclassing ***/
/* Data structure */
- QVariant data( const QModelIndex &index, int role ) const;
+ QVariant data( const QModelIndex &index, const int role ) const;
QVariant headerData( int section, Qt::Orientation orientation,
int role = Qt::DisplayRole ) const;
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
Qt::ItemFlags flags( const QModelIndex &index ) const;
- QModelIndex index( int r, int c, const QModelIndex &parent ) const;
+ QModelIndex index( const int r, const int c, const QModelIndex &parent ) const;
QModelIndex parent( const QModelIndex &index ) const;
/* Drag and Drop */
@@ -90,8 +90,8 @@ public:
/* Lookups */
QStringList selectedURIs();
- QModelIndex index( PLItem *, int c ) const;
- QModelIndex index( int i_id, int c );
+ QModelIndex index( PLItem *, const int c ) const;
+ QModelIndex index( const int i_id, const int c );
QModelIndex currentIndex() const;
bool isParent( const QModelIndex &index, const QModelIndex ¤t) const;
bool isCurrent( const QModelIndex &index ) const;
@@ -103,8 +103,8 @@ public:
bool popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list );
void doDelete( QModelIndexList selected );
void search( const QString& search_text, const QModelIndex & root, bool b_recursive );
- void sort( int column, Qt::SortOrder order );
- void sort( int i_root_id, int column, Qt::SortOrder order );
+ void sort( const int column, Qt::SortOrder order );
+ void sort( const int i_root_id, const int column, Qt::SortOrder order );
void rebuild();
void rebuild( playlist_item_t * );
More information about the vlc-commits
mailing list