Version: 2.0.1 (using KDE 4.4.5) OS: FreeBSD In at least one of the k3b-2 betas and in k3b-1.* it was possible to edit track and artist details inline (by double clicking on the relevant cell). This is not possible with k3b-2.0.1. Currently k3b requires one to use the "Edit Track CDDB Info" dialog. Reproducible: Always
Same behaviour under archlinux. k3b used to be my favorite ripping tool... I already wrote to the mailing list and this is really a bug as inline editing is supposed to work. Here part of my mail for a better description what I observe: -- snip -- I am 99% sure that in all the versions I used, it was just as simple as clicking (or maybe double clicking) into one of the fields to change it. For example: http://img97.imageshack.us/img97/8385/k3b1.png Back then, I was able to just click on the "Title" field of e.g. the song "Memories" and change it to "Memories (Album Version)" or so. With the current release (see image), I have to right click, select "Edit Track CDDB Info", change it, and then click OK. And that for each song I want to change. Am I getting Alzheimer of was this behaviour not different in earlier versions? -- snap -- Thanks for putting your time into this! :)
commit fadbc5b9997cc21b8e742e5dec4144612bef52f2 branch 2.0 Author: Michal Malek <michalm@jabster.pl> Date: Thu Jan 6 20:39:57 2011 +0100 Fixed inline editing of audio tracks in CD ripping view BUG: 250600 diff --git a/ChangeLog b/ChangeLog index 81f275d..ece78be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ Bugfixes: * Show K3b also in "System" category in KDE launch menus (250749) * Crash when multiple instances start at the same time (253794) * Crash after track splitting (261188) + * Inline editing of tracks in CD ripping view no longer works (250600) 2.0.1 ===== diff --git a/src/rip/k3baudiocdview.cpp b/src/rip/k3baudiocdview.cpp index d7d95bb..93c8e39 100644 --- a/src/rip/k3baudiocdview.cpp +++ b/src/rip/k3baudiocdview.cpp @@ -1,7 +1,7 @@ /* * * Copyright (C) 2003-2008 Sebastian Trueg <trueg@k3b.org> - * Copyright (C) 2010 Michal Malek <michalm@jabster.pl> + * Copyright (C) 2010-2011 Michal Malek <michalm@jabster.pl> * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.org> @@ -54,6 +54,7 @@ #include <QFont> #include <QVBoxLayout> #include <QItemSelectionModel> +#include <QKeyEvent> #include <QLabel> #include <QList> #include <QSpinBox> @@ -118,6 +119,7 @@ K3b::AudioCdView::AudioCdView( QWidget* parent ) d->trackView->setRootIsDecorated( false ); d->trackView->setContextMenuPolicy( Qt::CustomContextMenu ); d->trackView->setDragEnabled( true ); + d->trackView->installEventFilter( this ); K3b::ViewColumnAdjuster* vca = new K3b::ViewColumnAdjuster( d->trackView ); vca->setFixedColumns( QList<int>() << 0 << 3 ); vca->setColumnMargin( K3b::AudioTrackModel::LengthColumn, 10 ); @@ -439,6 +441,24 @@ void K3b::AudioCdView::queryCddb() } +bool K3b::AudioCdView::eventFilter( QObject* obj, QEvent* event ) +{ + if( event->type() == QEvent::KeyPress ) { + // Due to limitation of default implementation of QTreeView + // checking items with Space key doesn't work for columns other than first. + // Using below code a user can do that. + QKeyEvent* keyEvent = static_cast<QKeyEvent*>( event ); + if( keyEvent->key() == Qt::Key_Space ) { + foreach( int track, selectedTrackIndices( d->trackView ) ) { + d->trackModel->setTrackChecked( track, !d->trackModel->trackChecked( track ) ); + } + return true; + } + } + return MediaContentsView::eventFilter( obj, event ); +} + + void K3b::AudioCdView::slotSaveCddbLocally() { KCDDB::Client cddbClient; diff --git a/src/rip/k3baudiocdview.h b/src/rip/k3baudiocdview.h index 05b0009..cb1e497 100644 --- a/src/rip/k3baudiocdview.h +++ b/src/rip/k3baudiocdview.h @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) 2003-2008 Sebastian Trueg <trueg@k3b.org> * Copyright (C) 2010 Michal Malek <michalm@jabster.pl> @@ -37,6 +37,9 @@ public: public Q_SLOTS: void queryCddb(); +protected: + virtual bool eventFilter( QObject* obj, QEvent* event ); + private Q_SLOTS: void slotContextMenu( const QPoint& ); void slotTrackSelectionChanged(); @@ -56,7 +59,7 @@ private: void enableInteraction( bool ); void showBusyLabel( bool ); void updateTitle(); - + class Private; Private* d; }; diff --git a/src/rip/k3baudiotrackmodel.cpp b/src/rip/k3baudiotrackmodel.cpp index 011e248..20e8186 100644 --- a/src/rip/k3baudiotrackmodel.cpp +++ b/src/rip/k3baudiotrackmodel.cpp @@ -1,6 +1,7 @@ /* * * Copyright (C) 2008 Sebastian Trueg <trueg@k3b.org> + * Copyright (C) 2011 Michal Malek <michalm@jabster.pl> * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.org> @@ -234,12 +235,9 @@ Qt::ItemFlags K3b::AudioTrackModel::flags( const QModelIndex& index ) const if ( index.isValid() && index.row() >= 0 && index.row() < d->medium.toc().count() && d->medium.toc()[index.row()].type() == K3b::Device::Track::TYPE_AUDIO ) { - f |= Qt::ItemIsDragEnabled|Qt::ItemIsEnabled; + f |= Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; switch( index.column() ) { - case TrackNumberColumn: - f |= Qt::ItemIsUserCheckable; - break; case ArtistColumn: case TitleColumn: f |= Qt::ItemIsEditable; @@ -286,7 +284,7 @@ void K3b::AudioTrackModel::setTrackChecked( int track, bool checked ) { if ( track >= 0 && track < d->itemCheckedList.count() ) { d->itemCheckedList[track] = checked; - emit dataChanged( index( track, 0 ), index( track, 0 ) ); + emit dataChanged( index( track, TrackNumberColumn ), index( track, TrackNumberColumn ) ); } } @@ -370,7 +368,7 @@ QMimeData* K3b::AudioTrackModel::mimeData( const QModelIndexList& indexes ) cons // d'n'd is not a problem QList<int> trackNumbers; foreach( const QModelIndex& index, indexes ) { - if ( index.column() == 0 ) + if ( index.column() == TrackNumberColumn ) trackNumbers << index.data( TrackNumberColumn ).toInt(); } AudioCdTrackDrag drag( d->medium.toc(), trackNumbers, d->cddbCache, d->medium.device() ); @@ -380,21 +378,12 @@ QMimeData* K3b::AudioTrackModel::mimeData( const QModelIndexList& indexes ) cons } -QModelIndex K3b::AudioTrackModel::buddy( const QModelIndex& index ) const -{ - if( index.isValid() && index.column() != TrackNumberColumn ) - return AudioTrackModel::index( index.row(), TrackNumberColumn ); - else - return index; -} - - void K3b::AudioTrackModel::checkAll() { for ( int i = 0; i < d->medium.toc().count(); ++i ) { d->itemCheckedList[i] = true; } - emit dataChanged( index( 0, 0 ), index( d->itemCheckedList.count(), 0 ) ); + emit dataChanged( index( 0, TrackNumberColumn ), index( d->itemCheckedList.count(), TrackNumberColumn ) ); } @@ -403,7 +392,7 @@ void K3b::AudioTrackModel::uncheckAll() for ( int i = 0; i < d->medium.toc().count(); ++i ) { d->itemCheckedList[i] = false; } - emit dataChanged( index( 0, 0 ), index( d->itemCheckedList.count(), 0 ) ); + emit dataChanged( index( 0, TrackNumberColumn ), index( d->itemCheckedList.count(), TrackNumberColumn ) ); } #include "k3baudiotrackmodel.moc" diff --git a/src/rip/k3baudiotrackmodel.h b/src/rip/k3baudiotrackmodel.h index e56191a..d55f63f 100644 --- a/src/rip/k3baudiotrackmodel.h +++ b/src/rip/k3baudiotrackmodel.h @@ -1,6 +1,7 @@ /* * * Copyright (C) 2008 Sebastian Trueg <trueg@k3b.org> + * Copyright (C) 2011 Michal Malek <michalm@jabster.pl> * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.org> @@ -71,7 +72,6 @@ namespace K3b { virtual bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ); virtual QMimeData* mimeData( const QModelIndexList& indexes ) const; virtual QStringList mimeTypes() const; - virtual QModelIndex buddy( const QModelIndex& index ) const; public Q_SLOTS: void checkAll();
commit 519883cf71d4a39c862280738ef39db385028cd2 branch master Author: Michal Malek <michalm@jabster.pl> Date: Thu Jan 6 20:39:57 2011 +0100 Fixed inline editing of audio tracks in CD ripping view BUG: 250600 diff --git a/ChangeLog b/ChangeLog index bae0fb3..686c6a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ Bugfixes: * Show K3b also in "System" category in KDE launch menus (250749) * Crash when multiple instances start at the same time (253794) * Crash after track splitting (261188) + * Inline editing of tracks in CD ripping view no longer works (250600) 2.0.1 ===== diff --git a/src/rip/k3baudiocdview.cpp b/src/rip/k3baudiocdview.cpp index b9820b9..8a80ed1 100644 --- a/src/rip/k3baudiocdview.cpp +++ b/src/rip/k3baudiocdview.cpp @@ -1,7 +1,7 @@ /* * * Copyright (C) 2003-2008 Sebastian Trueg <trueg@k3b.org> - * Copyright (C) 2010 Michal Malek <michalm@jabster.pl> + * Copyright (C) 2010-2011 Michal Malek <michalm@jabster.pl> * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.org> @@ -54,6 +54,7 @@ #include <QFont> #include <QVBoxLayout> #include <QItemSelectionModel> +#include <QKeyEvent> #include <QLabel> #include <QList> #include <QSpinBox> @@ -118,6 +119,7 @@ K3b::AudioCdView::AudioCdView( QWidget* parent ) d->trackView->setRootIsDecorated( false ); d->trackView->setContextMenuPolicy( Qt::CustomContextMenu ); d->trackView->setDragEnabled( true ); + d->trackView->installEventFilter( this ); K3b::ViewColumnAdjuster* vca = new K3b::ViewColumnAdjuster( d->trackView ); vca->addFixedColumn( AudioTrackModel::TrackNumberColumn ); vca->addFixedColumn( AudioTrackModel::LengthColumn ); @@ -440,6 +442,24 @@ void K3b::AudioCdView::queryCddb() } +bool K3b::AudioCdView::eventFilter( QObject* obj, QEvent* event ) +{ + if( event->type() == QEvent::KeyPress ) { + // Due to limitation of default implementation of QTreeView + // checking items with Space key doesn't work for columns other than first. + // Using below code a user can do that. + QKeyEvent* keyEvent = static_cast<QKeyEvent*>( event ); + if( keyEvent->key() == Qt::Key_Space ) { + foreach( int track, selectedTrackIndices( d->trackView ) ) { + d->trackModel->setTrackChecked( track, !d->trackModel->trackChecked( track ) ); + } + return true; + } + } + return MediaContentsView::eventFilter( obj, event ); +} + + void K3b::AudioCdView::slotSaveCddbLocally() { KCDDB::Client cddbClient; diff --git a/src/rip/k3baudiocdview.h b/src/rip/k3baudiocdview.h index 05b0009..cb1e497 100644 --- a/src/rip/k3baudiocdview.h +++ b/src/rip/k3baudiocdview.h @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) 2003-2008 Sebastian Trueg <trueg@k3b.org> * Copyright (C) 2010 Michal Malek <michalm@jabster.pl> @@ -37,6 +37,9 @@ public: public Q_SLOTS: void queryCddb(); +protected: + virtual bool eventFilter( QObject* obj, QEvent* event ); + private Q_SLOTS: void slotContextMenu( const QPoint& ); void slotTrackSelectionChanged(); @@ -56,7 +59,7 @@ private: void enableInteraction( bool ); void showBusyLabel( bool ); void updateTitle(); - + class Private; Private* d; }; diff --git a/src/rip/k3baudiotrackmodel.cpp b/src/rip/k3baudiotrackmodel.cpp index 011e248..20e8186 100644 --- a/src/rip/k3baudiotrackmodel.cpp +++ b/src/rip/k3baudiotrackmodel.cpp @@ -1,6 +1,7 @@ /* * * Copyright (C) 2008 Sebastian Trueg <trueg@k3b.org> + * Copyright (C) 2011 Michal Malek <michalm@jabster.pl> * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.org> @@ -234,12 +235,9 @@ Qt::ItemFlags K3b::AudioTrackModel::flags( const QModelIndex& index ) const if ( index.isValid() && index.row() >= 0 && index.row() < d->medium.toc().count() && d->medium.toc()[index.row()].type() == K3b::Device::Track::TYPE_AUDIO ) { - f |= Qt::ItemIsDragEnabled|Qt::ItemIsEnabled; + f |= Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; switch( index.column() ) { - case TrackNumberColumn: - f |= Qt::ItemIsUserCheckable; - break; case ArtistColumn: case TitleColumn: f |= Qt::ItemIsEditable; @@ -286,7 +284,7 @@ void K3b::AudioTrackModel::setTrackChecked( int track, bool checked ) { if ( track >= 0 && track < d->itemCheckedList.count() ) { d->itemCheckedList[track] = checked; - emit dataChanged( index( track, 0 ), index( track, 0 ) ); + emit dataChanged( index( track, TrackNumberColumn ), index( track, TrackNumberColumn ) ); } } @@ -370,7 +368,7 @@ QMimeData* K3b::AudioTrackModel::mimeData( const QModelIndexList& indexes ) cons // d'n'd is not a problem QList<int> trackNumbers; foreach( const QModelIndex& index, indexes ) { - if ( index.column() == 0 ) + if ( index.column() == TrackNumberColumn ) trackNumbers << index.data( TrackNumberColumn ).toInt(); } AudioCdTrackDrag drag( d->medium.toc(), trackNumbers, d->cddbCache, d->medium.device() ); @@ -380,21 +378,12 @@ QMimeData* K3b::AudioTrackModel::mimeData( const QModelIndexList& indexes ) cons } -QModelIndex K3b::AudioTrackModel::buddy( const QModelIndex& index ) const -{ - if( index.isValid() && index.column() != TrackNumberColumn ) - return AudioTrackModel::index( index.row(), TrackNumberColumn ); - else - return index; -} - - void K3b::AudioTrackModel::checkAll() { for ( int i = 0; i < d->medium.toc().count(); ++i ) { d->itemCheckedList[i] = true; } - emit dataChanged( index( 0, 0 ), index( d->itemCheckedList.count(), 0 ) ); + emit dataChanged( index( 0, TrackNumberColumn ), index( d->itemCheckedList.count(), TrackNumberColumn ) ); } @@ -403,7 +392,7 @@ void K3b::AudioTrackModel::uncheckAll() for ( int i = 0; i < d->medium.toc().count(); ++i ) { d->itemCheckedList[i] = false; } - emit dataChanged( index( 0, 0 ), index( d->itemCheckedList.count(), 0 ) ); + emit dataChanged( index( 0, TrackNumberColumn ), index( d->itemCheckedList.count(), TrackNumberColumn ) ); } #include "k3baudiotrackmodel.moc" diff --git a/src/rip/k3baudiotrackmodel.h b/src/rip/k3baudiotrackmodel.h index e56191a..d55f63f 100644 --- a/src/rip/k3baudiotrackmodel.h +++ b/src/rip/k3baudiotrackmodel.h @@ -1,6 +1,7 @@ /* * * Copyright (C) 2008 Sebastian Trueg <trueg@k3b.org> + * Copyright (C) 2011 Michal Malek <michalm@jabster.pl> * * This file is part of the K3b project. * Copyright (C) 1998-2008 Sebastian Trueg <trueg@k3b.org> @@ -71,7 +72,6 @@ namespace K3b { virtual bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ); virtual QMimeData* mimeData( const QModelIndexList& indexes ) const; virtual QStringList mimeTypes() const; - virtual QModelIndex buddy( const QModelIndex& index ) const; public Q_SLOTS: void checkAll();