extragear/multimedia/amarok/src/playlist/view/listview

Seb Ruiz ruiz at kde.org
Tue Dec 16 22:44:51 CET 2008


2008/12/17 Bart Cerneels <bart.cerneels at kde.org>:
> SVN commit 897767 by shanachie:
>
> Use Ctrl+Right Click to quickly adjust the queue order in the Playlist.
>
> This restores the basic functionality of the queue manager. It also uses the same key combo.

I have to put up my opposition to this commit. As you already know,
I've got a fairly good reimplementation of the queuing system for
Amarok 2, which already uses the Ctrl-RightClick shortcut to queue
within the playlist. It would be more beneficial if we worked together
on this.

>
> CCMAIL: amarok-devel at kde.org
>
>
>  M  +45 -3     PrettyListView.cpp
>
>
> --- trunk/extragear/multimedia/amarok/src/playlist/view/listview/PrettyListView.cpp #897766:897767
> @@ -124,6 +124,14 @@
>
>     if ( !index.isValid() )
>         return;
> +
> +    Qt::KeyboardModifiers modifiers = event->modifiers();
> +    const bool controlKeyPressed = modifiers & Qt::ControlModifier;
> +    //Ctrl + Right Click is used for quick queue sorting
> +    if ( controlKeyPressed )
> +    {
> +        return;
> +    }
>
>     ViewCommon::trackMenu( this, &index, event->globalPos(), true );
>     event->accept();
> @@ -217,7 +225,6 @@
>  {
>     if ( mouseEventInHeader( event ) && ( event->button() == Qt::LeftButton ) )
>     {
> -        //event->accept();
>         m_mousePressInHeader = true;
>         QModelIndex index = indexAt( event->pos() );
>         //only do this dance if header is not already selected
> @@ -236,8 +243,43 @@
>     {
>         m_mousePressInHeader = false;
>     }
> -    QListView::mousePressEvent( event ); //this should always be forwarded, as it is used to determine the offset
> -    //relative to the mousr of the selection we are dragging!
> +
> +    //handle Ctrl + Right Click for quick queue sorting
> +    Qt::KeyboardModifiers modifiers = event->modifiers();
> +    const bool controlKeyPressed = modifiers & Qt::ControlModifier;
> +    if ( ( event->button() == Qt::RightButton ) && controlKeyPressed )
> +    {
> +        QAbstractItemModel* plModel = model();
> +
> +        //move clicked items to row right after the last selected item.
> +        int targetRow = selectedRows().isEmpty()
> +                ? plModel->rowCount()
> +                : selectedRows().last() + 1;
> +        selectionModel()->clear();
> +
> +        event->accept();
> +
> +        QModelIndex index = indexAt( event->pos() );
> +        QList<int> sr;
> +        if( mouseEventInHeader( event ) )
> +        {
> +            int rows = index.data( GroupedTracksRole ).toInt();
> +            for( int i = index.row(); i < index.row() + rows; i++ )
> +            {
> +                sr << i;
> +            }
> +        }
> +        else
> +        {
> +            sr << index.row();
> +        }
> +        Controller::instance()->moveRows( sr, targetRow );
> +    }
> +    else
> +    {
> +        QListView::mousePressEvent( event ); //this should always be forwarded, as it is used to determine the offset
> +        //relative to the mouse of the selection we are dragging!
> +    }
>  }
>
>  void
> _______________________________________________
> Amarok-devel mailing list
> Amarok-devel at kde.org
> https://mail.kde.org/mailman/listinfo/amarok-devel
>



-- 
Seb Ruiz

http://www.sebruiz.net/
http://amarok.kde.org/


More information about the Amarok-devel mailing list