mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 02:09:48 +01:00
TWK-798: Start playing first resolvable track when double-clicking on a playlist item
This commit is contained in:
parent
9f5215302c
commit
79bfdec895
@ -116,6 +116,7 @@ set( libGuiSources
|
||||
utils/dropjobnotifier.cpp
|
||||
utils/proxystyle.cpp
|
||||
utils/tomahawkutilsgui.cpp
|
||||
utils/closure.cpp
|
||||
|
||||
widgets/checkdirtree.cpp
|
||||
widgets/querylabel.cpp
|
||||
@ -240,6 +241,7 @@ set( libGuiHeaders
|
||||
utils/rdioparser.h
|
||||
utils/shortenedlinkparser.h
|
||||
utils/dropjobnotifier.h
|
||||
utils/closure.h
|
||||
|
||||
widgets/checkdirtree.h
|
||||
widgets/querylabel.h
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "dynamic/widgets/LoadingSpinner.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/closure.h"
|
||||
#include "dropjob.h"
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
@ -152,6 +153,41 @@ TrackView::setTrackModel( TrackModel* model )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::startPlayingFromStart()
|
||||
{
|
||||
if ( m_proxyModel->rowCount() == 0 )
|
||||
return;
|
||||
|
||||
const QModelIndex index = m_proxyModel->index( 0, 0 );
|
||||
startAutoPlay( index );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::autoPlayResolveFinished( const query_ptr& query, int row )
|
||||
{
|
||||
Q_ASSERT( !query.isNull() );
|
||||
Q_ASSERT( row >= 0 );
|
||||
|
||||
if ( query.isNull() || row < 0 || query != m_autoPlaying )
|
||||
return;
|
||||
|
||||
const QModelIndex index = m_proxyModel->index( row, 0 );
|
||||
if ( query->playable() )
|
||||
{
|
||||
onItemActivated( index );
|
||||
return;
|
||||
}
|
||||
|
||||
// Try the next one..
|
||||
const QModelIndex sib = index.sibling( index.row() + 1, index.column() );
|
||||
if ( sib.isValid() )
|
||||
startAutoPlay( sib );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::currentChanged( const QModelIndex& current, const QModelIndex& previous )
|
||||
{
|
||||
@ -174,15 +210,48 @@ TrackView::onItemActivated( const QModelIndex& index )
|
||||
if ( !index.isValid() )
|
||||
return;
|
||||
|
||||
tryToPlayItem( index );
|
||||
emit itemActivated( index );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::startAutoPlay( const QModelIndex& index )
|
||||
{
|
||||
if ( tryToPlayItem( index ) )
|
||||
return;
|
||||
|
||||
// item isn't playable but still resolving
|
||||
TrackModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
|
||||
if ( item && !item->query().isNull() && !item->query()->resolvingFinished() )
|
||||
{
|
||||
m_autoPlaying = item->query(); // So we can kill it if user starts autoplaying this playlist again
|
||||
NewClosure( item->query().data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( autoPlayResolveFinished( Tomahawk::query_ptr, int ) ),
|
||||
item->query(), index.row() );
|
||||
return;
|
||||
}
|
||||
|
||||
// not playable at all, try next
|
||||
const QModelIndex sib = index.sibling( index.row() + 1, index.column() );
|
||||
if ( sib.isValid() )
|
||||
startAutoPlay( sib );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TrackView::tryToPlayItem( const QModelIndex& index )
|
||||
{
|
||||
TrackModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
|
||||
if ( item && !item->query().isNull() && item->query()->numResults() )
|
||||
{
|
||||
tDebug() << "Result activated:" << item->query()->toString() << item->query()->results().first()->url();
|
||||
m_proxyModel->setCurrentIndex( index );
|
||||
AudioEngine::instance()->playItem( m_proxyModel->playlistInterface(), item->query()->results().first() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
emit itemActivated( index );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,6 +64,9 @@ public:
|
||||
bool updatesContextView() const { return m_updateContextView; }
|
||||
void setUpdatesContextView( bool b ) { m_updateContextView = b; }
|
||||
|
||||
// Starts playing from the beginning if resolved, or waits until a track is playable
|
||||
void startPlayingFromStart();
|
||||
|
||||
public slots:
|
||||
virtual void onItemActivated( const QModelIndex& index );
|
||||
|
||||
@ -98,7 +101,11 @@ private slots:
|
||||
|
||||
void onCustomContextMenu( const QPoint& pos );
|
||||
|
||||
void autoPlayResolveFinished( const Tomahawk::query_ptr& query, int row );
|
||||
|
||||
private:
|
||||
void startAutoPlay( const QModelIndex& index );
|
||||
bool tryToPlayItem( const QModelIndex& index );
|
||||
void updateHoverIndex( const QPoint& pos );
|
||||
|
||||
QString m_guid;
|
||||
@ -117,6 +124,9 @@ private:
|
||||
|
||||
QModelIndex m_hoveredIndex;
|
||||
QModelIndex m_contextMenuIndex;
|
||||
|
||||
Tomahawk::query_ptr m_autoPlaying;
|
||||
|
||||
Tomahawk::ContextMenu* m_contextMenu;
|
||||
};
|
||||
|
||||
|
89
src/libtomahawk/utils/closure.cpp
Normal file
89
src/libtomahawk/utils/closure.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2011, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "closure.h"
|
||||
|
||||
namespace _detail {
|
||||
|
||||
Closure::Closure(QObject* sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const ClosureArgumentWrapper* val0,
|
||||
const ClosureArgumentWrapper* val1,
|
||||
const ClosureArgumentWrapper* val2,
|
||||
const ClosureArgumentWrapper* val3)
|
||||
: QObject(receiver),
|
||||
callback_(NULL),
|
||||
val0_(val0),
|
||||
val1_(val1),
|
||||
val2_(val2),
|
||||
val3_(val3) {
|
||||
const QMetaObject* meta_receiver = receiver->metaObject();
|
||||
|
||||
QByteArray normalised_slot = QMetaObject::normalizedSignature(slot + 1);
|
||||
const int index = meta_receiver->indexOfSlot(normalised_slot.constData());
|
||||
Q_ASSERT(index != -1);
|
||||
slot_ = meta_receiver->method(index);
|
||||
|
||||
Connect(sender, signal);
|
||||
}
|
||||
|
||||
Closure::Closure(QObject* sender,
|
||||
const char* signal,
|
||||
std::tr1::function<void()> callback)
|
||||
: callback_(callback) {
|
||||
Connect(sender, signal);
|
||||
}
|
||||
|
||||
Closure::~Closure() {
|
||||
}
|
||||
|
||||
void Closure::Connect(QObject* sender, const char* signal) {
|
||||
bool success = connect(sender, signal, SLOT(Invoked()));
|
||||
Q_ASSERT(success);
|
||||
success = connect(sender, SIGNAL(destroyed()), SLOT(Cleanup()));
|
||||
Q_ASSERT(success);
|
||||
Q_UNUSED(success);
|
||||
}
|
||||
|
||||
void Closure::Invoked() {
|
||||
if (callback_) {
|
||||
callback_();
|
||||
} else {
|
||||
slot_.invoke(
|
||||
parent(),
|
||||
val0_ ? val0_->arg() : QGenericArgument(),
|
||||
val1_ ? val1_->arg() : QGenericArgument(),
|
||||
val2_ ? val2_->arg() : QGenericArgument(),
|
||||
val3_ ? val3_->arg() : QGenericArgument());
|
||||
}
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void Closure::Cleanup() {
|
||||
disconnect();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
} // namespace _detail
|
||||
|
||||
_detail::Closure* NewClosure(
|
||||
QObject* sender, const char* signal,
|
||||
QObject* receiver, const char* slot) {
|
||||
return new _detail::Closure(sender, signal, receiver, slot);
|
||||
}
|
225
src/libtomahawk/utils/closure.h
Normal file
225
src/libtomahawk/utils/closure.h
Normal file
@ -0,0 +1,225 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2011, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLOSURE_H
|
||||
#define CLOSURE_H
|
||||
|
||||
#include <tr1/functional>
|
||||
|
||||
#include <QMetaMethod>
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace _detail {
|
||||
|
||||
class ClosureArgumentWrapper {
|
||||
public:
|
||||
virtual ~ClosureArgumentWrapper() {}
|
||||
|
||||
virtual QGenericArgument arg() const = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ClosureArgument : public ClosureArgumentWrapper {
|
||||
public:
|
||||
explicit ClosureArgument(const T& data) : data_(data) {}
|
||||
|
||||
virtual QGenericArgument arg() const {
|
||||
return Q_ARG(T, data_);
|
||||
}
|
||||
|
||||
private:
|
||||
T data_;
|
||||
};
|
||||
|
||||
class Closure : public QObject, boost::noncopyable {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Closure(QObject* sender, const char* signal,
|
||||
QObject* receiver, const char* slot,
|
||||
const ClosureArgumentWrapper* val0 = 0,
|
||||
const ClosureArgumentWrapper* val1 = 0,
|
||||
const ClosureArgumentWrapper* val2 = 0,
|
||||
const ClosureArgumentWrapper* val3 = 0);
|
||||
|
||||
Closure(QObject* sender, const char* signal,
|
||||
std::tr1::function<void()> callback);
|
||||
|
||||
virtual ~Closure();
|
||||
|
||||
private slots:
|
||||
void Invoked();
|
||||
void Cleanup();
|
||||
|
||||
private:
|
||||
void Connect(QObject* sender, const char* signal);
|
||||
|
||||
QMetaMethod slot_;
|
||||
std::tr1::function<void()> callback_;
|
||||
|
||||
boost::scoped_ptr<const ClosureArgumentWrapper> val0_;
|
||||
boost::scoped_ptr<const ClosureArgumentWrapper> val1_;
|
||||
boost::scoped_ptr<const ClosureArgumentWrapper> val2_;
|
||||
boost::scoped_ptr<const ClosureArgumentWrapper> val3_;
|
||||
};
|
||||
|
||||
class SharedPointerWrapper {
|
||||
public:
|
||||
virtual ~SharedPointerWrapper() {}
|
||||
virtual QObject* data() const = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class SharedPointer : public SharedPointerWrapper {
|
||||
public:
|
||||
explicit SharedPointer(QSharedPointer<T> ptr)
|
||||
: ptr_(ptr) {
|
||||
}
|
||||
|
||||
QObject* data() const {
|
||||
return ptr_.data();
|
||||
}
|
||||
|
||||
private:
|
||||
QSharedPointer<T> ptr_;
|
||||
};
|
||||
|
||||
// For use with a QSharedPointer as a sender.
|
||||
class SharedClosure : public Closure {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SharedClosure(SharedPointerWrapper* sender, const char* signal,
|
||||
QObject* receiver, const char* slot,
|
||||
const ClosureArgumentWrapper* val0 = 0,
|
||||
const ClosureArgumentWrapper* val1 = 0,
|
||||
const ClosureArgumentWrapper* val2 = 0,
|
||||
const ClosureArgumentWrapper* val3 = 0)
|
||||
: Closure(sender->data(), signal,
|
||||
receiver, slot,
|
||||
val0, val1, val2, val3),
|
||||
shared_sender_(sender) {
|
||||
}
|
||||
|
||||
private:
|
||||
boost::scoped_ptr<SharedPointerWrapper> shared_sender_;
|
||||
};
|
||||
|
||||
} // namespace _detail
|
||||
|
||||
#define C_ARG(type, data) new _detail::ClosureArgument<type>(data)
|
||||
|
||||
_detail::Closure* NewClosure(
|
||||
QObject* sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot);
|
||||
|
||||
template <typename T>
|
||||
_detail::Closure* NewClosure(
|
||||
QObject* sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const T& val0) {
|
||||
return new _detail::Closure(
|
||||
sender, signal, receiver, slot,
|
||||
C_ARG(T, val0));
|
||||
}
|
||||
|
||||
template <typename T0, typename T1>
|
||||
_detail::Closure* NewClosure(
|
||||
QObject* sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const T0& val0,
|
||||
const T1& val1) {
|
||||
return new _detail::Closure(
|
||||
sender, signal, receiver, slot,
|
||||
C_ARG(T0, val0), C_ARG(T1, val1));
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2>
|
||||
_detail::Closure* NewClosure(
|
||||
QObject* sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const T0& val0,
|
||||
const T1& val1,
|
||||
const T2& val2) {
|
||||
return new _detail::Closure(
|
||||
sender, signal, receiver, slot,
|
||||
C_ARG(T0, val0), C_ARG(T1, val1), C_ARG(T2, val2));
|
||||
}
|
||||
|
||||
template <typename T0, typename T1, typename T2, typename T3>
|
||||
_detail::Closure* NewClosure(
|
||||
QObject* sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const T0& val0,
|
||||
const T1& val1,
|
||||
const T2& val2,
|
||||
const T3& val3) {
|
||||
return new _detail::Closure(
|
||||
sender, signal, receiver, slot,
|
||||
C_ARG(T0, val0), C_ARG(T1, val1), C_ARG(T2, val2), C_ARG(T3, val3));
|
||||
}
|
||||
|
||||
template <typename TP>
|
||||
_detail::Closure* NewClosure(
|
||||
QSharedPointer<TP> sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot) {
|
||||
return new _detail::SharedClosure(
|
||||
new _detail::SharedPointer<TP>(sender), signal, receiver, slot);
|
||||
}
|
||||
|
||||
template <typename TP, typename T0>
|
||||
_detail::Closure* NewClosure(
|
||||
QSharedPointer<TP> sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const T0& val0) {
|
||||
return new _detail::SharedClosure(
|
||||
new _detail::SharedPointer<TP>(sender), signal, receiver, slot,
|
||||
C_ARG(T0, val0));
|
||||
}
|
||||
|
||||
template <typename TP, typename T0, typename T1>
|
||||
_detail::Closure* NewClosure(
|
||||
QSharedPointer<TP> sender,
|
||||
const char* signal,
|
||||
QObject* receiver,
|
||||
const char* slot,
|
||||
const T0& val0,
|
||||
const T1& val1) {
|
||||
return new _detail::SharedClosure(
|
||||
new _detail::SharedPointer<TP>(sender), signal, receiver, slot,
|
||||
C_ARG(T0, val0), C_ARG(T1, val1));
|
||||
}
|
||||
|
||||
#endif // CLOSURE_H
|
@ -24,6 +24,7 @@
|
||||
#include "query.h"
|
||||
#include "viewmanager.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
#include "playlist/playlistview.h"
|
||||
#include "categoryitems.h"
|
||||
#include "sourceitem.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
@ -136,6 +137,17 @@ PlaylistItem::activate()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistItem::doubleClicked()
|
||||
{
|
||||
ViewPage* p = ViewManager::instance()->currentPage();
|
||||
if ( PlaylistView* view = dynamic_cast< PlaylistView* >( p ) )
|
||||
{
|
||||
view->startPlayingFromStart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistItem::setLoaded( bool loaded )
|
||||
{
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
virtual QString text() const;
|
||||
virtual Tomahawk::playlist_ptr playlist() const;
|
||||
virtual Qt::ItemFlags flags() const;
|
||||
virtual void activate();
|
||||
virtual bool willAcceptDrag( const QMimeData* data ) const;
|
||||
virtual DropTypes supportedDropTypes( const QMimeData* data ) const;
|
||||
virtual bool dropMimeData( const QMimeData* data, Qt::DropAction action );
|
||||
@ -43,6 +42,10 @@ public:
|
||||
|
||||
virtual SourceTreeItem* activateCurrent();
|
||||
|
||||
public slots:
|
||||
virtual void activate();
|
||||
virtual void doubleClicked();
|
||||
|
||||
protected:
|
||||
void setLoaded( bool loaded );
|
||||
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
|
||||
public slots:
|
||||
virtual void activate() {}
|
||||
virtual void doubleClicked() {}
|
||||
|
||||
signals:
|
||||
void updated();
|
||||
|
@ -43,6 +43,7 @@
|
||||
SourceDelegate::SourceDelegate( QAbstractItemView* parent )
|
||||
: QStyledItemDelegate( parent )
|
||||
, m_parent( parent )
|
||||
, m_lastClicked( -1 )
|
||||
{
|
||||
m_dropTypeMap.insert( 0, SourceTreeItem::DropTypeThisTrack );
|
||||
m_dropTypeMap.insert( 1, SourceTreeItem::DropTypeThisAlbum );
|
||||
@ -631,7 +632,27 @@ SourceDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QSt
|
||||
// a mouse press event. Since we want to swallow click events when they are on headphones other action items, here wemake sure we only
|
||||
// emit if we really want to
|
||||
if ( event->type() == QEvent::MouseButtonRelease )
|
||||
emit clicked( index );
|
||||
{
|
||||
if ( m_lastClicked == -1 )
|
||||
{
|
||||
m_lastClicked = QDateTime::currentMSecsSinceEpoch();
|
||||
emit clicked( index );
|
||||
}
|
||||
else
|
||||
{
|
||||
qint64 elapsed = QDateTime::currentMSecsSinceEpoch() - m_lastClicked;
|
||||
if ( elapsed < QApplication::doubleClickInterval() )
|
||||
{
|
||||
m_lastClicked = -1;
|
||||
emit doubleClicked( index );
|
||||
} else
|
||||
{
|
||||
m_lastClicked = QDateTime::currentMSecsSinceEpoch();
|
||||
emit clicked( index );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return QStyledItemDelegate::editorEvent ( event, model, option, index );
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
signals:
|
||||
void clicked( const QModelIndex& idx );
|
||||
void doubleClicked( const QModelIndex& idx );
|
||||
void latchOn( const Tomahawk::source_ptr& idx );
|
||||
void latchOff( const Tomahawk::source_ptr& idx );
|
||||
void toggleRealtimeLatch( const Tomahawk::source_ptr& idx, bool realtime );
|
||||
@ -72,6 +73,7 @@ private:
|
||||
mutable SourceTreeItem::DropType m_hoveredDropType; // Hack to keep easily track of the current highlighted DropType in paint()
|
||||
QMap< QModelIndex, AnimationHelper* > m_expandedMap;
|
||||
QPixmap m_headphonesOn, m_headphonesOff, m_realtimeLocked, m_realtimeUnlocked, m_nowPlayingSpeaker, m_nowPlayingSpeakerDark;
|
||||
qint64 m_lastClicked;
|
||||
|
||||
QMap< int, SourceTreeItem::DropType > m_dropTypeMap;
|
||||
QMap< int, QString > m_dropTypeTextMap;
|
||||
|
@ -78,6 +78,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
sortByColumn( 0, Qt::AscendingOrder );
|
||||
setVerticalScrollMode( QTreeView::ScrollPerPixel );
|
||||
setMouseTracking( true );
|
||||
setEditTriggers( NoEditTriggers );
|
||||
|
||||
// TODO animation conflicts with the expanding-playlists-when-collection-is-null
|
||||
// so investigate
|
||||
@ -88,6 +89,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
connect( m_delegate, SIGNAL( latchOff( Tomahawk::source_ptr ) ), SLOT( latchOff( Tomahawk::source_ptr ) ) );
|
||||
connect( m_delegate, SIGNAL( toggleRealtimeLatch( Tomahawk::source_ptr, bool ) ), m_latchManager, SLOT( latchModeChangeRequest( Tomahawk::source_ptr,bool ) ) );
|
||||
connect( m_delegate, SIGNAL( clicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
||||
connect( m_delegate, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemDoubleClicked( QModelIndex ) ) );
|
||||
|
||||
setItemDelegate( m_delegate );
|
||||
|
||||
@ -230,6 +232,17 @@ SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::onItemDoubleClicked( const QModelIndex& idx )
|
||||
{
|
||||
if ( !selectionModel()->selectedIndexes().contains( idx ) )
|
||||
onItemActivated( idx );
|
||||
|
||||
SourceTreeItem* item = itemFromIndex< SourceTreeItem >( idx );
|
||||
item->doubleClicked();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::onItemExpanded( const QModelIndex& idx )
|
||||
{
|
||||
|
@ -66,6 +66,7 @@ private slots:
|
||||
void selectRequest( const QPersistentModelIndex& idx );
|
||||
void expandRequest( const QPersistentModelIndex& idx );
|
||||
void toggleExpandRequest( const QPersistentModelIndex& idx );
|
||||
void onItemDoubleClicked( const QModelIndex& idx );
|
||||
|
||||
void loadPlaylist();
|
||||
void deletePlaylist( const QModelIndex& = QModelIndex() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user