Version: 2.2.2 (using KDE 4.4.0) Installed from: openSUSE RPMs Under Media Sources there are many different items that need double-click for activating them somehow. The general behavior is that when a single-click is done, the item is selected, but when double-click is done, it's somehow activated. However, some items don't get selected when single-clicking on them: Media Sources (Local Music, Playlists etc.), selection of type of playlists (Dynamic/Saved).
Wrong, double click doesn't activate, it adds to the playlist. If the single click doesn't select or open an item, then it is probably a problem in your settings. With the default KDE settings, this works already since quite some time.
I meant "activate item" as "make some action with the item, eg. add it to playlist". "Activating" media source doesn't add media source to playlist, does it? :P I don't have any problems in my settings, I have double-clicking activated in KDE. Read again, exactly what I meant to "select" (hint: not tracks in collections).
You are right, the first level items in the Media Sources don't react on single click when one sets KDE to use the double-click settings. Confirmed on 2.3-Git
commit 6a9b70cfe6f645d2a75ef65e87e31adf6bb2f45c Author: Rick W. Chen <stuffcorpse@archlinux.us> Date: Sun May 16 03:02:28 2010 +1200 Remove extra delays of single click operations in CollectionTreeView If KDE is running in single click mode, a noteable delay occurs when e.g. expanding an item, starting drag for the PUD. Under double click mode, there's no such delay. Further, this delay is set to DoubleClickInterval, which makes the ui seem unresponsive. This patch removes that delay and fixes some issues related to selection of items. BUG:222760 CCBUG:226533 diff --git a/ChangeLog b/ChangeLog index 7ac7979..4120ef2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,10 +5,13 @@ Amarok ChangeLog VERSION 2.3.1 CHANGES: + * Improved responsiveness when expanding/collapsing items in the + collection browser when using single-click mode. * The Collection scanner now runs with idle priority when invoked by Amarok. Batch scan users can invoke it with the --idlepriority flag. BUGFIXES: + * Fixed strange selection behaviour in the music sources pane (BR 222760). * Fixed factor used when filtering lengths in collection browser. * Fixed wrong value used when filtering comments in collection browser. * Don't truncate the "Label:" label in the TagDialog. (BR 235957) diff --git a/src/browsers/CollectionTreeItem.cpp b/src/browsers/CollectionTreeItem.cpp index cc16862..efb7daa 100644 --- a/src/browsers/CollectionTreeItem.cpp +++ b/src/browsers/CollectionTreeItem.cpp @@ -388,7 +388,6 @@ CollectionTreeItem::descendentTracks() bool CollectionTreeItem::allDescendentTracksLoaded() const { - Meta::TrackPtr track; if( isTrackItem() ) return true; @@ -400,7 +399,6 @@ CollectionTreeItem::allDescendentTracksLoaded() const if( !item->allDescendentTracksLoaded() ) return false; } - return true; } diff --git a/src/browsers/CollectionTreeView.cpp b/src/browsers/CollectionTreeView.cpp index 4a87de2..360cac5 100644 --- a/src/browsers/CollectionTreeView.cpp +++ b/src/browsers/CollectionTreeView.cpp @@ -66,7 +66,6 @@ CollectionTreeView::CollectionTreeView( QWidget *parent) , m_cmSeperator( 0 ) , m_dragMutex() , m_ongoingDrag( false ) - , m_justDoubleClicked( false ) { setSortingEnabled( true ); sortByColumn( 0, Qt::AscendingOrder ); @@ -87,8 +86,6 @@ CollectionTreeView::CollectionTreeView( QWidget *parent) connect( this, SIGNAL( collapsed( const QModelIndex & ) ), SLOT( slotCollapsed( const QModelIndex & ) ) ); connect( this, SIGNAL( expanded( const QModelIndex & ) ), SLOT( slotExpanded( const QModelIndex & ) ) ); - - connect( &m_clickTimer, SIGNAL( timeout() ), this, SLOT( slotClickTimeout() ) ); } void CollectionTreeView::setModel( QAbstractItemModel * model ) @@ -277,38 +274,44 @@ void CollectionTreeView::mouseDoubleClickEvent( QMouseEvent *event ) return; } - QModelIndex origIndex = indexAt( event->pos() ); - CollectionTreeItem *item = getItemFromIndex( origIndex ); - - if( !item ) + QModelIndex index = indexAt( event->pos() ); + if( !index.isValid() ) { event->accept(); return; } - if( event->button() != Qt::LeftButton || event->modifiers() - || KGlobalSettings::singleClick() || ( item && item->isTrackItem() ) ) + if( model()->hasChildren( index ) ) + { + if( event->button() == Qt::LeftButton && + event->modifiers() == Qt::NoModifier ) + { + setExpanded( index, !isExpanded( index ) ); + } + } + else { + CollectionTreeItem *item = getItemFromIndex( index ); playChildTracks( item, Playlist::AppendAndPlay ); - update(); - event->accept(); - return; } - - m_clickTimer.stop(); - //m_justDoubleClicked is necessary because the mouseReleaseEvent still - //comes through, but after the mouseDoubleClickEvent, so we need to tell - //mouseReleaseEvent to ignore that one event - m_justDoubleClicked = true; - setExpanded( origIndex, !isExpanded( origIndex ) ); event->accept(); } void CollectionTreeView::mousePressEvent( QMouseEvent *event ) { - if( KGlobalSettings::singleClick() ) - setItemsExpandable( false ); - update(); + QModelIndex index = indexAt( event->pos() ); + + if( index.isValid() && + event->button() == Qt::LeftButton && + event->modifiers() == Qt::NoModifier && + KGlobalSettings::singleClick() && + model()->hasChildren( index ) ) + { + setCurrentIndex( index ); + setExpanded( index, !isExpanded( index ) ); + event->accept(); + return; + } Amarok::PrettyTreeView::mousePressEvent( event ); } @@ -318,46 +321,21 @@ void CollectionTreeView::mouseReleaseEvent( QMouseEvent *event ) { connect( m_pd, SIGNAL( fadeHideFinished() ), m_pd, SLOT( deleteLater() ) ); m_pd->hide(); + m_pd = 0; } - m_pd = 0; - setItemsExpandable( true ); if( event->button() == Qt::MidButton ) { QModelIndex origIndex = indexAt( event->pos() ); - CollectionTreeItem *item = getItemFromIndex( origIndex ); - if ( item ) + if( origIndex.isValid() ) { + CollectionTreeItem *item = getItemFromIndex( origIndex ); playChildTracks( item, Playlist::AppendAndPlay ); - update(); event->accept(); return; } } - if( event->button() != Qt::LeftButton - || event->modifiers() - || selectedIndexes().size() > 1) - { - Amarok::PrettyTreeView::mousePressEvent( event ); - update(); - return; - } - - if( m_clickTimer.isActive() || m_justDoubleClicked ) - { - //it's a double-click...so ignore it - m_clickTimer.stop(); - m_justDoubleClicked = false; - m_savedClickIndex = QModelIndex(); - event->accept(); - return; - } - - m_savedClickIndex = indexAt( event->pos() ); - KConfigGroup cg( KGlobal::config(), "KDE" ); - m_clickTimer.start( cg.readEntry( "DoubleClickInterval", 400 ) ); - m_clickLocation = event->pos(); - event->accept(); + Amarok::PrettyTreeView::mouseReleaseEvent( event ); } void CollectionTreeView::mouseMoveEvent( QMouseEvent *event ) @@ -366,17 +344,8 @@ void CollectionTreeView::mouseMoveEvent( QMouseEvent *event ) if( event->buttons() || event->modifiers() ) { Amarok::PrettyTreeView::mouseMoveEvent( event ); - update(); return; } - - QPoint point = event->pos() - m_clickLocation; - KConfigGroup cg( KGlobal::config(), "KDE" ); - if( point.manhattanLength() > cg.readEntry( "StartDragDistance", 4 ) ) - { - m_clickTimer.stop(); - slotClickTimeout(); - } event->accept(); } @@ -390,22 +359,12 @@ CollectionTreeItem* CollectionTreeView::getItemFromIndex( QModelIndex &index ) if( !filteredIndex.isValid() ) { - return NULL; + return 0; } return static_cast<CollectionTreeItem*>( filteredIndex.internalPointer() ); } -void CollectionTreeView::slotClickTimeout() -{ - m_clickTimer.stop(); - if( m_savedClickIndex.isValid() && KGlobalSettings::singleClick() ) - { - setExpanded( m_savedClickIndex, !isExpanded( m_savedClickIndex ) ); - } - m_savedClickIndex = QModelIndex(); -} - void CollectionTreeView::keyPressEvent( QKeyEvent *event ) { QModelIndexList indices = selectedIndexes(); @@ -555,8 +514,13 @@ CollectionTreeView::startDrag(Qt::DropActions supportedActions) void CollectionTreeView::selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) { - Q_UNUSED( deselected ) QModelIndexList indexes = selected.indexes(); + + QModelIndexList changedIndexes = indexes; + changedIndexes << deselected.indexes(); + foreach( const QModelIndex &index, changedIndexes ) + update( index ); + if ( indexes.count() < 1 ) return; @@ -566,9 +530,7 @@ void CollectionTreeView::selectionChanged(const QItemSelection & selected, const else index = indexes[0]; - CollectionTreeItem * item = static_cast<CollectionTreeItem *>( index.internalPointer() ); - emit( itemSelected ( item ) ); } diff --git a/src/browsers/CollectionTreeView.h b/src/browsers/CollectionTreeView.h index 4b3de7c..a13ab6c 100644 --- a/src/browsers/CollectionTreeView.h +++ b/src/browsers/CollectionTreeView.h @@ -78,7 +78,6 @@ class CollectionTreeView: public Amarok::PrettyTreeView void mouseReleaseEvent( QMouseEvent *event ); void keyPressEvent( QKeyEvent * event ); void startDrag( Qt::DropActions supportedActions ); - //void changeEvent ( QEvent * event ); protected slots: virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ); @@ -87,7 +86,6 @@ class CollectionTreeView: public Amarok::PrettyTreeView void slotExpanded( const QModelIndex &index ); void slotCheckAutoExpand(); - void slotClickTimeout(); void slotPlayChildTracks(); void slotAppendChildTracks(); @@ -142,10 +140,6 @@ class CollectionTreeView: public Amarok::PrettyTreeView QMutex m_dragMutex; bool m_ongoingDrag; - QPoint m_clickLocation; - QTimer m_clickTimer; - QModelIndex m_savedClickIndex; - bool m_justDoubleClicked; signals: void itemSelected( CollectionTreeItem * item );
I've just committed something that might be related to this. Although I'm not exactly sure what the reporter wanted. Let me know if the behaviour is still not good and what is actually wrong with it.
Although I'm using double-clicking in KDE, these items (Media Sources (Local Music, Playlists etc.), selection of type of playlists (Dynamic/Saved)) are now selected on single click. They should be only selected with one click and selected with double-click.
I assume you meant "they should be only selected with one click and /activated/ with double click". You have a point there but in this case I don't think it matters much, since the only option those items support is to activate them (as oppose to say, expand, delete, invoking a context menu, etc.).
Yes, it does not matter much, but it's just not consistent. I try to double-click on the entry, so what happens is that the first click of the double-click selects the action and the other click already does smth else (eg. expands an artist under Local Music) in there.
Makes sense. This turned out to be a oneline fix (yay), but it will have to wait until after next release since we're dangerously close to tagging.
commit af56fdf1a1503f6261829f9110d4efbe28f7948e Author: Rick W. Chen <stuffcorpse@archlinux.us> Date: Tue May 25 03:29:21 2010 +1200 Use activated signal for activating a browser category This will honour single/double click settings. BUG:226533 diff --git a/ChangeLog b/ChangeLog index bbcba4f..a593e92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ VERSION 2.3.2-Beta 1 CHANGES: BUGFIXES: + * Fixed clicking on browser categories not honoring mouse settings. (BR 226533) * Fixed usability issue with regards to context menu item order when right clicking in the playlist widget. (BR 198650) diff --git a/src/browsers/BrowserCategoryList.cpp b/src/browsers/BrowserCategoryList.cpp index 4c33b3e..3c73f5c 100644 --- a/src/browsers/BrowserCategoryList.cpp +++ b/src/browsers/BrowserCategoryList.cpp @@ -81,7 +81,7 @@ BrowserCategoryList::BrowserCategoryList( QWidget * parent, const QString& name, m_categoryListView->sortByColumn( 0 ); } - connect( m_categoryListView, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( categoryActivated( const QModelIndex & ) ) ); + connect( m_categoryListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(categoryActivated(const QModelIndex&)) ); connect( m_categoryListView, SIGNAL( entered( const QModelIndex & ) ), this, SLOT( categoryEntered( const QModelIndex & ) ) );