[amarok] src/browsers/playlistbrowser: Playlist browser: normalize connect() calls

Bart Cerneels bart.cerneels at kde.org
Wed Apr 11 10:48:27 UTC 2012


I think the style for function statements should be applied to the
contents of SIGNAL/SLOT macro's as well. i.e. space after and before
the parentheses. I don't use that style for macros since they are not
functions, with the capitals it's clear they aren't.

Probably best to stick to the style.

Saying that, my favorite editor QtCreator's auto-format is not
compatible with our style. I'm getting quite annoyed with manually
ocrrecting all the time so am thinking of relaxing the style rules to
suite that. I do prefer very easy to read code, specifically on
reviewboard, where there might not be such nice coloration as in an
IDE.

What do you think?

On Wed, Apr 11, 2012 at 12:37, Matěj Laitl <matej at laitl.cz> wrote:
> Git commit 3e5a5601402222de37d37fdfcf8bae9c0db06683 by Matěj Laitl.
> Committed on 11/04/2012 at 11:46.
> Pushed by laitl into branch 'master'.
>
> Playlist browser: normalize connect() calls
>
> Also remove one duplicate connect call.
>
> M  +2    -2    src/browsers/playlistbrowser/PlaylistBrowserModel.cpp
> M  +2    -5    src/browsers/playlistbrowser/PlaylistBrowserView.cpp
> M  +4    -4    src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp
> M  +8    -11   src/browsers/playlistbrowser/QtGroupingProxy.cpp
>
> http://commits.kde.org/amarok/3e5a5601402222de37d37fdfcf8bae9c0db06683
>
> diff --git a/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp b/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp
> index a5c2848..64740e6 100644
> --- a/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp
> +++ b/src/browsers/playlistbrowser/PlaylistBrowserModel.cpp
> @@ -69,8 +69,8 @@ PlaylistBrowserModel::PlaylistBrowserModel( int playlistCategory )
>     connect( The::playlistManager(), SIGNAL(playlistUpdated( Playlists::PlaylistPtr, int )),
>              SLOT(slotPlaylistUpdated( Playlists::PlaylistPtr, int )) );
>
> -    connect( The::playlistManager(), SIGNAL(renamePlaylist( Playlists::PlaylistPtr )),
> -             SLOT(slotRenamePlaylist( Playlists::PlaylistPtr )) );
> +    connect( The::playlistManager(), SIGNAL(renamePlaylist(Playlists::PlaylistPtr)),
> +             SLOT(slotRenamePlaylist(Playlists::PlaylistPtr)) );
>
>     m_playlists = loadPlaylists();
>  }
> diff --git a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp
> index cfb69e4..e1a4332 100644
> --- a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp
> +++ b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp
> @@ -73,13 +73,10 @@ PlaylistBrowserNS::PlaylistBrowserView::~PlaylistBrowserView()
>  void
>  PlaylistBrowserNS::PlaylistBrowserView::setModel( QAbstractItemModel *model )
>  {
> -    if( this->model() )
> -        this->model()->disconnect();
> -
> +    disconnect( this->model(), 0, this, 0 );
>     Amarok::PrettyTreeView::setModel( model );
>
> -    connect( this->model(), SIGNAL(renameIndex( const QModelIndex & )),
> -                 SLOT(edit( const QModelIndex &)) );
> +    connect( this->model(), SIGNAL(renameIndex(QModelIndex)), SLOT(edit(QModelIndex)) );
>  }
>
>  void
> diff --git a/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp b/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp
> index 0a450ae..e1e429e 100644
> --- a/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp
> +++ b/src/browsers/playlistbrowser/PlaylistsByProviderProxy.cpp
> @@ -31,8 +31,8 @@ PlaylistsByProviderProxy::PlaylistsByProviderProxy( QAbstractItemModel *model, i
>         : QtGroupingProxy( model, QModelIndex(), column )
>         , m_playlistCategory( playlistCategory )
>  {
> -    connect( sourceModel(), SIGNAL(renameIndex( const QModelIndex & )),
> -             SLOT(slotRenameIndex( const QModelIndex & )) );
> +    connect( sourceModel(), SIGNAL(renameIndex(QModelIndex)),
> +             SLOT(slotRenameIndex(QModelIndex)) );
>
>     // we need this to track providers with no playlists
>     connect( The::playlistManager(), SIGNAL(providerAdded(Playlists::PlaylistProvider*,int)),
> @@ -192,8 +192,8 @@ PlaylistsByProviderProxy::setSourceModel( QAbstractItemModel *model )
>
>     QtGroupingProxy::setSourceModel( model );
>
> -    connect( sourceModel(), SIGNAL(renameIndex( const QModelIndex & )),
> -             SLOT(slotRenameIndex( const QModelIndex & )) );
> +    connect( sourceModel(), SIGNAL(renameIndex(QModelIndex)),
> +             SLOT(slotRenameIndex(QModelIndex)) );
>  }
>
>  void
> diff --git a/src/browsers/playlistbrowser/QtGroupingProxy.cpp b/src/browsers/playlistbrowser/QtGroupingProxy.cpp
> index 53b01fb..a3ebdce 100644
> --- a/src/browsers/playlistbrowser/QtGroupingProxy.cpp
> +++ b/src/browsers/playlistbrowser/QtGroupingProxy.cpp
> @@ -37,18 +37,15 @@ QtGroupingProxy::QtGroupingProxy( QAbstractItemModel *model, QModelIndex rootNod
>     setSourceModel( model );
>
>     // signal proxies
> -    connect( sourceModel(),
> -        SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ),
> -        this, SLOT( modelDataChanged( const QModelIndex&, const QModelIndex& ) )
> -    );
> -    connect( sourceModel(), SIGNAL( rowsInserted( const QModelIndex&, int, int ) ),
> -             SLOT( modelRowsInserted( const QModelIndex &, int, int ) ) );
> -    connect( sourceModel(), SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int ,int )),
> -             SLOT(modelRowsAboutToBeInserted( const QModelIndex &, int ,int )));
> -    connect( sourceModel(), SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ),
> -             SLOT( modelRowsRemoved( const QModelIndex&, int, int ) ) );
> -    connect( sourceModel(), SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int ,int )),
> +    connect( sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int) ),
> +             SLOT(modelRowsInserted(QModelIndex,int,int)) );
> +    connect( sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
> +             SLOT(modelRowsAboutToBeInserted(QModelIndex,int,int)) );
> +    connect( sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
> +             SLOT(modelRowsRemoved(QModelIndex,int,int)) );
> +    connect( sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
>              SLOT(modelRowsAboutToBeRemoved(QModelIndex,int,int)) );
> +
>     connect( sourceModel(), SIGNAL(layoutChanged()), SLOT(buildTree()) );
>     connect( sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
>              SLOT(modelDataChanged(QModelIndex,QModelIndex)) );
>


More information about the Amarok-devel mailing list